Code

Updated printer selection in evironment tab
[gosa.git] / gosa-plugins / goto / personal / environment / main.inc
index b4b5508a5266323d7094bf931c428d8c70eb0212..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');
   }
@@ -56,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);
     }
   }
@@ -108,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";