From 7379bb5bc7b6b066ab3306eb7f823161f2dd8891 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 20 Apr 2010 12:23:49 +0000 Subject: [PATCH] Updated role listing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17736 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../roleManagement/class_roleGeneric.inc | 62 ++++++++++++------- .../admin/roleManagement/roleGeneric.tpl | 9 +-- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc index 132f3d7e3..9d04d137b 100644 --- a/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc +++ b/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc @@ -86,6 +86,17 @@ class roleGeneric extends plugin { $this->baseSelector->setSubmitButton(false); $this->baseSelector->setHeight(300); $this->baseSelector->update(true); + + // Prepare lists + $this->memberList = new sortableListing(); + $this->memberList->setDeleteable(true); + $this->memberList->setInstantDelete(true); + $this->memberList->setEditable(false); + $this->memberList->setWidth("100%"); + $this->memberList->setHeight("300px"); + $this->memberList->setHeader(array("~",_("Name"))); + $this->memberList->setColspecs(array('20px','*','20px')); + $this->memberList->setDefaultSortColumn(1); } @@ -152,6 +163,12 @@ class roleGeneric extends plugin { if(isset($_POST['edit_membership']) && !$this->dialog instanceOf userSelect){ $this->dialog = new userSelect($this->config,get_userinfo()); } + $this->memberList->save_object(); + $action = $this->memberList->getAction(); + if($action['action'] == 'delete'){ + $this->roleOccupant = $this->memberList->getMaintainedData(); + } + if(isset($_POST['delete_membership']) && !$this->dialog instanceOf userSelect){ if(isset($_POST['members'])){ foreach($_POST['members'] as $id){ @@ -191,11 +208,32 @@ class roleGeneric extends plugin { * Template handling ***************/ + $this->memberList->setAcl($this->getacl("roleOccupant")); + + $data = $lData = array(); + $icon = image('plugins/generic/images/head.png'); + foreach ($this->roleOccupant as $key => $dn){ + $data[$key] = $dn; + if(isset($this->roleOccCache[$dn])){ + $entry = $this->roleOccCache[$dn]; + $name = $entry['cn']['0']; + if(isset($entry['description'][0])){ + $name .= " [".$entry['description'][0]."]"; + } + }else{ + $name = _("Unknown")." ".$dn; + } + $lData[$key] = array('data' => array($icon,$name)); + } + + $this->memberList->setListData($data,$lData); + $this->memberList->update(); + // Get smarty instance and assign required variables. $smarty = get_smarty(); $smarty->assign("usePrototype", "true"); $smarty->assign("base", $this->baseSelector->render()); - $smarty->assign("members",$this->convert_list()); + $smarty->assign("memberList",$this->memberList->render()); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); } @@ -252,28 +290,6 @@ class roleGeneric extends plugin { } - /* Returns list of occupants as \n"; - } - return ($temp); - } - - /* Removes the object from the ldap database */ function remove_from_parent() diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/roleGeneric.tpl b/gosa-plugins/rolemanagement/admin/roleManagement/roleGeneric.tpl index 90cd60dde..37bc8cb0c 100644 --- a/gosa-plugins/rolemanagement/admin/roleManagement/roleGeneric.tpl +++ b/gosa-plugins/rolemanagement/admin/roleManagement/roleGeneric.tpl @@ -65,18 +65,11 @@ {render acl=$roleOccupantACL} - + {$memberList} {/render}
{render acl=$roleOccupantACL}   - -{/render} -{render acl=$roleOccupantACL} - - {/render} -- 2.30.2