From: cajus Date: Thu, 21 Jan 2010 14:44:13 +0000 (+0000) Subject: List stuff reviewed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0254456ed9efaff69fd14af77c7fde1d4cc5dd2a;p=gosa.git List stuff reviewed git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15235 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index cdf74fe9e..cbdf7366a 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -100,6 +100,7 @@ class posixAccount extends plugin var $uid= ""; var $multiple_support = TRUE; var $groupMembership_some = array(); + var $groupMembershipList; /* constructor, if 'dn' is set, the node loads the given 'dn' from LDAP */ @@ -262,6 +263,15 @@ class posixAccount extends plugin session::set("sysfilter", $sysfilter); } $this->ui = get_userinfo(); + + /* Create list widget */ + $this->groupMembershipList= new sortableListing($this->groupMembership, $this->generateGroupInfos()); + $this->groupMembershipList->setDeleteable(true); + $this->groupMembershipList->setHeader(array(_("Group"),_("Description"))); + $this->groupMembershipList->setColspecs(array('*','*')); + $this->groupMembershipList->setWidth("100%"); + $this->groupMembershipList->setHeight("130px"); + $this->groupMembershipList->setInstantDelete(false); } @@ -272,6 +282,10 @@ class posixAccount extends plugin plugin::execute(); $display= ""; + /* Let the lists update themselves */ + $this->groupMembershipList->setAcl($this->getacl('memberUid', (!is_object($this->parent) && !session::is_set('edit')))); + $this->groupMembershipList->update(); + /* Log view */ if($this->is_account && !$this->view_logged){ $this->view_logged = TRUE; @@ -359,6 +373,12 @@ class posixAccount extends plugin $this->delGroup ($_POST['group_list']); } + /* Delete selected groups */ + $action= $this->groupMembershipList->getAction(); + if ($action['action'] == 'delete') { + $this->delGroup (array($this->groupMembershipList->getKey($action['targets'][0]))); + } + /* Add user workstation? */ if (isset($_POST["add_ws"])){ $this->show_ws_dialog= TRUE; @@ -502,6 +522,7 @@ class posixAccount extends plugin /* Show main page */ $smarty= get_smarty(); $smarty->assign("usePrototype", "true"); + $smarty->assign("groupMembershipList", $this->groupMembershipList->render()); /* In 'MyAccount' mode, we must remove write acls if we are not in editing mode. */ $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit'); @@ -1252,9 +1273,8 @@ class posixAccount extends plugin } } - /* Sort groups */ - asort ($this->groupMembership); - reset ($this->groupMembership); + // Sync new list + $this->groupMembershipList->setListData($this->groupMembership, $this->generateGroupInfos()); } @@ -1272,6 +1292,9 @@ class posixAccount extends plugin } } } + + // Sync new list + $this->groupMembershipList->setListData($this->groupMembership, $this->generateGroupInfos()); } @@ -1804,7 +1827,25 @@ class posixAccount extends plugin plugin::set_multi_edit_values($attrs); $this->groupMembership = $groups; } + + + function generateGroupInfos() + { + $tmp= array(); + + foreach ($this->groupMembership as $key => $value) { + if (!preg_match('/^([^[]+)\[(.*)\]$/', $value, $m)) { + $tmp[$key]= array($value, ""); + } else { + $tmp[$key]= array(rtrim($m[1]), $m[2]); + } + } + + return ($tmp); + } + } + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-core/plugins/personal/posix/generic.tpl b/gosa-core/plugins/personal/posix/generic.tpl index ceb6fa86d..5fe78a567 100644 --- a/gosa-core/plugins/personal/posix/generic.tpl +++ b/gosa-core/plugins/personal/posix/generic.tpl @@ -91,28 +91,15 @@ {t}(Warning: more than 16 groups are not supported by NFS!){/t}
{/if} -{render acl=$groupMembershipACL} - -{/render} -
-{render acl=$groupMembershipACL} + {render acl=$groupMembershipACL} + {$groupMembershipList} + {/render} + {render acl=$groupMembershipACL}   -{/render} -{render acl=$groupMembershipACL} + {/render} +