Code

Updated description
[gosa.git] / gosa-plugins / scalix / personal / scalix / class_scalixAccount.inc
index 4f5ff3978aa54d8b38789b97580b5b9fde579896..ec108855ec80e6abc94da97d2f77f34e823cd022 100644 (file)
@@ -13,8 +13,8 @@
 class scalixAccount extends plugin
 {
   /* Definitions */
-  var $plHeadline   = "Scalix";
-  var $plDescription= "This does something";
+  var $plHeadline   = "SCALIX";
+  var $plDescription= "Manage personal SCALIX settings";
 
   /* plugin specific values - scalixUserClass */
   /* MUST */
@@ -108,7 +108,7 @@ class scalixAccount extends plugin
 
     /* Load templating engine */
     $smarty= get_smarty();
-    $smarty->assign("scalixGroup",$this->scalixGroup);
+    $smarty->assign("scalixGroup", set_post($this->scalixGroup));
     $display= "";
 
     /* Do we need to flip is_account state? */
@@ -123,7 +123,7 @@ class scalixAccount extends plugin
     /* Do we represent a valid account? */
     if (!$this->is_account && $this->parent === NULL){
       $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no scalix extensions.")."</b>";
+        _("This account has no SCALIX extensions.")."</b>";
 
       $display.= back_to_main();
       return ($display);
@@ -132,10 +132,10 @@ class scalixAccount extends plugin
     /* Show tab dialog headers */
     if ($this->parent !== NULL){
       if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove scalix account"),
-            _("This account has scalix synchronization enabled. You can disable it by clicking below."));
+        $display= $this->show_disable_header(_("Remove SCALIX account"),
+            _("This account has SCALIX synchronization enabled. You can disable it by clicking below."));
       } else {
-        $display= $this->show_enable_header(_("Create scalix account"), _("This account has scalix synchronization disabled. You can enable it by clicking below."));
+        $display= $this->show_enable_header(_("Create SCALIX account"), _("This account has SCALIX synchronization disabled. You can enable it by clicking below."));
         return ($display);
       }
     }
@@ -159,8 +159,12 @@ class scalixAccount extends plugin
       "scalixServerLanguage", "scalixLimitMailboxSize", "scalixLimitOutboundMail", "scalixEmailAddress",
       "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry", "scalixMailboxClass") as $val){
 
-      $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", $this->getacl($val));
+      $smarty->assign("$val", set_post($this->$val));
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $desc){
+      $smarty->assign($name."ACL", $this->getacl($name));
     }
 
     /* Fill checkboxes */
@@ -246,12 +250,12 @@ class scalixAccount extends plugin
       plugin::save_object();
 
       /* Check if given value is not empty */
-      if (isset($_POST['email_address']) && !empty($_POST['email_address'])){
+      if (isset($_POST['email_address']) && !empty($_POST['email_address']) && isset($_POST['add_email'])){
         $valid= FALSE;
 
         /* Valid mail address */
         if( ($this->is_template && !tests::is_email($_POST['email_address'], TRUE)) ||
-            (!$this->is_template && !tests::is_email($_POST['email_address'])) ){
+            (!$this->is_template && !tests::is_email($_POST['email_address']))){
           msg_dialog::display(_("Error"), _("Cannot add invalid mail address!"), ERROR_DIALOG);
         }else{
           $valid = TRUE;
@@ -263,7 +267,7 @@ class scalixAccount extends plugin
         }else{
 
           /* Mail address already in use ? */
-          if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
+          if ($valid && ($user= $this->addEmail (get_post('email_address'))) != ""){
             $ui= get_userinfo();
             if ($user != $ui->username){
               msg_dialog::display(_("Error"), sprintf(_("Cannot add mail address: it is already used by user '%s'."), $user),
@@ -357,10 +361,10 @@ class scalixAccount extends plugin
     $message= array();
 
     if(empty($this->scalixMailnode)){
-      $message[]= msgPool::required(_("Mailnode"));
+      $message[]= msgPool::required(_("Mail node"));
     }
     if(empty($this->scalixScalixObject)){
-      $message[]= msgPool::required(_("Scalix object"));
+      $message[]= msgPool::required(_("SCALIX object"));
     }
 
     $ldap->cd($this->config->current['BASE']);
@@ -451,7 +455,7 @@ class scalixAccount extends plugin
   static function plInfo()
   {
     return (array(
-          "plDescription"     => _("Scalix account"),
+          "plDescription"     => _("SCALIX account"),
           "plSelfModify"      => TRUE,
           "plDepends"         => array("user"),
           "plPriority"        => 2,
@@ -459,19 +463,24 @@ class scalixAccount extends plugin
           "plCategory"        => array("users"),
           "plOptions"         => array(),
 
+          "plRequirements"=> array(
+              'ldapSchema' => array('scalixUserClass' => ''),
+              'onFailureDisablePlugin' => array(get_class())
+              ),
+
           "plProvidedAcls"  => array(
 
-            "scalixMailnode"            => _("Scalix Mail node"),
+            "scalixMailnode"            => _("SCALIX Mail node"),
             "scalixMailboxClass"        => _("Mailbox class"),
             "scalixServerLanguage"      => _("Server language"),
             "scalixAdministrator"       => _("Administrator"),
             "scalixMailboxAdministrator"=> _("Mailbox administrator"),
-            "scalixHideUserEntry"       => _("Hide user entry in Scalix"),
+            "scalixHideUserEntry"       => _("Hide user entry in SCALIX"),
             "scalixLimitMailboxSize"    => _("Mailbox size limitations"),
             "scalixLimitOutboundMail"   => _("Limit outbound"),
             "scalixLimitInboundMail"    => _("Limit inbound"),
             "scalixLimitNotifyUser"     => _("Notify user"),
-            "scalixEmailAddress"        => _("Scalix email addresses"))
+            "scalixEmailAddress"        => _("SCALIX email addresses"))
 
             ));
   }
@@ -497,7 +506,7 @@ class scalixAccount extends plugin
           }
 
           /* Mail address already in use ? */
-          if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
+          if ($valid && ($user= $this->addEmail (get_post('email_address'))) != ""){
             $ui= get_userinfo();
             if ($user != $ui->username){
               msg_dialog::display(_("Error"), sprintf(_("Cannot add mail address: it is already used by user '%s'."), $user), ERROR_DIALOG);
@@ -542,7 +551,7 @@ class scalixAccount extends plugin
   function getCopyDialog()
   {
     $smarty = get_smarty(); 
-    $smarty->assign("scalixEmailAddress",$this->scalixEmailAddress);
+    $smarty->assign("scalixEmailAddress",set_post($this->scalixEmailAddress));
     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));    
     $ret = array();
     $ret['string'] = $str;