dnExists($request['dn'])) { error(sprintf(_('The entry (%s) does not exist.'), $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('%s %s %s %s',_('Add new'),htmlspecialchars($request['attr']),_('value to'),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('', _('Current list of'),$request['count'],_('values for attribute'),$request['attribute']->getFriendlyName()); echo ''; } else { printf('', _('No current value for attribute'),$request['attribute']->getFriendlyName()); echo ''; } echo ''; echo ''; printf('',_('Enter the value(s) 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 objectClass(es) require')); } echo '
%s %s %s %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 '
%s %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 ObjectClass'), (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('%s: %s %s
', _('Maximum Length'), number_format($sattr->getMaxLength()), _('characters')); } echo '
'; printf('',_('Add New 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']); } }