$dn) { # Check if the entry exists. if (! $dn || ! $app['server']->dnExists($dn)) { system_message(array( 'title'=>_('Entry does not exist'), 'body'=>sprintf('%s (%s/%s)',_('The entry does not exist and will be ignored'),$dn), 'type'=>'error')); continue; } # Simulate the requirements for *Render->accept() if (! isset($request['mass_values'][$index])) { continue; } $_REQUEST['new_values'] = $request['mass_values'][$index]; $render = new MassRender($app['server']->getIndex(),'none'); $render->setDN($dn); $render->accept(true); if ($render->getTemplate()->getLDAPmodify(false,$index)) { $request['update'][$index] = $render; } } # We can use the $render to give us a title $render->drawTitle(_('Bulk update the following DNs')); $render->drawSubTitle(sprintf('%s: %s',_('Server'),$app['server']->getName())); if (count($request['update'])) { if (get_request('confirm','REQUEST')) { foreach ($request['update'] as $index => $page) { $template = $page->getTemplate(); # Perform the modification $result = $app['server']->modify($template->getDN(),$template->getLDAPmodify(false,$index)); if ($result) { printf('%s: %s
', $template->getDN(), _('Modification successful!')); } else { printf('%s: %s
', $template->getDN(), _('Modification NOT successful!')); } } } else { echo '
'; echo ''; printf('',$app['server']->getIndex()); echo ''; foreach ($request['update'] as $j => $page) { printf('', $j, $page->getTemplate()->getDN()); } echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; printf(_('There will be %s updates done with this mass update'),sprintf('%s',count($request['update']))); echo '
'; echo '
'; foreach ($request['update'] as $index => $page) { $template = $page->getTemplate(); echo ''; echo ''; printf('',IMGDIR,get_icon($app['server']->getIndex(),$template->getDN())); printf('', $app['server']->getIndex(),rawurlencode(dn_unescape($template->getDN())),htmlspecialchars(get_rdn($template->getDN()))); echo ''; printf('', htmlspecialchars(dn_unescape($template->getDN())),_('Old Value')); foreach ($template->getLDAPmodify(true,$index) as $attribute) { echo ''; echo ''; echo ''; # Show NEW Values echo ''; # Show OLD Values echo ''; echo ''; } echo '
icon%s
 dn%s%s
 '; $page->draw('Name',$attribute); echo ''; if (! $attribute->getValueCount() || $attribute->isForceDelete()) { printf('[%s]',_('attribute deleted')); printf('',$index,$attribute->getName(),0,''); } foreach ($attribute->getValues() as $key => $value) { # For multiple values, we'll highlight the changed ones if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues())) { echo ''; } $page->draw('CurrentValue',$attribute,$key); # For multiple values, close the highlighting if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues())) { echo ''; } echo '
'; printf('',$index,$attribute->getName(),$key,$value); } echo '
'; if (! $attribute->getOldValues()) { printf('[%s]', _('attribute doesnt exist')); } foreach ($attribute->getOldValues() as $key => $value) { # For multiple values, we'll highlight the changed ones if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues())) { echo ''; } $page->draw('OldValue',$attribute,$key); # For multiple values, close the highlighting if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues())) { echo ''; } echo '
'; } echo '
'; echo '
'; } echo '
'; printf('',_('Update Values')); echo '
'; } } else { echo '
'; echo _('You made no changes'); echo '
'; }