isReadOnly()) pla_error(_('You cannot perform updates while server is in read-only mode')); # The DN and ATTR we are working with. $entry['dn']['encode'] = get_request('dn','GET',true); $entry['dn']['string'] = urldecode($entry['dn']['encode']); $entry['dn']['html'] = htmlspecialchars($entry['dn']['string']); $entry['attr']['string'] = get_request('attr','GET',true); $entry['attr']['encode'] = rawurlencode($entry['attr']['string']); $entry['attr']['html'] = htmlspecialchars($entry['attr']['string']); if (! is_null($entry['dn']['string'])) $entry['rdn']['string'] = get_rdn($entry['dn']['string']); else $entry['rdn']['string'] = null; $entry['rdn']['html'] = htmlspecialchars($entry['rdn']['string']); /***************/ /* get entry */ /***************/ if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string'])) pla_error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),null,-1,true); $tree = get_cached_item($ldapserver->server_id,'tree'); $entry['ldap'] = null; if ($tree) { $entry['ldap'] = $tree->getEntry($entry['dn']['string']); if (! $entry['ldap']) $tree->addEntry($entry['dn']['string']); $entry['ldap'] = $tree->getEntry($entry['dn']['string']); } // define the template of the entry if possible eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader').'($ldapserver);'); $reader->visit('Start', $entry['ldap']); if (! $entry['ldap'] || $entry['ldap']->isReadOnly()) pla_error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),null,-1,true); /*********************/ /* attribute values */ /*********************/ eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_writer').'($ldapserver);'); $ldap['attr'] = $entry['ldap']->getAttribute($entry['attr']['string']); if (!$ldap['attr']) { // define a new attribute for the entry $attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory'); eval('$attribute_factory = new '.$attributefactoryclass.'();'); $ldap['attr'] = $attribute_factory->newAttribute($entry['attr']['string'], array()); $ldap['attr']->setEntry($entry['ldap']); } $ldap['count'] = $ldap['attr']->getValueCount(); if ($ldap['attr']->isReadOnly()) pla_error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),null,-1,true); if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value'))); if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add')) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute'))); /* $ldap['attrs'] = $ldapserver->getDNAttr($entry['dn']['string'],$entry['attr']['string']); $ldap['count'] = count($ldap['attrs']); */ $entry['attr']['oclass'] = (strcasecmp($entry['attr']['string'],'objectClass') == 0) ? true : false; if ($entry['attr']['oclass']) { # Fetch all available objectClasses and remove those from the list that are already defined in the entry $ldap['oclasses'] = $ldapserver->SchemaObjectClasses(); foreach($ldap['attr']->getValues() as $oclass) unset($ldap['oclasses'][strtolower($oclass)]); } else { $ldap['schema'] = $ldapserver->getSchemaAttribute($entry['attr']['string']); } printf('
'; $writer->draw('BlankValue', $ldap['attr'], $ldap['count']); echo ' |
';
/*
if ($ldapserver->isAttrBinary($entry['attr']['string'])) {
echo '';
echo '';
} else {
if ($ldapserver->isMultiLineAttr($entry['attr']['string'])) {
echo '';
} else {
printf('',
($ldap['attr']->getMaxLength() ? sprintf(' maxlength="%s"',$ldap['attr']->getMaxLength()) : ''));
# Draw the "browse" button next to this input box if this attr houses DNs:
if ($ldapserver->isDNAttr($entry['attr']['string']))
draw_chooser_link("new_value_form.new_value", false);
}
}
*/
if ($ldap['schema']->getDescription())
printf('%s: %s ',_('Description'),$ldap['schema']->getDescription()); if ($ldap['schema']->getType()) printf('%s: %s ',_('Syntax'),$ldap['schema']->getType()); if ($ldap['schema']->getMaxLength()) printf('%s: %s %s ', _('Maximum Length'),number_format($ldap['schema']->getMaxLength()),_('characters')); echo ' '; printf('',_('Add New Value')); echo ' |