summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9d233a7)
raw | patch | inline | side by side (parent: 9d233a7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 28 Jan 2010 09:31:39 +0000 (09:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 28 Jan 2010 09:31:39 +0000 (09:31 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15397 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index 995c51670d1e377749e4ce9bd5f1c0d72f76d083..32bbecd3763d9d8089bd31519eeff5addda4a859 100644 (file)
var $orig_dn= "";
var $orig_cn= "";
var $orig_base= "";
- var $group_dialog= FALSE;
+ var $objectSelect= FALSE;
var $view_logged = FALSE;
var $accessTo= array();
}
/* Add objects to group */
- if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
+ if (isset($_POST['objectSelect_save'])){
+ $objects = $this->objectSelect->save();
+ print_a($objects);
+ $this->objectSelect= FALSE;
+ $this->dialog= FALSE;
+ return;
$tmp = "";
foreach($this->memberList as $obj){
$tmp .= $obj['type'];
/* Add objects? */
if (isset($_POST["edit_membership"])){
- $this->group_dialog= TRUE;
+ $this->objectSelect= new objectSelect($this->config, get_userinfo());
$this->dialog= TRUE;
}
/* Add objects finished? */
- if (isset($_POST["add_object_finish"]) || isset($_POST["add_object_cancel"])){
- $this->group_dialog= FALSE;
+ if (isset($_POST["objectSelect_cancel"])){
+ $this->objectSelect= FALSE;
$this->dialog= FALSE;
}
/* Manage object add dialog */
- if ($this->group_dialog){
-
- /* Save data */
- $ogfilter= session::get("ogfilter");
- foreach( array("dselect", "regex") as $type){
- if (isset($_POST[$type])){
- $ogfilter[$type]= $_POST[$type];
- }
- }
- if (isset($_POST['dselect'])){
- foreach( array("accounts", "groups", "applications", "departments",
- "servers", "workstations", "winstations", "terminals", "printers","subtrees",
- "phones") as $type){
-
- if (isset($_POST[$type])) {
- $ogfilter[$type]= "checked";
- } else {
- $ogfilter[$type]= "";
- }
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $ogfilter['regex']= $s;
- }
- session::set("ogfilter", $ogfilter);
- $this->reload();
-
- /* Calculate actual groups / remove entries that are already inside... */
- $strippedObjects= array();
- foreach ($this->objects as $key => $value){
- if (!isset($this->member[$key])){
- $strippedObjects[$key]= $value;
- }
- }
- $smarty->assign("objects", $this->convert_list($strippedObjects));
-
- /* Show dialog */
- $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());
- foreach( array("dselect", "regex", "subtrees") as $type){
- $smarty->assign("$type", $ogfilter[$type]);
- }
- $smarty->assign("hint", print_sizelimit_warning());
- $smarty->assign("apply", apply_filter());
-
- /* Build up checkboxes
- */
- $ar = array(
- "departments" => array(
- "T" => msgPool::selectToView(_("departments")),
- "C" => (isset($ogfilter['departments']) && ($ogfilter['departments'])),
- "L" => sprintf(_("Show %s"),_("departments"))),
- "accounts" => array(
- "T" => msgPool::selectToView(_("people")),
- "C" => (isset($ogfilter['accounts']) && ($ogfilter['accounts'])),
- "L" => sprintf(_("Show %s"),_("people"))),
- "groups"=> array(
- "T" => msgPool::selectToView(_("groups")),
- "C" => (isset($ogfilter['groups']) && ($ogfilter['groups'])),
- "L" => sprintf(_("Show %s"),_("groups"))),
- "servers"=> array(
- "T" => msgPool::selectToView(_("servers")),
- "C" => (isset($ogfilter['servers']) && ($ogfilter['servers'])),
- "L" => sprintf(_("Show %s"),_("servers"))),
- "workstations"=> array(
- "T" => msgPool::selectToView(_("workstations")),
- "C" => (isset($ogfilter['workstations']) && ($ogfilter['workstations'])),
- "L" => sprintf(_("Show %s"),_("workstations"))),
- "terminals"=> array(
- "T" => msgPool::selectToView(_("terminals")),
- "C" => (isset($ogfilter['terminals']) && ($ogfilter['terminals'])),
- "L" => sprintf(_("Show %s"),_("terminals"))),
- "printers"=> array(
- "T" => msgPool::selectToView(_("printer")),
- "C" => (isset($ogfilter['printers']) && ($ogfilter['printers'])),
- "L" => sprintf(_("Show %s"),_("printers"))),
- "phones"=> array(
- "T" => msgPool::selectToView(_("phones")),
- "C" => (isset($ogfilter['phones']) && ($ogfilter['phones'])),
- "L" => sprintf(_("Show %s"),_("phones"))));
-
- /* Allow selecting applications if we are having a non
- release managed application storage */
- if(!$this->IsReleaseManagementActivated()){
- $ar["applications"] = array(
- "T" => msgPool::selectToView(_("applications")),
- "C" => (isset($ogfilter['applications']) && ($ogfilter['applications'])),
- "L" => sprintf(_("Show %s"),_("applications")));
- }
-
- $smarty->assign("checkboxes",$ar);
- $display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__)));
- return ($display);
+ if ($this->objectSelect){
+ return($this->objectSelect->execute());
}
/* Bases / Departments */
diff --git a/gosa-core/plugins/admin/ogroups/objectSelect/class_filterLDAPDepartmentBlacklist.inc b/gosa-core/plugins/admin/ogroups/objectSelect/class_filterLDAPDepartmentBlacklist.inc
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+class filterLDAPDepartmentBlacklist extends filterLDAPBlacklist{
+
+ static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+ {
+ $entries = filterLDAPBlacklist::query($base, $scope, $filter, $attributes, $category,array());
+ foreach($entries as $key => $entry){
+ $entries[$key]['cn'] = $entry['ou'];
+ $entries[$key][ $entries[$key]['count'] ]= 'cn';
+ $entries[$key]['count'] ++;
+ }
+ return($entries);
+ }
+}
+
+?>
diff --git a/gosa-core/plugins/admin/ogroups/objectSelect/class_objectSelect.inc b/gosa-core/plugins/admin/ogroups/objectSelect/class_objectSelect.inc
index e90676e28c54c6d9b4c9a0ba93740ed4ce16ce42..13163d5a74c4eb7fd6c4b9af55111a14530a38e8 100644 (file)
// Build headpage
$headpage = new listing(get_template_path("selectObject-list.xml", true, dirname(__FILE__)));
+ $headpage->registerElementFilter("depLabel", "objectSelect::filterDepLabel");
+ $this->registerAction("open","openEntry");
$headpage->setFilter($filter);
parent::__construct($config, $ui, "object", $headpage);
}
+
+ // An action handler which enables to switch into deparmtment by clicking the names.
+ function openEntry($action,$entry)
+ {
+ $headpage = $this->getHeadpage();
+ $headpage->setBase(array_pop($entry));
+ }
+
+
+ // A filter which allows to open a department by clicking on the departments name.
+ static function filterDepLabel($row,$dn,$pid,$base,$objectClass, $cn)
+ {
+ $cn = $cn[0];
+ if(!in_array('gosaDepartment', $objectClass)){
+ return($cn);
+ }
+ if($dn == $base){
+ $cn =".";
+ }
+ $dn= LDAP::fix(func_get_arg(1));
+ return("<a href='?plug=".$_GET['plug']."&PID=$pid&act=listing_open_$row' title='$dn'>$cn</a>");
+ }
+
function save()
{
$act = $this->detectPostActions();
diff --git a/gosa-core/plugins/admin/ogroups/objectSelect/selectObject-filter.xml b/gosa-core/plugins/admin/ogroups/objectSelect/selectObject-filter.xml
index be500d5ced1e4e0e5a8ce7c8814a3a28bb2cc29f..69e2ced02d84542fab0e2e06ec38c5fb6f72eab6 100644 (file)
<attribute>objectClass</attribute>
<attribute>cn</attribute>
<attribute>sn</attribute>
+ <attribute>ou</attribute>
<attribute>uid</attribute>
<attribute>givenName</attribute>
<attribute>description</attribute>
<attribute>objectClass</attribute>
<attribute>cn</attribute>
<attribute>sn</attribute>
+ <attribute>ou</attribute>
<attribute>uid</attribute>
<attribute>givenName</attribute>
<attribute>description</attribute>
diff --git a/gosa-core/plugins/admin/ogroups/objectSelect/selectObject-list.xml b/gosa-core/plugins/admin/ogroups/objectSelect/selectObject-list.xml
index 27e68d887b0741db9751f8743b451a95eda705db..dca51a59091ef7829ad039d84b1d1f7ae2bcefa2 100644 (file)
<list>
<definition>
- <departmentBrowser>true</departmentBrowser>
+ <departmentBrowser>false</departmentBrowser>
<departmentRootVisible>false</departmentRootVisible>
<baseMode>true</baseMode>
<multiSelect>true</multiSelect>
<label>Name</label>
<sortAttribute>cn</sortAttribute>
<sortType>string</sortType>
- <value>%{cn}</value>
+ <value>%{filter:depLabel(row,dn,pid,base,objectClass,cn)}</value>
<export>true</export>
</column>