3ed1eaf7e6a2fbea469bdc814e7e0cb3dce7f70d
1 <?php
2 if (!$remove_lock){
4 /* Reset requested? */
5 if (isset($_POST['edit_cancel']) ||
6 (isset($_GET['reset']) && $_GET['reset'] == 1)){
8 del_lock ($ui->dn);
9 sess_del ('edit');
10 sess_del ('gofaxAccount');
11 }
13 /* Create gofaxAccount object on demand */
14 if (!isset($_SESSION['gofaxAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
15 $_SESSION['gofaxAccount']= new gofaxAccount ($config, $ui->dn);
16 }
17 $gofaxAccount= $_SESSION['gofaxAccount'];
19 /* save changes back to object */
20 if (isset ($_SESSION['edit'])){
21 $gofaxAccount->save_object ();
22 }
24 /* Enter edit mode? */
25 if (isset($_POST['edit'])){
27 /* Check locking */
28 if (($username= get_lock($ui->dn)) != ""){
29 $_SESSION['back_plugin']= $plug;
30 gen_locked_message ($username, $ui->dn);
31 exit ();
32 }
34 /* Lock the current entry */
35 add_lock ($ui->dn, $ui->dn);
36 $_SESSION['dn']= $ui->dn;
37 $_SESSION['edit']= TRUE;
38 }
40 /* Adjust acl's to mode */
41 if (isset($_SESSION['edit'])){
42 $acl= get_permissions ($ui->dn, $ui->subtreeACL);
43 $gofaxAccount->acl= get_module_permission($acl, "gofax", $ui->dn);
44 } else {
45 $acl= get_permissions ($ui->dn, $ui->subtreeACL);
46 $editacl= get_module_permission($acl, "gofax", $ui->dn);
47 $gofaxAccount->acl= "#none#";
48 }
50 /* save changes to LDAP and disable edit mode */
51 if (isset($_POST['edit_finish'])){
53 /* Perform checks */
54 $message= $gofaxAccount->check ();
56 /* No errors, save object */
57 if (count ($message) == 0){
58 $gofaxAccount->save ();
59 gosa_log ("User/fax object'".$ui->dn."' has been saved");
60 $gofaxAccount->acl= "#none#";
61 del_lock ($ui->dn);
62 sess_del ('edit');
64 } else {
65 /* Errors found, show message */
66 show_errors ($message);
67 }
68 }
70 /* Execute formular */
71 $display= $gofaxAccount->execute ();
72 $info= "";
74 /* Store changes in session */
75 if (isset ($_SESSION['edit'])){
76 $_SESSION['gofaxAccount']= $gofaxAccount;
77 }
79 /* Show page footer depending on the mode */
80 if (!$gofaxAccount->locals_dialog &&
81 !$gofaxAccount->out_blocklist_dialog &&
82 !$gofaxAccount->in_blocklist_dialog &&
83 $gofaxAccount->is_account){
85 $display.= "<p class=\"plugbottom\">\n";
87 /* Are we in edit mode? */
88 if (isset($_SESSION['edit'])){
89 $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
90 $display.= " \n";
91 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
92 $info= "<img alt='' align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn." ";
93 } else {
94 $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn." ";
95 if (isset($editacl) && $editacl != "#none#"){
96 $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
97 $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">";
98 }
99 $display.= "<input type=\"hidden\" name=\"ignore\">\n";
100 }
101 $display.= "</p>";
102 }
104 /* Page header*/
105 $display= print_header(get_template_path('images/fax.png'), _("FAX settings"), $info).$display;
107 }
108 ?>