Add copy message functionality to drag&drop (drag + shift) [#42]

+ Update jquery to 1.10.2
This commit is contained in:
RainLoop Team 2013-12-09 01:32:19 +04:00
parent 74af8f793a
commit f22b90dbe3
16 changed files with 318 additions and 201 deletions

View file

@ -113,7 +113,7 @@ module.exports = function (grunt) {
src: [ src: [
"vendors/modernizr.js", "vendors/modernizr.js",
"vendors/underscore/underscore-1.5.2.min.js", "vendors/underscore/underscore-1.5.2.min.js",
"vendors/jquery-1.10.1.min.js", "vendors/jquery-1.10.2.min.js",
"vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js", "vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js",
"vendors/jquery-cookie/jquery.cookie-1.4.0.min.js", "vendors/jquery-cookie/jquery.cookie-1.4.0.min.js",
"vendors/jquery-mousewheel/jquery.mousewheel-3.1.4.min.js", "vendors/jquery-mousewheel/jquery.mousewheel-3.1.4.min.js",

View file

@ -289,6 +289,7 @@ Enums.Notification = {
'CantGetMessage': 202, 'CantGetMessage': 202,
'CantDeleteMessage': 203, 'CantDeleteMessage': 203,
'CantMoveMessage': 204, 'CantMoveMessage': 204,
'CantCopyMessage': 205,
'CantSaveMessage': 301, 'CantSaveMessage': 301,
'CantSendMessage': 302, 'CantSendMessage': 302,

View file

@ -270,7 +270,7 @@ ko.bindingHandlers.draggable = {
} }
oConf['helper'] = function (oEvent) { oConf['helper'] = function (oEvent) {
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null); return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null, !!oEvent.shiftKey);
}; };
$(oElement).draggable(oConf).on('mousedown', function () { $(oElement).draggable(oConf).on('mousedown', function () {

View file

@ -525,6 +525,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE'); NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE'); NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE'); NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE'); NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE'); NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');

View file

@ -507,6 +507,21 @@ WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder,
}, null, '', ['MessageList', 'Message']); }, null, '', ['MessageList', 'Message']);
}; };
/**
* @param {?Function} fCallback
* @param {string} sFolder
* @param {string} sToFolder
* @param {Array} aUids
*/
WebMailAjaxRemoteStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageCopy', {
'FromFolder': sFolder,
'ToFolder': sToFolder,
'Uids': aUids.join(',')
});
};
/** /**
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sFolder * @param {string} sFolder

View file

@ -88,13 +88,14 @@ MailBoxFolderListViewModel.prototype.messagesDrop = function (oToFolder, oUi)
{ {
var var
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'), sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
bCopy = '1' === oUi.helper.data('rl-copy'),
aUids = oUi.helper.data('rl-uids') aUids = oUi.helper.data('rl-uids')
; ;
if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids)) if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids))
{ {
MailBoxMessageListViewModel.__vm.moveMessagesToFolder( MailBoxMessageListViewModel.__vm.moveMessagesToFolder(
sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw); sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
} }
} }
}; };

View file

@ -202,12 +202,12 @@ MailBoxMessageListViewModel.prototype.cancelSearch = function ()
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string=} sToFolderFullNameRaw * @param {string=} sToFolderFullNameRaw
* @param {boolean=} bVisialEffectOnly = false * @param {boolean=} bCopy = false
*/ */
MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bVisialEffectOnly) MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{ {
sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : ''; sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
bVisialEffectOnly = Utils.isUnd(bVisialEffectOnly) ? false : !!bVisialEffectOnly; bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
var var
iUnseenCount = 0 , iUnseenCount = 0 ,
@ -221,17 +221,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}) : [] }) : []
; ;
if (!bVisialEffectOnly)
{
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen()) if (oMessage && oMessage.unseen())
{ {
iUnseenCount++; iUnseenCount++;
} }
}); });
}
if (oFromFolder && !bVisialEffectOnly) if (oFromFolder && !bCopy)
{ {
oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ? oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
oFromFolder.messageCountAll() - aUidForRemove.length : 0); oFromFolder.messageCountAll() - aUidForRemove.length : 0);
@ -243,7 +240,7 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
} }
} }
if (oToFolder && !bVisialEffectOnly) if (oToFolder)
{ {
oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length); oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length);
if (0 < iUnseenCount) if (0 < iUnseenCount)
@ -253,6 +250,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
} }
if (0 < aMessages.length) if (0 < aMessages.length)
{
if (bCopy)
{
_.each(aMessages, function (oMessage) {
oMessage.checked(false);
});
}
else
{ {
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash) if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
@ -270,17 +275,15 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}); });
}, 400); }, 400);
if (!bVisialEffectOnly)
{
RL.data().messageListIsNotCompleted(true); RL.data().messageListIsNotCompleted(true);
RL.cache().setFolderHash(sFromFolderFullNameRaw, ''); RL.cache().setFolderHash(sFromFolderFullNameRaw, '');
}
if (Utils.isNormal(sToFolderFullNameRaw)) if (Utils.isNormal(sToFolderFullNameRaw))
{ {
RL.cache().setFolderHash(sToFolderFullNameRaw || '', ''); RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
} }
} }
}
}; };
/** /**
@ -303,9 +306,10 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
} }
else else
{ {
if (oData && Enums.Notification.CantMoveMessage === oData.ErrorCode) if (oData && -1 < Utils.inArray(oData.ErrorCode,
[Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
{ {
window.alert(Utils.getNotification(Enums.Notification.CantMoveMessage)); window.alert(Utils.getNotification(oData.ErrorCode));
} }
RL.cache().setFolderHash(RL.data().currentFolderFullNameRaw(), ''); RL.cache().setFolderHash(RL.data().currentFolderFullNameRaw(), '');
@ -321,8 +325,9 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string} sToFolderFullNameRaw * @param {string} sToFolderFullNameRaw
* @param {boolean=} bCopy = false
*/ */
MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw) MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{ {
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForRemove) && 0 < aUidForRemove.length) if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForRemove) && 0 < aUidForRemove.length)
{ {
@ -333,7 +338,9 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
if (oFromFolder && oToFolder) if (oFromFolder && oToFolder)
{ {
RL.remote().messagesMove( bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
RL.remote()[bCopy ? 'messagesCopy' : 'messagesMove'](
_.bind(this.moveOrDeleteResponse, this), _.bind(this.moveOrDeleteResponse, this),
oFromFolder.fullNameRaw, oFromFolder.fullNameRaw,
oToFolder.fullNameRaw, oToFolder.fullNameRaw,
@ -342,7 +349,7 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
oToFolder.actionBlink(true); oToFolder.actionBlink(true);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw); this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy);
return true; return true;
} }
} }
@ -408,7 +415,7 @@ MailBoxMessageListViewModel.prototype.deleteSelectedMessageFromCurrentFolder = f
} }
}; };
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem) MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem, bCopy)
{ {
if (oMessageListItem) if (oMessageListItem)
{ {
@ -418,7 +425,8 @@ MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageList
var oEl = Utils.draggeblePlace(); var oEl = Utils.draggeblePlace();
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw()); oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
oEl.data('rl-uids', RL.data().messageListCheckedOrSelectedUidsWithSubMails()); oEl.data('rl-uids', RL.data().messageListCheckedOrSelectedUidsWithSubMails());
oEl.find('.text').text(RL.data().messageListCheckedOrSelectedUidsWithSubMails().length); oEl.data('rl-copy', bCopy ? '1' : '0');
oEl.find('.text').text((bCopy ? '+' : '') + '' + RL.data().messageListCheckedOrSelectedUidsWithSubMails().length);
return oEl; return oEl;
}; };

View file

@ -561,6 +561,32 @@ class MailClient
return $this; return $this;
} }
/**
* @param string $sFromFolder
* @param string $sToFolder
* @param array $aIndexRange
* @param bool $bIndexIsUid
*
* @return \MailSo\Mail\MailClient
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function MessageCopy($sFromFolder, $sToFolder, $aIndexRange, $bIndexIsUid)
{
if (0 === \strlen($sFromFolder) || 0 === \strlen($sToFolder) ||
!\is_array($aIndexRange) || 0 === \count($aIndexRange))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
$this->oImapClient->FolderSelect($sFromFolder);
$this->oImapClient->MessageCopy($sToFolder, \implode(',', $aIndexRange), $bIndexIsUid);
return $this;
}
/** /**
* @param resource $rMessageStream * @param resource $rMessageStream
* @param int $iMessageStreamSize * @param int $iMessageStreamSize

View file

@ -4316,6 +4316,40 @@ class Actions
'' === $sHash ? false : array($sFromFolder, $sHash)); '' === $sHash ? false : array($sFromFolder, $sHash));
} }
/**
* @return array
*
* @throws \MailSo\Base\Exceptions\Exception
*/
public function DoMessageCopy()
{
$this->initMailClientConnection();
$sFromFolder = $this->GetActionParam('FromFolder', '');
$sToFolder = $this->GetActionParam('ToFolder', '');
$aUids = explode(',', (string) $this->GetActionParam('Uids', ''));
$aFilteredUids = array_filter($aUids, function (&$mUid) {
$mUid = (int) trim($mUid);
return 0 < $mUid;
});
try
{
$this->MailClient()->MessageCopy($sFromFolder, $sToFolder,
$aFilteredUids, true);
$sHash = $this->MailClient()->FolderHash($sFromFolder);
}
catch (\Exception $oException)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantCopyMessage, $oException);
}
return $this->DefaultResponse(__FUNCTION__,
'' === $sHash ? false : array($sFromFolder, $sHash));
}
/** /**
* @param string $sFileName * @param string $sFileName
* @param string $sContentType * @param string $sContentType

View file

@ -19,6 +19,7 @@ class Notifications
const CantGetMessage = 202; const CantGetMessage = 202;
const CantDeleteMessage = 203; const CantDeleteMessage = 203;
const CantMoveMessage = 204; const CantMoveMessage = 204;
const CantCopyMessage = 205;
const CantSaveMessage = 301; const CantSaveMessage = 301;
const CantSendMessage = 302; const CantSendMessage = 302;

View file

@ -551,6 +551,7 @@ Enums.Notification = {
'CantGetMessage': 202, 'CantGetMessage': 202,
'CantDeleteMessage': 203, 'CantDeleteMessage': 203,
'CantMoveMessage': 204, 'CantMoveMessage': 204,
'CantCopyMessage': 205,
'CantSaveMessage': 301, 'CantSaveMessage': 301,
'CantSendMessage': 302, 'CantSendMessage': 302,
@ -1111,6 +1112,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE'); NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE'); NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE'); NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE'); NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE'); NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
@ -2476,7 +2478,7 @@ ko.bindingHandlers.draggable = {
} }
oConf['helper'] = function (oEvent) { oConf['helper'] = function (oEvent) {
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null); return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null, !!oEvent.shiftKey);
}; };
$(oElement).draggable(oConf).on('mousedown', function () { $(oElement).draggable(oConf).on('mousedown', function () {

File diff suppressed because one or more lines are too long

View file

@ -551,6 +551,7 @@ Enums.Notification = {
'CantGetMessage': 202, 'CantGetMessage': 202,
'CantDeleteMessage': 203, 'CantDeleteMessage': 203,
'CantMoveMessage': 204, 'CantMoveMessage': 204,
'CantCopyMessage': 205,
'CantSaveMessage': 301, 'CantSaveMessage': 301,
'CantSendMessage': 302, 'CantSendMessage': 302,
@ -1111,6 +1112,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE'); NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE'); NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE'); NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE'); NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE'); NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
@ -2476,7 +2478,7 @@ ko.bindingHandlers.draggable = {
} }
oConf['helper'] = function (oEvent) { oConf['helper'] = function (oEvent) {
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null); return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null, !!oEvent.shiftKey);
}; };
$(oElement).draggable(oConf).on('mousedown', function () { $(oElement).draggable(oConf).on('mousedown', function () {
@ -10493,13 +10495,14 @@ MailBoxFolderListViewModel.prototype.messagesDrop = function (oToFolder, oUi)
{ {
var var
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'), sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
bCopy = '1' === oUi.helper.data('rl-copy'),
aUids = oUi.helper.data('rl-uids') aUids = oUi.helper.data('rl-uids')
; ;
if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids)) if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids))
{ {
MailBoxMessageListViewModel.__vm.moveMessagesToFolder( MailBoxMessageListViewModel.__vm.moveMessagesToFolder(
sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw); sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
} }
} }
}; };
@ -10719,12 +10722,12 @@ MailBoxMessageListViewModel.prototype.cancelSearch = function ()
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string=} sToFolderFullNameRaw * @param {string=} sToFolderFullNameRaw
* @param {boolean=} bVisialEffectOnly = false * @param {boolean=} bCopy = false
*/ */
MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bVisialEffectOnly) MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{ {
sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : ''; sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
bVisialEffectOnly = Utils.isUnd(bVisialEffectOnly) ? false : !!bVisialEffectOnly; bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
var var
iUnseenCount = 0 , iUnseenCount = 0 ,
@ -10738,17 +10741,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}) : [] }) : []
; ;
if (!bVisialEffectOnly)
{
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen()) if (oMessage && oMessage.unseen())
{ {
iUnseenCount++; iUnseenCount++;
} }
}); });
}
if (oFromFolder && !bVisialEffectOnly) if (oFromFolder && !bCopy)
{ {
oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ? oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
oFromFolder.messageCountAll() - aUidForRemove.length : 0); oFromFolder.messageCountAll() - aUidForRemove.length : 0);
@ -10760,7 +10760,7 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
} }
} }
if (oToFolder && !bVisialEffectOnly) if (oToFolder)
{ {
oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length); oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length);
if (0 < iUnseenCount) if (0 < iUnseenCount)
@ -10770,6 +10770,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
} }
if (0 < aMessages.length) if (0 < aMessages.length)
{
if (bCopy)
{
_.each(aMessages, function (oMessage) {
oMessage.checked(false);
});
}
else
{ {
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash) if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
@ -10787,17 +10795,15 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}); });
}, 400); }, 400);
if (!bVisialEffectOnly)
{
RL.data().messageListIsNotCompleted(true); RL.data().messageListIsNotCompleted(true);
RL.cache().setFolderHash(sFromFolderFullNameRaw, ''); RL.cache().setFolderHash(sFromFolderFullNameRaw, '');
}
if (Utils.isNormal(sToFolderFullNameRaw)) if (Utils.isNormal(sToFolderFullNameRaw))
{ {
RL.cache().setFolderHash(sToFolderFullNameRaw || '', ''); RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
} }
} }
}
}; };
/** /**
@ -10820,9 +10826,10 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
} }
else else
{ {
if (oData && Enums.Notification.CantMoveMessage === oData.ErrorCode) if (oData && -1 < Utils.inArray(oData.ErrorCode,
[Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
{ {
window.alert(Utils.getNotification(Enums.Notification.CantMoveMessage)); window.alert(Utils.getNotification(oData.ErrorCode));
} }
RL.cache().setFolderHash(RL.data().currentFolderFullNameRaw(), ''); RL.cache().setFolderHash(RL.data().currentFolderFullNameRaw(), '');
@ -10838,8 +10845,9 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
* @param {string} sFromFolderFullNameRaw * @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove * @param {Array} aUidForRemove
* @param {string} sToFolderFullNameRaw * @param {string} sToFolderFullNameRaw
* @param {boolean=} bCopy = false
*/ */
MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw) MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
{ {
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForRemove) && 0 < aUidForRemove.length) if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForRemove) && 0 < aUidForRemove.length)
{ {
@ -10850,7 +10858,9 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
if (oFromFolder && oToFolder) if (oFromFolder && oToFolder)
{ {
RL.remote().messagesMove( bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
RL.remote()[bCopy ? 'messagesCopy' : 'messagesMove'](
_.bind(this.moveOrDeleteResponse, this), _.bind(this.moveOrDeleteResponse, this),
oFromFolder.fullNameRaw, oFromFolder.fullNameRaw,
oToFolder.fullNameRaw, oToFolder.fullNameRaw,
@ -10859,7 +10869,7 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
oToFolder.actionBlink(true); oToFolder.actionBlink(true);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw); this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy);
return true; return true;
} }
} }
@ -10925,7 +10935,7 @@ MailBoxMessageListViewModel.prototype.deleteSelectedMessageFromCurrentFolder = f
} }
}; };
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem) MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem, bCopy)
{ {
if (oMessageListItem) if (oMessageListItem)
{ {
@ -10935,7 +10945,8 @@ MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageList
var oEl = Utils.draggeblePlace(); var oEl = Utils.draggeblePlace();
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw()); oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
oEl.data('rl-uids', RL.data().messageListCheckedOrSelectedUidsWithSubMails()); oEl.data('rl-uids', RL.data().messageListCheckedOrSelectedUidsWithSubMails());
oEl.find('.text').text(RL.data().messageListCheckedOrSelectedUidsWithSubMails().length); oEl.data('rl-copy', bCopy ? '1' : '0');
oEl.find('.text').text((bCopy ? '+' : '') + '' + RL.data().messageListCheckedOrSelectedUidsWithSubMails().length);
return oEl; return oEl;
}; };
@ -14381,6 +14392,21 @@ WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder,
}, null, '', ['MessageList', 'Message']); }, null, '', ['MessageList', 'Message']);
}; };
/**
* @param {?Function} fCallback
* @param {string} sFolder
* @param {string} sToFolder
* @param {Array} aUids
*/
WebMailAjaxRemoteStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
{
this.defaultRequest(fCallback, 'MessageCopy', {
'FromFolder': sFolder,
'ToFolder': sToFolder,
'Uids': aUids.join(',')
});
};
/** /**
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sFolder * @param {string} sFolder

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
vendors/jquery-1.10.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long