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(); $attribute_factory = new AttributeFactory(); # Grab the required attributes for the new objectClass $ldap = array(); $ldap['attrs']['must'] = array(); foreach ($request['template']->getAttribute('objectclass')->getValues() as $oclass_name) { # Exclude "top" if its there. if (! strcasecmp('top',$oclass_name)) continue; if ($soc = $app['server']->getSchemaObjectClass($oclass_name)) $ldap['attrs']['must'] = array_merge($ldap['attrs']['must'],$soc->getMustAttrNames(true)); } $ldap['attrs']['must'] = array_unique($ldap['attrs']['must']); /* Build a list of the attributes that this new objectClass requires, * but that the object does not currently contain */ $ldap['attrs']['need'] = array(); foreach ($ldap['attrs']['must'] as $attr) if (is_null($request['template']->getAttribute($attr))) array_push($ldap['attrs']['need'],$attribute_factory->newAttribute($attr,array('values'=>array()),$app['server']->getIndex())); # Mark all the need attributes as shown foreach ($ldap['attrs']['need'] as $index => $values) $ldap['attrs']['need'][$index]->show(); if (count($ldap['attrs']['need']) > 0) { $request['page']->drawTitle(sprintf(_('Add new object class to %s'),get_rdn($request['dn']))); $request['page']->drawSubTitle(); echo '