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();
# Render the form
if (get_request('meth','REQUEST') != 'ajax') {
$request['page']->drawTitle(sprintf('%s %s',_('Add new attribute'),get_rdn($request['dn'])));
$request['page']->drawSubTitle();
echo '
';
if (count($request['template']->getAvailAttrs())) {
# If we have more than the configured entries, we'll separate our input to the old ways.
if (count($request['template']->getAvailAttrs()) > $_SESSION[APPCONFIG]->getValue('appearance','max_add_attrs')) {
$attr = array();
$attr['avail'] = array();
$attr['binary'] = array();
foreach ($request['template']->getAvailAttrs() as $attribute)
{
if ($app['server']->isAttrBinary($attribute->getName()))
{
array_push($attr['binary'], $attribute);
} else
{
array_push($attr['avail'], $attribute);
}
}
if (count($attr['avail']) > 0) {
echo '
';
echo _('Add new attribute');
echo '
';
echo '
';
echo '
';
} else {
echo '
';
printf('
(%s)',_('no new attributes available for this entry'));
}
if (count($attr['binary']) > 0) {
echo '
';
echo _('Add new binary attribute');
echo '
';
echo '
';
echo '';
echo '
';
} else {
echo '
';
printf('
(%s)',_('no new binary attributes available for this entry'));
}
} else {
echo '
';
$request['page']->drawFormStart();
printf('
',$app['server']->getIndex());
printf('
',htmlspecialchars($request['dn']));
echo '
';
foreach ($request['template']->getAvailAttrs() as $attribute)
{
$request['page']->draw('Template', $attribute);
}
$request['page']->drawFormSubmitButton();
echo '
';
$request['page']->drawFormEnd();
}
} else {
printf('
(%s)',_('no new attributes available for this entry'));
}
echo '
';
# The ajax addition (it is going into an existing TemplateRendered page
} else {
# Put our DIV there for the callback
echo '