PageRenderTime 57ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/phpldapadmin-1.2.2/htdocs/schema.php

#
PHP | 640 lines | 495 code | 129 blank | 16 comment | 99 complexity | fe1c5abd98b2e33128c829f3321f41b1 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * Displays the schema for the specified server
  4. *
  5. * Variables that come in as GET vars:
  6. * - view (optional)
  7. * Shows attribute, objectclass or matching rule
  8. * - viewvalue (optional)
  9. * Shows the attribute, objectclass or matching rule
  10. * - highlight_oid (optional)
  11. * Use to higlight the oid in the syntaxes view.
  12. *
  13. * @package phpLDAPadmin
  14. * @subpackage Page
  15. */
  16. /**
  17. */
  18. require './common.php';
  19. $entry = array();
  20. $entry['view'] = get_request('view','GET','false','objectclasses');
  21. $entry['value'] = get_request('viewvalue','GET');
  22. if (! is_null($entry['value'])) {
  23. $entry['viewed'] = false;
  24. $entry['value'] = strtolower($entry['value']);
  25. }
  26. $schema_error_str = sprintf('%s <b>%s</b>.<br /><br /></div>%s<ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>',
  27. _('Could not retrieve schema from'),$app['server']->getName(),
  28. _('This could happen for several reasons, the most probable of which are:'),_('The server does not fully support the LDAP protocol.'),
  29. _('Your version of PHP does not correctly perform the query.'),_('phpLDAPadmin doesn\'t know how to fetch the schema for your server.'),
  30. _('Or lastly, your LDAP server doesnt provide this information.'));
  31. printf('<h3 class="title">%s <b>%s</b></h3>',_('Schema for server'),$app['server']->getName());
  32. $entry['schema_types'] = array(
  33. 'objectclasses'=>_('ObjectClasses'),
  34. 'attributes'=>_('Attribute Types'),
  35. 'syntaxes'=>_('Syntaxes'),
  36. 'matching_rules'=>_('Matching Rules'));
  37. echo '<br />';
  38. echo '<div style="text-align: center;">';
  39. $counter = 0;
  40. foreach ($entry['schema_types'] as $item => $value) {
  41. if ($counter++)
  42. echo ' | ';
  43. $entry['href'][$item] = sprintf('cmd=schema&server_id=%s&view=%s',$app['server']->getIndex(),$item);
  44. if ($entry['view'] == $item) {
  45. echo _($value);
  46. } else {
  47. if (isAjaxEnabled())
  48. printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'Loading %s\');" title="Loading %s">%s</a>',
  49. htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value);
  50. else
  51. printf('<a href="cmd.php?%s">%s</a>',htmlspecialchars($entry['href'][$item]),_($value));
  52. }
  53. }
  54. echo '</div>';
  55. echo '<br />';
  56. switch($entry['view']) {
  57. case 'syntaxes':
  58. $highlight_oid = get_request('highlight_oid','GET',false,false);
  59. echo '<table class="result_table" border="0" style="margin-left: auto; margin-right: auto;">';
  60. printf('<tr class="heading"><td>%s</td><td>%s</td></tr>',_('Syntax OID'),_('Description'));
  61. $counter = 1;
  62. $schema_syntaxes = $app['server']->SchemaSyntaxes();
  63. if (! $schema_syntaxes)
  64. error($schema_error_str,'error','index.php');
  65. foreach ($schema_syntaxes as $syntax) {
  66. $counter++;
  67. $oid = $syntax->getOID();
  68. $desc = $syntax->getDescription();
  69. if ($highlight_oid && $highlight_oid == $oid)
  70. echo '<tr class="highlight">';
  71. else
  72. printf('<tr class="%s">',$counter%2==0?'even':'odd');
  73. printf('<td>%s</td><td>%s</td></tr>',$oid,$desc);
  74. }
  75. echo '</table>';
  76. break;
  77. case 'attributes':
  78. $entry['attr_types'] = array(
  79. 'desc' => _('Description'),
  80. 'obsolete' => _('Obsolete'),
  81. 'inherits' => _('Inherits from'),
  82. 'equality' => _('Equality'),
  83. 'ordering' => _('Ordering'),
  84. 'substring_rule' => _('Substring Rule'),
  85. 'syntax' => _('Syntax'),
  86. 'single_valued' => _('Single Valued'),
  87. 'collective' => _('Collective'),
  88. 'user_modification' => _('User Modification'),
  89. 'usage' => _('Usage'),
  90. 'maximum_length' => _('Maximum Length'),
  91. 'aliases' => _('Aliases'),
  92. 'used_by_objectclasses' => _('Used by objectClasses'),
  93. 'force_as_may' => _('Force as MAY by config')
  94. );
  95. $sattrs = $app['server']->SchemaAttributes();
  96. if (! $sattrs || ! $app['server']->SchemaObjectClasses())
  97. error($schema_error_str,'error','index.php');
  98. printf('<small>%s:</small>',_('Jump to an attribute type'));
  99. echo '<form action="cmd.php" method="get">';
  100. echo '<div>';
  101. echo '<input type="hidden" name="cmd" value="schema" />';
  102. printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
  103. printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
  104. if (isAjaxEnabled()) {
  105. drawJSItems($sattrs);
  106. echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'attributes\',\'at\')" id="attributes">';
  107. } else
  108. echo '<select name="viewvalue" onchange="submit()">';
  109. echo '<option value=""> - all -</option>';
  110. foreach ($sattrs as $name => $attr)
  111. printf('<option value="%s" %s>%s</option>',
  112. $name,$name == $entry['value'] ? 'selected="selected" ': '',$attr->getName(false));
  113. echo '</select>';
  114. if (isAjaxEnabled())
  115. printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'attributes\',\'at\')"/>',_('Go'));
  116. else
  117. printf('<input type="submit" value="%s" />',_('Go'));
  118. echo '</div>';
  119. echo '</form>';
  120. echo '<br />';
  121. foreach ($sattrs as $attr) {
  122. if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$attr->getName())) {
  123. if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim($entry['value']))
  124. $entry['viewed'] = true;
  125. if (isAjaxEnabled() && $entry['value'])
  126. printf('<div id="at%s" style="display: %s">',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block');
  127. else
  128. printf('<div id="at%s">',$attr->getName());
  129. echo '<table class="result_table" width="100%" border="0">';
  130. printf('<tr class="heading"><td colspan="2"><a name="%s">%s</a></td></tr>',
  131. $attr->getName(),$attr->getName(false));
  132. $counter = 0;
  133. foreach ($entry['attr_types'] as $item => $value) {
  134. printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
  135. printf('<td class="title" style="width: 30%%;">%s</td>',$value);
  136. switch ($item) {
  137. case 'desc':
  138. printf('<td>%s</td>',
  139. is_null($attr->getDescription()) ?
  140. '('._('no description').')' : $attr->getDescription());
  141. echo '</tr>';
  142. printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
  143. echo '<td class="title"><acronym title="Object Identier">OID</acronym></td>';
  144. printf('<td>%s</td>',$attr->getOID());
  145. break;
  146. case 'obsolete':
  147. printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No'));
  148. break;
  149. case 'inherits':
  150. echo '<td>';
  151. if (is_null($attr->getSupAttribute()))
  152. printf('(%s)',_('none'));
  153. else {
  154. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($attr->getSupAttribute())));
  155. if (isAjaxEnabled())
  156. printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
  157. $href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
  158. else
  159. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSupAttribute());
  160. }
  161. echo '</td>';
  162. break;
  163. case 'equality':
  164. echo '<td>';
  165. if (is_null($attr->getEquality()))
  166. printf('(%s)',_('not specified'));
  167. else {
  168. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['matching_rules'],$attr->getEquality()));
  169. if (isAjaxEnabled())
  170. printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
  171. $href,$href,_('Matching Rules'),$attr->getEquality(),$attr->getEquality());
  172. else
  173. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getEquality());
  174. }
  175. echo '</td>';
  176. break;
  177. case 'ordering':
  178. printf('<td>%s</td>',
  179. is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering());
  180. break;
  181. case 'substring_rule':
  182. printf('<td>%s</td>',
  183. is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr());
  184. break;
  185. case 'syntax':
  186. echo '<td>';
  187. if (is_null($attr->getType())) {
  188. echo $attr->getSyntaxOID();
  189. } else {
  190. $href = htmlspecialchars(sprintf('%s&highlight_oid=%s',$entry['href']['syntaxes'],$attr->getSyntaxOID()));
  191. if (isAjaxEnabled())
  192. printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s (%s)</a>',
  193. $href,$href,_('Syntaxes'),'',$attr->getType(),$attr->getSyntaxOID());
  194. else
  195. printf('<a href="cmd.php?%s">%s (%s)</a>',$href,$attr->getType(),$attr->getSyntaxOID());
  196. }
  197. echo '</td>';
  198. break;
  199. case 'single_valued':
  200. printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No'));
  201. break;
  202. case 'collective':
  203. printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No'));
  204. break;
  205. case 'user_modification':
  206. printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes'));
  207. break;
  208. case 'usage':
  209. printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')');
  210. break;
  211. case 'maximum_length':
  212. echo '<td>';
  213. if ( is_null($attr->getMaxLength()))
  214. echo '('._('not applicable').')';
  215. else
  216. printf('%s %s',number_format($attr->getMaxLength()),
  217. $attr->getMaxLength()>1 ? _('characters') : _('character'));
  218. echo '</td>';
  219. break;
  220. case 'aliases':
  221. echo '<td>';
  222. if (count($attr->getAliases()) == 0)
  223. printf('(%s)',_('none'));
  224. else
  225. foreach ($attr->getAliases() as $alias) {
  226. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($alias)));
  227. if (isAjaxEnabled())
  228. printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
  229. $href,strtolower($alias),$alias);
  230. else
  231. printf('<a href="cmd.php?%s">%s</a>',$href,$alias);
  232. }
  233. echo '</td>';
  234. break;
  235. case 'used_by_objectclasses':
  236. echo '<td>';
  237. if (count($attr->getUsedInObjectClasses()) == 0)
  238. printf('(%s)',_('none'));
  239. else
  240. foreach ($attr->getUsedInObjectClasses() as $objectclass) {
  241. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($objectclass)));
  242. if (isAjaxEnabled())
  243. printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a> ',
  244. $href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass);
  245. else
  246. printf('<a href="cmd.php?%s">%s</a> ',$href,$objectclass);
  247. }
  248. echo '</td>';
  249. break;
  250. case 'force_as_may':
  251. printf('<td>%s</td>',$attr->isForceMay() ? _('Yes') : _('No'));
  252. break;
  253. }
  254. echo '</tr>';
  255. }
  256. echo '</table>';
  257. echo '<br />';
  258. echo '</div>';
  259. }
  260. }
  261. break;
  262. case 'matching_rules':
  263. $schema_matching_rules = $app['server']->MatchingRules();
  264. if (! $schema_matching_rules)
  265. error($schema_error_str,'error','index.php');
  266. printf('<small>%s</small><br />',_('Jump to a matching rule'));
  267. echo '<form action="cmd.php" method="get">';
  268. echo '<div>';
  269. echo '<input type="hidden" name="cmd" value="schema" />';
  270. printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
  271. echo '<input type="hidden" name="view" value="matching_rules" />';
  272. if (isAjaxEnabled()) {
  273. drawJSItems($schema_matching_rules);
  274. echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'matchingrules\',\'mr\')" id="matchingrules">';
  275. } else
  276. echo '<select name="viewvalue" onchange="submit()">';
  277. echo '<option value=""> - all -</option>';
  278. foreach ($schema_matching_rules as $rule)
  279. printf('<option value="%s" %s>%s</option>',
  280. $rule->getName(),
  281. ($rule->getName() == $entry['value'] ? 'selected="selected"': ''),
  282. $rule->getName(false));
  283. echo '</select>';
  284. if (isAjaxEnabled())
  285. printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'matchingrules\',\'mr\')"/>',_('Go'));
  286. else
  287. printf('<input type="submit" value="%s" />',_('Go'));
  288. echo '</div>';
  289. echo '</form>';
  290. echo '<br />';
  291. echo '<table class="result_table" width="100%" border="0">';
  292. printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
  293. _('Matching Rule OID'),_('Name'),_('Used by Attributes'));
  294. $counter = 1;
  295. foreach ($schema_matching_rules as $rule) {
  296. $counter++;
  297. $oid = $rule->getOID();
  298. $desc = $rule->getName(false);
  299. if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$rule->getName())) {
  300. if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim($entry['value']))
  301. $entry['viewed'] = true;
  302. if (null != $rule->getDescription())
  303. $desc .= sprintf(' (%s)',$rule->getDescription());
  304. if ( $rule->getIsObsolete())
  305. $desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
  306. if (isAjaxEnabled() && $entry['value'])
  307. printf('<tr class="%s" id="mr%s" style="display: %s">',$counter%2 ? 'odd' : 'even',$rule->getName(),
  308. strcasecmp($entry['value'],$rule->getName()) ? 'none' : '');
  309. else
  310. printf('<tr class="%s" id="mr%s">',$counter%2 ? 'odd' : 'even',$rule->getName());
  311. printf('<td>%s</td>',$oid);
  312. printf('<td>%s</td>',$desc);
  313. echo '<td>';
  314. if (count($rule->getUsedByAttrs()) == 0) {
  315. printf('<div style="text-align: center;">(%s)</div><br /><br />',_('none'));
  316. } else {
  317. echo '<table width="100%" border="0"><tr><td>';
  318. echo '<form action="cmd.php" method="get">';
  319. echo '<div>';
  320. echo '<input type="hidden" name="cmd" value="schema" />';
  321. printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
  322. echo '<input type="hidden" name="view" value="attributes" />';
  323. printf('<select size="4" name="viewvalue" id="vv%s">',$rule->getName());
  324. foreach ($rule->getUsedByAttrs() as $attr)
  325. printf('<option>%s</option>',$attr);
  326. echo '</select><br />';
  327. if (isAjaxEnabled())
  328. printf('<input type="button" value="%s" onclick="return ajJUMP(\'cmd=schema&amp;view=attributes&amp;server_id=%s\',\'%s\',\'%s\',\'vv\');"/>',
  329. _('Go'),$app['server']->getIndex(),_('Attributes'),$rule->getName());
  330. else
  331. printf('<input type="submit" value="%s" />',_('Go'));
  332. echo '</div>';
  333. echo '</form>';
  334. echo '</td></tr></table>';
  335. }
  336. echo '</td>';
  337. echo '</tr>';
  338. }
  339. }
  340. echo '</table>';
  341. break;
  342. case 'objectclasses':
  343. $socs = $app['server']->SchemaObjectClasses();
  344. if (! $socs)
  345. error($schema_error_str,'error','index.php');
  346. printf('<small>%s:</small>',_('Jump to an objectClass'));
  347. echo '<form action="cmd.php" method="get">';
  348. echo '<div>';
  349. echo '<input type="hidden" name="cmd" value="schema" />';
  350. printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
  351. printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
  352. if (isAjaxEnabled()) {
  353. drawJSItems($socs);
  354. echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'objectclasses\',\'oc\')" id="objectclasses">';
  355. } else
  356. echo '<select name="viewvalue" onchange="submit()">';
  357. echo '<option value=""> - all - </option>';
  358. foreach ($socs as $name => $oclass)
  359. printf('<option value="%s" %s>%s</option>',
  360. $name,$name == $entry['value'] ? 'selected="selected" ': '',$oclass->getName(false));
  361. echo '</select>';
  362. if (isAjaxEnabled())
  363. printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'objectclasses\',\'oc\')"/>',_('Go'));
  364. else
  365. printf('<input type="submit" value="%s" />',_('Go'));
  366. echo '</div>';
  367. echo '</form>';
  368. echo '<br />';
  369. foreach ($socs as $name => $oclass) {
  370. if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$oclass->getName())) {
  371. if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim($entry['value']))
  372. $entry['viewed'] = true;
  373. if (isAjaxEnabled() && $entry['value'])
  374. printf('<div id="oc%s" style="display: %s">',$oclass->getName(),strcasecmp($entry['value'],$oclass->getName()) ? 'none' : '');
  375. else
  376. printf('<div id="oc%s">',$oclass->getName());
  377. echo '<table class="result_table" width="100%" border="0">';
  378. printf('<tr class="heading"><td colspan="4"><a name="%s">%s</a></td></tr>',$name,$oclass->getName(false));
  379. printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('OID'),$oclass->getOID());
  380. if ($oclass->getDescription())
  381. printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('Description'),$oclass->getDescription());
  382. printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('Type'),$oclass->getType());
  383. if ($oclass->getIsObsolete())
  384. printf('<tr class="odd"><td colspan="4">%s</td></tr>',_('This objectClass is obsolete.'));
  385. printf('<tr class="odd"><td colspan="4">%s: <b>',_('Inherits from'));
  386. if (count($oclass->getSupClasses()) == 0)
  387. printf('(%s)',_('none'));
  388. else
  389. foreach ($oclass->getSupClasses() as $i => $object_class) {
  390. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
  391. if (isAjaxEnabled())
  392. printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
  393. $href,strtolower($object_class),$object_class);
  394. else
  395. printf('<a href="cmd.php?%s&viewvalue=%s" title="%s">%s</a>',
  396. $href,$object_class,_('Jump to this objectClass definition'),$object_class);
  397. if ($i < count($oclass->getSupClasses()) - 1)
  398. echo ', ';
  399. }
  400. echo '</b></td></tr>';
  401. printf('<tr class="odd"><td colspan="4">%s: <b>',_('Parent to'));
  402. if (strcasecmp($oclass->getName(),'top') == 0) {
  403. $href = htmlspecialchars($entry['href']['objectclasses']);
  404. if (isAjaxEnabled())
  405. printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'\');">all</a>',
  406. $href);
  407. else
  408. printf('(<a href="cmd.php?%s">all</a>)',$href);
  409. } elseif (count($oclass->getChildObjectClasses()) == 0)
  410. printf('(%s)',_('none'));
  411. else
  412. foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
  413. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
  414. if (isAjaxEnabled())
  415. printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
  416. $href,_('Jump to this objectClass definition'),strtolower($object_class),$object_class);
  417. else
  418. printf('<a href="cmd.php?%s" title="%s">%s</a>',$href,_('Jump to this objectClass definition'),$object_class);
  419. if ( $i < count($oclass->getChildObjectClasses()) - 1)
  420. echo ', ';
  421. }
  422. echo '</b></td></tr>';
  423. printf('<tr class="even"><td class="blank" rowspan="2" style="width: 5%%;">&nbsp;</td><td style="width: 45%%;"><b>%s</b></td><td style="width: 45%%;"><b>%s</b></td><td class="blank" rowspan="2" style="width: 5%%;">&nbsp;</td></tr>',
  424. _('Required Attributes'),_('Optional Attributes'));
  425. echo '<tr class="odd">';
  426. echo '<td>';
  427. if ($attrs = $oclass->getMustAttrs(true)) {
  428. echo '<ul class="list">';
  429. foreach ($attrs as $attr) {
  430. echo '<li>';
  431. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
  432. if (isAjaxEnabled())
  433. printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
  434. $href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
  435. else
  436. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
  437. if ($attr->getSource() != $oclass->getName(false)) {
  438. echo '<br />';
  439. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
  440. printf('<small>(%s ',_('Inherited from'));
  441. if (isAjaxEnabled())
  442. printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
  443. $href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
  444. else
  445. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
  446. echo ')</small>';
  447. }
  448. echo '</li>';
  449. }
  450. echo '</ul>';
  451. } else
  452. printf('(%s)',_('none'));
  453. echo '</td>';
  454. echo '<td>';
  455. if ($attrs = $oclass->getMayAttrs(true)) {
  456. echo '<ul class="list">';
  457. foreach ($attrs as $attr) {
  458. echo '<li>';
  459. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
  460. if (isAjaxEnabled())
  461. printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
  462. $href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
  463. else
  464. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
  465. if ($attr->getSource() != $oclass->getName(false)) {
  466. echo '<br />';
  467. $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
  468. printf('<small>(%s ',_('Inherited from'));
  469. if (isAjaxEnabled())
  470. printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
  471. $href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
  472. else
  473. printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
  474. echo ')</small>';
  475. }
  476. if ($oclass->isForceMay($attr->getName())) {
  477. echo '<br />';
  478. printf('<small>%s</small>',_('This attribute has been forced as a MAY attribute by the configuration'));
  479. }
  480. echo '</li>';
  481. }
  482. echo '</ul>';
  483. } else
  484. printf('(%s)',_('none'));
  485. echo '</td>';
  486. echo '</tr>';
  487. echo '</table>';
  488. echo '<br />';
  489. echo '</div>';
  490. }
  491. }
  492. break;
  493. }
  494. if (! is_null($entry['value']) && ! $entry['viewed'])
  495. error(sprintf(_('No such schema item: "%s"'),$entry['value']),'error','index.php');
  496. function drawJSItems($object) {
  497. echo '<script type="text/javascript">'."\n";
  498. echo "
  499. function items() {
  500. var \$items = new Array();";
  501. $counter = 0;
  502. foreach ($object as $attr) {
  503. printf(' items[%s] = "%s";',$counter++,$attr->getName());
  504. echo "\n";
  505. }
  506. echo '
  507. return items;
  508. }';
  509. echo '</script>';
  510. }
  511. ?>