phpldapadmin/htdocs/schema.php

641 lines
22 KiB
PHP
Raw Permalink Normal View History

2009-06-30 08:07:14 +00:00
<?php
2009-06-30 09:29:51 +00:00
/**
* Displays the schema for the specified server
2009-06-30 09:29:51 +00:00
*
* Variables that come in as GET vars:
* - view (optional)
* Shows attribute, objectclass or matching rule
* - viewvalue (optional)
* Shows the attribute, objectclass or matching rule
* - highlight_oid (optional)
* Use to higlight the oid in the syntaxes view.
2009-06-30 09:29:51 +00:00
*
* @package phpLDAPadmin
* @subpackage Page
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:29:51 +00:00
/**
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 11:52:55 +00:00
$entry = array();
$entry['view'] = get_request('view','GET','false','objectclasses');
2009-06-30 10:46:00 +00:00
$entry['value'] = get_request('viewvalue','GET');
2009-06-30 09:29:51 +00:00
2009-06-30 10:46:00 +00:00
if (! is_null($entry['value'])) {
$entry['viewed'] = false;
$entry['value'] = strtolower($entry['value']);
}
2009-06-30 08:07:14 +00:00
2010-02-24 15:03:10 +00:00
$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>',
_('Could not retrieve schema from'),$app['server']->getName(),
2009-06-30 10:26:08 +00:00
_('This could happen for several reasons, the most probable of which are:'),_('The server does not fully support the LDAP protocol.'),
_('Your version of PHP does not correctly perform the query.'),_('phpLDAPadmin doesn\'t know how to fetch the schema for your server.'),
_('Or lastly, your LDAP server doesnt provide this information.'));
2009-06-30 08:05:37 +00:00
printf('<h3 class="title">%s <b>%s</b></h3>',_('Schema for server'),$app['server']->getName());
2009-06-30 10:46:00 +00:00
$entry['schema_types'] = array(
'objectclasses'=>_('ObjectClasses'),
2009-06-30 11:51:50 +00:00
'attributes'=>_('Attribute Types'),
'syntaxes'=>_('Syntaxes'),
'matching_rules'=>_('Matching Rules'));
2009-06-30 10:46:00 +00:00
echo '<br />';
2010-02-24 15:03:10 +00:00
echo '<div style="text-align: center;">';
2009-06-30 10:46:00 +00:00
$counter = 0;
foreach ($entry['schema_types'] as $item => $value) {
if ($counter++)
echo ' | ';
$entry['href'][$item] = sprintf('cmd=schema&server_id=%s&view=%s',$app['server']->getIndex(),$item);
2009-06-30 10:46:00 +00:00
if ($entry['view'] == $item) {
echo _($value);
} else {
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'Loading %s\');" title="Loading %s">%s</a>',
htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value);
else
printf('<a href="cmd.php?%s">%s</a>',htmlspecialchars($entry['href'][$item]),_($value));
}
2009-06-30 10:46:00 +00:00
}
2010-02-24 15:03:10 +00:00
echo '</div>';
2009-06-30 10:46:00 +00:00
echo '<br />';
switch($entry['view']) {
2009-06-30 09:29:51 +00:00
case 'syntaxes':
2009-06-30 11:52:55 +00:00
$highlight_oid = get_request('highlight_oid','GET',false,false);
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
echo '<table class="result_table" border="0" style="margin-left: auto; margin-right: auto;">';
2009-06-30 11:51:50 +00:00
printf('<tr class="heading"><td>%s</td><td>%s</td></tr>',_('Syntax OID'),_('Description'));
2009-06-30 09:29:51 +00:00
$counter = 1;
$schema_syntaxes = $app['server']->SchemaSyntaxes();
2009-06-30 09:29:51 +00:00
if (! $schema_syntaxes)
2009-06-30 11:52:55 +00:00
error($schema_error_str,'error','index.php');
2009-06-30 09:29:51 +00:00
foreach ($schema_syntaxes as $syntax) {
$counter++;
$oid = $syntax->getOID();
$desc = $syntax->getDescription();
2009-06-30 09:29:51 +00:00
if ($highlight_oid && $highlight_oid == $oid)
echo '<tr class="highlight">';
else
printf('<tr class="%s">',$counter%2==0?'even':'odd');
2009-06-30 11:51:50 +00:00
printf('<td>%s</td><td>%s</td></tr>',$oid,$desc);
2009-06-30 09:29:51 +00:00
}
echo '</table>';
2009-06-30 09:29:51 +00:00
break;
case 'attributes':
2009-06-30 10:46:00 +00:00
$entry['attr_types'] = array(
'desc' => _('Description'),
'obsolete' => _('Obsolete'),
'inherits' => _('Inherits from'),
'equality' => _('Equality'),
'ordering' => _('Ordering'),
'substring_rule' => _('Substring Rule'),
'syntax' => _('Syntax'),
'single_valued' => _('Single Valued'),
'collective' => _('Collective'),
'user_modification' => _('User Modification'),
'usage' => _('Usage'),
'maximum_length' => _('Maximum Length'),
'aliases' => _('Aliases'),
2009-06-30 11:52:55 +00:00
'used_by_objectclasses' => _('Used by objectClasses'),
'force_as_may' => _('Force as MAY by config')
2009-06-30 10:46:00 +00:00
);
$sattrs = $app['server']->SchemaAttributes();
2009-06-30 09:29:51 +00:00
if (! $sattrs || ! $app['server']->SchemaObjectClasses())
2009-06-30 11:52:55 +00:00
error($schema_error_str,'error','index.php');
2009-06-30 08:07:14 +00:00
2009-06-30 10:26:08 +00:00
printf('<small>%s:</small>',_('Jump to an attribute type'));
2009-06-30 10:46:00 +00:00
echo '<form action="cmd.php" method="get">';
2010-02-24 15:03:10 +00:00
echo '<div>';
2009-06-30 10:46:00 +00:00
echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
if (isAjaxEnabled()) {
2009-08-22 11:30:50 +00:00
drawJSItems($sattrs);
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'attributes\',\'at\')" id="attributes">';
} else
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="submit()">';
2009-06-30 09:22:30 +00:00
2009-06-30 10:26:08 +00:00
echo '<option value=""> - all -</option>';
foreach ($sattrs as $name => $attr)
2009-06-30 09:29:51 +00:00
printf('<option value="%s" %s>%s</option>',
2010-02-24 15:03:10 +00:00
$name,$name == $entry['value'] ? 'selected="selected" ': '',$attr->getName(false));
2009-06-30 10:26:08 +00:00
echo '</select>';
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'attributes\',\'at\')"/>',_('Go'));
else
printf('<input type="submit" value="%s" />',_('Go'));
2010-02-24 15:03:10 +00:00
echo '</div>';
echo '</form>';
2009-06-30 10:26:08 +00:00
echo '<br />';
2009-06-30 09:29:51 +00:00
foreach ($sattrs as $attr) {
2010-02-24 15:03:10 +00:00
if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$attr->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim($entry['value']))
2009-06-30 10:46:00 +00:00
$entry['viewed'] = true;
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled() && $entry['value'])
2009-08-22 11:30:50 +00:00
printf('<div id="at%s" style="display: %s">',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block');
else
printf('<div id="at%s">',$attr->getName());
2010-02-24 15:03:10 +00:00
echo '<table class="result_table" width="100%" border="0">';
printf('<tr class="heading"><td colspan="2"><a name="%s">%s</a></td></tr>',
$attr->getName(),$attr->getName(false));
2009-06-30 09:29:51 +00:00
$counter = 0;
2009-06-30 10:46:00 +00:00
foreach ($entry['attr_types'] as $item => $value) {
2009-06-30 09:29:51 +00:00
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
2010-02-24 15:03:10 +00:00
printf('<td class="title" style="width: 30%%;">%s</td>',$value);
2009-06-30 09:29:51 +00:00
switch ($item) {
case 'desc':
printf('<td>%s</td>',
is_null($attr->getDescription()) ?
2009-06-30 10:26:08 +00:00
'('._('no description').')' : $attr->getDescription());
2009-06-30 09:29:51 +00:00
echo '</tr>';
2009-06-30 09:29:51 +00:00
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
2009-06-30 11:51:50 +00:00
echo '<td class="title"><acronym title="Object Identier">OID</acronym></td>';
2009-06-30 09:29:51 +00:00
printf('<td>%s</td>',$attr->getOID());
break;
case 'obsolete':
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No'));
2009-06-30 09:29:51 +00:00
break;
case 'inherits':
echo '<td>';
2009-06-30 09:29:51 +00:00
if (is_null($attr->getSupAttribute()))
2009-06-30 10:26:08 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
2009-06-30 10:46:00 +00:00
else {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($attr->getSupAttribute())));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
$href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSupAttribute());
2009-06-30 10:46:00 +00:00
}
2009-06-30 09:29:51 +00:00
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
case 'equality':
echo '<td>';
2009-06-30 10:46:00 +00:00
if (is_null($attr->getEquality()))
printf('(%s)',_('not specified'));
else {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['matching_rules'],$attr->getEquality()));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
$href,$href,_('Matching Rules'),$attr->getEquality(),$attr->getEquality());
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getEquality());
2009-06-30 10:46:00 +00:00
}
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
case 'ordering':
printf('<td>%s</td>',
2009-06-30 10:26:08 +00:00
is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering());
2009-06-30 09:29:51 +00:00
break;
case 'substring_rule':
printf('<td>%s</td>',
2009-06-30 10:26:08 +00:00
is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr());
2009-06-30 09:29:51 +00:00
break;
case 'syntax':
echo '<td>';
2009-06-30 09:29:51 +00:00
if (is_null($attr->getType())) {
echo $attr->getSyntaxOID();
} else {
$href = htmlspecialchars(sprintf('%s&highlight_oid=%s',$entry['href']['syntaxes'],$attr->getSyntaxOID()));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s (%s)</a>',
$href,$href,_('Syntaxes'),'',$attr->getType(),$attr->getSyntaxOID());
else
printf('<a href="cmd.php?%s">%s (%s)</a>',$href,$attr->getType(),$attr->getSyntaxOID());
2009-06-30 09:29:51 +00:00
}
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
case 'single_valued':
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No'));
2009-06-30 09:29:51 +00:00
break;
case 'collective':
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No'));
2009-06-30 09:29:51 +00:00
break;
case 'user_modification':
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes'));
2009-06-30 09:29:51 +00:00
break;
case 'usage':
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')');
2009-06-30 09:29:51 +00:00
break;
case 'maximum_length':
echo '<td>';
2009-06-30 09:29:51 +00:00
if ( is_null($attr->getMaxLength()))
2009-06-30 10:26:08 +00:00
echo '('._('not applicable').')';
2009-06-30 09:29:51 +00:00
else
printf('%s %s',number_format($attr->getMaxLength()),
2009-06-30 10:26:08 +00:00
$attr->getMaxLength()>1 ? _('characters') : _('character'));
2009-06-30 09:29:51 +00:00
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
case 'aliases':
echo '<td>';
2009-06-30 09:29:51 +00:00
if (count($attr->getAliases()) == 0)
2009-06-30 10:46:00 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
else
foreach ($attr->getAliases() as $alias) {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($alias)));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
$href,strtolower($alias),$alias);
else
printf('<a href="cmd.php?%s">%s</a>',$href,$alias);
2009-06-30 10:46:00 +00:00
}
2009-06-30 09:29:51 +00:00
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
case 'used_by_objectclasses':
echo '<td>';
2009-06-30 09:29:51 +00:00
if (count($attr->getUsedInObjectClasses()) == 0)
2009-06-30 10:46:00 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
else
foreach ($attr->getUsedInObjectClasses() as $objectclass) {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($objectclass)));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a> ',
$href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass);
else
printf('<a href="cmd.php?%s">%s</a> ',$href,$objectclass);
2009-06-30 10:46:00 +00:00
}
2009-06-30 09:29:51 +00:00
echo '</td>';
2009-06-30 09:29:51 +00:00
break;
2009-06-30 11:52:55 +00:00
case 'force_as_may':
printf('<td>%s</td>',$attr->isForceMay() ? _('Yes') : _('No'));
2009-06-30 11:52:55 +00:00
break;
2009-06-30 09:29:51 +00:00
}
echo '</tr>';
2009-06-30 09:29:51 +00:00
}
echo '</table>';
2009-06-30 10:46:00 +00:00
echo '<br />';
echo '</div>';
2009-06-30 09:29:51 +00:00
}
2009-06-30 09:22:30 +00:00
}
2009-06-30 09:29:51 +00:00
break;
case 'matching_rules':
$schema_matching_rules = $app['server']->MatchingRules();
2009-06-30 09:29:51 +00:00
if (! $schema_matching_rules)
2009-06-30 11:52:55 +00:00
error($schema_error_str,'error','index.php');
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
printf('<small>%s</small><br />',_('Jump to a matching rule'));
2009-06-30 09:29:51 +00:00
echo '<form action="cmd.php" method="get">';
2010-02-24 15:03:10 +00:00
echo '<div>';
echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
echo '<input type="hidden" name="view" value="matching_rules" />';
if (isAjaxEnabled()) {
2009-08-22 11:30:50 +00:00
drawJSItems($schema_matching_rules);
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'matchingrules\',\'mr\')" id="matchingrules">';
} else
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="submit()">';
2009-06-30 09:29:51 +00:00
echo '<option value=""> - all -</option>';
2009-06-30 09:29:51 +00:00
foreach ($schema_matching_rules as $rule)
printf('<option value="%s" %s>%s</option>',
$rule->getName(),
2010-02-24 15:03:10 +00:00
($rule->getName() == $entry['value'] ? 'selected="selected"': ''),
$rule->getName(false));
2009-06-30 09:29:51 +00:00
echo '</select>';
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'matchingrules\',\'mr\')"/>',_('Go'));
else
printf('<input type="submit" value="%s" />',_('Go'));
2010-02-24 15:03:10 +00:00
echo '</div>';
echo '</form>';
echo '<br />';
2010-02-24 15:03:10 +00:00
echo '<table class="result_table" width="100%" border="0">';
2009-06-30 11:51:50 +00:00
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
2009-06-30 10:26:08 +00:00
_('Matching Rule OID'),_('Name'),_('Used by Attributes'));
2009-06-30 09:29:51 +00:00
$counter = 1;
foreach ($schema_matching_rules as $rule) {
$counter++;
$oid = $rule->getOID();
$desc = $rule->getName(false);
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$rule->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim($entry['value']))
2009-06-30 10:46:00 +00:00
$entry['viewed'] = true;
2009-06-30 09:29:51 +00:00
if (null != $rule->getDescription())
$desc .= sprintf(' (%s)',$rule->getDescription());
if ( $rule->getIsObsolete())
2009-06-30 10:26:08 +00:00
$desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled() && $entry['value'])
printf('<tr class="%s" id="mr%s" style="display: %s">',$counter%2 ? 'odd' : 'even',$rule->getName(),
strcasecmp($entry['value'],$rule->getName()) ? 'none' : '');
else
printf('<tr class="%s" id="mr%s">',$counter%2 ? 'odd' : 'even',$rule->getName());
2009-06-30 11:51:50 +00:00
printf('<td>%s</td>',$oid);
printf('<td>%s</td>',$desc);
2009-06-30 09:29:51 +00:00
echo '<td>';
2009-06-30 09:29:51 +00:00
if (count($rule->getUsedByAttrs()) == 0) {
2010-02-24 15:03:10 +00:00
printf('<div style="text-align: center;">(%s)</div><br /><br />',_('none'));
2009-06-30 09:29:51 +00:00
} else {
2010-02-24 15:03:10 +00:00
echo '<table width="100%" border="0"><tr><td>';
echo '<form action="cmd.php" method="get">';
2010-02-24 15:03:10 +00:00
echo '<div>';
echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
echo '<input type="hidden" name="view" value="attributes" />';
2009-06-30 09:29:51 +00:00
printf('<select size="4" name="viewvalue" id="vv%s">',$rule->getName());
2009-06-30 09:29:51 +00:00
foreach ($rule->getUsedByAttrs() as $attr)
printf('<option>%s</option>',$attr);
echo '</select><br />';
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<input type="button" value="%s" onclick="return ajJUMP(\'cmd=schema&amp;view=attributes&amp;server_id=%s\',\'%s\',\'%s\',\'vv\');"/>',
_('Go'),$app['server']->getIndex(),_('Attributes'),$rule->getName());
else
printf('<input type="submit" value="%s" />',_('Go'));
2010-02-24 15:03:10 +00:00
echo '</div>';
echo '</form>';
echo '</td></tr></table>';
2009-06-30 09:29:51 +00:00
}
echo '</td>';
echo '</tr>';
2009-06-30 09:29:51 +00:00
}
2009-06-30 08:09:20 +00:00
}
2009-06-30 09:29:51 +00:00
echo '</table>';
2009-06-30 09:29:51 +00:00
break;
case 'objectclasses':
$socs = $app['server']->SchemaObjectClasses();
if (! $socs)
2009-06-30 11:52:55 +00:00
error($schema_error_str,'error','index.php');
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
printf('<small>%s:</small>',_('Jump to an objectClass'));
2009-06-30 09:29:51 +00:00
2009-06-30 10:46:00 +00:00
echo '<form action="cmd.php" method="get">';
2010-02-24 15:03:10 +00:00
echo '<div>';
2009-06-30 10:46:00 +00:00
echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
if (isAjaxEnabled()) {
2009-08-22 11:30:50 +00:00
drawJSItems($socs);
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="ajSHOWSCHEMA(\'objectclasses\',\'oc\')" id="objectclasses">';
} else
2010-02-24 15:03:10 +00:00
echo '<select name="viewvalue" onchange="submit()">';
2009-06-30 10:26:08 +00:00
echo '<option value=""> - all - </option>';
foreach ($socs as $name => $oclass)
2009-06-30 09:29:51 +00:00
printf('<option value="%s" %s>%s</option>',
2010-02-24 15:03:10 +00:00
$name,$name == $entry['value'] ? 'selected="selected" ': '',$oclass->getName(false));
2009-06-30 10:26:08 +00:00
echo '</select>';
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<input type="button" value="%s" onclick="ajSHOWSCHEMA(\'objectclasses\',\'oc\')"/>',_('Go'));
else
printf('<input type="submit" value="%s" />',_('Go'));
2010-02-24 15:03:10 +00:00
echo '</div>';
2009-06-30 10:26:08 +00:00
echo '</form>';
echo '<br />';
2009-06-30 09:29:51 +00:00
foreach ($socs as $name => $oclass) {
2010-02-24 15:03:10 +00:00
if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$oclass->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim($entry['value']))
2009-06-30 10:46:00 +00:00
$entry['viewed'] = true;
2009-06-30 09:29:51 +00:00
if (isAjaxEnabled() && $entry['value'])
printf('<div id="oc%s" style="display: %s">',$oclass->getName(),strcasecmp($entry['value'],$oclass->getName()) ? 'none' : '');
else
printf('<div id="oc%s">',$oclass->getName());
2010-02-24 15:03:10 +00:00
echo '<table class="result_table" width="100%" border="0">';
printf('<tr class="heading"><td colspan="4"><a name="%s">%s</a></td></tr>',$name,$oclass->getName(false));
printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('OID'),$oclass->getOID());
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($oclass->getDescription())
2010-02-24 15:03:10 +00:00
printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('Description'),$oclass->getDescription());
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
printf('<tr class="odd"><td colspan="4">%s: <b>%s</b></td></tr>',_('Type'),$oclass->getType());
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($oclass->getIsObsolete())
2010-02-24 15:03:10 +00:00
printf('<tr class="odd"><td colspan="4">%s</td></tr>',_('This objectClass is obsolete.'));
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
printf('<tr class="odd"><td colspan="4">%s: <b>',_('Inherits from'));
2009-06-30 09:29:51 +00:00
if (count($oclass->getSupClasses()) == 0)
2009-06-30 10:26:08 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
else
foreach ($oclass->getSupClasses() as $i => $object_class) {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
$href,strtolower($object_class),$object_class);
else
printf('<a href="cmd.php?%s&viewvalue=%s" title="%s">%s</a>',
$href,$object_class,_('Jump to this objectClass definition'),$object_class);
2009-06-30 09:29:51 +00:00
if ($i < count($oclass->getSupClasses()) - 1)
2009-06-30 10:26:08 +00:00
echo ', ';
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:46:00 +00:00
echo '</b></td></tr>';
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
printf('<tr class="odd"><td colspan="4">%s: <b>',_('Parent to'));
2009-06-30 10:46:00 +00:00
if (strcasecmp($oclass->getName(),'top') == 0) {
$href = htmlspecialchars($entry['href']['objectclasses']);
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'\');">all</a>',
$href);
else
printf('(<a href="cmd.php?%s">all</a>)',$href);
2009-06-30 09:29:51 +00:00
2009-06-30 10:46:00 +00:00
} elseif (count($oclass->getChildObjectClasses()) == 0)
2009-06-30 10:26:08 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
else
foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
$href,_('Jump to this objectClass definition'),strtolower($object_class),$object_class);
else
printf('<a href="cmd.php?%s" title="%s">%s</a>',$href,_('Jump to this objectClass definition'),$object_class);
2009-06-30 09:29:51 +00:00
if ( $i < count($oclass->getChildObjectClasses()) - 1)
2009-06-30 10:26:08 +00:00
echo ', ';
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:46:00 +00:00
echo '</b></td></tr>';
2009-06-30 09:29:51 +00:00
2010-02-24 15:03:10 +00:00
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>',
2009-06-30 10:46:00 +00:00
_('Required Attributes'),_('Optional Attributes'));
2009-06-30 09:22:30 +00:00
2009-06-30 11:51:50 +00:00
echo '<tr class="odd">';
2009-06-30 10:26:08 +00:00
echo '<td>';
2009-06-30 10:46:00 +00:00
if ($attrs = $oclass->getMustAttrs(true)) {
2009-06-30 11:51:50 +00:00
echo '<ul class="list">';
2009-06-30 09:29:51 +00:00
foreach ($attrs as $attr) {
echo '<li>';
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
$href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
if ($attr->getSource() != $oclass->getName(false)) {
2009-06-30 10:26:08 +00:00
echo '<br />';
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
printf('<small>(%s ',_('Inherited from'));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
echo ')</small>';
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:26:08 +00:00
echo '</li>';
2009-06-30 08:09:20 +00:00
}
2009-06-30 10:26:08 +00:00
echo '</ul>';
2009-06-30 09:29:51 +00:00
} else
2009-06-30 10:46:00 +00:00
printf('(%s)',_('none'));
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo '</td>';
2009-06-30 10:46:00 +00:00
echo '<td>';
2009-06-30 09:29:51 +00:00
if ($attrs = $oclass->getMayAttrs(true)) {
2009-06-30 11:51:50 +00:00
echo '<ul class="list">';
2009-06-30 09:29:51 +00:00
foreach ($attrs as $attr) {
echo '<li>';
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
$href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
if ($attr->getSource() != $oclass->getName(false)) {
2009-06-30 10:26:08 +00:00
echo '<br />';
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
printf('<small>(%s ',_('Inherited from'));
if (isAjaxEnabled())
2010-02-24 15:03:10 +00:00
printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
else
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
echo ')</small>';
2009-06-30 09:29:51 +00:00
}
2009-06-30 11:52:55 +00:00
if ($oclass->isForceMay($attr->getName())) {
echo '<br />';
printf('<small>%s</small>',_('This attribute has been forced as a MAY attribute by the configuration'));
}
2009-06-30 10:26:08 +00:00
echo '</li>';
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:26:08 +00:00
echo '</ul>';
2009-06-30 09:29:51 +00:00
} else
2009-06-30 10:46:00 +00:00
printf('(%s)',_('none'));
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '</td>';
echo '</tr>';
echo '</table>';
2009-06-30 10:46:00 +00:00
echo '<br />';
echo '</div>';
2009-06-30 09:29:51 +00:00
}
}
2009-06-30 09:29:51 +00:00
break;
}
2009-06-30 10:46:00 +00:00
if (! is_null($entry['value']) && ! $entry['viewed'])
error(sprintf(_('No such schema item: "%s"'),$entry['value']),'error','index.php');
2009-08-22 11:30:50 +00:00
function drawJSItems($object) {
2010-02-24 15:03:10 +00:00
echo '<script type="text/javascript">'."\n";
2009-08-22 11:30:50 +00:00
echo "
function items() {
var \$items = new Array();";
$counter = 0;
foreach ($object as $attr) {
printf(' items[%s] = "%s";',$counter++,$attr->getName());
echo "\n";
}
echo '
return items;
}';
echo '</script>';
}
2009-06-30 10:46:00 +00:00
?>