schema.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. $sDesc = MetaModel::GetRelationDescription($sRelCode);
  40. return "<a href=\"?operation=details_relation&relcode=$sRelCode\" title=\"$sDesc\">".$sRelCode."</a>";
  41. }
  42. /**
  43. * Helper for the global list and the details of a given class
  44. */
  45. function DisplaySubclasses($oPage, $sClass)
  46. {
  47. $aChildClasses = MetaModel::EnumChildClasses($sClass);
  48. if (count($aChildClasses) != 0)
  49. {
  50. $oPage->add("<ul>\n");
  51. foreach($aChildClasses as $sClassName)
  52. {
  53. // Skip indirect childs, they will be handled somewhere else
  54. if (MetaModel::GetParentPersistentClass($sClassName) == $sClass)
  55. {
  56. $oPage->add("<li>".MakeClassHLink($sClassName)."\n");
  57. DisplaySubclasses($oPage, $sClassName);
  58. $oPage->add("</li>\n");
  59. }
  60. }
  61. $oPage->add("</ul>\n");
  62. }
  63. }
  64. /**
  65. * Helper for the global list and the details of a given class
  66. */
  67. function DisplayReferencingClasses($oPage, $sClass)
  68. {
  69. $bSkipLinkingClasses = false;
  70. $aRefs = MetaModel::EnumReferencingClasses($sClass, $bSkipLinkingClasses);
  71. if (count($aRefs) != 0)
  72. {
  73. $oPage->add("<ul>\n");
  74. foreach ($aRefs as $sRemoteClass => $aRemoteKeys)
  75. {
  76. foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef)
  77. {
  78. $oPage->add("<li>".Dict::Format('UI:Schema:Class_ReferencingClasses_From_By', $sClass, MakeClassHLink($sRemoteClass), $sExtKeyAttCode)."</li>\n");
  79. }
  80. }
  81. $oPage->add("</ul>\n");
  82. }
  83. }
  84. /**
  85. * Helper for the global list and the details of a given class
  86. */
  87. function DisplayLinkingClasses($oPage, $sClass)
  88. {
  89. $bSkipLinkingClasses = false;
  90. $aRefs = MetaModel::EnumLinkingClasses($sClass);
  91. if (count($aRefs) != 0)
  92. {
  93. $oPage->add("<ul>\n");
  94. foreach ($aRefs as $sLinkClass => $aRemoteClasses)
  95. {
  96. foreach($aRemoteClasses as $sExtKeyAttCode => $sRemoteClass)
  97. {
  98. $oPage->add("<li>".Dict::Format('UI:Schema:Class_IsLinkedTo_Class_Via_ClassAndAttribute', $sClass, MakeClassHLink($sRemoteClass), MakeClassHLink($sLinkClass), $sExtKeyAttCode));
  99. }
  100. }
  101. $oPage->add("</ul>\n");
  102. }
  103. }
  104. /**
  105. * Helper for the global list and the details of a given class
  106. */
  107. function DisplayRelatedClassesBestInClass($oPage, $sClass, $iLevels = 20, &$aVisitedClasses = array(), $bSubtree = true)
  108. {
  109. if ($iLevels <= 0) return;
  110. $iLevels--;
  111. if (array_key_exists($sClass, $aVisitedClasses)) return;
  112. $aVisitedClasses[$sClass] = true;
  113. if ($bSubtree) $oPage->add("<ul class=\"treeview\">\n");
  114. foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass)
  115. {
  116. DisplayRelatedClassesBestInClass($oPage, $sParentClass, $iLevels, $aVisitedClasses, false);
  117. }
  118. ////$oPage->add("<div style=\"background-color:#ccc; border: 1px dashed #333;\">");
  119. foreach (MetaModel::EnumReferencedClasses($sClass) as $sExtKeyAttCode => $sRemoteClass)
  120. {
  121. $sVisited = (array_key_exists($sRemoteClass, $aVisitedClasses)) ? " ..." : "";
  122. if (MetaModel::GetAttributeOrigin($sClass, $sExtKeyAttCode) == $sClass)
  123. {
  124. $oPage->add("<li>$sClass| <em>$sExtKeyAttCode</em> =&gt;".MakeClassHLink($sRemoteClass)."$sVisited</li>\n");
  125. DisplayRelatedClassesBestInClass($oPage, $sRemoteClass, $iLevels, $aVisitedClasses);
  126. }
  127. }
  128. foreach (MetaModel::EnumReferencingClasses($sClass) as $sRemoteClass => $aRemoteKeys)
  129. {
  130. foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef)
  131. {
  132. $sVisited = (array_key_exists($sRemoteClass, $aVisitedClasses)) ? " ..." : "";
  133. $oPage->add("<li>$sClass| &lt;=".MakeClassHLink($sRemoteClass)."::<em>$sExtKeyAttCode</em>$sVisited</li>\n");
  134. DisplayRelatedClassesBestInClass($oPage, $sRemoteClass, $iLevels, $aVisitedClasses);
  135. }
  136. }
  137. ////$oPage->add("</div>");
  138. if ($bSubtree) $oPage->add("</ul>\n");
  139. }
  140. /**
  141. * Helper for the list of classes related to the given class
  142. */
  143. function DisplayRelatedClasses($oPage, $sClass)
  144. {
  145. $oPage->add("<h3>".Dict::Format('UI:Schema:Links:1-n', $sClass)."</h3>\n");
  146. DisplayReferencingClasses($oPage, $sClass);
  147. $oPage->add("<h3>".Dict::Format('UI:Schema:Links:n-n', $sClass)."</h3>\n");
  148. DisplayLinkingClasses($oPage, $sClass);
  149. $oPage->add("<h3>".Dict::S('UI:Schema:Links:All')."</h3>\n");
  150. DisplayRelatedClassesBestInClass($oPage, $sClass, 4);
  151. }
  152. /**
  153. * Helper for the lifecycle details of a given class
  154. */
  155. function DisplayLifecycle($oPage, $sClass)
  156. {
  157. $sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
  158. if (empty($sStateAttCode))
  159. {
  160. $oPage->p(Dict::S('UI:Schema:NoLifeCyle'));
  161. }
  162. else
  163. {
  164. $aStates = MetaModel::EnumStates($sClass);
  165. $aStimuli = MetaModel::EnumStimuli($sClass);
  166. $oPage->add("<img src=\"../pages/graphviz.php?class=$sClass\">\n");
  167. $oPage->add("<h3>".Dict::S('UI:Schema:LifeCycleTransitions')."</h3>\n");
  168. $oPage->add("<ul>\n");
  169. foreach ($aStates as $sStateCode => $aStateDef)
  170. {
  171. $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode);
  172. $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode);
  173. $oPage->add("<li title=\"code: $sStateCode\">$sStateLabel <span style=\"color:grey;\">($sStateCode) $sStateDescription</span></li>\n");
  174. $oPage->add("<ul>\n");
  175. foreach(MetaModel::EnumTransitions($sClass, $sStateCode) as $sStimulusCode => $aTransitionDef)
  176. {
  177. $sStimulusLabel = $aStimuli[$sStimulusCode]->GetLabel();
  178. $sTargetStateLabel = MetaModel::GetStateLabel($sClass, $aTransitionDef['target_state']);
  179. if (count($aTransitionDef['actions']) > 0)
  180. {
  181. $sActions = " <em>(".implode(', ', $aTransitionDef['actions']).")</em>";
  182. }
  183. else
  184. {
  185. $sActions = "";
  186. }
  187. $oPage->add("<li><span style=\"color:red;font-weight=bold;\">$sStimulusLabel</span> =&gt; $sTargetStateLabel $sActions</li>\n");
  188. }
  189. $oPage->add("</ul>\n");
  190. }
  191. $oPage->add("</ul>\n");
  192. $oPage->add("<h3>".Dict::S('UI:Schema:LifeCyleAttributeOptions')."</h3>\n");
  193. $oPage->add("<ul>\n");
  194. foreach ($aStates as $sStateCode => $aStateDef)
  195. {
  196. $sStateLabel = MetaModel::GetStateLabel($sClass, $sStateCode);
  197. $sStateDescription = MetaModel::GetStateDescription($sClass, $sStateCode);
  198. $oPage->add("<li title=\"code: $sStateCode\">$sStateLabel <span style=\"color:grey;\">($sStateCode) $sStateDescription</span></li>\n");
  199. if (count($aStates[$sStateCode]['attribute_list']) > 0)
  200. {
  201. $oPage->add("<ul>\n");
  202. foreach($aStates[$sStateCode]['attribute_list'] as $sAttCode => $iOptions)
  203. {
  204. $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
  205. $sAttLabel = $oAttDef->GetLabel();
  206. $aOptions = array();
  207. if ($iOptions & OPT_ATT_HIDDEN) $aOptions[] = Dict::S('UI:Schema:LifeCycleHiddenAttribute');
  208. if ($iOptions & OPT_ATT_READONLY) $aOptions[] = Dict::S('UI:Schema:LifeCycleReadOnlyAttribute');
  209. if ($iOptions & OPT_ATT_MANDATORY) $aOptions[] = Dict::S('UI:Schema:LifeCycleMandatoryAttribute');
  210. if ($iOptions & OPT_ATT_MUSTCHANGE) $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustChange');
  211. if ($iOptions & OPT_ATT_MUSTPROMPT) $aOptions[] = Dict::S('UI:Schema:LifeCycleAttributeMustPrompt');
  212. if (count($aOptions))
  213. {
  214. $sOptions = implode(', ', $aOptions);
  215. }
  216. else
  217. {
  218. $sOptions = "";
  219. }
  220. $oPage->add("<li><span style=\"color:purple;font-weight=bold;\">$sAttLabel</span> $sOptions</li>\n");
  221. }
  222. $oPage->add("</ul>\n");
  223. }
  224. else
  225. {
  226. $oPage->p("<em>".Dict::S('UI:Schema:LifeCycleEmptyList')."</em>");
  227. }
  228. }
  229. $oPage->add("</ul>\n");
  230. }
  231. }
  232. /**
  233. * Helper for the trigger
  234. */
  235. function DisplayTriggers($oPage, $sClass)
  236. {
  237. $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
  238. $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObject WHERE target_class IN ('$sClassList')"));
  239. cmdbAbstractObject::DisplaySet($oPage, $oSet);
  240. }
  241. /**
  242. * Display the list of classes from the business model
  243. */
  244. function DisplayClassesList($oPage)
  245. {
  246. $oPage->add("<h1>".Dict::S('UI:Schema:Title')."</h1>\n");
  247. $oPage->add("<ul id=\"ClassesList\" class=\"treeview fileview\">\n");
  248. foreach(MetaModel::GetClasses() as $sClassName)
  249. {
  250. if (MetaModel::IsRootClass($sClassName))
  251. {
  252. $oPage->add("<li class=\"closed\">".MakeClassHLink($sClassName)."\n");
  253. DisplaySubclasses($oPage, $sClassName);
  254. $oPage->add("</li>\n");
  255. }
  256. elseif (MetaModel::IsStandaloneClass($sClassName))
  257. {
  258. $oPage->add("<li>".MakeClassHLink($sClassName)."</li>\n");
  259. }
  260. }
  261. $oPage->add("</ul>\n");
  262. $oPage->add("<h1>".Dict::S('UI:Schema:Relationships')."</h1>\n");
  263. $oPage->add("<ul id=\"ClassesRelationships\" class=\"treeview\">\n");
  264. foreach (MetaModel::EnumRelations() as $sRelCode)
  265. {
  266. $oPage->add("<li>".MakeRelationHLink($sRelCode)."\n");
  267. $oPage->add("<ul>\n");
  268. $oPage->add("<li>Description: ".htmlentities(MetaModel::GetRelationDescription($sRelCode))."</li>\n");
  269. $oPage->add("<li>Verb up: ".htmlentities(MetaModel::GetRelationVerbUp($sRelCode))."</li>\n");
  270. $oPage->add("<li>Verb down: ".htmlentities(MetaModel::GetRelationVerbDown($sRelCode))."</li>\n");
  271. $oPage->add("</ul>\n");
  272. $oPage->add("</li>\n");
  273. }
  274. $oPage->add("</ul>\n");
  275. $oPage->add_ready_script('$("#ClassesList").treeview();');
  276. $oPage->add_ready_script('$("#ClassesRelationships").treeview();');
  277. }
  278. /**
  279. * Display the details of a given class of objects
  280. */
  281. function DisplayClassDetails($oPage, $sClass)
  282. {
  283. $oPage->add("<h2>$sClass - ".MetaModel::GetClassDescription($sClass)."</h2>\n");
  284. if (MetaModel::IsAbstract($sClass))
  285. {
  286. $oPage->p(Dict::S('UI:Schema:AbstractClass'));
  287. }
  288. else
  289. {
  290. $oPage->p(Dict::S('UI:Schema:NonAbstractClass'));
  291. }
  292. // $oPage->p("<h3>".Dict::S('UI:Schema:ClassHierarchyTitle')."</h3>");
  293. $aParentClasses = array();
  294. foreach(MetaModel::EnumParentClasses($sClass) as $sParentClass)
  295. {
  296. $aParentClasses[] = MakeClassHLink($sParentClass);
  297. }
  298. if (count($aParentClasses) > 0)
  299. {
  300. $sParents = implode(' &gt;&gt; ', $aParentClasses)." &gt;&gt; <b>$sClass</b>";
  301. }
  302. else
  303. {
  304. $sParents = '';
  305. }
  306. $oPage->p("[<a href=\"?operation='list'\">".Dict::S('UI:Schema:AllClasses')."</a>] $sParents");
  307. if (MetaModel::HasChildrenClasses($sClass))
  308. {
  309. $oPage->add("<ul id=\"ClassHierarchy\">");
  310. $oPage->add("<li class=\"closed\">".$sClass."\n");
  311. DisplaySubclasses($oPage, $sClass);
  312. $oPage->add("</li>\n");
  313. $oPage->add("</ul>\n");
  314. $oPage->add_ready_script('$("#ClassHierarchy").treeview();');
  315. }
  316. $oPage->p('');
  317. $oPage->AddTabContainer('details');
  318. $oPage->SetCurrentTabContainer('details');
  319. // List the attributes of the object
  320. $aDetails = array();
  321. foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode=>$oAttDef)
  322. {
  323. if ($oAttDef->IsExternalKey())
  324. {
  325. $sValue = Dict::Format('UI:Schema:ExternalKey_To',MakeClassHLink($oAttDef->GetTargetClass()));
  326. }
  327. else
  328. {
  329. $sValue = $oAttDef->GetDescription();
  330. }
  331. $sType = $oAttDef->GetType().' ('.$oAttDef->GetTypeDesc().')';
  332. $sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode);
  333. $sAllowedValues = "";
  334. $oAllowedValuesDef = $oAttDef->GetValuesDef();
  335. $sMoreInfo = "";
  336. $aCols = array();
  337. foreach($oAttDef->GetSQLColumns() as $sCol => $sFieldDesc)
  338. {
  339. $aCols[] = "$sCol: $sFieldDesc";
  340. }
  341. if (count($aCols) > 0)
  342. {
  343. $sCols = implode(', ', $aCols);
  344. $aMoreInfo = array();
  345. $aMoreInfo[] = Dict::Format('UI:Schema:Columns_Description', $sCols);
  346. $aMoreInfo[] = Dict::Format('UI:Schema:Default_Description', $oAttDef->GetDefaultValue());
  347. $aMoreInfo[] = $oAttDef->IsNullAllowed() ? Dict::S('UI:Schema:NullAllowed') : Dict::S('UI:Schema:NullNotAllowed');
  348. $sMoreInfo .= implode(', ', $aMoreInfo);
  349. }
  350. if (is_object($oAllowedValuesDef)) $sAllowedValues = $oAllowedValuesDef->GetValuesDescription();
  351. else $sAllowedValues = '';
  352. $aDetails[] = array('code' => $oAttDef->GetCode(), 'type' => $sType, 'origin' => $sOrigin, 'label' => $oAttDef->GetLabel(), 'description' => $sValue, 'values' => $sAllowedValues, 'moreinfo' => $sMoreInfo);
  353. }
  354. $oPage->SetCurrentTab(Dict::S('UI:Schema:Attributes'));
  355. $aConfig = array( 'code' => array('label' => Dict::S('UI:Schema:AttributeCode'), 'description' => Dict::S('UI:Schema:AttributeCode+')),
  356. 'label' => array('label' => Dict::S('UI:Schema:Label'), 'description' => Dict::S('UI:Schema:Label+')),
  357. 'type' => array('label' => Dict::S('UI:Schema:Type'), 'description' => Dict::S('UI:Schema:Type+')),
  358. 'origin' => array('label' => Dict::S('UI:Schema:Origin'), 'description' => Dict::S('UI:Schema:Origin+')),
  359. 'description' => array('label' => Dict::S('UI:Schema:Description'), 'description' => Dict::S('UI:Schema:Description+')),
  360. 'values' => array('label' => Dict::S('UI:Schema:AllowedValues'), 'description' => Dict::S('UI:Schema:AllowedValues+')),
  361. 'moreinfo' => array('label' => Dict::S('UI:Schema:MoreInfo'), 'description' => Dict::S('UI:Schema:MoreInfo+')),
  362. );
  363. $oPage->table($aConfig, $aDetails);
  364. // List the search criteria for this object
  365. $aDetails = array();
  366. foreach (MetaModel::GetClassFilterDefs($sClass) as $sFilterCode => $oFilterDef)
  367. {
  368. $aOpDescs = array();
  369. foreach ($oFilterDef->GetOperators() as $sOpCode => $sOpDescription)
  370. {
  371. $sIsTheLooser = ($sOpCode == $oFilterDef->GetLooseOperator()) ? " (loose search)" : "";
  372. $aOpDescs[] = "$sOpCode ($sOpDescription)$sIsTheLooser";
  373. }
  374. $aDetails[] = array( 'code' => $sFilterCode, 'description' => $oFilterDef->GetLabel(),'operators' => implode(" / ", $aOpDescs));
  375. }
  376. $oPage->SetCurrentTab(Dict::S('UI:Schema:SearchCriteria'));
  377. $aConfig = array( 'code' => array('label' => Dict::S('UI:Schema:FilterCode'), 'description' => Dict::S('UI:Schema:FilterCode+')),
  378. 'description' => array('label' => Dict::S('UI:Schema:FilterDescription'), 'description' => Dict::S('UI:Schema:FilterDescription+')),
  379. 'operators' => array('label' => Dict::S('UI:Schema:AvailOperators'), 'description' => Dict::S('UI:Schema:AvailOperators+'))
  380. );
  381. $oPage->table($aConfig, $aDetails);
  382. $oPage->SetCurrentTab(Dict::S('UI:Schema:ChildClasses'));
  383. DisplaySubclasses($oPage, $sClass);
  384. $oPage->SetCurrentTab(Dict::S('UI:Schema:ReferencingClasses'));
  385. DisplayReferencingClasses($oPage, $sClass);
  386. $oPage->SetCurrentTab(Dict::S('UI:Schema:RelatedClasses'));
  387. DisplayRelatedClasses($oPage, $sClass);
  388. $oPage->SetCurrentTab(Dict::S('UI:Schema:LifeCycle'));
  389. DisplayLifecycle($oPage, $sClass);
  390. $oPage->SetCurrentTab(Dict::S('UI:Schema:Triggers'));
  391. DisplayTriggers($oPage, $sClass);
  392. $oPage->SetCurrentTab();
  393. $oPage->SetCurrentTabContainer();
  394. }
  395. /**
  396. * Display the details of a given relation (e.g. "impacts")
  397. */
  398. function DisplayRelationDetails($oPage, $sRelCode)
  399. {
  400. $sDesc = MetaModel::GetRelationDescription($sRelCode);
  401. $sVerbDown = MetaModel::GetRelationVerbDown($sRelCode);
  402. $sVerbUp = MetaModel::GetRelationVerbUp($sRelCode);
  403. $oPage->add("<h1>".Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc)."</h1>");
  404. $oPage->p(Dict::Format('UI:Schema:RelationDown_Description', $sVerbDown));
  405. $oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sVerbUp));
  406. $oPage->add("<ul id=\"RelationshipDetails\" class=\"treeview\">\n");
  407. foreach(MetaModel::GetClasses() as $sClass)
  408. {
  409. $aRelQueries = MetaModel::EnumRelationQueries($sClass, $sRelCode);
  410. if (count($aRelQueries) > 0)
  411. {
  412. $oPage->add("<li>class ".MakeClassHLink($sClass)."\n");
  413. $oPage->add("<ul>\n");
  414. foreach ($aRelQueries as $sRelKey => $aQuery)
  415. {
  416. $sQuery = $aQuery['sQuery'];
  417. $iDistance = $aQuery['iDistance'];
  418. if ($aQuery['bPropagate'])
  419. {
  420. $oPage->add("<li>".Dict::Format('UI:Schema:RelationPropagates', $sRelKey, $iDistance, $sQuery)."</li>\n");
  421. }
  422. else
  423. {
  424. $oPage->add("<li>".Dict::Format('UI:Schema:RelationDoesNotPropagate', $sRelKey, $iDistance, $sQuery)."</li>\n");
  425. }
  426. }
  427. $oPage->add("</ul>\n");
  428. $oPage->add("</li>\n");
  429. }
  430. }
  431. $oPage->add_ready_script('$("#RelationshipDetails").treeview();');
  432. }
  433. require_once('../application/loginwebpage.class.inc.php');
  434. LoginWebPage::DoLogin(); // Check user rights and prompt if needed
  435. // Display the menu on the left
  436. $oAppContext = new ApplicationContext();
  437. $iActiveNodeId = utils::ReadParam('menu', -1);
  438. $currentOrganization = utils::ReadParam('org_id', 1);
  439. $operation = utils::ReadParam('operation', '');
  440. $oPage = new iTopWebPage(Dict::S('UI:Schema:Title'), $currentOrganization);
  441. $oPage->no_cache();
  442. $operation = utils::ReadParam('operation', '');
  443. switch($operation)
  444. {
  445. case 'details_class':
  446. $sClass = utils::ReadParam('class', 'logRealObject');
  447. DisplayClassDetails($oPage, $sClass);
  448. break;
  449. case 'details_relation':
  450. $sRelCode = utils::ReadParam('relcode', '');
  451. DisplayRelationDetails($oPage, $sRelCode);
  452. break;
  453. case 'list':
  454. default:
  455. DisplayClassesList($oPage);
  456. }
  457. $oPage->output();
  458. ?>