Code

Fixed Translation Strings.
[gosa.git] / gosa-plugins / gofax / gofax / faxaccount / class_gofaxAccount.inc
index 63f22cee6057f5290813c78acabf700fe59a1154..3731093505078d927947006603047ff4e8f1e356 100644 (file)
@@ -6,12 +6,6 @@ class gofaxAccount extends plugin
   var $plHeadline= "FAX";
   var $plDescription= "This does something";
 
-  /* CLI vars */
-  var $cli_summary= "Manage users fax account";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-
   /* Department list shown in the divSelectList*/
   var $departments;
 
@@ -166,8 +160,8 @@ class gofaxAccount extends plugin
 
       /* Do we represent a valid account? */
       if (!$this->is_account && $this->parent === NULL){
-        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-          _("This account has no fax extensions.")."</b>";
+        $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\">&nbsp;<b>".
+          msgPool::noValidExtension(_("GOfax"))."</b>";
         $display.= back_to_main();
         return ($display);
       }
@@ -177,10 +171,10 @@ class gofaxAccount extends plugin
       if ($this->parent !== NULL){
         if ($this->is_account){
           $display= $this->show_disable_header(_("Remove fax account"),
-              _("This account has fax features enabled. You can disable them by clicking below."));
+              msgPool::featuresEnabled(_("GOfax")));
         } else {
           $display= $this->show_enable_header(_("Create fax account"),
-              _("This account has fax features disabled. You can enable them by clicking below."));
+              msgPool::featuresDisabled(_("GOfax")));
           return ($display);
         }
       }
@@ -244,7 +238,7 @@ class gofaxAccount extends plugin
     /* Add number to blocklist (dialog) */
     if (isset($_POST['add_blocklist_number']) && $_POST['block_number'] != ""){
       if (!tests::is_phone_nr($_POST['block_number'])){
-        print_red (_("You're trying to add an invalid phone number."));
+        msg_dialog::display(_("Error"), msgPool::invalid(_("Phone number")), ERROR_DIALOG);
       } else {
         array_push($this->current_blocklist, $_POST['block_number']);
         $this->current_blocklist= array_unique($this->current_blocklist);
@@ -385,11 +379,11 @@ class gofaxAccount extends plugin
       }
 
       /* Show dialog */
-      $smarty->assign("search_image", get_template_path('images/search.png'));
-      $smarty->assign("usearch_image", get_template_path('images/search_user.png'));
-      $smarty->assign("tree_image", get_template_path('images/tree.png'));
+      $smarty->assign("search_image", get_template_path('images/lists/search.png'));
+      $smarty->assign("usearch_image", get_template_path('images/lists/search-user.png'));
+      $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
       $smarty->assign("infoimage", get_template_path('images/info.png'));
-      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+      $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
       $smarty->assign("departments", $this->config->idepartments);
       $smarty->assign("list", $list);
       if (isset($_POST['depselect'])){
@@ -477,7 +471,7 @@ class gofaxAccount extends plugin
         if(!isset($this->config->departments[trim($key)])){
           $this->config->departments[trim($key)]="";
         }
-        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+        $field1 = array("string" => "<img src='images/lists/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
         $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
         $divSel->AddEntry(array($field1,$field2));
       }
@@ -560,7 +554,7 @@ class gofaxAccount extends plugin
           $this->config->departments[trim($key)]="";
         }
 
-        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+        $field1 = array("string" => "<img src='images/lists/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
         $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
         $divSel->AddEntry(array($field1,$field2));
       }
@@ -660,7 +654,9 @@ class gofaxAccount extends plugin
 
     new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
 
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn));
+    if (!$ldap->success()){
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+    }
 
     /* Optionally execute a command after we're done */
     $this->handle_post_events('remove',array("uid"=> $this->uid));
@@ -675,11 +671,11 @@ class gofaxAccount extends plugin
 
     /* must: facsimileTelephoneNumber */
     if ($this->facsimileTelephoneNumber == ""){
-      $message[]= _("The required field 'Fax' is not set.");
+      $message[]= msgPool::required(_("Fax number"));
     }
 
     if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= _("Please enter a valid telephone number in the 'Fax' field.");
+      $message[]= msgPool::invalid(_("Fax number"),$this->facsimileTelephoneNumber,"/[0-9]/");
     }
 
     /* IF mail is specified (which is only the case if there's no mail account
@@ -687,15 +683,15 @@ class gofaxAccount extends plugin
     if (@isset($this->parent->by_object['mailAccount']) &&
         $this->goFaxDeliveryMode & 32){
       if ($this->mail == ""){
-        $message[]= _("Mail delivery is checked, but no address has been specified.");
+        $message[]= _("Mail delivery is requested without target address!");
       } elseif (!tests::is_email($this->mail)){
-        $message[]= _("The mail address you've entered is invalid.");
+        $message[]= msgPool::invalid(_("Mail address"),"","",_("your-name@your-domain.com"));
       }
     }
 
     // IE Fix, IE lets you choose disabled option, stupid browser ... 
     if((empty($this->goFaxPrinter))&&($this->goFaxDeliveryMode & 64)){
-      $message[]= _("Deliver fax to printer, is only possible if valid printer is given. Please correct your choice.");
+      $message[]= _("Printing is requested without a target printer!");
     }
 
     return ($message);
@@ -787,7 +783,9 @@ class gofaxAccount extends plugin
       new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }
 
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account with dn '%s' failed."),$this->dn));
+    if (!$ldap->success()){
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+    }
 
     /* Optionally execute a command after we're done */
     if ($this->initially_was_account == $this->is_account){
@@ -802,13 +800,17 @@ class gofaxAccount extends plugin
 
 
   /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
+  function adapt_from_template($dn, $skip= array())
   {
-    plugin::adapt_from_template($dn);
+    plugin::adapt_from_template($dn, $skip);
 
     foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
           "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
 
+      if (in_array($val, $skip)){
+        continue;
+      }
+
       if (isset($this->attrs[$val])){
         $this->$val= $this->attrs[$val];
       }