Many fixes

New ownCloud package with a built-in webmail
This commit is contained in:
RainLoop Team 2015-02-12 01:39:27 +04:00
parent 323dd34c8b
commit 6116597f6f
56 changed files with 1137 additions and 232 deletions

View file

@ -50,6 +50,37 @@
}
});
Globals.$win.on('resize', function () {
Events.pub('window.resize');
});
Events.sub('window.resize', _.throttle(function () {
var
iH = Globals.$win.height(),
iW = Globals.$win.height()
;
if (Globals.$win.__sizes[0] !== iH || Globals.$win.__sizes[1] !== iW)
{
Globals.$win.__sizes[0] = iH;
Globals.$win.__sizes[1] = iW;
Events.pub('window.resize.real');
}
}, 50));
// TODO
// Events.sub({
// 'window.resize': function () {
// window.console.log('window.resize');
// },
// 'window.resize.real': function () {
// window.console.log('window.resize.real');
// }
// });
Globals.$doc.on('keydown', function (oEvent) {
if (oEvent && oEvent.ctrlKey)
{
@ -315,6 +346,8 @@
ssm.ready();
require('Stores/Language').populate();
require('Stores/Theme').populate();
require('Stores/Social').populate();

View file

@ -41,6 +41,7 @@
MessageModel = require('Model/Message'),
AccountModel = require('Model/Account'),
IdentityModel = require('Model/Identity'),
TemplateModel = require('Model/Template'),
OpenPgpKeyModel = require('Model/OpenPgpKey'),
AbstractApp = require('App/Abstract')
@ -611,12 +612,10 @@
{
Utils.delegateRunOnDestroy(TemplateStore.templates());
IdentityStore.templates(_.map(oData.Result['Templates'], function (oIdentityData) {
return {
'id': Utils.pString(oIdentityData['Id']),
'name': Utils.pString(oIdentityData['Name'])
};
}));
TemplateStore.templates(_.compact(_.map(oData.Result['Templates'], function (oTemplateData) {
var oTemplate = new TemplateModel();
return oTemplate.parse(oTemplateData) ? oTemplate : null;
})));
}
});
};

View file

@ -45,6 +45,7 @@
'Sieve': 'SIEVE',
'Filters': 'FILTERS',
'AttachmentThumbnails': 'ATTACHMENT_THUMBNAILS',
'Templates': 'TEMPLATES',
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS'
};

View file

@ -28,12 +28,24 @@
*/
Events.prototype.sub = function (sName, fFunc, oContext)
{
if (Utils.isUnd(this.oSubs[sName]))
if (Utils.isObject(sName))
{
this.oSubs[sName] = [];
}
oContext = fFunc || null;
fFunc = null;
this.oSubs[sName].push([fFunc, oContext]);
_.each(sName, function (fSubFunc, sSubName) {
this.sub(sSubName, fSubFunc, oContext);
}, this);
}
else
{
if (Utils.isUnd(this.oSubs[sName]))
{
this.oSubs[sName] = [];
}
this.oSubs[sName].push([fFunc, oContext]);
}
return this;
};

View file

@ -20,6 +20,8 @@
Globals.$html = $('html');
Globals.$div = $('<div></div>');
Globals.$win.__sizes = [0, 0];
/**
* @type {?}
*/
@ -255,7 +257,7 @@
});
Globals.keyScopeReal.subscribe(function (sValue) {
// window.console.log(sValue);
// window.console.log(sValue); //TODO
key.setScope(sValue);
});

View file

@ -106,8 +106,13 @@
.replace("\u0002", '').replace("\u0002", '')
.replace("\u0003", '').replace("\u0003", '')
.replace("\u0003", '').replace("\u0003", '')
.replace("\u0004", '').replace("\u0004", '')
.replace("\u0004", '').replace("\u0004", '')
.replace("\u0005", '').replace("\u0005", '')
.replace("\u0005", '').replace("\u0005", '')
;
}
};
/**
* @param {boolean=} bWrapIsHtml = false
* @param {boolean=} bClearSignatureSigns = false

View file

@ -24,6 +24,7 @@
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
Utils.isObject = _.isObject;
Utils.isFunc = _.isFunction;
Utils.isUnd = _.isUndefined;
Utils.isNull = _.isNull;

View file

@ -41,7 +41,7 @@
AbstractModel.prototype.onDestroy = function ()
{
Utils.disposeObject(this);
// window.console.log('onDestroy: ' + this.sModelName);
// window.console.log('onDestroy: ' + this.sModelName); // TODO
};
module.exports = AbstractModel;

View file

@ -7,6 +7,8 @@
_ = require('_'),
ko = require('ko'),
Utils = require('Common/Utils'),
AbstractModel = require('Knoin/AbstractModel')
;
@ -24,6 +26,7 @@
this.id = sID;
this.name = sName;
this.body = sBody;
this.populated = true;
this.deleteAccess = ko.observable(false);
}
@ -45,6 +48,30 @@
*/
TemplateModel.prototype.body = '';
/**
* @type {boolean}
*/
TemplateModel.prototype.populated = true;
/**
* @type {boolean}
*/
TemplateModel.prototype.parse = function (oItem)
{
var bResult = false;
if (oItem && 'Object/Template' === oItem['@Object'])
{
this.id = Utils.pString(oItem['ID']);
this.name = Utils.pString(oItem['Name']);
this.body = Utils.pString(oItem['Body']);
this.populated = !!oItem['Populated'];
bResult = true;
}
return bResult;
};
module.exports = TemplateModel;
}());

