summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cc5cb1)
raw | patch | inline | side by side (parent: 8cc5cb1)
author | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 26 Sep 2005 16:17:47 +0000 (16:17 +0000) | ||
committer | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 26 Sep 2005 16:17:47 +0000 (16:17 +0000) |
corrected save_object mailTab -> nagiosTab
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1426 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1426 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/nagios/class_nagiosAccount.inc | patch | blob | history | |
plugins/personal/nagios/main.inc | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc
index f5c3939cb7b5fca16b38bc55fa9fb0203befa71e..b9b1d850e81b873cf5e666f80db526adcbc0a9b5 100644 (file)
function save_object()
{
- if (isset($_POST['mailTab'])){
+ if (isset($_POST['nagiosTab'])){
/* Save ldap attributes */
plugin::save_object();
}
diff --git a/plugins/personal/nagios/main.inc b/plugins/personal/nagios/main.inc
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2005 Benoit Mortier
+
+ 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
+ */
+
+if (!$remove_lock){
+ /* Reset requested? */
+ if (isset($_POST['edit_cancel']) ||
+ (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ del_lock ($ui->dn);
+ sess_del ('edit');
+ sess_del ('nagiosAccount');
+ }
+
+ /* Create mail object on demand */
+ if (!isset($_SESSION['nagiosAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $_SESSION['nagiosAccount']= new nagiosAccount ($config, $ui->dn);
+ }
+ $nagiosAccount= $_SESSION['nagiosAccount'];
+
+ /* save changes back to object */
+ if (isset ($_SESSION['edit'])){
+ $nagiosAccount->save_object ();
+ }
+
+ /* Enter edit mode? */
+ if (isset($_POST['edit'])){
+
+ /* Check locking */
+ if (($username= get_lock($ui->dn)) != ""){
+ $_SESSION['back_plugin']= $plug;
+ gen_locked_message ($username, $ui->dn);
+ exit ();
+ }
+
+ /* Lock the current entry */
+ add_lock ($ui->dn, $ui->dn);
+ $_SESSION['dn']= $ui->dn;
+ $_SESSION['edit']= TRUE;
+ }
+
+ /* Adjust acl's to mode */
+ if (isset($_SESSION['edit'])){
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $nagiosAccount->acl= get_module_permission($acl, "nagios", $ui->dn);
+ } else {
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $editacl= get_module_permission($acl, "nagios", $ui->dn);
+ $nagiosAccount->acl= "#none#";
+ }
+
+ /* save changes to LDAP and disable edit mode */
+ if (isset($_POST['edit_finish'])){
+
+ /* Perform checks */
+ $message= $nagiosAccount->check ();
+
+ /* No errors, save object */
+ if (count ($message) == 0){
+ $nagiosAccount->save ();
+ gosa_log ("User/mail object'".$ui->dn."' has been saved");
+ $nagiosAccount->acl= "#none#";
+ del_lock ($ui->dn);
+ sess_del ('edit');
+
+ /* Store object */
+ $_SESSION['nagiosAccount']= $nagiosAccount;
+ } else {
+ /* Errors found, show message */
+ show_errors ($message);
+ }
+ }
+
+ /* Execute formular */
+ $display= $nagiosAccount->execute ();
+
+ /* Store changes in session */
+ if (isset ($_SESSION['edit'])){
+ $_SESSION['nagiosAccount']= $nagiosAccount;
+ }
+
+ $info= "";
+ /* Show page footer depending on the mode */
+ if (!$nagiosAccount->forward_dialog && $nagiosAccount->is_account){
+ $display.= "<p class=\"plugbottom\">";
+
+ /* Are we in edit mode? */
+ if (isset($_SESSION['edit'])){
+ $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+ $display.= " ";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+ "\"> ".$ui->dn." ";
+ } else {
+ $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+ "\"> ".$ui->dn." ";
+ if (isset($editacl) && $editacl != "#none#"){
+ $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+ "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+ $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+ }
+
+ $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+ }
+ $display.= "</p>\n";
+ }
+
+ /* Page header*/
+ $display= print_header(get_template_path('images/email.png'), _("User nagios settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>