Code

Updated mailForward selection list
[gosa.git] / gosa-plugins / mail / personal / mail / main.inc
index 153199cbb28a2fe4a7c1726f3aadf1adb086bb11..db39f469b2f85621da5f9f849dd96a12cbcd9872 100644 (file)
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-$lock_msg ="";
-$display  =""; 
-if (!$remove_lock){
+
+/* Remove locks created by this plugin
+*/
+$lock_msg="";
+if ($remove_lock || isset($_POST['edit_cancel'])){
+  if(session::is_set('mailAccount') && session::is_set('edit')){
+    del_lock($ui->dn);
+  }
+}
+
+/* Remove this plugin from session
+*/
+if ( $cleanup ){
+  session::un_set('mailAccount');
+  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 ('mailAccount');
   }
@@ -45,7 +58,7 @@ if (!$remove_lock){
   }
 
   /* Enter edit mode? */
-  if (isset($_POST['edit']) && preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
+  if (isset($_POST['edit']) && preg_match("/r/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
 
     /* Check locking */
     if (($username= get_lock($ui->dn)) != ""){
@@ -57,7 +70,6 @@ if (!$remove_lock){
 
       /* Lock the current entry */
       add_lock ($ui->dn, $ui->dn);
-      session::set('dn',$ui->dn);
       session::set('edit',TRUE);
     }
   }
@@ -113,7 +125,7 @@ if (!$remove_lock){
         $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/on.png').
             "\"> ".msgPool::clickEditToChange();
 
-        if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
+        if(preg_match("/r/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
           $display.= "<input type=submit name=\"edit\" value=\"".msgPool::editButton()."\">\n";
         }
 
@@ -123,7 +135,7 @@ if (!$remove_lock){
   }
 
   /* Page header*/
-  $display= print_header(get_template_path('images/email.png'), _("User mail settings"), $info).$display;
+  $display= print_header(get_template_path('plugins/mail/images/plugin.png'), _("User mail settings"), $info).$display;
 
 }