Code

Updated images.
[gosa.git] / gosa-plugins / connectivity / 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     session::un_set ('edit');
28     session::un_set ('connectivity');
29   }
31   /* Create connectivity object on demand */
32   if (!session::is_set('connectivity') || (isset($_GET['reset']) &&
33       $_GET['reset'] == 1)){
34     $connectivity= new connectivity ($config, $ui->dn);
35     $connectivity->enable_CSN_check();
36     $connectivity->set_acl_base($ui->dn);
37     $connectivity->set_acl_category("users");
39     /* Adjust acl's to mode */
40     foreach ($connectivity->plugin_name as $name){
41       $connectivity->plugin[$name]->set_acl_category( "users");
42       $connectivity->plugin[$name]->set_acl_base($ui->dn);
43     }
44     session::set('connectivity',$connectivity);
45   }
46   $connectivity = session::get('connectivity');
48   /* save changes back to object */
49   if (session::is_set('edit')){
50     $connectivity->save_object ();
51   }
53   /* Enter edit mode? */
54   if (isset($_POST['edit']) || isset($_POST['delete_lock'])){
56     /* Check locking */
57     if ((($username= get_lock($ui->dn)) != "") && (!session::is_set('edit'))){
58       session::set('back_plugin',$plug);
59       $display = gen_locked_message ($username, $ui->dn);
60     }else{
62       /* Lock the current entry */
63       add_lock ($ui->dn, $ui->dn);
64       session::set('dn',$ui->dn);
65       session::set('edit',TRUE);
66     }
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       session::un_set ('edit');
81       /* Remove from session */
82       session::un_set ('connectivity');
83     } else {
84       /* Errors found, show message */
85       msg_dialog::displayChecks($message);
86     }
87   }
89   /* Execute formular */
90   $info= "";
91   if(!isset($display)){
92     $display= $connectivity->execute ();
94     /* Store changes  in session */
95     if (session::is_set('edit')){
96       session::set('connectivity',$connectivity);
97     }
100     $display.="<div align='right'>";
101     if (session::is_set('edit')){
102       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
103       $display.= "&nbsp;";
104       $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
105       $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png').
106         "\"> ".$ui->dn."&nbsp;";
107     } else {
108       $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/unlocked.png').
109         "\"> ".$ui->dn."&nbsp;";
111       $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/on.png').
112         "\">".msgPool::clickEditToChange();
113       $display.= "<input type=submit name=\"edit\" value=\"".msgPool::editButton()."\">\n";
114       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
115     }
116     $display.="</div>";
117   }
119   /* Page header*/
120   $display= print_header(get_template_path('plugins/connectivity/images/plugin.png'),
121       _("Connectivity"), $info).$display;
125 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
126 ?>