Code

Added pureftpd multiple edit
[gosa.git] / gosa-core / 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']->enable_CSN_check();
36     $_SESSION['connectivity']->set_acl_base($ui->dn);
37     $_SESSION['connectivity']->set_acl_category("users");
39     /* Adjust acl's to mode */
40     foreach ($_SESSION['connectivity']->plugin_name as $name){
41       $_SESSION['connectivity']->plugin[$name]->set_acl_category( "users");
42       $_SESSION['connectivity']->plugin[$name]->set_acl_base($ui->dn);
43     }
44   }
45   $connectivity= $_SESSION['connectivity'];
47   /* save changes back to object */
48   if (isset ($_SESSION['edit'])){
49     $connectivity->save_object ();
50   }
52   /* Enter edit mode? */
53   if (isset($_POST['edit'])){
55     /* Check locking */
56     if ((($username= get_lock($ui->dn)) != "") && (!isset($_SESSION['edit']))){
57       $_SESSION['back_plugin']= $plug;
58       gen_locked_message ($username, $ui->dn);
59       exit ();
60     }
63     /* Lock the current entry */
64     add_lock ($ui->dn, $ui->dn);
65     $_SESSION['dn']= $ui->dn;
66     $_SESSION['edit']= TRUE;
67   }
69   /* save changes to LDAP and disable edit mode */
70   if (isset($_POST['edit_finish'])){
72     /* Perform checks */
73     $message= $connectivity->check ();
75     /* No errors, save object */
76     if (count ($message) == 0){
77       $connectivity->save ();
78       del_lock ($ui->dn);
79       sess_del ('edit');
81       /* Remove from session */
82       sess_del ('connectivity');
83     } else {
84       /* Errors found, show message */
85       show_errors ($message);
86     }
87   }
89   /* Execute formular */
90   $display= $connectivity->execute ();
92   /* Store changes  in session */
93   if (isset ($_SESSION['edit'])){
94     $_SESSION['connectivity']= $connectivity;
95   }
97   $info= "";
99   $display.="<div align='right'>";
100   if (isset($_SESSION['edit'])){
101     $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
102     $display.= "&nbsp;";
103     $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
104     $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
105       "\"> ".$ui->dn."&nbsp;";
106   } else {
107     $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
108       "\"> ".$ui->dn."&nbsp;";
110     $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
111       "\">"._("Click the 'Edit' button below to change informations in this dialog");
112     $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
113     $display.= "<input type=\"hidden\" name=\"ignore\">\n";
114   }
115   $display.="</div>";
117   /* Page header*/
118   $display= print_header(get_template_path('images/proxy.png'),
119       _("Connectivity"), $info).$display;
123 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
124 ?>