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_applicationManagement.inc 14766 2009-11-05 14:30:35Z 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 applicationManagement extends management
24 {
25 var $plHeadline = "Applications";
26 var $plDescription = "Application administration";
27 var $plIcon = "plugins/applications/images/plugin.png";
29 var $app_release = ""; // The currently selected release while in release management mode!
31 // Tab definition
32 protected $tabClass = "apptabs";
33 protected $tabType = "APPSTABS";
34 protected $aclCategory = "application";
35 protected $aclPlugin = "application";
36 protected $objectName = "application";
38 function __construct($config,$ui)
39 {
40 $this->config = $config;
41 $this->ui = $ui;
43 $this->storagePoints = array(get_ou("applicationRDN"));
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("application-filter-release.xml", true));
50 # $filter->setObjectStorage($this->storagePoints);
51 # }
52 $this->setFilter($filter);
54 // Build headpage
55 $headpage = new listing(get_template_path("application-list-release.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, "applications", $headpage);
67 $this->registerAction("edit_application","editEntry");
68 $this->registerAction("edit_environment","editEntry");
69 $this->registerAction("edit_appapplication","editEntry");
70 $this->registerAction("edit_mailapplication","editEntry");
71 }
73 function renderList()
74 {
75 $filter = $this->getFilter();
76 $headpage = $this->getHeadpage();
77 $filter->setComboBoxOptions("RELEASE",$this->getReleaseList());
79 if(isset($_POST['RELEASE'])){
80 $headpage->setBase($_POST['RELEASE']);
81 }else{
82 $headpage->setBase($base = get_ou('applicationRDN').$this->config->current['BASE']);
83 }
85 $headpage->update();
86 $display = $headpage->render();
87 return($this->getHeader().$display);
89 }
91 function getReleaseList($base = "", $prefix ="")
92 {
93 $list = array();
94 if(empty($base)){
95 $base = get_ou('applicationRDN').$this->config->current['BASE'];
96 $list[$base] = "/";
97 }
99 $ldap = $this->config->get_ldap_link();
100 $ldap->ls("(objectClass=FAIbranch)",$base,array("ou","FAIstate"));
101 while($release = $ldap->fetch()){
102 $list[$release['dn']] = $prefix.$release['ou'][0];
103 $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix." "));
104 }
105 return($list);
106 }
109 function IsReleaseManagementActivated()
110 {
111 /* Check if we should enable the release selection */
112 $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
113 if(!empty($tmp)){
114 return(true);
115 }
116 return(false);
117 }
119 }
120 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
121 ?>