CommonJS (research/3)

This commit is contained in:
RainLoop Team 2014-08-22 19:08:56 +04:00
parent 586abbb802
commit 06bb124379
99 changed files with 51037 additions and 42961 deletions

View file

@ -118,7 +118,7 @@
*/
AttachmentModel.prototype.linkDownload = function ()
{
return LinkBuilder.attachmentDownload(this.download); // TODO cjs
return LinkBuilder.attachmentDownload(this.download);
};
/**
@ -126,7 +126,7 @@
*/
AttachmentModel.prototype.linkPreview = function ()
{
return LinkBuilder.attachmentPreview(this.download); // TODO cjs
return LinkBuilder.attachmentPreview(this.download);
};
/**

View file

@ -6,11 +6,13 @@
var
_ = require('../External/underscore.js'),
ko = require('./External/ko.js'),
ko = require('../External/ko.js'),
$window = require('../External/$window.js'),
Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js')
Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js')
;
/**
@ -42,18 +44,7 @@
this.actionBlink = ko.observable(false).extend({'falseTimeout': 1000});
this.nameForEdit = ko.observable('');
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0);
@ -150,11 +141,6 @@
iType = this.type()
;
if (Enums.FolderType.Inbox === iType)
{
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
}
if (0 < iCount)
{
if (Enums.FolderType.Draft === iType)
@ -290,6 +276,25 @@
});
}, this);
// subscribe
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.messageCountUnread.subscribe(function (iUnread) {
if (Enums.FolderType.Inbox === this.type())
{
Events.pub('mailbox.inbox-unread-count', [iUnread]);
}
}, this);
return this;
};

View file

@ -346,16 +346,17 @@
MessageModel.prototype.computeSenderEmail = function ()
{
var
sSent = RL.data().sentFolder(),
sDraft = RL.data().draftFolder()
;
var
Data = require('../Storages/WebMailDataStorage.js'),
sSent = Data.sentFolder(),
sDraft = Data.draftFolder()
;
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toEmailsString() : this.fromEmailString());
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toEmailsString() : this.fromEmailString());
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toClearEmailsString() : this.fromClearEmailString());
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toClearEmailsString() : this.fromClearEmailString());
};
/**
@ -424,6 +425,7 @@
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
{
var
Data = require('../Storages/WebMailDataStorage.js'),
bResult = false,
iPriority = Enums.MessagePriority.Normal
;
@ -442,7 +444,7 @@
this.proxy = !!oJsonMessage.ExternalProxy;
if (RL.data().capaOpenPGP()) // TODO cjs
if (Data.capaOpenPGP())
{
this.isPgpSigned(!!oJsonMessage.PgpSigned);
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
@ -731,7 +733,7 @@
*/
MessageModel.prototype.viewLink = function ()
{
return LinkBuilder.messageViewLink(this.requestHash);// TODO cjs
return LinkBuilder.messageViewLink(this.requestHash);
};
/**
@ -739,7 +741,7 @@
*/
MessageModel.prototype.downloadLink = function ()
{
return LinkBuilder.messageDownloadLink(this.requestHash);// TODO cjs
return LinkBuilder.messageDownloadLink(this.requestHash);
};
/**
@ -1079,7 +1081,7 @@
this.body.data('rl-plain-raw', this.plainRaw);
if (RL.data().capaOpenPGP()) // TODO cjs
if (Data.capaOpenPGP())
{
this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
@ -1091,7 +1093,7 @@
MessageModel.prototype.storePgpVerifyDataToDom = function ()
{
if (this.body && RL.data().capaOpenPGP()) // TODO cjs
if (this.body && Data.capaOpenPGP())
{
this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
@ -1107,7 +1109,7 @@
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
if (RL.data().capaOpenPGP()) // TODO cjs
if (Data.capaOpenPGP())
{
this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
@ -1132,7 +1134,7 @@
aRes = [],
mPgpMessage = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
aPublicKeys = Data.findPublicKeysByEmail(sFrom),
oValidKey = null,
oValidSysKey = null,
sPlain = ''
@ -1158,7 +1160,7 @@
if (oValidKey)
{
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
if (oValidSysKey)
{
sPlain = mPgpMessage.getText();
@ -1195,8 +1197,8 @@
mPgpMessage = null,
mPgpMessageDecrypted = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKey = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
oPrivateKey = RL.data().findSelfPrivateKey(sPassword), // TODO cjs
aPublicKey = Data.findPublicKeysByEmail(sFrom),
oPrivateKey = Data.findSelfPrivateKey(sPassword),
oValidKey = null,
oValidSysKey = null,
sPlain = ''
@ -1229,7 +1231,7 @@
if (oValidKey)
{
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
if (oValidSysKey)
{
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);