> On 5/29/06, Tomas Kuliavas <[EMAIL PROTECTED]> wrote:
>
>> For 1.4.x see
>> https://sourceforge.net/tracker/index.php?func=detail&aid=859825&group_id=311&atid=300311
>
> Thanx for the info.
> If it isn't possible to get it working in v1.5.x, then I can use
> v1.4.6, for the users who need to copy mails marked as spam, to the
> non-spam folder, until is possible to get a copy button in v1.5.x
>
>> 1.5.1+ needs different changes. I think they all are in
>> mailbox_display.php.
>
> Do you know what I shall look for?
> I've tried to search for "copy", but there were only 2 places in the
> file, where the word "copy" was and they was both comments.
>
> If I could make a copy of the code, for the delete button and modify
> that, that would great, I just don't know who to do it :-D

Search for code that does 'move'. In IMAP message move is performed with
two operations. Copy message and flag message as deleted.

attached sample changes in 1.5.2cvs. You should be able locate related
code in 1.5.1 showMessagesForMailbox() and handleMessageListForm()
functions.

-- 
Tomas
Index: mailbox_display.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/mailbox_display.php,v
retrieving revision 1.462
diff -u -w -r1.462 mailbox_display.php
--- mailbox_display.php 5 Apr 2006 00:22:01 -0000       1.462
+++ mailbox_display.php 29 May 2006 16:46:53 -0000
@@ -1004,7 +1004,8 @@
                            'undeleteButton'=> 1,
                            'bypass_trash'  => 1,
                            'expungeButton' => 1,
-                           'moveButton'    => 1
+                           'moveButton'    => 1,
+                           'copyButton'    => 1
                            );
     /* user prefs control */
     $aUserControl = array (
@@ -1018,7 +1019,8 @@
                            'undeleteButton'=> 1,
                            'bypass_trash'  => 1,
                            'expungeButton' => 1,
-                           'moveButton'    => 1
+                           'moveButton'    => 1,
+                           'copyButton'    => 1
 
                           );
 
@@ -1043,7 +1045,8 @@
                            'undeleteButton'=> $showUndelete,
                            'bypass_trash'  => $showByPassTrash,
                            'expungeButton' => $showExpunge,
-                           'moveButton'    => $showMove
+                           'moveButton'    => $showMove,
+                           'copyButton'    => 1
                           );
     $aButtonStrings = array(
                            'markUnflagged' => _("Unflag"),
@@ -1055,7 +1058,8 @@
                            'undeleteButton'  => _("Undelete"),
                            'bypass_trash'  => _("Bypass Trash"),
                            'expungeButton' => _("Expunge"),
-                           'moveButton'          => _("Move")
+                           'moveButton'          => _("Move"),
+                           'copyButton'          => _("Copy")
                            );
 
 
@@ -1081,6 +1085,7 @@
                 $aFormElements[$k] = array($aButtonStrings[$k],'checkbox');
                 break;
               case 'moveButton':
+              case 'copyButton':
                 $aFormElements['targetMailbox'] =
                    array(sqimap_mailbox_option_list($imapConnection, 
array(strtolower($lastTargetMailbox)), 0, $boxes),'select');
                 $aFormElements['mailbox']       = 
array($aMailbox['NAME'],'hidden');
@@ -1223,6 +1228,7 @@
 function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = 
array()) {
     /* incoming formdata */
     $sButton = (sqgetGlobalVar('moveButton',      $sTmp, SQ_POST)) ? 'move'    
     : $sButton;
+    $sButton = (sqgetGlobalVar('copyButton',      $sTmp, SQ_POST)) ? 'copy'    
     : $sButton;
     $sButton = (sqgetGlobalVar('expungeButton',   $sTmp, SQ_POST)) ? 'expunge' 
     : $sButton;
     $sButton = (sqgetGlobalVar('forward',         $sTmp, SQ_POST)) ? 'forward' 
     : $sButton;
     $sButton = (sqgetGlobalVar('delete',          $sTmp, SQ_POST)) ? 
'setDeleted'   : $sButton;
@@ -1271,6 +1277,10 @@
             sqsession_register($targetMailbox,'lastTargetMailbox');
             $bExpunge = true;
             break;
+          case 'copy':
+            $aUpdatedMsgs = 
sqimap_msgs_list_copy($imapConnection,$aUid,$targetMailbox,true,$mailbox);
+            sqsession_register($targetMailbox,'lastTargetMailbox');
+            break;
           case 'forward':
             $aMsgHeaders = array();
             foreach ($aUid as $iUid) {
Index: message_list.tpl
===================================================================
RCS file: 
/cvsroot/squirrelmail/squirrelmail/templates/default/message_list.tpl,v
retrieving revision 1.34
diff -u -w -r1.34 message_list.tpl
--- message_list.tpl    6 May 2006 06:46:25 -0000       1.34
+++ message_list.tpl    29 May 2006 16:47:20 -0000
@@ -131,7 +131,7 @@
         foreach ($aFormElements as $key => $value) {
             switch ($value[1]) {
             case 'submit':
-                if ($key != 'moveButton' && $key != 'delete' && $key != 
'undeleteButton') { // add move in a different table cell
+                if ($key != 'moveButton' && $key != 'copyButton' && $key != 
'delete' && $key != 'undeleteButton') { // add move in a different table cell
 ?>
                   <input type="submit" name="<?php echo $key; ?>" value="<?php 
echo $value[0]; ?>" class="message_control_button" />&nbsp;
 <?php
@@ -174,13 +174,18 @@
               </td>
 <?php
         } // if (isset($aFormElements['delete']))
-        if (isset($aFormElements['moveButton'])) {
+        if (isset($aFormElements['moveButton']) || 
isset($aFormElements['copyButton'])) {
 ?>
               <td class="message_control_move">
                     <select name="targetMailbox">
                        <?php echo $aFormElements['targetMailbox'][0];?>
                     </select>
+<?php         if (isset($aFormElements['moveButton'])) { ?>
                   <input type="submit" name="moveButton" value="<?php echo 
$aFormElements['moveButton'][0]; ?>" class="message_control_button" />
+<?php         }
+              if (isset($aFormElements['copyButton'])) { ?>
+                  <input type="submit" name="copyButton" value="<?php echo 
$aFormElements['copyButton'][0]; ?>" class="message_control_button" />
+<?php         } ?>
               </td>
 
 <?php

Reply via email to