Code

Soem fixes for logging:
[gosa.git] / plugins / personal / connectivity / main.inc
1 <?php
2 /*
3    This code is part of GOsa (https://gosa.gonicus.de)
4    Copyright (C) 2003  Cajus Pollmeier
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
21 if (!$remove_lock){
22   /* Reset requested? */
23   if (isset($_POST['edit_cancel']) ||
24       (isset($_GET['reset']) && $_GET['reset'] == 1)){
26     del_lock ($ui->dn);
27     sess_del ('edit');
28     sess_del ('connectivity');
29   }
31   /* Create connectivity object on demand */
32   if (!isset($_SESSION['connectivity']) || (isset($_GET['reset']) &&
33       $_GET['reset'] == 1)){
34     $_SESSION['connectivity']= new connectivity ($config, $ui->dn);
35     $_SESSION['connectivity']->set_acl_base($ui->dn);
36     $_SESSION['connectivity']->set_acl_category("users");
38     /* Adjust acl's to mode */
39     foreach ($_SESSION['connectivity']->plugin_name as $name){
40       $_SESSION['connectivity']->plugin[$name]->set_acl_category( "users");
41       $_SESSION['connectivity']->plugin[$name]->set_acl_base($ui->dn);
42     }
43   }
44   $connectivity= $_SESSION['connectivity'];
46   /* save changes back to object */
47   if (isset ($_SESSION['edit'])){
48     $connectivity->save_object ();
49   }
51   /* Enter edit mode? */
52   if (isset($_POST['edit'])){
54     /* Check locking */
55     if ((($username= get_lock($ui->dn)) != "") && (!isset($_SESSION['edit']))){
56       $_SESSION['back_plugin']= $plug;
57       gen_locked_message ($username, $ui->dn);
58       exit ();
59     }
62     /* Lock the current entry */
63     add_lock ($ui->dn, $ui->dn);
64     $_SESSION['dn']= $ui->dn;
65     $_SESSION['edit']= TRUE;
66   }
68   /* save changes to LDAP and disable edit mode */
69   if (isset($_POST['edit_finish'])){
71     /* Perform checks */
72     $message= $connectivity->check ();
74     /* No errors, save object */
75     if (count ($message) == 0){
76       $connectivity->save ();
77       del_lock ($ui->dn);
78       sess_del ('edit');
80       /* Remove from session */
81       sess_del ('connectivity');
82     } else {
83       /* Errors found, show message */
84       show_errors ($message);
85     }
86   }
88   /* Execute formular */
89   $display= $connectivity->execute ();
91   /* Store changes  in session */
92   if (isset ($_SESSION['edit'])){
93     $_SESSION['connectivity']= $connectivity;
94   }
96   $info= "";
98   $display.="<div align='right'>";
99   if (isset($_SESSION['edit'])){
100     $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
101     $display.= "&nbsp;";
102     $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
103     $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
104       "\"> ".$ui->dn."&nbsp;";
105   } else {
106     $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
107       "\"> ".$ui->dn."&nbsp;";
109     $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
110       "\">"._("Click the 'Edit' button below to change informations in this dialog");
111     $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
112     $display.= "<input type=\"hidden\" name=\"ignore\">\n";
113   }
114   $display.="</div>";
116   /* Page header*/
117   $display= print_header(get_template_path('images/proxy.png'),
118       _("Connectivity"), $info).$display;
122 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
123 ?>