schema.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <?php
  2. // Copyright (C) 2010 Combodo SARL
  3. //
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; version 3 of the License.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. /**
  17. * Presentation of the data model
  18. *
  19. * @author Erwan Taloc <erwan.taloc@combodo.com>
  20. * @author Romain Quetiez <romain.quetiez@combodo.com>
  21. * @author Denis Flaven <denis.flaven@combodo.com>
  22. * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
  23. */
  24. require_once('../application/application.inc.php');
  25. require_once('../application/itopwebpage.class.inc.php');
  26. require_once('../application/startup.inc.php');
  27. /**
  28. * Helper for this page -> link to a class
  29. */
  30. function MakeClassHLink($sClass)
  31. {
  32. return "<a href=\"?operation=details_class&class=$sClass\" title=\"".MetaModel::GetClassDescription($sClass)."\">".MetaModel::GetName($sClass)."</a>";
  33. }
  34. /**
  35. * Helper for this page -> link to a class
  36. */
  37. function MakeRelationHLink($sRelCode)
  38. {
  39. $sDec = MetaModel::GetRelationProperty($sRelCode, 'description');
  40. //$sVerbDown = MetaModel::GetRelationProperty($sRelCode, 'verb_down');
  41. //$sVerbUp = MetaModel::GetRelationProperty($sRelCode, 'verb_up');
  42. return "<a href=\"?operation=details_relation&relcode=$sRelCode\" title=\"$sDec\">".$sRelCode."</a>";
  43. }
  44. /**
  45. * Helper for the global list and the details of a given class
  46. */
  47. function DisplaySubclasses($oPage, $sClass)
  48. {
  49. $aChildClasses = MetaModel::EnumChildClasses($sClass);
  50. if (count($aChildClasses) != 0)
  51. {
  52. $oPage->add("<ul>\n");
  53. foreach($aChildClasses as $sClassName)
  54. {
  55. // Skip indirect childs, they will be handled somewhere else
  56. if (MetaModel::GetParentPersistentClass($sClassName) == $sClass)
  57. {
  58. $oPage->add("<li>".MakeClassHLink($sClassName)."\n");
  59. DisplaySubclasses($oPage, $sClassName);
  60. $oPage->add("</li>\n");
  61. }
  62. }
  63. $oPage->add("</ul>\n");
  64. }
  65. }
  66. /**
  67. * Helper for the global list and the details of a given class
  68. */
  69. function DisplayReferencingClasses($oPage, $sClass)
  70. {
  71. $bSkipLinkingClasses = false;
  72. $aRefs = MetaModel::EnumReferencingClasses($sClass, $bSkipLinkingClasses);
  73. if (count($aRefs) != 0)
  74. {
  75. $oPage->add("<ul>\n");
  76. foreach ($aRefs as $sRemoteClass => $aRemoteKeys)
  77. {
  78. foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef)
  79. {
  80. $oPage->add("<li>".Dict::Format('UI:Schema:Class_ReferencingClasses_From_By', $sClass, MakeClassHLink($sRemoteClass), $sExtKeyAttCode)."</li>\n");
  81. }
  82. }
  83. $oPage->add("</ul>\n");
  84. }
  85. }
  86. /**
  87. * Helper for the global list and the details of a given class
  88. */
  89. function DisplayLinkingClasses($oPage, $sClass)
  90. {
  91. $bSkipLinkingClasses = false;
  92. $aRefs = MetaModel::EnumLinkingClasses($sClass);
  93. if (count($aRefs) != 0)
  94. {
  95. $oPage->add("<ul>\n");
  96. foreach ($aRefs as $sLinkClass => $aRemoteClasses)
  97. {
  98. foreach($aRemoteClasses as $sExtKeyAttCode => $sRemoteClass)
  99. {
  100. $oPage->add("<li>".Dict::Format('UI:Schema:Class_IsLinkedTo_Class_Via_ClassAndAttribute', $sClass, MakeClassHLink($sRemoteClass), MakeClassHLink($sLinkClass), $sExtKeyAttCode));
  101. }
  102. }
  103. $oPage->add("</ul>\n");
  104. }
  105. }
  106. /**
  107. * Helper for the global list and the details of a given class
  108. */
  109. function DisplayRelatedClassesBestInClass($oPage, $sClass, $iLevels = 20, &$aVisitedClasses = array(), $bSubtree = true)
  110. {
  111. if ($iLevels <= 0) return;
  112. $iLevels--;
  113. if (array_key_exists($sClass, $aVisitedClasses)) return;
  114. $aVisitedClasses[$sClass] = true;
  115. if ($bSubtree) $oPage->add("<ul class=\"treeview\">\n");
  116. foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass)
  117. {
  118. DisplayRelatedClassesBestInClass($oPage, $sParentClass, $iLevels, $aVisitedClasses, false);
  119. }
  120. ////$oPage->add("<div style=\"background-color:#ccc; border: 1px dashed #333;\">");
  121. foreach (MetaModel::EnumReferencedClasses($sClass) as $sExtKeyAttCode => $sRemoteClass)
  122. {
  123. $sVisited = (array_key_exists($sRemoteClass, $aVisitedClasses)) ? " ..." : "";
  124. if (MetaModel::GetAttributeOrigin($sClass, $sExtKeyAttCode) == $sClass)
  125. {
  126. $oPage->add("<li>$sClass| <em>$sExtKeyAttCode</em> =&gt;".MakeClassHLink($sRemoteClass)."$sVisited</li>\n");
  127. DisplayRelatedClassesBestInClass($oPage, $sRemoteClass, $iLevels, $aVisitedClasses);
  128. }
  129. }
  130. foreach (MetaModel::EnumReferencingClasses($sClass) as $sRemoteClass => $aRemoteKeys)
  131. {
  132. foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef)
  133. {
  134. $sVisited = (array_key_exists($sRemoteClass, $aVisitedClasses)) ? " ..." : "";
  135. $oPage->add("<li>$sClass| &lt;=".MakeClassHLink($sRemoteClass)."::<em>$sExtKeyAttCode</em>$sVisited</li>\n");
  136. DisplayRelatedClassesBestInClass($oPage, $sRemoteClass, $iLevels, $aVisitedClasses);
  137. }
  138. }
  139. ////$oPage->add("</div>");
  140. if ($bSubtree) $oPage->add("</ul>\n");
  141. }
  142. /**
  143. * Helper for the list of classes related to the given class
  144. */
  145. function DisplayRelatedClasses($oPage, $sClass)
  146. {
  147. $oPage->add("<h3>".Dict::Format('UI:Schema:Links:1-n', $sClass)."</h3>\n");
  148. DisplayReferencingClasses($oPage, $sClass);
  149. $oPage->add("<h3>".Dict::Format('UI:Schema:Links:n-n', $sClass)."</h3>\n");
  150. DisplayLinkingClasses($oPage, $sClass);
  151. $oPage->add("<h3>".Dict::S('UI:Schema:Links:All')."</h3>\n");
  152. DisplayRelatedClassesBestInClass($oPage, $sClass, 4);
  153. }
  154. /**
  155. * Helper for the lifecycle details of a given class
  156. */
  157. function DisplayLifecycle($oPage, $sClass)
  158. {
  159. $sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
  160. if (empty($sStateAttCode))
  161. {
  162. $oPage->p(Dict::S('UI:Schema:NoLifeCyle'));
  163. }
  164. else
  165. {
  166. $aStates = MetaModel::EnumStates($sClass);
  167. $aStimuli = MetaModel::EnumStimuli($sClass);
  168. $oPage->add("<img src=\"../pages/graphviz.php?class=$sClass\">\n");
  169. $oPage->add("<h3>".Dict::S('UI:Schema:LifeCycleTransitions')."</h3>\n");
  170. $oPage->add("<ul>\n");
  171. foreach ($aStates as $sStateCode => $aStateDef)
  172. {
  173. $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode);
  174. $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode);
  175. $oPage->add("<li title=\"code: $sStateCode\">$sStateLabel <span style=\"color:grey;\">($sStateDescription)</span></li>\n");
  176. $oPage->add("<ul>\n");
  177. foreach(MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef)
  178. {
  179. $sStimulusLabel = $aStimuli[$sStimulusCode]->GetLabel();
  180. $sTargetStateLabel = MetaModel::GetStateLabel($sClass, $aTransitionDef['target_state']);
  181. if (count($aTransitionDef['actions']) > 0)
  182. {
  183. $sActions = " <em>(".implode(', ', $aTransitionDef['actions']).")</em>";
  184. }
  185. else
  186. {
  187. $sActions = "";
  188. }
  189. $oPage->add("<li><span style=\"color:red;font-weight=bold;\">$sStimulusLabel</span> =&gt; $sTargetStateLabel $sActions</li>\n");
  190. }
  191. $oPage->add("</ul>\n");
  192. }
  193. $oPage->add("</ul>\n");
  194. $oPage->add("<h3>".Dict::S('UI:Schema:LifeCyleAttributeOptions')."</h3>\n");
  195. $oPage->add("<ul>\n");
  196. foreach ($aStates as $sStateCode => $aStateDef)
  197. {
  198. $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode);
  199. $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode);
  200. $oPage->add("<li title=\"code: $sStateCode\">$sStateLabel <span style=\"color:grey;\">($sStateDescription)</span></li>\n");
  201. if (count($aStates[$sStateCode]['attribute_list']) > 0)
  202. {
  203. $oPage->add("<ul>\n");
  204. foreach($aStates[$sStateCode]['attribute_list'] as $sAttCode => $iOptions)
  205. {
  206. $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
  207. $sAttLabel = $oAttDef->GetLabel();
  208. $aOptions = array();
  209. if ($iOptions & OPT_ATT_HIDDEN) $aOptions[] = Dict::S('UI:Schema:LifeCycleHiddenAttribute');
  210. if ($iOptions & OPT_ATT_READONLY) $aOptions[] = Dict::S('UI:Schema:LifeCycleReadOnlyAttribute');
  211. if ($iOptions & OPT_ATT_MANDATORY) $aOptions[] = Dict::S('UI:Schema:LifeCycleMandatoryAttribute');
  212. if ($iOptions & OPT_ATT_MUSTCHANGE) $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustChange');
  213. if ($iOptions & OPT_ATT_MUSTPROMPT) $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustPrompt');
  214. if (count($aOptions))
  215. {
  216. $sOptions = implode(', ', $aOptions);
  217. }
  218. else
  219. {
  220. $sOptions = "";
  221. }
  222. $oPage->add("<li><span style=\"color:purple;font-weight=bold;\">$sAttLabel</span> $sOptions</li>\n");
  223. }
  224. $oPage->add("</ul>\n");
  225. }
  226. else
  227. {
  228. $oPage->p("<em>".Dict::S('UI:Schema:LifeCycleEmptyList')."</em>");
  229. }
  230. }
  231. $oPage->add("</ul>\n");
  232. }
  233. }
  234. /**
  235. * Helper for the trigger
  236. */
  237. function DisplayTriggers($oPage, $sClass)
  238. {
  239. $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnStateChange WHERE target_class = '$sClass'"));
  240. cmdbAbstractObject::DisplaySet($oPage, $oSet);
  241. }
  242. /**
  243. * Display the list of classes from the business model
  244. */
  245. function DisplayClassesList($oPage)
  246. {
  247. $oPage->add("<h1>".Dict::S('UI:Schema:Title')."</h1>\n");
  248. $oPage->add("<ul id=\"ClassesList\" class=\"treeview fileview\">\n");
  249. foreach(MetaModel::EnumCategories() as $sCategory)
  250. {
  251. if (empty($sCategory)) continue; // means 'all' -> skip
  252. $sClosed = ($sCategory == 'bizmodel') ? '' : ' class="closed"';
  253. $oPage->add("<li$sClosed>".Dict::Format('UI:Schema:CategoryMenuItem', $sCategory)."\n");
  254. $oPage->add("<ul>\n");
  255. foreach(MetaModel::GetClasses($sCategory) as $sClassName)
  256. {
  257. if (MetaModel::IsStandaloneClass($sClassName))
  258. {
  259. $oPage->add("<li>".MakeClassHLink($sClassName)."</li>\n");
  260. }
  261. else if (MetaModel::IsRootClass($sClassName))
  262. {
  263. $oPage->add("<li class=\"closed\">".MakeClassHLink($sClassName)."\n");
  264. DisplaySubclasses($oPage, $sClassName);
  265. $oPage->add("</li>\n");
  266. }
  267. }
  268. $oPage->add("</ul>\n");
  269. $oPage->add("</li>\n");
  270. }
  271. $oPage->add("</ul>\n");
  272. $oPage->add("<h1>".Dict::S('UI:Schema:Relationships')."</h1>\n");
  273. $oPage->add("<ul id=\"ClassesRelationships\" class=\"treeview\">\n");
  274. foreach (MetaModel::EnumRelations() as $sRelCode)
  275. {
  276. $oPage->add("<li>".MakeRelationHLink($sRelCode)."\n");
  277. $oPage->add("<ul>\n");
  278. foreach (MetaModel::EnumRelationProperties($sRelCode) as $sProp => $sValue)
  279. {
  280. $oPage->add("<li>$sProp: ".htmlentities($sValue)."</li>\n");
  281. }
  282. $oPage->add("</ul>\n");
  283. $oPage->add("</li>\n");
  284. }
  285. $oPage->add("</ul>\n");
  286. $oPage->add_ready_script('$("#ClassesList").treeview();');
  287. $oPage->add_ready_script('$("#ClassesRelationships").treeview();');
  288. }
  289. /**
  290. * Display the details of a given class of objects
  291. */
  292. function DisplayClassDetails($oPage, $sClass)
  293. {
  294. $oPage->p("<h2>$sClass</h2><br/>\n".MetaModel::GetClassDescription($sClass)."<br/>\n");
  295. if (MetaModel::IsAbstract($sClass))
  296. {
  297. $oPage->p(Dict::S('UI:Schema:AbstractClass'));
  298. }
  299. else
  300. {
  301. $oPage->p(Dict::S('UI:Schema:NonAbstractClass'));
  302. }
  303. $oPage->p("<h3>".Dict::S('UI:Schema:ClassHierarchyTitle')."</h3>");
  304. $oPage->p("[<a href=\"?operation='list'\">".Dict::S('UI:Schema:AllClasses')."</a>]");
  305. // List the parent classes
  306. $sParent = MetaModel::GetParentPersistentClass($sClass);
  307. $aParents = array();
  308. $aParents[] = $sClass;
  309. while($sParent != "" && $sParent != 'cmdbAbstractObject')
  310. {
  311. $aParents[] = $sParent;
  312. $sParent = MetaModel::GetParentPersistentClass($sParent);
  313. }
  314. $iIndex = count($aParents);
  315. $sSpace ="";
  316. $oPage->add("<ul id=\"ClassHierarchy\">");
  317. while ($iIndex > 0)
  318. {
  319. $iIndex--;
  320. $oPage->add("<li>".MakeClassHLink($aParents[$iIndex])."\n");
  321. $oPage->add("<ul>\n");
  322. }
  323. for($iIndex = 0; $iIndex < count($aParents); $iIndex++)
  324. {
  325. $oPage->add("</ul>\n</li>\n");
  326. }
  327. $oPage->add("</ul>\n");
  328. $oPage->add_ready_script('$("#ClassHierarchy").treeview();');
  329. $oPage->p('');
  330. $oPage->AddTabContainer('details');
  331. $oPage->SetCurrentTabContainer('details');
  332. // List the attributes of the object
  333. $aDetails = array();
  334. foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode=>$oAttDef)
  335. {
  336. if ($oAttDef->IsExternalKey())
  337. {
  338. $sValue = Dict::Format('UI:Schema:ExternalKey_To',MakeClassHLink($oAttDef->GetTargetClass()));
  339. }
  340. else
  341. {
  342. $sValue = $oAttDef->GetDescription();
  343. }
  344. $sType = $oAttDef->GetType().' ('.$oAttDef->GetTypeDesc().')';
  345. $sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode);
  346. $sAllowedValues = "";
  347. $oAllowedValuesDef = $oAttDef->GetValuesDef();
  348. $sMoreInfo = "";
  349. $aCols = array();
  350. foreach($oAttDef->GetSQLColumns() as $sCol => $sFieldDesc)
  351. {
  352. $aCols[] = "$sCol: $sFieldDesc";
  353. }
  354. if (count($aCols) > 0)
  355. {
  356. $sCols = implode(', ', $aCols);
  357. $aMoreInfo = array();
  358. $aMoreInfo[] = Dict::Format('UI:Schema:Columns_Description', $sCols);
  359. $aMoreInfo[] = Dict::Format('UI:Schema:Default_Description', $oAttDef->GetDefaultValue());
  360. $aMoreInfo[] = $oAttDef->IsNullAllowed() ? Dict::S('UI:Schema:NullAllowed') : Dict::S('UI:Schema:NullNotAllowed');
  361. $sMoreInfo .= implode(', ', $aMoreInfo);
  362. }
  363. if (is_object($oAllowedValuesDef)) $sAllowedValues = $oAllowedValuesDef->GetValuesDescription();
  364. else $sAllowedValues = '';
  365. $aDetails[] = array('code' => $oAttDef->GetCode(), 'type' => $sType, 'origin' => $sOrigin, 'label' => $oAttDef->GetLabel(), 'description' => $sValue, 'values' => $sAllowedValues, 'moreinfo' => $sMoreInfo);
  366. }
  367. $oPage->SetCurrentTab(Dict::S('UI:Schema:Attributes'));
  368. $aConfig = array( 'code' => array('label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')),
  369. 'label' => array('label' => Dict::S('UI:Schema:Label'), 'description' => Dict::S('UI:Schema:Label+')),
  370. 'type' => array('label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')),
  371. 'origin' => array('label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')),
  372. 'description' => array('label' => Dict::S('UI:Schema:Description'), 'description' => Dict::S('UI:Schema:Description+')),
  373. 'values' => array('label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')),
  374. 'moreinfo' => array('label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')),
  375. );
  376. $oPage->table($aConfig, $aDetails);
  377. // List the search criteria for this object
  378. $aDetails = array();
  379. foreach (MetaModel::GetClassFilterDefs($sClass) as $sFilterCode => $oFilterDef)
  380. {
  381. $aOpDescs = array();
  382. foreach ($oFilterDef->GetOperators() as $sOpCode => $sOpDescription)
  383. {
  384. $sIsTheLooser = ($sOpCode == $oFilterDef->GetLooseOperator()) ? " (loose search)" : "";
  385. $aOpDescs[] = "$sOpCode ($sOpDescription)$sIsTheLooser";
  386. }
  387. $aDetails[] = array( 'code' => $sFilterCode, 'description' => $oFilterDef->GetLabel(),'operators' => implode(" / ", $aOpDescs));
  388. }
  389. $oPage->SetCurrentTab(Dict::S('UI:Schema:SearchCriteria'));
  390. $aConfig = array( 'code' => array('label' => Dict::S('UI:Schema:FilterCode'), 'description' => Dict::S('UI:Schema:FilterCode+')),
  391. 'description' => array('label' => Dict::S('UI:Schema:FilterDescription'), 'description' => Dict::S('UI:Schema:FilterDescription+')),
  392. 'operators' => array('label' => Dict::S('UI:Schema:AvailOperators'), 'description' => Dict::S('UI:Schema:AvailOperators+'))
  393. );
  394. $oPage->table($aConfig, $aDetails);
  395. $oPage->SetCurrentTab(Dict::S('UI:Schema:ChildClasses'));
  396. DisplaySubclasses($oPage, $sClass);
  397. $oPage->SetCurrentTab(Dict::S('UI:Schema:ReferencingClasses'));
  398. DisplayReferencingClasses($oPage, $sClass);
  399. $oPage->SetCurrentTab(Dict::S('UI:Schema:RelatedClasses'));
  400. DisplayRelatedClasses($oPage, $sClass);
  401. $oPage->SetCurrentTab(Dict::S('UI:Schema:LifeCycle'));
  402. DisplayLifecycle($oPage, $sClass);
  403. $oPage->SetCurrentTab(Dict::S('UI:Schema:Triggers'));
  404. DisplayTriggers($oPage, $sClass);
  405. $oPage->SetCurrentTab();
  406. $oPage->SetCurrentTabContainer();
  407. }
  408. /**
  409. * Display the details of a given relation (e.g. "impacts")
  410. */
  411. function DisplayRelationDetails($oPage, $sRelCode)
  412. {
  413. $sDesc = MetaModel::GetRelationProperty($sRelCode, 'description');
  414. $sVerbDown = MetaModel::GetRelationProperty($sRelCode, 'verb_down');
  415. $sVerbUp = MetaModel::GetRelationProperty($sRelCode, 'verb_up');
  416. $oPage->add("<h1>".Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc)."</h1>");
  417. $oPage->p(Dict::Format('UI:Schema:RelationDown_Description', $sVerbDown));
  418. $oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sVerbUp));
  419. $oPage->add("<ul id=\"RelationshipDetails\" class=\"treeview\">\n");
  420. foreach(MetaModel::GetClasses() as $sClass)
  421. {
  422. $aRelQueries = MetaModel::EnumRelationQueries($sClass, $sRelCode);
  423. if (count($aRelQueries) > 0)
  424. {
  425. $oPage->add("<li>class ".MakeClassHLink($sClass)."\n");
  426. $oPage->add("<ul>\n");
  427. foreach ($aRelQueries as $sRelKey => $aQuery)
  428. {
  429. $sQuery = $aQuery['sQuery'];
  430. $iDistance = $aQuery['iDistance'];
  431. if ($aQuery['bPropagate'])
  432. {
  433. $oPage->add("<li>".Dict::Format('UI:Schema:RelationPropagates', $sRelKey, $iDistance, $sQuery)."</li>\n");
  434. }
  435. else
  436. {
  437. $oPage->add("<li>".Dict::Format('UI:Schema:RelationDoesNotPropagate', $sRelKey, $iDistance, $sQuery)."</li>\n");
  438. }
  439. }
  440. $oPage->add("</ul>\n");
  441. $oPage->add("</li>\n");
  442. }
  443. }
  444. $oPage->add_ready_script('$("#RelationshipDetails").treeview();');
  445. }
  446. require_once('../application/loginwebpage.class.inc.php');
  447. LoginWebPage::DoLogin(); // Check user rights and prompt if needed
  448. // Display the menu on the left
  449. $oContext = new UserContext();
  450. $oAppContext = new ApplicationContext();
  451. $iActiveNodeId = utils::ReadParam('menu', -1);
  452. $currentOrganization = utils::ReadParam('org_id', 1);
  453. $operation = utils::ReadParam('operation', '');
  454. $oPage = new iTopWebPage(Dict::S('UI:Schema:Title'), $currentOrganization);
  455. $oPage->no_cache();
  456. $operation = utils::ReadParam('operation', '');
  457. switch($operation)
  458. {
  459. case 'details_class':
  460. $sClass = utils::ReadParam('class', 'logRealObject');
  461. DisplayClassDetails($oPage, $sClass);
  462. break;
  463. case 'details_relation':
  464. $sRelCode = utils::ReadParam('relcode', '');
  465. DisplayRelationDetails($oPage, $sRelCode);
  466. break;
  467. case 'list':
  468. default:
  469. DisplayClassesList($oPage);
  470. }
  471. $oPage->output();
  472. ?>