Code

Updated copy & paste hanling for everal classes.
[gosa.git] / gosa-plugins / gofax / gofax / blocklists / class_blocklistManagement.inc
index f9b19ea2a94c94f2ca7f42981f47dbfce276aae0..cfe2f55e12fd5728f53995f28c69b842f8f9433c 100644 (file)
@@ -2,7 +2,7 @@
 class blocklist extends plugin
 {
   /* Definitions */
-  var $plHeadline= "FAX Blocklists";
+  var $plHeadline= "FAX blocklists";
   var $plDescription= "This does something";
 
   var $blocklists       = array();
@@ -16,7 +16,7 @@ class blocklist extends plugin
     $this->ui     = $ui;
     $this->dn     = "";
     $this->config = &$config;
-    $this->base = $_SESSION['CurrentMainBase']
+    $this->base  = session::get('CurrentMainBase')
     $this->DivListBlocklist = new divListBlocklist($this->config,$this);
 
     /* Initialize copy&paste queue */
@@ -31,7 +31,7 @@ class blocklist extends plugin
     /* Call parent execute */
     plugin::execute();
 
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/");
+    session::set('LOCK_VARS_TO_USE',array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/"));
 
     /***************
       Init vars 
@@ -124,7 +124,7 @@ class blocklist extends plugin
 
       del_lock ($this->dn);
       $this->dialog = NULL;
-      unset($_SESSION['objectinfo']);
+      session::un_set('objectinfo');
     }
 
 
@@ -146,11 +146,11 @@ class blocklist extends plugin
           del_lock ($this->dn);
           $this->dn= "";
           $this->dialog = NULL;
-          unset($_SESSION['objectinfo']);
+          session::un_set('objectinfo');
         }
       } else {
         /* Errors found, show message */
-        show_errors ($message);
+        msg_dialog::displayChecks($message);
       }
     }
 
@@ -180,7 +180,7 @@ class blocklist extends plugin
       }else{
         add_lock ($this->dn, $this->ui->dn);
       }
-      $_SESSION['objectinfo']= trim($this->dn);
+      session::set('objectinfo',trim($this->dn));
       $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
       $this->dialog->set_acl_base($this->dn);
     }    
@@ -214,15 +214,14 @@ class blocklist extends plugin
           $this->dns[$id] = $dn;
         }
 
-        $dns_names = "<br><pre>";
+        $dns_names[] = array();
         foreach($this->dns as $dn){
           add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
+          $dns_names[]=@LDAP::fix( $dn);
         }
-        $dns_names .="</pre>";
 
         /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info",     sprintf(_("You're about to delete the following blocklists(s) %s"), @LDAP::fix($dns_names)));
+        $smarty->assign("info", msgPool::deleteInfo($dns_names,_("blocklist")));
         $smarty->assign("multiple", true);
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
@@ -244,7 +243,7 @@ class blocklist extends plugin
           $this->dialog->delete();
           $this->dialog = NULL;
         } else {
-          print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
+          msg_dialog::display(_("Permission error"), msgPool::permDelete($dn), ERROR_DIALOG);
         }
         /* Remove lock file after successfull deletion */
         del_lock ($dn);
@@ -277,13 +276,13 @@ class blocklist extends plugin
 
       /* Check locking */
       if (($user= get_lock($this->dn)) != ""){
-        $_SESSION['dn']= $this->dn;
+        session::set('dn',$this->dn);
         return(gen_locked_message($user, $this->dn));
       } else {
 
         // Lock this dn for editing
         add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
+        $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("blocklist")));
         $smarty->assign("multiple", false);
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
@@ -302,7 +301,7 @@ class blocklist extends plugin
         $this->dialog = NULL;
         del_lock ($this->dn);
       } else {
-        print_red (_("You have no permission to remove this blocklist."));
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
       }
     }
 
@@ -346,7 +345,7 @@ class blocklist extends plugin
   /* Return departments, that will be included within snapshot detection */
   function get_used_snapshot_bases()
   {
-    return(array("ou=gofax,ou=systems,". $this->DivListBlocklist->selectedBase));
+    return(array(get_ou('blocklistou').$this->DivListBlocklist->selectedBase));
   }
 
 
@@ -367,7 +366,7 @@ class blocklist extends plugin
     if($SubSearch){
       $Flags |= GL_SUBSEARCH;
     }else{
-      $base = "ou=gofax,ou=systems,".$base;
+      $base = get_ou('blocklistou').$base;
     }  
 
     /* Create filter */
@@ -404,6 +403,9 @@ class blocklist extends plugin
   function save_object()
   {
     $this->DivListBlocklist->save_object();
+    if(is_object($this->CopyPasteHandler)){
+      $this->CopyPasteHandler->save_object();
+    }
   }
 
 
@@ -452,12 +454,9 @@ class blocklist extends plugin
     /* Return C&P dialog */
     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
 
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListBlocklist->selectedBase);
-
       /* Get dialog */
       $data = $this->CopyPasteHandler->execute();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListBlocklist->selectedBase);
 
       /* Return dialog data */
       if(!empty($data)){