summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 44ede7d)
raw | patch | inline | side by side (parent: 44ede7d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jan 2010 09:01:59 +0000 (09:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 27 Jan 2010 09:01:59 +0000 (09:01 +0000) |
-use new style lists to add elements
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15351 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15351 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/class_occupantSelect.inc b/gosa-plugins/rolemanagement/admin/roleManagement/class_occupantSelect.inc
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/*
-* This code is part of GOsa (http://www.gosa-project.org)
-* Copyright (C) 2003-2008 GONICUS GmbH
-*
-* ID: $$Id: class_roleManagement.inc 13520 2009-03-09 14:54:13Z hickert $$
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-
-class occupantSelect extends plugin {
- function __construct($config, $dn, $parent){
- $this->config = $config;
- $this->dn = $dn;
- $this->parent = $parent;
- $this->skipEntries = $parent->getOccupants();
-
- /* Get global filter config */
- if (!session::is_set("roleAddOccupantFilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
- $roleAddOccupantFilter= array(
- "dselect" => $base,
- "subtrees" => FALSE,
- "regex" => "*");
- session::set("roleAddOccupantFilter", $roleAddOccupantFilter);
- }
-
- }
-
-
- function execute()
- {
- /* Save data */
- $roleAddOccupantFilter= session::get("roleAddOccupantFilter");
- if(isset($_POST['occupantSearched'])){
-
- $roleAddOccupantFilter['subtrees'] = false;
- if(isset($_POST['subtrees'])){
- $roleAddOccupantFilter['subtrees'] = "checked";
- }
-
- foreach( array("dselect", "regex") as $type){
- if (isset($_POST[$type])){
- $roleAddOccupantFilter[$type]= $_POST[$type];
- }
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $roleAddOccupantFilter['regex']= $s;
- }
- session::set("roleAddOccupantFilter", $roleAddOccupantFilter);
-
- $smarty = get_smarty();
- $smarty->assign("search_image", get_template_path('images/lists/search.png'));
- $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
- $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("alphabet", generate_alphabet());
- $smarty->assign("hint", print_sizelimit_warning());
- $smarty->assign("apply", apply_filter());
- $smarty->assign("objects", $this->getObjects());
- foreach( array("dselect", "regex", "subtrees") as $type){
- $smarty->assign("$type", $roleAddOccupantFilter[$type]);
- }
- return($smarty->fetch(get_template_path("occupantSelect.tpl",TRUE, dirname(__FILE__))));
- }
-
-
- function getObjects()
- {
-
- // Initialize variables
- $ldap = $this->config->get_ldap_link();
- $roleAddOccupantFilter= session::get("roleAddOccupantFilter");
- $regex = $roleAddOccupantFilter['regex'];
-
- // Detect the base to be use for ldap search
- if($roleAddOccupantFilter['subtrees']){
- $base = $roleAddOccupantFilter['dselect'];
- }else{
- $base = get_people_ou().$roleAddOccupantFilter['dselect'];
- }
-
- // Set search flags flat/subsearch
- $Get_list_flags = 0;
- if($roleAddOccupantFilter['subtrees'] == "checked"){
- $Get_list_flags |= GL_SUBSEARCH;
- }
-
- // Search for matching user objects.
- $filter = "(&(objectClass=gosaAccount)(!(uid=*$))(|(uid=$regex)(cn=$regex)))";
- $res = get_list($filter, "users/user" , $base,
- array("description", "objectClass", "sn", "givenName", "uid","cn"),$Get_list_flags);
-
- // Collect data.
- $this->objects = array();
- foreach($res as $attrs){
-
- // Skip entries which are already part of our role
- if(in_array($attrs['dn'], $this->skipEntries)) continue;
-
- $name = $attrs['cn'][0];
- $dn = $attrs['dn'];
- if (isset($attrs["description"][0])){
- $name .= " [".$attrs["description"][0]."]";
- }
-
- $entry = array();
- $entry['attrs'] = $attrs;
- $entry['name'] = $name;
- $entry['dn'] = $dn;
- $this->objects[] = $entry;
- }
- uksort ($this->objects, 'strnatcasecmp');
- reset ($this->objects);
-
- // Create HTML content
- $temp = "";
- foreach ($this->objects as $key => $value){
- $temp.= "
- <option
- title='".addslashes($value['dn'])."'
- value='$key' class='select'
- style=\"background-image:url('plugins/generic/images/head.png');
- \">".$value['name']."</option>\n";
- }
- return ($temp);
- }
-
-
- function save()
- {
- $ret = array();
- if(isset($_POST['objects'])){
- $objects = $_POST['objects'];
- foreach($objects as $id){
- $ret[] = $this->objects[$id];
- }
- }
- return($ret);
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/rolemanagement/admin/roleManagement/class_roleGeneric.inc
index f4b821b99de0097852884cf3258cfff4377d906c..b27fef306f9bd0830cd183e3a3c53cd3ffb6ad6c 100644 (file)
* Dialog handling
***************/
- if(isset($_POST['edit_membership']) && !$this->dialog instanceOf plugin){
- $this->dialog = new occupantSelect($this->config,$this->dn,$this);
+ if(isset($_POST['edit_membership']) && !$this->dialog instanceOf userSelect){
+ $this->dialog = new userSelect($this->config,get_userinfo());
}
- if(isset($_POST['delete_membership']) && !$this->dialog instanceOf plugin){
+ if(isset($_POST['delete_membership']) && !$this->dialog instanceOf userSelect){
if(isset($_POST['members'])){
foreach($_POST['members'] as $id){
if(isset($this->roleOccupant[$id])){
}
}
- if(isset($_POST['add_object_cancel']) && $this->dialog instanceOf plugin){
+ if(isset($_POST['add_users_cancel']) && $this->dialog instanceOf userSelect){
$this->dialog = NULL;
}
- if(isset($_POST['add_object_finish']) && $this->dialog instanceOf plugin){
- $ret = $this->dialog->save();
- foreach($ret as $key => $entry){
- $this->roleOccupant[] = $entry['dn'];
- $this->roleOccCache[$entry['dn']] = $entry['attrs'];
- }
- $this->reload();
- $this->dialog = NULL;
+ if(isset($_POST['add_users_finish']) && $this->dialog instanceOf userSelect){
+ $users = $this->dialog->detectPostActions();
+ if(isset($users['targets'])){
+ $headpage = $this->dialog->getHeadpage();
+ foreach($users['targets'] as $dn){
+ $attrs = $headpage->getEntry($dn);
+ $this->roleOccupant[] = $dn;
+ $this->roleOccCache[$dn] = $attrs;
+ }
+ }
+ $this->dialog= FALSE;
}
- if($this->dialog instanceOf plugin){
- $this->dialog->save_object();
+ if($this->dialog instanceOf userSelect){
+
+ // Build up blocklist
+ session::set('filterBlacklist', array('dn' => $this->roleOccupant));
return($this->dialog->execute());
}
diff --git a/gosa-plugins/rolemanagement/admin/roleManagement/occupantSelect.tpl b/gosa-plugins/rolemanagement/admin/roleManagement/occupantSelect.tpl
+++ /dev/null
@@ -1,49 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
- <td style="vertical-align:top; width:600px;">
- <div class="contentboxh" style="height:20px;">
- <p class="contentboxh" style="font-size:12px">
- <b>{t}Select objects to add{/t} {$hint}</b>
- </p>
- </div>
- <div class="contentboxb">
- <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
- <select style="width:600px; height:450px; margin-top:4px;" name="objects[]" size="15" multiple>
- {$objects}
- </select>
- <input type=hidden name="edit_helper">
- </p>
- </div>
- </td>
- <td style="vertical-align:top;">
- <div class="contentboxh" style="height:20px;">
- <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]"><b>{t}Filters{/t}</b></p>
- </div>
- <div class="contentboxb">
- <table summary="" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
- {$alphabet}
- </table>
- <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
- <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}<br>
- </p>
-
- <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle title="{t}Display objects of department{/t}">
- <select name="dselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
- {html_options options=$deplist selected=$dselect}
- </select></td></tr></table>
- <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td style="width:18px"><img alt="" src="{$search_image}" align=middle title="{t}Display objects matching{/t}"></td>
- <td><input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()"></td></tr></table>
- {$apply}
- </div>
- </td>
-</tr>
-</table>
-
-<input type='hidden' value='1' name='occupantSearched'>
-
-<p class="plugbottom">
- <input type=submit name="add_object_finish" value="{msgPool type=addButton}">
-
- <input type=submit name="add_object_cancel" value="{msgPool type=cancelButton}">
-</p>
-