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