Code

Added scalix copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Jun 2007 09:16:00 +0000 (09:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Jun 2007 09:16:00 +0000 (09:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6634 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_divListGroup.inc
plugins/admin/users/class_divListUsers.inc
plugins/personal/scalix/class_scalixAccount.inc
plugins/personal/scalix/paste_generic.tpl [new file with mode: 0644]

index 26e46ce1a8750f04faa388ad60b3decc31b8f66e..d08d22cd14c3bbbb3556ce20f7b106b097b29355 100644 (file)
@@ -187,7 +187,7 @@ class divListGroup extends MultiSelectWindow
         title='"._("Remove selected groups")."' alt='"._("Remove groups")."' name='remove_multiple_groups'>&nbsp;";
   
     /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
       $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
         title='"._("Copy selected group")."' alt='"._("Copy groups")."' name='multiple_copy_groups'>&nbsp;";
       $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
index b9500e4fc047ff946b0f63d7d078c626f0e8a298..88af3d7f1a29534f3efb298d261bdedec56046ba 100644 (file)
@@ -169,7 +169,7 @@ class divListUsers extends MultiSelectWindow
         title='"._("Remove selected user")."' alt='"._("Remove user")."' name='remove_multiple_users'>&nbsp;";
 
     /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
       $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
         title='"._("Copy selected user")."' alt='"._("Copy users")."' name='multiple_copy_users'>&nbsp;";
       $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
index cc970d43cec3080b096ef12aa775b43b76027dc8..8bffd873de8453401e61a22c105326fe8e28e33c 100644 (file)
@@ -151,47 +151,6 @@ class scalixAccount extends plugin
       $this->dialog= FALSE;
     }
 
-    /* Add email addresses */
-    if (isset($_POST['add_email'])){
-
-      /* Check write access */
-      if(!$this->acl_is_writeable("scalixEmailAddress")){
-        print_red(_("You are not allowed to modify alternate addresses"));
-      }else{
-
-        /* Check if given value is not empty */
-        if ($_POST['email_address'] != ""){
-          $valid= FALSE;
-
-          /* Valid mail address */
-          if( ($this->is_template && !is_email($_POST['email_address'], TRUE)) || 
-              (!$this->is_template && !is_email($_POST['email_address'])) ){
-            print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
-          }else{
-            $valid = TRUE;
-          }
-
-          /* Mail address already in use ? */
-          if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
-            $ui= get_userinfo();
-            if ($user != $ui->username){
-              print_red (_("The address you're trying to add is already used by user")." '$user'.");
-            }
-          }
-        }
-      }
-    }
-
-    /* Delete email addresses */
-    if (isset($_POST['delete_email']) && isset ($_POST['emails_list'])){
-      if(!$this->acl_is_writeable("scalixEmailAddress")){
-        print_red(_("You are not allowed to modify alternate addresses"));
-      }else{
-        if (count($_POST['emails_list'])){
-          $this->delEmail ($_POST['emails_list']);
-        }
-      }
-    }
 
     $smarty->assign("mailboxClasses", $mailboxClasses);
     $smarty->assign("serverLanguages", $serverLanguages);
@@ -465,7 +424,91 @@ class scalixAccount extends plugin
             ));
   }
 
+
+  function saveCopyDialog()
+  {
+    if (isset($_POST['scalixTab'])){
+
+      /* Add email addresses */
+      if (isset($_POST['add_email'])){
+
+        /* Check write access */
+#        if(!$this->acl_is_writeable("scalixEmailAddress")){
+#          print_red(_("You are not allowed to modify alternate addresses"));
+#        }else{
+
+          /* Check if given value is not empty */
+          if ($_POST['email_address'] != ""){
+            $valid= FALSE;
+
+            /* Valid mail address */
+            if( ($this->is_template && !is_email($_POST['email_address'], TRUE)) || 
+                (!$this->is_template && !is_email($_POST['email_address'])) ){
+              print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
+            }else{
+              $valid = TRUE;
+            }
+
+            /* Mail address already in use ? */
+            if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
+              $ui= get_userinfo();
+              if ($user != $ui->username){
+                print_red (_("The address you're trying to add is already used by user")." '$user'.");
+              }
+            }
+#          }
+        }
+      }
+  
+      /* Delete email addresses */
+      if (isset($_POST['delete_email']) && isset ($_POST['emails_list'])){
+#        if(!$this->acl_is_writeable("scalixEmailAddress")){
+#          print_red(_("You are not allowed to modify alternate addresses"));
+#        }else{
+          if (count($_POST['emails_list'])){
+            $this->delEmail ($_POST['emails_list']);
+#          }
+        }
+      }
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    foreach ($this->fakeBooleanAttributes as $val){
+      if (isset($source["$val"][0])&&$source["$val"][0]=="TRUE"){
+        $this->$val = TRUE;
+      } else {
+        $this->$val = FALSE;
+      }
+    }
+
+    /* Load attributes containing arrays */
+    foreach (array("scalixEmailAddress") as $val){
+      if (isset($source["$val"]["count"])){
+        for ($i= 0; $i<$source["$val"]["count"]; $i++){
+          array_push($this->$val, $source["$val"][$i]);
+        }
+      }
+    }
+  }
+
+
+  /* Create the posix dialog part for copy & paste */
+  function getCopyDialog()
+  {
+    $smarty = get_smarty(); 
+    $smarty->assign("scalixEmailAddress",$this->scalixEmailAddress);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));    
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
 }
 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:rulere
 ?>
diff --git a/plugins/personal/scalix/paste_generic.tpl b/plugins/personal/scalix/paste_generic.tpl
new file mode 100644 (file)
index 0000000..4bdf489
--- /dev/null
@@ -0,0 +1,25 @@
+<table>
+       <tr>
+  <td style="vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/envelope.png" /><label for="emails_list"> {t}Scalix email addresses{/t}</label></h2>
+   <select id="emails_list" style="width:100%;height:100px;" name="emails_list[]" size="15"
+                multiple title="{t}List of scalix email addresses{/t}" >
+            {html_options values=$scalixEmailAddress output=$scalixEmailAddress}
+                       <option disabled>&nbsp;</option>
+   </select>
+   <br />
+   <input name="email_address" size="30" align="middle" maxlength="65" value="">
+   <input type=submit value="{t}Add{/t}" name="add_email">&nbsp;
+   <input type=submit value="{t}Delete{/t}" name="delete_email">
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="scalixTab" value="scalixTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.scalixMailnode.focus();
+  -->
+</script>