dnExists($request['dn'])) error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($request['dn'])),'error','index.php'); $request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null)); $request['page']->setDN($request['dn']); $request['page']->accept(true); $request['template'] = $request['page']->getTemplate(); /* if ($request['attribute']->isReadOnly()) error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php'); */ # Render the form if (! strcasecmp($request['attr'],'objectclass') || get_request('meth','REQUEST') != 'ajax') { # Render the form. $request['page']->drawTitle(sprintf(_('Add new %s value to %s'), htmlspecialchars($request['attr']),htmlspecialchars(get_rdn($request['dn'])))); $request['page']->drawSubTitle(); if (! strcasecmp($request['attr'],'objectclass')) { echo '
'; echo '
'; echo ''; } else { echo ''; echo '
'; if ($_SESSION[APPCONFIG]->getValue('confirm','update')) echo ''; else echo ''; } printf('',$app['server']->getIndex()); printf('',htmlspecialchars($request['dn'])); echo '
'; echo ''; echo ''; $request['attribute'] = $request['template']->getAttribute($request['attr']); $request['count'] = $request['attribute']->getValueCount(); if ($request['count']) { printf('', $request['count'],$request['attribute']->getFriendlyName()); echo ''; } else { printf('', $request['attribute']->getFriendlyName()); echo ''; } echo ''; echo ''; printf('',_('Enter the values you would like to add:')); echo ''; echo ''; if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints')) printf('', IMGDIR,_('Note: You may be required to enter new attributes that these object classes require')); echo '
' . _('Current list of %s values for attribute %s:') . ''; # Display current attribute values echo '
'; for ($i=0;$i<$request['count'];$i++) { if ($i > 0) echo '
'; $request['page']->draw('CurrentValue',$request['attribute'],$i); $request['page']->draw('HiddenValue',$request['attribute'],$i); } echo '
'; echo '
' . _('No current value for attribute %s.') . '

%s'; if (! strcasecmp($request['attr'],'objectclass')) { # If our attr is an objectClass, fetch all available objectClasses and remove those from the list that are already defined in the entry $socs = $app['server']->SchemaObjectClasses(); foreach ($request['attribute']->getValues() as $oclass) unset($socs[strtolower($oclass)]); # Draw objectClass selection echo ''; echo '
'; echo ''; echo '
'; echo '
'; printf('', _('Add new object class'), (isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'entry_form\'),\'%s\');"',_('Updating object')) : '')); echo '
'; echo '

Hint%s
'; echo ''; } else { # Draw a blank field echo '
'; $request['page']->draw('FormValue',$request['attribute'],$request['count']); echo '
'; $sattr = $app['server']->getSchemaAttribute($request['attr']); if ($sattr->getDescription()) printf('%s: %s
',_('Description'),$sattr->getDescription()); if ($sattr->getType()) printf('%s: %s
',_('Syntax'),$sattr->getType()); if ($sattr->getMaxLength()) printf('' . _('Maximum length: %s characters') . '
', number_format($sattr->getMaxLength())); echo '
'; printf('',_('Add value')); echo '
'; echo ''; echo ''; echo ''; } } else { if (is_null($attribute = $request['template']->getAttribute($request['attr']))) { $request['template']->addAttribute($request['attr'],array('values'=>array())); $attribute = $request['template']->getAttribute($request['attr']); $attribute->show(); echo ''; $request['page']->draw('Template',$attribute); $request['page']->draw('Javascript',$attribute); echo '
'; } else { $request['count'] = $attribute->getValueCount(); $request['page']->draw('FormReadWriteValue',$attribute,$request['count']); } } ?>