Code

Updated printer selection in evironment tab
[gosa.git] / gosa-plugins / goto / personal / environment / main.inc
index 23f97b23a685f258d1c54c6cb74cec11e7730b45..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);
     }
   }
@@ -94,11 +107,11 @@ 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)){
+    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=\"".msgPool::cancelButton()."\">\n";
@@ -107,7 +120,7 @@ if (!$remove_lock){
     } else {
       $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"))){
+      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";
@@ -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;
 
 }