haveAuthInfo())
pla_error( $lang['not_enough_login_info'] );
dn_exists( $ldapserver, $dn )
or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
$rdn = get_rdn($dn);
$attrs = get_object_attrs( $ldapserver, $dn, false, $config->GetValue('deref','view'));
$modified_attrs = isset( $_REQUEST['modified_attrs'] ) ? $_REQUEST['modified_attrs'] : false;
$show_internal_attrs = isset( $_REQUEST['show_internal_attrs'] ) ? true : false;
# If an entry has more children than this, stop searching and display this amount with a '+'
$max_children = 100;
} else {
$dn = '';
$rdn = '';
$encoded_dn = '';
isset($_REQUEST['template']) or die(); // pla_error( $lang['must_choose_template'] );
if ($_REQUEST['template'] == 'custom') {
include TMPLDIR.'template_header.php';
require TMPLDIR.'creation/custom.php';
die();
} else {
$templates = new Templates($ldapserver->server_id);
$template = $templates->GetTemplate($_REQUEST['template']);
}
}
include TMPLDIR.'template_header.php';
/*
* When we get here, (either a new entry, or modifying an existing entry), if the
* empty_attrs array has content, then we need to ask the user for this information.
*/
if (isset($template['empty_attrs'])) {
masort($template['empty_attrs'],'page,order',1);
# What page are we working on.
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
?>
This is the template engine. .
';
print ' var reduced = new Array();';
print 'function reduceMust(form,attr,attrname){';
print ' if (attr.value.length > 0) {';
print ' if (! reduced[attrname]) {';
print ' reduced[attrname] = 1;';
print ' form.mustitems.value--;';
print ' }';
print '';
print ' if (form.mustitems.value < 0) {';
print ' form.mustitems.value = 0;';
print ' }';
print '';
print ' if (form.mustitems.value == 0) {';
print ' form.submit.disabled = false;';
print ' }';
print ' } else {';
print ' if (reduced[attrname]) {';
print ' reduced[attrname] = 0;';
print ' form.mustitems.value++;';
print ' }';
print ' if (form.mustitems.value > 0) {';
print ' form.submit.disabled = true;';
print ' }';
print ' }';
print '}';
print '';
}
if (isset($verifyitems) && $verifyitems) {
//@todo: Return focus to the first item.
print '';
}
if ($templates->OnChangeDisplay()) {
print '';
}
# User needs to submit form to continue.
die();
}
if (! isset($template))
$template['attrs'] = $attrs;
# If we get here - we are displaying/editing the entry.
# Sort these entries.
uksort( $template['attrs'], 'sortAttrs' );
$js_date_attrs = $config->GetValue('appearance','date_attrs');
printf('',$config->GetValue('appearance','date'));
foreach( $template['attrs'] as $attr => $vals ) {
flush();
$schema_attr = $ldapserver->getSchemaAttribute($attr,$dn);
if( $schema_attr )
$attr_syntax = $schema_attr->getSyntaxOID();
else
$attr_syntax = null;
if( ! strcasecmp( $attr, 'dn' ) )
continue;
// has the config.php specified that this attribute is to be hidden or shown?
if( is_attr_hidden( $ldapserver, $attr))
continue;
// Setup the $attr_note, which will be displayed to the right of the attr name (if any)
$attr_note = '';
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $attr ) ] ) ) {
$attr_display = $friendly_attrs[ strtolower( $attr ) ];
$attr_note = "alias";
} else {
$attr_display = $attr;
}
// is this attribute required by an objectClass?
$required_by = '';
if( $schema_attr )
foreach( $schema_attr->getRequiredByObjectClasses() as $required )
if( isset($attrs['objectClass']) && in_array( strtolower( $required ), arrayLower( $attrs['objectClass'] ) ) )
$required_by .= $required . ' ';
// It seems that some LDAP servers (Domino) returns attributes in lower case?
elseif( isset($attrs['objectclass']) && in_array( strtolower( $required ), arrayLower( $attrs['objectclass'] ) ) )
$required_by .= $required . ' ';
if( $required_by ) {
if( trim( $attr_note ) )
$attr_note .= ', ';
$attr_note .= "" . $lang['required'] . " ";
}
// is this attribute required because its the RDN
if (preg_match("/^${attr}=/",$rdn)) {
if( trim( $attr_note ) )
$attr_note .= ', ';
$attr_note .= " " . 'rdn' . " ";
}
if( is_array( $modified_attrs ) && in_array( strtolower($attr), $modified_attrs ) )
$is_modified_attr = true;
else
$is_modified_attr = false;
if( $is_modified_attr ) { ?>
server_id,real_attr_name($attr)); ?>
()
isReadOnly() || is_attr_read_only( $ldapserver, $attr ) )
draw_jpeg_photos( $ldapserver, $dn, $attr, false );
else
draw_jpeg_photos( $ldapserver, $dn, $attr, true );
// proceed to the next attribute
echo "