$form->addVariable(_("No child permissions are to be added below this level."), 'child', 'description', false); } elseif (is_array($child_perms)) { /* Choice array available, so set up enum field. */ $form->addVariable(_("Permission"), 'child', 'enum', true, false, null, array($child_perms)); } else { /* No choices returned, so give a free form text field. */ $form->addVariable(_("Permission"), 'child', 'text', true); } if ($form->validate($vars)) { $form->getInfo($vars, $info); if ($info['cid'] == '-1') { $child =& $perms->newPermission($info['child']); $result = $perms->addPermission($child); } else { $pOb =& $perms->getPermissionById($info['cid']); $name = $pOb->getName() . ':' . DataTree::encodeName($info['child']); $child =& $perms->newPermission($name); $result = $perms->addPermission($child); } if (is_a($result, 'PEAR_Error')) { $notification->push(sprintf(_("'%s' was not created: %s."), $child->getShortName(), $result->getMessage()), 'horde.error'); } else { $notification->push(sprintf(_("'%s' was added to the permissions system."), $child->getShortName()), 'horde.success'); $permission =& $child; $url = Horde::applicationUrl('admin/perms/edit.php', true); $url = Util::addParameter($url, 'cid', $permission->getId()); header('Location: ' . $url); exit; } } $title = _("Permissions Administration");
} else { $group =& $groups->getGroupById(Util::getFormData('cid')); if (!is_a($group, 'PEAR_Error')) { $gname = $group->getShortName(); $form = 'addchild.inc'; } } break; case 'addchildform': $parent = Util::getFormData('cid'); if ($parent == '-1') { $child =& $groups->newGroup(Util::getFormData('child')); $result = $groups->addGroup($child); } else { $pOb =& $groups->getGroupById($parent); $name = $pOb->getName() . ':' . DataTree::encodeName(Util::getFormData('child')); $child =& $groups->newGroup($name); $result = $groups->addGroup($child); } if (is_a($result, 'PEAR_Error')) { $notification->push(sprintf(_("'%s' was not created: %s."), $child->getShortName(), $result->getMessage()), 'horde.error'); } else { $notification->push(sprintf(_("'%s' was added to the groups system."), $child->getShortName()), 'horde.success'); $group =& $child; $form = 'edit.inc'; $reload = true; } break; case 'delete': $group =& $groups->getGroupById(Util::getFormData('cid')); if (!is_a($group, 'PEAR_Error')) {