View file

@ -85,8 +85,11 @@
'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
}
// kn.addSettingsViewModel(require('Settings/User/Templates'),
// 'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
if (Settings.capa(Enums.Capa.Templates))
{
kn.addSettingsViewModel(require('Settings/User/Templates'),
'SettingsTemplates', 'SETTINGS_LABELS/LABEL_TEMPLATES_NAME', 'templates');
}
kn.addSettingsViewModel(require('Settings/User/Folders'),
'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');

View file

@ -34,6 +34,7 @@
this.capaGravatar = CapaAdminStore.gravatar;
this.capaAdditionalAccounts = CapaAdminStore.additionalAccounts;
this.capaAttachmentThumbnails = CapaAdminStore.attachmentThumbnails;
this.capaTemplates = CapaAdminStore.templates;
this.allowLanguagesOnSettings = AppAdminStore.allowLanguagesOnSettings;
this.weakPassword = AppAdminStore.weakPassword;
@ -105,6 +106,12 @@
});
});
self.capaTemplates.subscribe(function (bValue) {
Remote.saveAdminConfig(null, {
'CapaTemplates': bValue ? '1' : '0'
});
});
self.capaGravatar.subscribe(function (bValue) {
Remote.saveAdminConfig(null, {
'CapaGravatar': bValue ? '1' : '0'

View file

@ -9,7 +9,6 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Links = require('Common/Links'),

View file

@ -293,7 +293,17 @@
/**
* @param {?Function} fCallback
*/
RemoteUserStorage.prototype.templateGetById = function (fCallback, sID, sName, sBody)
RemoteUserStorage.prototype.templateDelete = function (fCallback, sID)
{
this.defaultRequest(fCallback, 'TemplateDelete', {
'IdToDelete': sID
});
};
/**
* @param {?Function} fCallback
*/
RemoteUserStorage.prototype.templateSetup = function (fCallback, sID, sName, sBody)
{
this.defaultRequest(fCallback, 'TemplateSetup', {
'ID': sID,

View file

@ -25,6 +25,7 @@
this.userBackground = ko.observable(false);
this.openPGP = ko.observable(false);
this.twoFactorAuth = ko.observable(false);
this.templates = ko.observable(false);
}
CapaAdminStore.prototype.populate = function()
@ -38,6 +39,7 @@
this.userBackground(Settings.capa(Enums.Capa.UserBackground));
this.openPGP(Settings.capa(Enums.Capa.OpenPGP));
this.twoFactorAuth(Settings.capa(Enums.Capa.TwoFactor));
this.templates(Settings.capa(Enums.Capa.Templates));
};
module.exports = new CapaAdminStore();

View file

@ -5,9 +5,9 @@
var
_ = require('_'),
ko = require('ko'),
ko = require('ko')
Remote = require('Storage/User/Remote')
// Remote = require('Storage/User/Remote')
;
/**
@ -27,16 +27,16 @@
})));
}, this);
this.templatesNames.subscribe(function (aList) {
if (this.templatesNames.skipFirst)
{
this.templatesNames.skipFirst = false;
}
else if (aList && 1 < aList.length)
{
Remote.templatesSortOrder(null, aList);
}
}, this);
// this.templatesNames.subscribe(function (aList) {
// if (this.templatesNames.skipFirst)
// {
// this.templatesNames.skipFirst = false;
// }
// else if (aList && 1 < aList.length)
// {
// Remote.templatesSortOrder(null, aList);
// }
// }, this);
}
module.exports = new TemplateUserStore();

View file

@ -1,5 +1,5 @@
.b-settings-identities {
.b-settings-templates {
.process-place {
text-align: center;

View file

@ -2,11 +2,15 @@
.b-template-add-content {
&.modal {
width: 700px;
width: 750px;
}
.modal-header {
background-color: #fff;
}
.e-template-place {
height: 300px;
}
}
}

View file

@ -80,7 +80,7 @@
this.bFromDraft = false;
this.sReferences = '';
this.triggerForResize = _.bind(this.triggerForResize, this);
this.resizerTrigger = _.bind(this.resizerTrigger, this);
this.allowContacts = !!AppStore.contactsIsAllowed();
@ -90,8 +90,6 @@
this.capaOpenPGP = PgpStore.capaOpenPGP;
this.resizer = ko.observable(false).extend({'throttle': 50});
this.identitiesDropdownTrigger = ko.observable(false);
this.to = ko.observable('');
@ -241,11 +239,13 @@
}
}, this);
this.editorResizeThrottle = _.throttle(_.bind(this.editorResize, this), 100);
this.resizer = ko.observable(false).extend({'throttle': 50});
this.resizer.subscribe(function () {
this.editorResizeThrottle();
}, this);
this.resizer.subscribe(_.bind(function () {
if (this.oEditor){
this.oEditor.resize();
}
}, this));
this.canBeSendedOrSaved = ko.computed(function () {
return !this.sending() && !this.saving();
@ -429,9 +429,9 @@
}
}, this);
this.showCc.subscribe(this.triggerForResize);
this.showBcc.subscribe(this.triggerForResize);
this.showReplyTo.subscribe(this.triggerForResize);
this.showCc.subscribe(this.resizerTrigger);
this.showBcc.subscribe(this.resizerTrigger);
this.showReplyTo.subscribe(this.resizerTrigger);
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
@ -1230,7 +1230,7 @@
this.currentIdentity(oIdentity);
}
this.triggerForResize();
this.resizerTrigger();
};
ComposePopupView.prototype.onFocus = function ()
@ -1244,15 +1244,7 @@
this.oEditor.focus();
}
this.triggerForResize();
};
ComposePopupView.prototype.editorResize = function ()
{
if (this.oEditor)
{
this.oEditor.resize();
}
this.resizerTrigger();
};
ComposePopupView.prototype.tryToClosePopup = function ()
@ -1315,7 +1307,7 @@
return false;
});
Globals.$win.on('resize', self.triggerForResize);
Events.sub('window.resize.real', this.resizerTrigger);
if (this.dropboxEnabled())
{
@ -2034,10 +2026,9 @@
});
};
ComposePopupView.prototype.triggerForResize = function ()
ComposePopupView.prototype.resizerTrigger = function ()
{
this.resizer(!this.resizer());
this.editorResizeThrottle();
};
module.exports = ComposePopupView;

View file

@ -36,6 +36,7 @@
this.name.focus = ko.observable(false);
this.body = ko.observable('');
this.body.loading = ko.observable(false);
this.body.error = ko.observable(false);
this.name.subscribe(function () {
@ -51,6 +52,8 @@
this.addTemplateCommand = Utils.createCommand(this, function () {
this.populateBodyFromEditor();
this.name.error('' === Utils.trim(this.name()));
this.body.error('' === Utils.trim(this.body()) ||
':HTML:' === Utils.trim(this.body()));
@ -109,40 +112,52 @@
this.submitRequest(false);
this.submitError('');
if (this.editor)
{
this.setBody('');
}
};
TemplatePopupView.prototype.setBody = function (sBody)
{
if (this.editor)
{
if (':HTML:' === sBody.substr(0, 6))
{
this.editor.setHtml(sBody.substr(6), false);
}
else
{
this.editor.setPlain(sBody, false);
}
}
};
TemplatePopupView.prototype.populateBodyFromEditor = function ()
{
if (this.editor)
{
this.body(
(this.editor.isHtml() ? ':HTML:' : '') + this.editor.getData()
);
}
};
TemplatePopupView.prototype.editorSetBody = function (sBody)
{
var
self = this,
fEditorSetData = function (sBody) {
if (self.editor)
{
if (':HTML:' === sBody.substr(0, 6))
{
self.editor.setHtml(sBody.substr(6), false);
}
else
{
self.editor.setPlain(sBody, false);
}
}
}
;
if (!this.editor && this.signatureDom())
{
var self = this;
this.editor = new HtmlEditor(self.signatureDom(), function () {
self.body(
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
);
self.populateBodyFromEditor();
}, function () {
fEditorSetData(sBody);
self.setBody(sBody);
});
}
else if (this.editor)
else
{
fEditorSetData(sBody);
this.setBody(sBody);
}
};
@ -156,16 +171,44 @@
{
this.id(oTemplate.id);
this.name(oTemplate.name);
this.body(oTemplate.body);
this.body.loading(true);
if (oTemplate.populated)
{
self.editorSetBody(this.body());
}
else
{
this.body.loading(true);
self.body.error(false);
Remote.templateGetById(function () {
Remote.templateGetById(function (sResult, oData) {
self.body.loading(false);
self.body.loading(false);
self.editorSetBody('');
if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
'Object/Template' === oData.Result['@Object'] && Utils.isNormal(oData.Result['Body']))
{
oTemplate.body = oData.Result['Body'];
oTemplate.populated = true;
}, this.id());
self.body(oTemplate.body);
self.body.error(false);
}
else
{
self.body('');
self.body.error(true);
}
self.editorSetBody(self.body());
}, this.id());
}
}
else
{
self.editorSetBody('');
}
};

View file

@ -423,11 +423,11 @@
this.showFullInfo.subscribe(fCheckHeaderHeight);
this.message.subscribe(fCheckHeaderHeight);
Globals.$win.on('resize', function () {
Events.sub('window.resize', _.throttle(function () {
_.delay(fCheckHeaderHeight, 1);
_.delay(fCheckHeaderHeight, 200);
_.delay(fCheckHeaderHeight, 500);
});
}, 50));
this.showFullInfo.subscribe(function () {
Utils.windowResize();