Code

Fixed lock detection and locking in connectivity plugin.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jul 2008 12:05:09 +0000 (12:05 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jul 2008 12:05:09 +0000 (12:05 +0000)
- Locked entries caused a white screen ;)

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11593 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/connectivity/personal/connectivity/main.inc

index a51269b6b9cd157dcc7495d27a0e4f4d75e9bc4a..76b926ade7c5bccf6635874ae847d47264e1bc6b 100644 (file)
@@ -51,20 +51,19 @@ 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)) != "") && (!session::is_set('edit'))){
       session::set('back_plugin',$plug);
-      gen_locked_message ($username, $ui->dn);
-      exit ();
-    }
-
+      $display = gen_locked_message ($username, $ui->dn);
+    }else{
 
-    /* Lock the current entry */
-    add_lock ($ui->dn, $ui->dn);
-    session::set('dn',$ui->dn);
-    session::set('edit',TRUE);
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      session::set('dn',$ui->dn);
+      session::set('edit',TRUE);
+    }
   }
 
   /* save changes to LDAP and disable edit mode */
@@ -88,32 +87,34 @@ if (!$remove_lock){
   }
 
   /* Execute formular */
-  $display= $connectivity->execute ();
+  $info= "";
+  if(!isset($display)){
+    $display= $connectivity->execute ();
 
-  /* Store changes  in session */
-  if (session::is_set('edit')){
-    session::set('connectivity',$connectivity);
-  }
+    /* Store changes  in session */
+    if (session::is_set('edit')){
+      session::set('connectivity',$connectivity);
+    }
 
-  $info= "";
 
-  $display.="<div align='right'>";
-  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";
-    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png').
-      "\"> ".$ui->dn."&nbsp;";
-  } else {
-    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/unlocked.png').
-      "\"> ".$ui->dn."&nbsp;";
-
-    $info.= "<img class=\"center\" 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";
+    $display.="<div align='right'>";
+    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";
+      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png').
+        "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/unlocked.png').
+        "\"> ".$ui->dn."&nbsp;";
+
+      $info.= "<img class=\"center\" 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";
+    }
+    $display.="</div>";
   }
-  $display.="</div>";
 
   /* Page header*/
   $display= print_header(get_template_path('plugins/connectivity/images/plugin.png'),