*/
function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) {
global $PHP_SELF;
- global $boxes;
+ global $boxes, $show_copy_buttons;
$highlight_list = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false;
$fancy_index_highlite = (isset($aProps['config']['fancy_index_highlite'])) ? $aProps['config']['fancy_index_highlite'] : true;
$sMailbox = (isset($aProps['mailbox'])) ? $aProps['mailbox'] : false;
$sTargetModule = (isset($aProps['module'])) ? $aProps['module'] : 'read_body';
$show_flag_buttons = (isset($aProps['config']['show_flag_buttons'])) ? $aProps['config']['show_flag_buttons'] : true;
+
+ /* allows to control copy button in function call. If array key is not set, code follows user preferences */
+ if (isset($aProps['config']['show_copy_buttons']))
+ $show_copy_buttons = $aProps['config']['show_copy_buttons'];
+
$lastTargetMailbox = (isset($aProps['config']['lastTargetMailbox'])) ? $aProps['config']['lastTargetMailbox'] : '';
$aOrder = array_keys($aProps['columns']);
$trash_folder = (isset($aProps['config']['trash_folder']) && $aProps['config']['trash_folder'])
/* future admin control over displayable buttons */
-
$aAdminControl = array(
'markUnflagged' => 1,
'markFlagged' => 1,
'undeleteButton'=> 1,
'bypass_trash' => 1,
'expungeButton' => 1,
- 'moveButton' => 1
+ 'moveButton' => 1,
+ 'copyButton' => 1
);
+
/* user prefs control */
$aUserControl = array (
'undeleteButton'=> 1,
'bypass_trash' => 1,
'expungeButton' => 1,
- 'moveButton' => 1
+ 'moveButton' => 1,
+ 'copyButton' => $show_copy_buttons
);
$showMove = ($aMailbox['RIGHTS'] != 'READ-ONLY') ? true : false;
$showExpunge = (!$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' &&
in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true)) ? true : false;
+
+ /* Button options that depend on IMAP server and selected folder */
$aImapControl = array (
'markUnflagged' => in_array('\\flagged',$aMailbox['PERMANENTFLAGS'], true),
'markFlagged' => in_array('\\flagged',$aMailbox['PERMANENTFLAGS'], true),
'undeleteButton'=> $showUndelete,
'bypass_trash' => $showByPassTrash,
'expungeButton' => $showExpunge,
- 'moveButton' => $showMove
+ 'moveButton' => $showMove,
+ 'copyButton' => 1
);
+ /* Button strings */
$aButtonStrings = array(
'markUnflagged' => _("Unflag"),
'markFlagged' => _("Flag"),
'undeleteButton' => _("Undelete"),
'bypass_trash' => _("Bypass Trash"),
'expungeButton' => _("Expunge"),
- 'moveButton' => _("Move")
+ 'moveButton' => _("Move"),
+ 'copyButton' => _("Copy")
);
$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');
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;
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) {
global $base_uri, $draft_folder, $where, $what, $color, $sort,
$startMessage, $PHP_SELF, $save_as_draft,
$enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
- $username, $delete_prev_next_display,
+ $username, $delete_prev_next_display, $show_copy_buttons,
$compose_new_win, $javascript_on, $compose_width, $compose_height;
//FIXME cleanup argument list, use $aMailbox where possible
}
$menu_row .= '</select> ';
- $menu_row .= getButton('submit', 'moveButton',_("Move")) . "\n" . '</form>';
+ $menu_row .= getButton('submit', 'moveButton',_("Move")) . "\n";
+
+ // Add msg copy button
+ if ($show_copy_buttons) {
+ $menu_row .= getButton('submit', 'copyButton', _("Copy"));
+ }
+
+ $menu_row .= '</form>';
}
$menu_row .= '</td></tr>';
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" />
<?php
</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