From b2629bd94ceb4d76b590ad3e35b5e27489ce4d99 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 5 Jan 2010 14:47:16 +0000 Subject: [PATCH] test git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15056 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiManagement.inc | 72 +++++++++++++++++++ .../fai/admin/fai/class_filterFAI.inc | 12 +++- gosa-plugins/fai/admin/fai/fai-filter.tpl | 23 ++++-- gosa-plugins/fai/admin/fai/fai-list.xml | 13 +--- gosa-plugins/fai/admin/fai/faiGroupHandle.tpl | 2 +- 5 files changed, 100 insertions(+), 22 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 63e1733ee..d1b2868f6 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -69,9 +69,55 @@ class faiManagement extends management if($this->config->get_cfg_value("enableSnapshots") == "true"){ $this->snapHandler = new SnapshotHandler($this->config); } + $this->registerAction("editByGroup","editByGroup"); parent::__construct($config, $ui, "roles", $headpage); } + + + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") + { + $headpage = $this->getHeadpage(); + if(count($target) == 1){ + foreach($headpage->entries as $entry){ + if($entry['dn'] == $target[0]){ + if(count($entry['GROUPS']) == 1){ + $data = array_pop($entry['GROUPS']); + $type = $this->get_type($data); + management::editEntry('editEntry',array($data['dn']),array(),$type[0],$type[2],$type[1]); + }else{ + $this->dialogObject = new faiGroupHandle($entry['GROUPS'],"edit"); + } + break; + } + } + } + } + + function editByGroup() + { + if($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "edit"){ + $entry = $this->dialogObject->get_selected(); + $this->editEntryByType(key($entry), array_pop($entry)); + } + } + + function editEntryByType($type, $data) + { + $this->closeDialogs(); + $type = $this->get_type($data); + management::editEntry('editEntry',array($data['dn']),array(),$type[0],$type[2],$type[1]); + } + + function detectPostActions() + { + $action = management::detectPostActions(); + if(isset($_POST['faiGroupHandle_cancel'])) $action['action'] = "cancel"; + if(isset($_POST['faiGroupHandle_apply'])) $action['action'] = "editByGroup"; + return($action); + } + + function renderList() { $filter = $this->getFilter(); @@ -109,6 +155,7 @@ class faiManagement extends management $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."  ")); } + print_a($_POST); return($list); } @@ -149,6 +196,31 @@ class faiManagement extends management } + function get_type($array){ + if(!isset($array['objectClass'])) return(array()); + if(in_array("FAIpartitionTable",$array['objectClass'])){ + return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS")); + } + if(in_array("FAIscript",$array['objectClass'])){ + return(array("tabsScript","faiScript","FAISCRIPTTABS")); + } + if(in_array("FAItemplate",$array['objectClass'])){ + return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS")); + } + if(in_array("FAIhook",$array['objectClass'])){ + return(array("tabsHook","faiHook","FAIHOOKTABS")); + } + if(in_array("FAIvariable",$array['objectClass'])){ + return(array("tabsVariable","faiVariable","FAIVARIABLETABS")); + } + if(in_array("FAIprofile",$array['objectClass'])){ + return(array("tabsProfile","faiProfile","FAIPROFILETABS")); + } + if(in_array("FAIpackageList",$array['objectClass'])){ + return(array("tabsPackage","faiPackage","FAIPACKAGETABS")); + } + return(array()); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/fai/admin/fai/class_filterFAI.inc b/gosa-plugins/fai/admin/fai/class_filterFAI.inc index 6583ab14a..61d12f936 100644 --- a/gosa-plugins/fai/admin/fai/class_filterFAI.inc +++ b/gosa-plugins/fai/admin/fai/class_filterFAI.inc @@ -56,11 +56,13 @@ class filterFAI extends filterLDAP{ $obj['description'] = $object['description'][0]; $obj['objectClass'] = $object['objectClass']; $obj['TYPES'][] = $type; + $obj['GROUPS'][$type] = $object; if(!isset($result[$obj['cn']])){ $result[$obj['cn']] = $obj; }else{ $result[$obj['cn']]['TYPES'][]=$type; + $result[$obj['cn']]['GROUPS'][$type]=$object; } } } @@ -69,11 +71,15 @@ class filterFAI extends filterLDAP{ // Make results useable for the listing class. $entries = array(); foreach($result as $entry){ - $item=array('count' => count($entry)); + $item=array('count' => count($entry) -1); foreach($entry as $name => $value){ - $item[] = $name; - $item[$name] = $value ; + if($name != "GROUPS"){ + $item[] = $name; + + $item[$name] = $value ; + } } + $item['GROUPS'] = $entry['GROUPS']; $entries[] = $item; } diff --git a/gosa-plugins/fai/admin/fai/fai-filter.tpl b/gosa-plugins/fai/admin/fai/fai-filter.tpl index 3c2904bfc..f29a2a5d4 100644 --- a/gosa-plugins/fai/admin/fai/fai-filter.tpl +++ b/gosa-plugins/fai/admin/fai/fai-filter.tpl @@ -8,13 +8,22 @@
- - - - -
-  {$RELEASE}
-
+
+  {$RELEASE}
+
+ +
+ +
+ + {t}Create release{/t} +
+ + {t}Create read-only release{/t} +
+ + {t}Delete current release{/t} +
{$PROFILE} {t}Show profiles{/t} diff --git a/gosa-plugins/fai/admin/fai/fai-list.xml b/gosa-plugins/fai/admin/fai/fai-list.xml index e4758ef6e..225054b4e 100644 --- a/gosa-plugins/fai/admin/fai/fai-list.xml +++ b/gosa-plugins/fai/admin/fai/fai-list.xml @@ -22,7 +22,7 @@ - |20px;c|||250px|170px;r| + |20px;c||250px|170px;r| %{filter:departmentLink(row,dn,description)} @@ -41,14 +41,6 @@ true - - - description - string - %{filter:link(row,dn,"%s",description)} - true - - %{filter:filterProperties(row,TYPES)} @@ -123,7 +115,7 @@ edit entry images/lists/edit.png - + @@ -135,7 +127,6 @@ remove entry images/lists/trash.png - roles/role[d] diff --git a/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl b/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl index 829db5090..c9794b2d4 100644 --- a/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl +++ b/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl @@ -42,7 +42,7 @@ class='center'> - {/foreach} -- 2.30.2
{$types.$key.NAME}({$item.description}) + ({$item.description.0})