Code

Updated printer selection in evironment tab
[gosa.git] / gosa-plugins / goto / personal / environment / main.inc
index 4a31aef587f93eee70eadf32e001f5810c915d17..141322066148ee80012083c48efa0193f090d53d 100644 (file)
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-$lock_msg = "";
-if (!$remove_lock){
+
+/* Remove locks created by this plugin
+*/
+$lock_msg="";
+if ($remove_lock || isset($_POST['edit_cancel'])){
+  if(session::is_set('environment') && session::is_set('edit')){
+    del_lock($ui->dn);
+  }
+}
+
+/* Remove this plugin from session
+*/
+if ( $cleanup ){
+  session::un_set('environment');
+  session::un_set('edit');
+
+}else{
+
   /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-#    del_lock ($ui->dn);
+  if (isset($_POST['edit_cancel'])){
     session::un_set ('edit');
     session::un_set ('environment');
   }
@@ -43,7 +57,7 @@ if (!$remove_lock){
   }
 
   /* Enter edit mode? */
-  if (isset($_POST['edit'])){
+  if (isset($_POST['edit']) || isset($_POST['delete_lock'])){
   
    /* Check locking */
     if (($username= get_lock($ui->dn)) != ""){
@@ -55,7 +69,6 @@ if (!$remove_lock){
 
       /* Lock the current entry */
       add_lock ($ui->dn, $ui->dn);
-      session::set('dn',$ui->dn);
       session::set('edit',TRUE);
     }
   }
@@ -76,7 +89,7 @@ if (!$remove_lock){
       session::un_set ('environment');
     } else {
       /* Errors found, show message */
-      show_errors ($message);
+      msg_dialog::displayChecks($message);
     }
   }
 
@@ -94,23 +107,23 @@ if (!$remove_lock){
 
   $info= "";
   /* Show page footer depending on the mode */
-  if (!$environment->in_dialog && $environment->is_account  && empty($lock_msg)){
+  if (!$environment->in_dialog && !$environment->dialog && $environment->is_account  && empty($lock_msg)){
     $display.= "<p class=\"plugbottom\">";
 
     /* Are we in edit mode? */
-    if ((session::is_set('edit'))&&($environment->dialog===NULL)){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+    if (session::is_set('edit')){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
       $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+      $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png').
              "\"> ".$ui->dn."&nbsp;";
     } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/unlocked.png').
         "\"> ".$ui->dn."&nbsp;";
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/environment"))){
-        $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";
+      if(preg_match("/r/",$ui->get_permissions($ui->dn,"users/environment"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/on.png').
+          "\"> ".msgPool::clickEditToChange();
+        $display.= "<input type=submit name=\"edit\" value=\"".msgPool::editButton()."\">\n";
       }
       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
     }
@@ -118,7 +131,7 @@ if (!$remove_lock){
   }
 
   /* Page header*/
-  $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display;
+  $display= print_header(get_template_path('plugins/goto/images/plugin.png'), _("User environment settings"), $info).$display;
 
 }