d962cf33bdbe57d1ea9d5b2fd8328912bfa93b0d
1 <?php
2 /*
3 * This code is part of GOsa (http://www.gosa-project.org)
4 * Copyright (C) 2003-2008 GONICUS GmbH
5 *
6 * ID: $$Id: class_roleManagement.inc 14742 2009-11-04 13:18:33Z hickert $$
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 class faiManagement extends management
24 {
25 var $plHeadline = "Software deployment";
26 var $plDescription = "Manage software packages and deployment reciepes";
27 var $plIcon = "plugins/fai/images/plugin.png";
29 // Tab definition
30 protected $tabClass = "roletabs";
31 protected $tabType = "ROLETABS";
32 protected $aclCategory = "roles";
33 protected $aclPlugin = "role";
34 protected $objectName = "role";
36 var $fai_release = ""; // The currently selected release while in release management mode!
38 function __construct($config,$ui)
39 {
40 $this->config = $config;
41 $this->ui = $ui;
43 $this->storagePoints = array(get_ou("roleRDN"));
45 // Build filter
46 # if (session::global_is_set(get_class($this)."_filter")){
47 # $filter= session::global_get(get_class($this)."_filter");
48 # } else {
49 $filter = new filter(get_template_path("fai-filter.xml", true));
50 $filter->setObjectStorage($this->storagePoints);
51 # }
52 $this->setFilter($filter);
54 // Build headpage
55 $headpage = new listing(get_template_path("fai-list.xml", true));
56 $headpage->setFilter($filter);
58 // Add copy&paste and snapshot handler.
59 if ($this->config->boolValueIsTrue("main", "copyPaste")){
60 $this->cpHandler = new CopyPasteHandler($this->config);
61 }
62 if($this->config->get_cfg_value("enableSnapshots") == "true"){
63 $this->snapHandler = new SnapshotHandler($this->config);
64 }
65 parent::__construct($config, $ui, "roles", $headpage);
66 }
68 function renderList()
69 {
70 $filter = $this->getFilter();
71 $headpage = $this->getHeadpage();
72 $filter->setComboBoxOptions("RELEASE",$this->getReleaseList());
74 if(isset($_POST['RELEASE'])){
75 $this->fai_release = get_post('RELEASE');
76 }
77 $headpage->setBase($this->fai_release);
78 $headpage->update();
79 $display = $headpage->render();
80 return($this->getHeader().$display);
81 }
83 function getReleaseList($base = "", $prefix ="")
84 {
85 $list = array();
86 if(empty($base)){
87 $base = get_ou('faiBaseRDN').$this->config->current['BASE'];
88 $list[$base] = "/";
89 }
91 $ldap = $this->config->get_ldap_link();
92 $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate"));
93 $cfg_rel = $this->config->search("faiManagement","DEFAULTFAIRELEASE",array("menu"));
95 while($release = $ldap->fetch()){
96 $list[$release['dn']] = $prefix.$release['ou'][0];
98 // Preset to prefered releaes if necessary
99 if(empty($this->fai_release) && $cfg_rel == $release['dn']){
100 $this->fai_release = $release['dn'];
101 }
103 $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix." "));
104 }
105 return($list);
106 }
109 }
110 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
111 ?>