getIndex(),get_request('template','REQUEST',false,'none')); $request['page']->setContainer(get_request('container','REQUEST',true)); $request['page']->accept(); $request['template'] = $request['page']->getTemplate(); if (! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer())) error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php'); # Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry... $tree = get_cached_item($app['server']->getIndex(),'tree'); $request['container'] = $tree->getEntry($request['template']->getContainer()); if (! $request['container']) { $tree->addEntry($request['template']->getContainer()); $request['container'] = $tree->getEntry($request['template']->getContainer()); } # Check our RDN if (! count($request['template']->getRDNAttrs())) error(_('The were no attributes marked as an RDN attribute.'),'error','index.php'); if (! $request['template']->getRDN()) error(_('The RDN field is empty?'),'error','index.php'); # Some other attribute checking... foreach ($request['template']->getAttributes() as $attribute) { # Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through. # @todo this isIgnoredAttr() function is missing? if ($attribute->isRequired() && ! count($attribute->getValues()) && ! $app['server']->isIgnoredAttr($attr->getName())) error(sprintf(_('You left the value blank for required attribute (%s).'), $attribute->getName(false)),'error','index.php'); } # Check for unique attributes $app['server']->checkUniqueAttrs($request['template']->getDN(),$request['template']->getLDAPadd()); $request['page']->drawTitle(_('Create object')); $request['page']->drawSubTitle(sprintf('%s: %s   %s: %s', _('Server'),$app['server']->getName(),_('Container'),$request['template']->getContainer())); # Confirm the creation if (count($request['template']->getLDAPadd(true))) { echo '
'; echo _('Do you want to create this entry?'); echo '

'; echo '
'; echo "\n\n"; echo '
'; echo '
'; echo ''; printf('',$app['server']->getIndex()); printf('',$request['template']->getContainerEncode(false)); printf('',$request['template']->getID()); foreach ($request['template']->getRDNAttrs() as $rdn) printf('',htmlspecialchars($rdn)); echo "\n"; $request['page']->drawHiddenAttributes(); echo '
'; echo ''; echo "\n"; printf('', _('Attribute'),_('New Value'),_('Skip')); echo "\n\n"; $counter = 0; printf('',$counter%2 ? 'even' : 'odd',htmlspecialchars($request['template']->getDN())); foreach ($request['template']->getLDAPadd(true) as $attribute) { $counter++; printf('',$counter%2 ? 'even' : 'odd'); printf('',$attribute->getFriendlyName()); # Show NEW Values echo ''; # Show SKIP Option $input_disabled = ''; $input_onclick = ''; if ($attribute->isRequired()) $input_disabled = 'disabled="disabled"'; printf('', htmlspecialchars($attribute->getName()),htmlspecialchars($attribute->getName()),$input_disabled,$input_onclick); echo ''; echo "\n\n"; } echo '
%s%s%s
%s
%s'; $request['page']->draw('CurrentValues',$attribute); echo '
'; echo '
'; echo '
'; printf('', _('Commit'), (isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'create_form\'),\'%s\');"',_('Updating Object')) : '')); printf('', _('Cancel'), (isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&container=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getContainer(),_('Retrieving DN')) : '')); echo '
'; echo '
'; echo '
'; } else { $href = sprintf('cmd=template_engine&server_id=%s&dn=%s', $app['server']->getIndex(),$request['template']->getDNEncode()); echo '
'; echo _('You made no changes'); if (isAjaxEnabled()) printf(' %s.', htmlspecialchars($href),htmlspecialchars($href),_('Retrieving DN'),_('Go back')); else printf(' %s.',htmlspecialchars($href),_('Go back')); echo '
'; } ?>