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: [
"vendors/modernizr.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-cookie/jquery.cookie-1.4.0.min.js",
"vendors/jquery-mousewheel/jquery.mousewheel-3.1.4.min.js",

View file

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

View file

@ -270,7 +270,7 @@ ko.bindingHandlers.draggable = {
}
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 () {

View file

@ -525,6 +525,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_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.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');

View file

@ -507,6 +507,21 @@ WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder,
}, 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 {string} sFolder

View file

@ -88,13 +88,14 @@ MailBoxFolderListViewModel.prototype.messagesDrop = function (oToFolder, oUi)
{
var
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
bCopy = '1' === oUi.helper.data('rl-copy'),
aUids = oUi.helper.data('rl-uids')
;
if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids))
{
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 {Array} aUidForRemove
* @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 : '';
bVisialEffectOnly = Utils.isUnd(bVisialEffectOnly) ? false : !!bVisialEffectOnly;
bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
var
iUnseenCount = 0 ,
@ -221,17 +221,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}) : []
;
if (!bVisialEffectOnly)
{
_.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen())
{
iUnseenCount++;
}
});
}
_.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen())
{
iUnseenCount++;
}
});
if (oFromFolder && !bVisialEffectOnly)
if (oFromFolder && !bCopy)
{
oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
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);
if (0 < iUnseenCount)
@ -254,31 +251,37 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
if (0 < aMessages.length)
{
_.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
{
oCurrentMessage = null;
oData.message(null);
}
oMessage.deleted(true);
});
_.delay(function () {
_.each(aMessages, function (oMessage) {
oData.messageList.remove(oMessage);
});
}, 400);
if (!bVisialEffectOnly)
if (bCopy)
{
_.each(aMessages, function (oMessage) {
oMessage.checked(false);
});
}
else
{
_.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
{
oCurrentMessage = null;
oData.message(null);
}
oMessage.deleted(true);
});
_.delay(function () {
_.each(aMessages, function (oMessage) {
oData.messageList.remove(oMessage);
});
}, 400);
RL.data().messageListIsNotCompleted(true);
RL.cache().setFolderHash(sFromFolderFullNameRaw, '');
}
if (Utils.isNormal(sToFolderFullNameRaw))
{
RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
}
if (Utils.isNormal(sToFolderFullNameRaw))
{
RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
}
}
};
@ -303,9 +306,10 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
}
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(), '');
@ -321,8 +325,9 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove
* @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)
{
@ -333,7 +338,9 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
if (oFromFolder && oToFolder)
{
RL.remote().messagesMove(
bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
RL.remote()[bCopy ? 'messagesCopy' : 'messagesMove'](
_.bind(this.moveOrDeleteResponse, this),
oFromFolder.fullNameRaw,
oToFolder.fullNameRaw,
@ -342,7 +349,7 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
oToFolder.actionBlink(true);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy);
return true;
}
}
@ -408,7 +415,7 @@ MailBoxMessageListViewModel.prototype.deleteSelectedMessageFromCurrentFolder = f
}
};
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem)
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem, bCopy)
{
if (oMessageListItem)
{
@ -418,7 +425,8 @@ MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageList
var oEl = Utils.draggeblePlace();
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
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;
};

View file

@ -561,6 +561,32 @@ class MailClient
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 int $iMessageStreamSize

View file

@ -4316,6 +4316,40 @@ class Actions
'' === $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 $sContentType

View file

@ -1,101 +1,102 @@
<?php
namespace RainLoop;
class Notifications
{
const InvalidToken = 101;
const AuthError = 102;
const AccessError = 103;
const ConnectionError = 104;
const CaptchaError = 105;
const SocialFacebookLoginAccessDisable = 106;
const SocialTwitterLoginAccessDisable = 107;
const SocialGoogleLoginAccessDisable = 108;
const DomainNotAllowed = 109;
const AccountNotAllowed = 110;
const CantGetMessageList = 201;
const CantGetMessage = 202;
const CantDeleteMessage = 203;
const CantMoveMessage = 204;
const CantSaveMessage = 301;
const CantSendMessage = 302;
const InvalidRecipients = 303;
const CantCreateFolder = 400;
const CantRenameFolder = 401;
const CantDeleteFolder = 402;
const CantSubscribeFolder = 403;
const CantUnsubscribeFolder = 404;
const CantDeleteNonEmptyFolder = 405;
const CantSaveSettings = 501;
const CantSavePluginSettings = 502;
const DomainAlreadyExists = 601;
const CantInstallPackage = 701;
const CantDeletePackage = 702;
const InvalidPluginPackage = 703;
const UnsupportedPluginPackage = 704;
const LicensingServerIsUnavailable = 710;
const LicensingExpired = 711;
const LicensingBanned = 712;
const DemoSendMessageError = 750;
const AccountAlreadyExists = 801;
const MailServerError = 901;
const UnknownNotification = 998;
const UnknownError = 999;
static public function GetNotificationsMessage($iCode)
{
static $aMap = array(
self::InvalidToken => 'InvalidToken',
self::AuthError => 'AuthError',
self::AccessError => 'AccessError',
self::ConnectionError => 'ConnectionError',
self::CaptchaError => 'CaptchaError',
self::SocialFacebookLoginAccessDisable => 'SocialFacebookLoginAccessDisable',
self::SocialTwitterLoginAccessDisable => 'SocialTwitterLoginAccessDisable',
self::SocialGoogleLoginAccessDisable => 'SocialGoogleLoginAccessDisable',
self::DomainNotAllowed => 'DomainNotAllowed',
self::AccountNotAllowed => 'AccountNotAllowed',
self::CantGetMessageList => 'CantGetMessageList',
self::CantGetMessage => 'CantGetMessage',
self::CantDeleteMessage => 'CantDeleteMessage',
self::CantMoveMessage => 'CantMoveMessage',
self::CantSaveMessage => 'CantSaveMessage',
self::CantSendMessage => 'CantSendMessage',
self::InvalidRecipients => 'InvalidRecipients',
self::CantCreateFolder => 'CantCreateFolder',
self::CantRenameFolder => 'CantRenameFolder',
self::CantDeleteFolder => 'CantDeleteFolder',
self::CantSubscribeFolder => 'CantSubscribeFolder',
self::CantUnsubscribeFolder => 'CantUnsubscribeFolder',
self::CantDeleteNonEmptyFolder => 'CantDeleteNonEmptyFolder',
self::CantSaveSettings => 'CantSaveSettings',
self::CantSavePluginSettings => 'CantSavePluginSettings',
self::DomainAlreadyExists => 'DomainAlreadyExists',
self::CantInstallPackage => 'CantInstallPackage',
self::CantDeletePackage => 'CantDeletePackage',
self::InvalidPluginPackage => 'InvalidPluginPackage',
self::UnsupportedPluginPackage => 'UnsupportedPluginPackage',
self::LicensingServerIsUnavailable => 'LicensingServerIsUnavailable',
self::LicensingExpired => 'LicensingExpired',
self::LicensingBanned => 'LicensingBanned',
self::DemoSendMessageError => 'DemoSendMessageError',
self::AccountAlreadyExists => 'AccountAlreadyExists',
self::MailServerError => 'MailServerError',
self::UnknownNotification => 'UnknownNotification',
self::UnknownError => 'UnknownError'
);
return isset($aMap[$iCode]) ? $aMap[$iCode].'['.$iCode.']' : 'UnknownNotification['.$iCode.']';
}
<?php
namespace RainLoop;
class Notifications
{
const InvalidToken = 101;
const AuthError = 102;
const AccessError = 103;
const ConnectionError = 104;
const CaptchaError = 105;
const SocialFacebookLoginAccessDisable = 106;
const SocialTwitterLoginAccessDisable = 107;
const SocialGoogleLoginAccessDisable = 108;
const DomainNotAllowed = 109;
const AccountNotAllowed = 110;
const CantGetMessageList = 201;
const CantGetMessage = 202;
const CantDeleteMessage = 203;
const CantMoveMessage = 204;
const CantCopyMessage = 205;
const CantSaveMessage = 301;
const CantSendMessage = 302;
const InvalidRecipients = 303;
const CantCreateFolder = 400;
const CantRenameFolder = 401;
const CantDeleteFolder = 402;
const CantSubscribeFolder = 403;
const CantUnsubscribeFolder = 404;
const CantDeleteNonEmptyFolder = 405;
const CantSaveSettings = 501;
const CantSavePluginSettings = 502;
const DomainAlreadyExists = 601;
const CantInstallPackage = 701;
const CantDeletePackage = 702;
const InvalidPluginPackage = 703;
const UnsupportedPluginPackage = 704;
const LicensingServerIsUnavailable = 710;
const LicensingExpired = 711;
const LicensingBanned = 712;
const DemoSendMessageError = 750;
const AccountAlreadyExists = 801;
const MailServerError = 901;
const UnknownNotification = 998;
const UnknownError = 999;
static public function GetNotificationsMessage($iCode)
{
static $aMap = array(
self::InvalidToken => 'InvalidToken',
self::AuthError => 'AuthError',
self::AccessError => 'AccessError',
self::ConnectionError => 'ConnectionError',
self::CaptchaError => 'CaptchaError',
self::SocialFacebookLoginAccessDisable => 'SocialFacebookLoginAccessDisable',
self::SocialTwitterLoginAccessDisable => 'SocialTwitterLoginAccessDisable',
self::SocialGoogleLoginAccessDisable => 'SocialGoogleLoginAccessDisable',
self::DomainNotAllowed => 'DomainNotAllowed',
self::AccountNotAllowed => 'AccountNotAllowed',
self::CantGetMessageList => 'CantGetMessageList',
self::CantGetMessage => 'CantGetMessage',
self::CantDeleteMessage => 'CantDeleteMessage',
self::CantMoveMessage => 'CantMoveMessage',
self::CantSaveMessage => 'CantSaveMessage',
self::CantSendMessage => 'CantSendMessage',
self::InvalidRecipients => 'InvalidRecipients',
self::CantCreateFolder => 'CantCreateFolder',
self::CantRenameFolder => 'CantRenameFolder',
self::CantDeleteFolder => 'CantDeleteFolder',
self::CantSubscribeFolder => 'CantSubscribeFolder',
self::CantUnsubscribeFolder => 'CantUnsubscribeFolder',
self::CantDeleteNonEmptyFolder => 'CantDeleteNonEmptyFolder',
self::CantSaveSettings => 'CantSaveSettings',
self::CantSavePluginSettings => 'CantSavePluginSettings',
self::DomainAlreadyExists => 'DomainAlreadyExists',
self::CantInstallPackage => 'CantInstallPackage',
self::CantDeletePackage => 'CantDeletePackage',
self::InvalidPluginPackage => 'InvalidPluginPackage',
self::UnsupportedPluginPackage => 'UnsupportedPluginPackage',
self::LicensingServerIsUnavailable => 'LicensingServerIsUnavailable',
self::LicensingExpired => 'LicensingExpired',
self::LicensingBanned => 'LicensingBanned',
self::DemoSendMessageError => 'DemoSendMessageError',
self::AccountAlreadyExists => 'AccountAlreadyExists',
self::MailServerError => 'MailServerError',
self::UnknownNotification => 'UnknownNotification',
self::UnknownError => 'UnknownError'
);
return isset($aMap[$iCode]) ? $aMap[$iCode].'['.$iCode.']' : 'UnknownNotification['.$iCode.']';
}
}

View file

@ -551,6 +551,7 @@ Enums.Notification = {
'CantGetMessage': 202,
'CantDeleteMessage': 203,
'CantMoveMessage': 204,
'CantCopyMessage': 205,
'CantSaveMessage': 301,
'CantSendMessage': 302,
@ -1111,6 +1112,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_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.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
@ -2476,7 +2478,7 @@ ko.bindingHandlers.draggable = {
}
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 () {

File diff suppressed because one or more lines are too long

View file

@ -551,6 +551,7 @@ Enums.Notification = {
'CantGetMessage': 202,
'CantDeleteMessage': 203,
'CantMoveMessage': 204,
'CantCopyMessage': 205,
'CantSaveMessage': 301,
'CantSendMessage': 302,
@ -1111,6 +1112,7 @@ Utils.initNotificationLanguage = function ()
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_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.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
@ -2476,7 +2478,7 @@ ko.bindingHandlers.draggable = {
}
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 () {
@ -10493,13 +10495,14 @@ MailBoxFolderListViewModel.prototype.messagesDrop = function (oToFolder, oUi)
{
var
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
bCopy = '1' === oUi.helper.data('rl-copy'),
aUids = oUi.helper.data('rl-uids')
;
if (MailBoxMessageListViewModel && MailBoxMessageListViewModel.__vm && Utils.isNormal(sFromFolderFullNameRaw) && Utils.isArray(aUids))
{
MailBoxMessageListViewModel.__vm.moveMessagesToFolder(
sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw);
sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
}
}
};
@ -10719,12 +10722,12 @@ MailBoxMessageListViewModel.prototype.cancelSearch = function ()
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove
* @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 : '';
bVisialEffectOnly = Utils.isUnd(bVisialEffectOnly) ? false : !!bVisialEffectOnly;
bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
var
iUnseenCount = 0 ,
@ -10738,17 +10741,14 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
}) : []
;
if (!bVisialEffectOnly)
{
_.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen())
{
iUnseenCount++;
}
});
}
_.each(aMessages, function (oMessage) {
if (oMessage && oMessage.unseen())
{
iUnseenCount++;
}
});
if (oFromFolder && !bVisialEffectOnly)
if (oFromFolder && !bCopy)
{
oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
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);
if (0 < iUnseenCount)
@ -10771,31 +10771,37 @@ MailBoxMessageListViewModel.prototype.removeMessagesFromList = function (sFromFo
if (0 < aMessages.length)
{
_.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
{
oCurrentMessage = null;
oData.message(null);
}
oMessage.deleted(true);
});
_.delay(function () {
_.each(aMessages, function (oMessage) {
oData.messageList.remove(oMessage);
});
}, 400);
if (!bVisialEffectOnly)
if (bCopy)
{
_.each(aMessages, function (oMessage) {
oMessage.checked(false);
});
}
else
{
_.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.requestHash === oMessage.requestHash)
{
oCurrentMessage = null;
oData.message(null);
}
oMessage.deleted(true);
});
_.delay(function () {
_.each(aMessages, function (oMessage) {
oData.messageList.remove(oMessage);
});
}, 400);
RL.data().messageListIsNotCompleted(true);
RL.cache().setFolderHash(sFromFolderFullNameRaw, '');
}
if (Utils.isNormal(sToFolderFullNameRaw))
{
RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
}
if (Utils.isNormal(sToFolderFullNameRaw))
{
RL.cache().setFolderHash(sToFolderFullNameRaw || '', '');
}
}
};
@ -10820,9 +10826,10 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
}
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(), '');
@ -10838,8 +10845,9 @@ MailBoxMessageListViewModel.prototype.moveOrDeleteResponse = function (sResult,
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove
* @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)
{
@ -10850,7 +10858,9 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
if (oFromFolder && oToFolder)
{
RL.remote().messagesMove(
bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
RL.remote()[bCopy ? 'messagesCopy' : 'messagesMove'](
_.bind(this.moveOrDeleteResponse, this),
oFromFolder.fullNameRaw,
oToFolder.fullNameRaw,
@ -10859,7 +10869,7 @@ MailBoxMessageListViewModel.prototype.moveMessagesToFolder = function (sFromFold
oToFolder.actionBlink(true);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw);
this.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy);
return true;
}
}
@ -10925,7 +10935,7 @@ MailBoxMessageListViewModel.prototype.deleteSelectedMessageFromCurrentFolder = f
}
};
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem)
MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem, bCopy)
{
if (oMessageListItem)
{
@ -10935,7 +10945,8 @@ MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageList
var oEl = Utils.draggeblePlace();
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
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;
};
@ -14381,6 +14392,21 @@ WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder,
}, 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 {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