From: hickert Date: Tue, 26 Jan 2010 09:21:16 +0000 (+0000) Subject: Updated posix group selection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a422f4098ab70037984e0b80932983a88d2403ba;p=gosa.git Updated posix group selection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15298 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 6e319d08b..94f10da0a 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -68,7 +68,7 @@ class posixAccount extends plugin var $mustchangepassword= "0"; var $force_ids= 0; var $gotoLastSystemLogin= ""; - var $group_dialog= FALSE; + var $groupSelect= FALSE; var $show_ws_dialog= FALSE; var $secondaryGroups= array(); var $primaryGroup= 0; @@ -334,22 +334,24 @@ class posixAccount extends plugin /* Trigger group edit? */ if (isset($_POST['edit_groupmembership'])){ - $this->group_dialog= TRUE; + $this->groupSelect = new groupSelect($this->config,get_userinfo()); $this->dialog= TRUE; } /* Cancel group edit? */ - if (isset($_POST['add_groups_cancel']) || - isset($_POST['add_groups_finish'])){ - $this->group_dialog= FALSE; + if (isset($_POST['add_groups_cancel'])){ + $this->groupSelect= NULL; $this->dialog= FALSE; } /* Add selected groups */ - if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) && - count($_POST['groups'])){ - - $this->addGroup ($_POST['groups']); + if (isset($_POST['add_groups_finish']) && $this->groupSelect){ + $groups = $this->groupSelect->detectPostActions(); + if(isset($groups['targets'])){ + $this->addGroup ($groups['targets']); + } + $this->groupSelect= NULL; + $this->dialog= FALSE; } /* Delete selected groups */ @@ -453,7 +455,9 @@ class posixAccount extends plugin } /* Manage group add dialog */ - if ($this->group_dialog){ + if ($this->groupSelect){ + + return($this->groupSelect->execute()); /* Get global filter config */ $this->reload(); @@ -1468,7 +1472,7 @@ class posixAccount extends plugin /* Open group add dialog */ if(isset($_POST['edit_groupmembership'])){ - $this->group_dialog = TRUE; + $this->groupSelect = new groupSelect($this->config,get_userinfo()); $sta = "SubDialog"; } @@ -1476,10 +1480,10 @@ class posixAccount extends plugin to ensure that the membership is updatd */ if(isset($_POST['add_groups_finish']) || isset($_POST['add_groups_cancel'])){ $this->execute(); - $this->group_dialog =FALSE; + $this->groupSelect =NULL; } - if($this->group_dialog){ + if($this->groupSelect){ $str = $this->execute(true); $ret = array(); $ret['string'] = $str; diff --git a/gosa-core/plugins/personal/posix/groupSelect/class_groupSelect.inc b/gosa-core/plugins/personal/posix/groupSelect/class_groupSelect.inc new file mode 100644 index 000000000..82f958204 --- /dev/null +++ b/gosa-core/plugins/personal/posix/groupSelect/class_groupSelect.inc @@ -0,0 +1,122 @@ +config = $config; + $this->ui = $ui; + + $this->storagePoints = array(get_ou("groupRDN")); + +# // Build filter +# if (session::global_is_set(get_class($this)."_filter")){ +# $filter= session::global_get(get_class($this)."_filter"); +# } else { + $filter = new filter(get_template_path("group-filter.xml", true, dirname(__FILE__))); + $filter->setObjectStorage($this->storagePoints); +# } + $this->setFilter($filter); + + // Build headpage + $headpage = new listing(get_template_path("group-list.xml", true, dirname(__FILE__))); + $headpage->registerElementFilter("filterProperties", "groupManagement::filterProperties"); + $headpage->setFilter($filter); + parent::__construct($config, $ui, "groups", $headpage); + } + + + static function filterProperties($row, $classes) + { + $result= ""; + + $map = array( + "posixGroup" => + array( + "image" => "plugins/groups/images/groups.png", + "plugin" => "group", + "alt" => _("Posix"), + "title" => _("Edit posix properties") + ), + + "gosaMailAccount" => + array( + "image" => "plugins/groups/images/mail.png", + "plugin" => "mailgroup", + "alt" => _("Mail"), + "title" => _("Edit mail properties") + ), + + "sambaGroupMapping" => + array( + "image" => "plugins/groups/images/samba.png", + "plugin" => "group", + "alt" => _("Samba"), + "title" => _("Edit samba properties") + ), + + "goFonPickupGroup" => + array( + "image" => "plugins/groups/images/asterisk.png", + "plugin" => "group", + "alt" => _("Phone"), + "title" => _("Edit phone properties") + ), + + "gotoMenuGroup" => + array( + "image" => "plugins/groups/images/menu.png", + "plugin" => "appgroup", + "alt" => _("Menu"), + "title" => _("Edit start menu properties") + ), + + "gotoEnvironment" => + array( + "image" => "plugins/groups/images/environment.png", + "plugin" => "environment", + "alt" => _("Environment"), + "title" => _("Edit environment properties") + ) + ); + + + // Walk thru map + foreach ($map as $oc => $properties) { + if (in_array_ics($oc, $classes)) { + $result.=""; + } else { + $result.=" "; + } + } + return $result; + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-core/plugins/personal/posix/groupSelect/group-filter.tpl b/gosa-core/plugins/personal/posix/groupSelect/group-filter.tpl new file mode 100644 index 000000000..c115cd06c --- /dev/null +++ b/gosa-core/plugins/personal/posix/groupSelect/group-filter.tpl @@ -0,0 +1,37 @@ +
+

+ [F]{t}Filter{/t} +

+
+ +
+ +
+ + {$PRIMARY} 
+ {$SAMBA} 
+ {$MAIL} 
+ + {$SCOPE} + + + + + + +
+ + + {$NAME} +
+ + + + + +
+ {$APPLY} +
+
diff --git a/gosa-core/plugins/personal/posix/groupSelect/group-filter.xml b/gosa-core/plugins/personal/posix/groupSelect/group-filter.xml new file mode 100644 index 000000000..00d28e4b5 --- /dev/null +++ b/gosa-core/plugins/personal/posix/groupSelect/group-filter.xml @@ -0,0 +1,64 @@ + + + + + groups + + true + + + + + LDAP + (&(objectClass=posixGroup)$NAME(|$PRIMARY$MAIL$SAMBA)) + dn + objectClass + cn + description + + auto + + + + checkbox + PRIMARY + true + + (!(objectClass=gosaObject)) + + + + checkbox + MAIL + true + + (objectClass=gosaMailAccount) + + + + checkbox + SAMBA + true + + (objectClass=sambaGroupMapping) + + + + textfield + NAME + 20 + 60 + + + (|(cn=*$*)(description=*$*)) + true + + LDAP + (&(objectClass=posixGroup)(|(cn=*$NAME*)(description=*$NAME*))) + cn + 0.5 + 3 + + + + diff --git a/gosa-core/plugins/personal/posix/groupSelect/group-list.tpl b/gosa-core/plugins/personal/posix/groupSelect/group-list.tpl new file mode 100644 index 000000000..367133c82 --- /dev/null +++ b/gosa-core/plugins/personal/posix/groupSelect/group-list.tpl @@ -0,0 +1,39 @@ + + + + + + + +
+
+

 {$HEADLINE} {$SIZELIMIT}

+
+ +
+
+ + +
{$ROOT} {$BACK} {$HOME} {$RELOAD} {$SEPARATOR} {t}Base{/t} {$BASE}  {$SEPARATOR}  {$ACTIONS}
+
+
+ +
+
+ + + + {$LIST} +
+ {$FILTER} +
+ + +

+ +   + +

+ + + diff --git a/gosa-core/plugins/personal/posix/groupSelect/group-list.xml b/gosa-core/plugins/personal/posix/groupSelect/group-list.xml new file mode 100644 index 000000000..8d64d2f6e --- /dev/null +++ b/gosa-core/plugins/personal/posix/groupSelect/group-list.xml @@ -0,0 +1,64 @@ + + + + + true + false + true + true + + groups + + 1 + + + + posixGroup + groups + group + plugins/groups/images/groups.png + + + + + + |20px;c||| + + + %{filter:objectType(dn,objectClass)} + + + + %{filter:departmentLink(row,dn,description)} + 1 + + + + %{filter:objectType(dn,objectClass)} + + + + + cn + string + %{filter:link(row,dn,"%s",cn)} + true + + + + + description + string + %{filter:link(row,dn,"%s",description)} + true + + +
+ + + + + + + +