Code

Updated copy & paste for mail accounts
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Apr 2010 11:49:32 +0000 (11:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Apr 2010 11:49:32 +0000 (11:49 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17880 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/class_mailAccount.inc
gosa-plugins/mail/personal/mail/copypaste.tpl

index b0c2024ca6c141ab33df0eeb5a5782061970d582..b57a751ea1f0a9ba2027a83abf51771c75d74cab 100644 (file)
@@ -1134,42 +1134,65 @@ class mailAccount extends plugin
    */ 
   function getCopyDialog()
   {
-    if(!$this->is_account) return("");
-    $smarty = get_smarty();
-    $smarty->assign("mail",$this->mail);
-    $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
-    $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
-    $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
-
-    $ret = array();
-    $ret['status'] = "";
-    $ret['string'] = $str;
-    return($ret);
+      if(!$this->is_account) return("");
+      $smarty = get_smarty();
+      $smarty->assign("mail",$this->mail);
+      $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
+      $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
+
+      $smarty->assign("domainSelectionEnabled", $this->mailMethod->domainSelectionEnabled());
+      $smarty->assign("MailDomains", $this->mailDomainParts);
+      $smarty->assign("MailDomain" , $this->mailDomainPart);
+      $smarty->assign("MailServers", $this->mailMethod->getMailServers());
+      $smarty->assign("isModifyableMail"  , $this->mailMethod->isModifyableMail());
+
+      $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
+
+      $ret = array();
+      $ret['status'] = "";
+      $ret['string'] = $str;
+      return($ret);
   }
 
-    
+
   /*! \brief  save_object for copy&paste vars 
    */  
   function saveCopyDialog()
   {
-    if(!$this->is_account) return;
+      if(!$this->is_account) return;
 
-    /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
-    $this->execute();
-    if(isset($_POST['mail'])){
-      $this->mail = $_POST['mail'];
-    }
+      /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
+      $this->execute();
+      if(isset($_POST['mail'])){
+          $this->mail = $_POST['mail'];
+      }
   }
 
-  
+
   /*! \brief  Prepare this account to be copied 
    */
   function PrepareForCopyPaste($source)
   {
-    plugin::PrepareForCopyPaste($source);
+      plugin::PrepareForCopyPaste($source);
+
+      /* Reset alternate mail addresses */
+      $this->gosaMailAlternateAddress = array();
+
+
+      /* If the doamin part is selectable, we have to split the mail address
+       */
+      if($this->mailMethod->domainSelectionEnabled()){
+          $this->mailDomainPart = preg_replace("/^[^@]*+@/","",$this->mail);
+          $this->mail = preg_replace("/@.*$/","\\1",$this->mail);
+          if(!in_array($this->mailDomainPart,$this->mailDomainParts)){
+              $this->mailDomainParts[] = $this->mailDomainPart;
+          }
+      }
 
-    /* Reset alternate mail addresses */
-    $this->gosaMailAlternateAddress = array();
+      /* Convert start/stop dates */
+#TODO: use date format
+      $this->gosaVacationStart= date('d.m.Y', $this->gosaVacationStart);
+      $this->gosaVacationStop= date('d.m.Y', $this->gosaVacationStop);
   }
 
 
index 8ae2a947cfd775df76737d7ee86bac54a175e356..8e89a38eba8d4f91a7cd57e9c87b5111e7c20d0c 100644 (file)
@@ -1,9 +1,24 @@
 <h3>{t}Mail settings{/t}</h3>
 
-    <label for="mail">{t}Primary address{/t}</label>{$must}
-    <input type='text' id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
 
 <table style='width:100%;' cellspacing=0  summary="{t}Address configuration{/t}">
+  <tr>
+     <td><label for="mail">{t}Primary address{/t}</label>{$must}
+      {if !$isModifyableMail && $initially_was_account}
+      <input type='text' disabled size=30 value="{$mail}">
+      {else}
+      {if $domainSelectionEnabled}
+      <input type='text' id="mail" name="mail" size=20 maxlength=65 value="{$mail}">
+      @<select name='MailDomain' size=1>
+       {html_options values=$MailDomains output=$MailDomains selected=$MailDomain}
+      </select>
+      {else}
+      <input type='text' id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
+      {/if}
+      {/if}
+     </td>
+    </tr>
+
        <tr>
                <td>
                <h3>