3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -1,65 +1,65 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.ApiEvents", {
mixins: {
observable: "Ext.mixin.Observable"
},
view: undefined,
widget: undefined,
element: undefined,
handlers: undefined,
settings: undefined,
enableKeyEvents: false,
isSelectMode: false,
hasCursor: false,
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
init: function (view, widgetElem, canvasElem, handlers, settings) {
this.view = view;
this.widget = widgetElem;
this.element = canvasElem;
this.handlers = new window.Asc.asc_CHandlersList(handlers);
this.settings = $.extend(true, {},
this.defaults, settings);
return this;
},
destroy: function () {
$(window).off("." + this.namespace);
return this;
},
enableKeyEventsHandler: function (f) {
this.enableKeyEvents = !!f;
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.ApiEvents", {
mixins: {
observable: "Ext.mixin.Observable"
},
view: undefined,
widget: undefined,
element: undefined,
handlers: undefined,
settings: undefined,
enableKeyEvents: false,
isSelectMode: false,
hasCursor: false,
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
init: function (view, widgetElem, canvasElem, handlers, settings) {
this.view = view;
this.widget = widgetElem;
this.element = canvasElem;
this.handlers = new window.Asc.asc_CHandlersList(handlers);
this.settings = $.extend(true, {},
this.defaults, settings);
return this;
},
destroy: function () {
$(window).off("." + this.namespace);
return this;
},
enableKeyEventsHandler: function (f) {
this.enableKeyEvents = !!f;
}
});

View File

@@ -1,94 +1,94 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Document", {
extend: "Ext.app.Controller",
config: {
refs: {},
control: {
"#id-btn-zoom-in": {
tap: "onZoomIn"
},
"#id-btn-zoom-out": {
tap: "onZoomOut"
}
}
},
_currZoom: 1,
_baseZoom: 1,
_maxZoom: 2,
_incrementZoom: 0.05,
init: function () {},
launch: function () {},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onDoubleTapEvent", Ext.bind(this._onDoubleTapDocument, this));
this.api.asc_registerCallback("asc_onStartAction", Ext.bind(this._onLongActionBegin, this));
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this._onLongActionEnd, this));
}
},
_onLongActionBegin: function (type, id) {},
_onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
var i = this.api.asc_getActiveWorksheetIndex();
this.api.asc_showWorksheet(i);
break;
}
}
},
_onDoubleTapDocument: function () {
if (this.api) {
if (this._currZoom != this._baseZoom) {
this._currZoom = this._baseZoom;
} else {
this._currZoom = this._maxZoom;
}
this.api.asc_setZoom(this._currZoom);
}
},
onZoomIn: function (event, node, opt) {
this._currZoom += this._incrementZoom;
if (this._currZoom > this._maxZoom) {
this._currZoom = this._maxZoom;
}
this.api.asc_setZoom(this._currZoom);
},
onZoomOut: function (event, node, opt) {
this._currZoom -= this._incrementZoom;
if (this._currZoom < this._baseZoom) {
this._currZoom = this._baseZoom;
}
this.api.asc_setZoom(this._currZoom);
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Document", {
extend: "Ext.app.Controller",
config: {
refs: {},
control: {
"#id-btn-zoom-in": {
tap: "onZoomIn"
},
"#id-btn-zoom-out": {
tap: "onZoomOut"
}
}
},
_currZoom: 1,
_baseZoom: 1,
_maxZoom: 2,
_incrementZoom: 0.05,
init: function () {},
launch: function () {},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onDoubleTapEvent", Ext.bind(this._onDoubleTapDocument, this));
this.api.asc_registerCallback("asc_onStartAction", Ext.bind(this._onLongActionBegin, this));
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this._onLongActionEnd, this));
}
},
_onLongActionBegin: function (type, id) {},
_onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
var i = this.api.asc_getActiveWorksheetIndex();
this.api.asc_showWorksheet(i);
break;
}
}
},
_onDoubleTapDocument: function () {
if (this.api) {
if (this._currZoom != this._baseZoom) {
this._currZoom = this._baseZoom;
} else {
this._currZoom = this._maxZoom;
}
this.api.asc_setZoom(this._currZoom);
}
},
onZoomIn: function (event, node, opt) {
this._currZoom += this._incrementZoom;
if (this._currZoom > this._maxZoom) {
this._currZoom = this._maxZoom;
}
this.api.asc_setZoom(this._currZoom);
},
onZoomOut: function (event, node, opt) {
this._currZoom -= this._incrementZoom;
if (this._currZoom < this._baseZoom) {
this._currZoom = this._baseZoom;
}
this.api.asc_setZoom(this._currZoom);
}
});

View File

@@ -1,296 +1,297 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Main", {
extend: "Ext.app.Controller",
editMode: false,
requires: ["Ext.Anim", "Ext.MessageBox", "SSE.controller.ApiEvents", "SSE.view.OpenCsvPanel"],
config: {
refs: {
mainView: "semainview"
}
},
launch: function () {
if (!this._isSupport()) {
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
return;
}
this.initControl();
var app = this.getApplication();
this.api = new Asc.spreadsheet_api("id-sdkeditor", "", SSE.controller.ApiEvents, {},
{});
this.api.asc_Init("../../../sdk/Fonts/");
this.api.asc_setMobileVersion(true);
this.api.asc_registerCallback("asc_onAdvancedOptions", Ext.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback("asc_onOpenDocumentProgress", Ext.bind(this.onOpenDocumentProgress, this));
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
this.api.asc_registerCallback("asc_onError", Ext.bind(this.onError, this));
this.api.asc_registerCallback("asc_onSaveUrl", Ext.bind(this.onSaveUrl, this));
this.api.asc_registerCallback("asc_onGetEditorPermissions", Ext.bind(this.onEditorPermissions, this));
Ext.each(app.getControllers(), function (controllerName) {
var controller = app.getController(controllerName);
controller && Ext.isFunction(controller.setApi) && controller.setApi(this.api);
},
this);
this.initApi();
this.editorConfig = {};
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
Common.Gateway.on("showmessage", Ext.bind(this.onExternalMessage, this));
Common.Gateway.on("processsaveresult", Ext.bind(this.onProcessSaveResult, this));
Common.Gateway.ready();
},
initControl: function () {},
initApi: function () {},
loadConfig: function (data) {
this.editorConfig = Ext.merge(this.editorConfig, data.config);
if ((this.editorConfig.user === undefined || this.editorConfig.user === null)) {
this.editorConfig.user = {};
if (this.editorConfig.users) {
this.editorConfig.userId = this.editorConfig.userId || 0;
for (var i = 0; i < this.editorConfig.users.length; i++) {
if (this.editorConfig.users[i].id === this.editorConfig.userId) {
this.editorConfig.user = {
id: this.editorConfig.users[i].id,
name: this.editorConfig.users[i].username
};
break;
}
}
}
}
this.editorConfig.user.id = this.editorConfig.user.id || ("uid-" + Ext.Date.now());
this.editorConfig.user.name = this.editorConfig.user.name || this.textAnonymous;
},
loadDocument: function (data) {
if (data.doc) {
this.permissions = data.doc.permissions;
var docInfo = {
Id: data.doc.key,
Url: data.doc.url,
Title: data.doc.title,
Format: data.doc.fileType,
Options: data.doc.options,
VKey: data.doc.vkey,
Origin: data.doc.origin,
UserId: this.editorConfig.user.id,
UserName: this.editorConfig.user.name
};
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions();
Common.component.Analytics.trackEvent("Load", "Start");
}
},
onEditorPermissions: function (params) {
this.permissions.edit !== false && (this.permissions.edit = params.asc_getCanEdit());
var modeEdit = this.permissions.edit === true && this.editorConfig.mode !== "view";
this.api.asc_setViewerMode(modeEdit);
this.api.asc_LoadDocument();
var profileName = this.getApplication().getCurrentProfile().getName();
this.getApplication().getController(profileName + ".Main").setMode(modeEdit);
},
goBack: function () {
Common.Gateway.goBack();
},
onError: function (id, level) {
this._hideLoadSplash();
var config = {
closable: false
};
switch (id) {
case c_oAscError.ID.Unknown:
config.message = this.unknownErrorText;
break;
case c_oAscError.ID.ConvertationTimeout:
config.message = this.convertationTimeoutText;
break;
case c_oAscError.ID.ConvertationError:
config.message = this.convertationErrorText;
break;
case c_oAscError.ID.DownloadError:
config.message = this.downloadErrorText;
break;
case c_oAscError.ID.UplImageSize:
config.message = this.uploadImageSizeMessage;
break;
case c_oAscError.ID.UplImageExt:
config.message = this.uploadImageExtMessage;
break;
case c_oAscError.ID.UplImageFileCount:
config.message = this.uploadImageFileCountMessage;
break;
case c_oAscError.ID.VKeyEncrypt:
config.msg = this.errorKeyEncrypt;
break;
case c_oAscError.ID.KeyExpire:
config.msg = this.errorKeyExpire;
break;
case c_oAscError.ID.UserCountExceed:
config.msg = this.errorUsersExceed;
break;
default:
config.message = this.errorDefaultMessage.replace("%1", id);
break;
}
if (level == c_oAscError.Level.Critical) {
Common.Gateway.reportError(id, config.message);
config.title = this.criticalErrorTitle;
config.message += "<br/>" + this.criticalErrorExtText;
config.buttons = Ext.Msg.OK;
config.fn = function (btn) {
if (btn == "ok") {
window.location.reload();
}
};
} else {
config.title = this.notcriticalErrorTitle;
config.buttons = Ext.Msg.OK;
config.fn = Ext.emptyFn;
}
Ext.Msg.show(config);
},
onSaveUrl: function (url) {
Common.Gateway.save(url);
},
onExternalMessage: function (msg) {
if (msg) {
this._hideLoadSplash();
Ext.Msg.show({
title: msg.title,
msg: "<br/>" + msg.msg,
icon: Ext.Msg[msg.severity.toUpperCase()],
buttons: Ext.Msg.OK
});
Common.component.Analytics.trackEvent("External Error", msg.title);
}
},
onAdvancedOptions: function (advOptions) {
if (advOptions.asc_getOptionId() == c_oAscAdvancedOptionsID["CSV"]) {
var preloader = Ext.get("loading-mask"),
me = this;
Ext.Anim.run(preloader, "slide", {
out: true,
direction: "up",
duration: 250,
after: function () {
preloader.hide();
}
});
var viewAdvOptionsCsv = Ext.Viewport.add({
xtype: "seopencsvpanel",
left: 0,
top: 0,
width: "100%",
height: "100%"
});
Ext.Anim.run(viewAdvOptionsCsv, "slide", {
out: false,
direction: "up",
duration: 1000
});
viewAdvOptionsCsv.on("close", Ext.bind(function (panel, result) {
preloader.show();
Ext.Anim.run(preloader, "slide", {
out: false,
direction: "down",
duration: 1000
});
Ext.Anim.run(viewAdvOptionsCsv, "slide", {
out: true,
direction: "down",
duration: 1000,
after: function () {
Ext.Viewport.remove(viewAdvOptionsCsv);
if (me.api) {
me.api.asc_setAdvancedOptions(c_oAscAdvancedOptionsID["CSV"], new Asc.asc_CCSVAdvancedOptions(result.encoding, result.delimiter));
}
}
});
},
this));
}
},
onOpenDocumentProgress: function (progress) {
var elem = document.getElementById("loadmask-text");
if (elem) {
var proc = (progress["CurrentFont"] + progress["CurrentImage"]) / (progress["FontsCount"] + progress["ImagesCount"]);
elem.innerHTML = this.textLoadingDocument + ": " + Math.round(proc * 100) + "%";
}
},
onOpenDocument: function () {
this._hideLoadSplash();
if (this.api) {
this.api.asc_cleanSelection();
}
},
onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
this.onOpenDocument();
break;
}
}
},
_hideLoadSplash: function () {
var preloader = Ext.get("loading-mask");
if (preloader) {
Ext.Anim.run(preloader, "fade", {
out: true,
duration: 1000,
after: function () {
preloader.destroy();
}
});
}
},
_isSupport: function () {
return (Ext.browser.is.WebKit && (Ext.os.is.iOS || Ext.os.is.Android || Ext.os.is.Desktop));
},
printText: "Printing...",
criticalErrorTitle: "Error",
notcriticalErrorTitle: "Warning",
errorDefaultMessage: "Error code: %1",
criticalErrorExtText: 'Press "Ok" to reload view page.',
uploadImageSizeMessage: "Maximium image size limit exceeded.",
uploadImageExtMessage: "Unknown image format.",
uploadImageFileCountMessage: "No images uploaded.",
unknownErrorText: "Unknown error.",
convertationTimeoutText: "Convertation timeout exceeded.",
convertationErrorText: "Convertation failed.",
downloadErrorText: "Download failed.",
unsupportedBrowserErrorText: "Your browser is not supported.",
errorKeyEncrypt: "Unknown key descriptor",
errorKeyExpire: "Key descriptor expired",
errorUsersExceed: "Count of users was exceed",
textAnonymous: "Anonymous",
textLoadingDocument: "LOADING DOCUMENT"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Main", {
extend: "Ext.app.Controller",
editMode: false,
requires: ["Ext.Anim", "Ext.MessageBox", "SSE.controller.ApiEvents", "SSE.view.OpenCsvPanel"],
config: {
refs: {
mainView: "semainview"
}
},
launch: function () {
if (!this._isSupport()) {
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
return;
}
this.initControl();
var app = this.getApplication();
this.api = new Asc.spreadsheet_api("id-sdkeditor", "", SSE.controller.ApiEvents, {},
{});
this.api.asc_Init("../../../sdk/Fonts/");
this.api.asc_setMobileVersion(true);
this.api.asc_registerCallback("asc_onAdvancedOptions", Ext.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback("asc_onOpenDocumentProgress", Ext.bind(this.onOpenDocumentProgress, this));
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
this.api.asc_registerCallback("asc_onError", Ext.bind(this.onError, this));
this.api.asc_registerCallback("asc_onSaveUrl", Ext.bind(this.onSaveUrl, this));
this.api.asc_registerCallback("asc_onGetEditorPermissions", Ext.bind(this.onEditorPermissions, this));
Ext.each(app.getControllers(), function (controllerName) {
var controller = app.getController(controllerName);
controller && Ext.isFunction(controller.setApi) && controller.setApi(this.api);
},
this);
this.initApi();
this.editorConfig = {};
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
Common.Gateway.on("showmessage", Ext.bind(this.onExternalMessage, this));
Common.Gateway.on("processsaveresult", Ext.bind(this.onProcessSaveResult, this));
Common.Gateway.ready();
},
initControl: function () {},
initApi: function () {},
loadConfig: function (data) {
this.editorConfig = Ext.merge(this.editorConfig, data.config);
if ((this.editorConfig.user === undefined || this.editorConfig.user === null)) {
this.editorConfig.user = {};
if (this.editorConfig.users) {
this.editorConfig.userId = this.editorConfig.userId || 0;
for (var i = 0; i < this.editorConfig.users.length; i++) {
if (this.editorConfig.users[i].id === this.editorConfig.userId) {
this.editorConfig.user = {
id: this.editorConfig.users[i].id,
name: this.editorConfig.users[i].username
};
break;
}
}
}
}
this.editorConfig.user.id = this.editorConfig.user.id || ("uid-" + Ext.Date.now());
this.editorConfig.user.name = this.editorConfig.user.name || this.textAnonymous;
},
loadDocument: function (data) {
if (data.doc) {
this.permissions = data.doc.permissions;
var docInfo = {
Id: data.doc.key,
Url: data.doc.url,
Title: data.doc.title,
Format: data.doc.fileType,
Options: data.doc.options,
VKey: data.doc.vkey,
Origin: data.doc.origin,
UserId: this.editorConfig.user.id,
UserName: this.editorConfig.user.name
};
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions();
Common.component.Analytics.trackEvent("Load", "Start");
}
},
onEditorPermissions: function (params) {
this.permissions.edit !== false && (this.permissions.edit = params.asc_getCanEdit());
var modeEdit = false;
this.api.asc_setViewerMode(!modeEdit);
this.api.asc_LoadDocument();
var profileName = this.getApplication().getCurrentProfile().getName();
this.getApplication().getController(profileName + ".Main").setMode(modeEdit);
},
goBack: function () {
Common.Gateway.goBack();
},
onError: function (id, level) {
this._hideLoadSplash();
var config = {
closable: false
};
switch (id) {
case c_oAscError.ID.Unknown:
config.message = this.unknownErrorText;
break;
case c_oAscError.ID.ConvertationTimeout:
config.message = this.convertationTimeoutText;
break;
case c_oAscError.ID.ConvertationError:
config.message = this.convertationErrorText;
break;
case c_oAscError.ID.DownloadError:
config.message = this.downloadErrorText;
break;
case c_oAscError.ID.UplImageSize:
config.message = this.uploadImageSizeMessage;
break;
case c_oAscError.ID.UplImageExt:
config.message = this.uploadImageExtMessage;
break;
case c_oAscError.ID.UplImageFileCount:
config.message = this.uploadImageFileCountMessage;
break;
case c_oAscError.ID.VKeyEncrypt:
config.msg = this.errorKeyEncrypt;
break;
case c_oAscError.ID.KeyExpire:
config.msg = this.errorKeyExpire;
break;
case c_oAscError.ID.UserCountExceed:
config.msg = this.errorUsersExceed;
break;
default:
config.message = this.errorDefaultMessage.replace("%1", id);
break;
}
if (level == c_oAscError.Level.Critical) {
Common.Gateway.reportError(id, config.message);
config.title = this.criticalErrorTitle;
config.message += "<br/>" + this.criticalErrorExtText;
config.buttons = Ext.Msg.OK;
config.fn = function (btn) {
if (btn == "ok") {
window.location.reload();
}
};
} else {
config.title = this.notcriticalErrorTitle;
config.buttons = Ext.Msg.OK;
config.fn = Ext.emptyFn;
}
Ext.Msg.show(config);
},
onSaveUrl: function (url) {
Common.Gateway.save(url);
},
onExternalMessage: function (msg) {
if (msg) {
this._hideLoadSplash();
Ext.Msg.show({
title: msg.title,
msg: "<br/>" + msg.msg,
icon: Ext.Msg[msg.severity.toUpperCase()],
buttons: Ext.Msg.OK
});
Common.component.Analytics.trackEvent("External Error", msg.title);
}
},
onAdvancedOptions: function (advOptions) {
if (advOptions.asc_getOptionId() == c_oAscAdvancedOptionsID["CSV"]) {
var preloader = Ext.get("loading-mask"),
me = this;
Ext.Anim.run(preloader, "slide", {
out: true,
direction: "up",
duration: 250,
after: function () {
preloader.hide();
}
});
var viewAdvOptionsCsv = Ext.Viewport.add({
xtype: "seopencsvpanel",
left: 0,
top: 0,
width: "100%",
height: "100%"
});
Ext.Anim.run(viewAdvOptionsCsv, "slide", {
out: false,
direction: "up",
duration: 1000
});
viewAdvOptionsCsv.on("close", Ext.bind(function (panel, result) {
preloader.show();
Ext.Anim.run(preloader, "slide", {
out: false,
direction: "down",
duration: 1000
});
Ext.Anim.run(viewAdvOptionsCsv, "slide", {
out: true,
direction: "down",
duration: 1000,
after: function () {
Ext.Viewport.remove(viewAdvOptionsCsv);
if (me.api) {
me.api.asc_setAdvancedOptions(c_oAscAdvancedOptionsID["CSV"], new Asc.asc_CCSVAdvancedOptions(result.encoding, result.delimiter));
}
}
});
},
this));
}
},
onOpenDocumentProgress: function (progress) {
var elem = document.getElementById("loadmask-text");
if (elem) {
var proc = (progress["CurrentFont"] + progress["CurrentImage"]) / (progress["FontsCount"] + progress["ImagesCount"]);
elem.innerHTML = this.textLoadingDocument + ": " + Math.round(proc * 100) + "%";
}
},
onOpenDocument: function () {
this._hideLoadSplash();
this.api.asc_Resize();
if (this.api) {
this.api.asc_cleanSelection();
}
},
onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
this.onOpenDocument();
break;
}
}
},
_hideLoadSplash: function () {
var preloader = Ext.get("loading-mask");
if (preloader) {
Ext.Anim.run(preloader, "fade", {
out: true,
duration: 1000,
after: function () {
preloader.destroy();
}
});
}
},
_isSupport: function () {
return (Ext.browser.is.WebKit && (Ext.os.is.iOS || Ext.os.is.Android || Ext.os.is.Desktop));
},
printText: "Printing...",
criticalErrorTitle: "Error",
notcriticalErrorTitle: "Warning",
errorDefaultMessage: "Error code: %1",
criticalErrorExtText: 'Press "Ok" to reload view page.',
uploadImageSizeMessage: "Maximium image size limit exceeded.",
uploadImageExtMessage: "Unknown image format.",
uploadImageFileCountMessage: "No images uploaded.",
unknownErrorText: "Unknown error.",
convertationTimeoutText: "Convertation timeout exceeded.",
convertationErrorText: "Convertation failed.",
downloadErrorText: "Download failed.",
unsupportedBrowserErrorText: "Your browser is not supported.",
errorKeyEncrypt: "Unknown key descriptor",
errorKeyExpire: "Key descriptor expired",
errorUsersExceed: "Count of users was exceed",
textAnonymous: "Anonymous",
textLoadingDocument: "LOADING DOCUMENT"
});

View File

@@ -1,96 +1,96 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Search", {
extend: "Ext.app.Controller",
config: {
refs: {
nextResult: "#id-btn-search-prev",
previousResult: "#id-btn-search-next",
searchField: "#id-field-search"
},
control: {
"#id-btn-search-prev": {
tap: "onPreviousResult"
},
"#id-btn-search-next": {
tap: "onNextResult"
},
"#id-field-search": {
keyup: "onSearchKeyUp",
change: "onSearchChange",
clearicontap: "onSearchClear"
}
}
},
_step: -1,
init: function () {},
setApi: function (o) {
this.api = o;
},
onNextResult: function () {
var searchField = this.getSearchField();
if (this.api && searchField) {
this.api.asc_findText(searchField.getValue(), true, true);
}
},
onPreviousResult: function () {
var searchField = this.getSearchField();
if (this.api && searchField) {
this.api.asc_findText(searchField.getValue(), true, false);
}
},
onSearchKeyUp: function (field, e) {
var keyCode = e.event.keyCode,
searchField = this.getSearchField();
if (keyCode == 13 && this.api) {
this.api.asc_findText(searchField.getValue(), true, true);
}
this.updateNavigation();
},
onSearchChange: function (field, newValue, oldValue) {
this.updateNavigation();
},
onSearchClear: function (field, e) {
this.updateNavigation();
window.focus();
document.activeElement.blur();
},
updateNavigation: function () {
var searchField = this.getSearchField(),
nextResult = this.getNextResult(),
previousResult = this.getPreviousResult();
if (searchField && nextResult && previousResult) {
nextResult.setDisabled(searchField.getValue() == "");
previousResult.setDisabled(searchField.getValue() == "");
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.Search", {
extend: "Ext.app.Controller",
config: {
refs: {
nextResult: "#id-btn-search-prev",
previousResult: "#id-btn-search-next",
searchField: "#id-field-search"
},
control: {
"#id-btn-search-prev": {
tap: "onPreviousResult"
},
"#id-btn-search-next": {
tap: "onNextResult"
},
"#id-field-search": {
keyup: "onSearchKeyUp",
change: "onSearchChange",
clearicontap: "onSearchClear"
}
}
},
_step: -1,
init: function () {},
setApi: function (o) {
this.api = o;
},
onNextResult: function () {
var searchField = this.getSearchField();
if (this.api && searchField) {
this.api.asc_findText(searchField.getValue(), true, true);
}
},
onPreviousResult: function () {
var searchField = this.getSearchField();
if (this.api && searchField) {
this.api.asc_findText(searchField.getValue(), true, false);
}
},
onSearchKeyUp: function (field, e) {
var keyCode = e.event.keyCode,
searchField = this.getSearchField();
if (keyCode == 13 && this.api) {
this.api.asc_findText(searchField.getValue(), true, true);
}
this.updateNavigation();
},
onSearchChange: function (field, newValue, oldValue) {
this.updateNavigation();
},
onSearchClear: function (field, e) {
this.updateNavigation();
window.focus();
document.activeElement.blur();
},
updateNavigation: function () {
var searchField = this.getSearchField(),
nextResult = this.getNextResult(),
previousResult = this.getPreviousResult();
if (searchField && nextResult && previousResult) {
nextResult.setDisabled(searchField.getValue() == "");
previousResult.setDisabled(searchField.getValue() == "");
}
}
});

View File

@@ -1,96 +1,96 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.WorksheetList", {
extend: "Ext.app.Controller",
config: {
refs: {
worksheetList: {
selector: "seworksheetlist list"
}
}
},
init: function () {
this.control({
"seworksheetlist list": {
itemtap: this._worksheetSelect
}
});
},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
}
},
_worksheetSelect: function (dataview, index, target, record, event, eOpts) {
if (this.api) {
var dataIndex = record.data.index;
if ((dataIndex > -1) && (this.api.asc_getActiveWorksheetIndex() != dataIndex)) {
this.api.asc_showWorksheet(dataIndex);
}
}
},
_loadWorksheets: function () {
if (this.api) {
var worksheetsStore = Ext.getStore("Worksheets"),
worksheetList = this.getWorksheetList();
if (worksheetsStore && worksheetList) {
worksheetsStore.removeAll(false);
var worksheetsCount = this.api.asc_getWorksheetsCount();
if (worksheetsCount) {
for (var i = 0; i < worksheetsCount; i++) {
var result = {
text: this.api.asc_getWorksheetName(i),
index: i
};
worksheetsStore.add(result);
}
var rec = worksheetsStore.findRecord("index", this.api.asc_getActiveWorksheetIndex());
if (rec) {
worksheetList.select(rec);
} else {
worksheetList.select(worksheetsStore.getAt(0));
}
}
}
}
},
onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
this._loadWorksheets();
break;
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.WorksheetList", {
extend: "Ext.app.Controller",
config: {
refs: {
worksheetList: {
selector: "seworksheetlist list"
}
}
},
init: function () {
this.control({
"seworksheetlist list": {
itemtap: this._worksheetSelect
}
});
},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
}
},
_worksheetSelect: function (dataview, index, target, record, event, eOpts) {
if (this.api) {
var dataIndex = record.data.index;
if ((dataIndex > -1) && (this.api.asc_getActiveWorksheetIndex() != dataIndex)) {
this.api.asc_showWorksheet(dataIndex);
}
}
},
_loadWorksheets: function () {
if (this.api) {
var worksheetsStore = Ext.getStore("Worksheets"),
worksheetList = this.getWorksheetList();
if (worksheetsStore && worksheetList) {
worksheetsStore.removeAll(false);
var worksheetsCount = this.api.asc_getWorksheetsCount();
if (worksheetsCount) {
for (var i = 0; i < worksheetsCount; i++) {
var result = {
text: this.api.asc_getWorksheetName(i),
index: i
};
worksheetsStore.add(result);
}
var rec = worksheetsStore.findRecord("index", this.api.asc_getActiveWorksheetIndex());
if (rec) {
worksheetList.select(rec);
} else {
worksheetList.select(worksheetsStore.getAt(0));
}
}
}
}
},
onLongActionEnd: function (type, id) {
if (type === c_oAscAsyncActionType["BlockInteraction"]) {
switch (id) {
case c_oAscAsyncAction["Open"]:
this._loadWorksheets();
break;
}
}
}
});

View File

@@ -1,76 +1,76 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.phone.Main", {
extend: "SSE.controller.Main",
requires: ["Ext.Anim"],
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar"
},
control: {}
},
launch: function () {
this.callParent(arguments);
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {
this.callParent(arguments);
},
setApi: function (o) {
this.api = o;
this.api.asc_enableKeyEvents(true);
},
setDocumentName: function (name) {
var caption = this.getDocumentNameLabel();
if (caption) {
caption.setHtml(Ext.String.htmlEncode(name));
}
},
onTapBack: function () {
Common.Gateway.goBack();
},
setMode: function (mode) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (mode == "edit") {
viewToolbar && viewToolbar.hide();
searchToolbar && searchToolbar.hide();
this.api && this.api.asc_enableKeyEvents(true);
} else {
viewToolbar && viewToolbar.show();
this.api && this.api.asc_enableKeyEvents(false);
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.phone.Main", {
extend: "SSE.controller.Main",
requires: ["Ext.Anim"],
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar"
},
control: {}
},
launch: function () {
this.callParent(arguments);
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {
this.callParent(arguments);
},
setApi: function (o) {
this.api = o;
this.api.asc_enableKeyEvents(true);
},
setDocumentName: function (name) {
var caption = this.getDocumentNameLabel();
if (caption) {
caption.setHtml(Ext.String.htmlEncode(name));
}
},
onTapBack: function () {
Common.Gateway.goBack();
},
setMode: function (mode) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (mode == "edit") {
viewToolbar && viewToolbar.hide();
searchToolbar && searchToolbar.hide();
this.api && this.api.asc_enableKeyEvents(true);
} else {
viewToolbar && viewToolbar.show();
this.api && this.api.asc_enableKeyEvents(false);
}
}
});

View File

@@ -1,73 +1,73 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.tablet.Main", {
extend: "SSE.controller.Main",
requires: ["Ext.Anim"],
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar"
},
control: {}
},
launch: function () {
this.callParent(arguments);
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {
this.callParent(arguments);
},
setApi: function (o) {
this.api = o;
this.api.asc_enableKeyEvents(true);
},
setDocumentName: function (name) {
var caption = this.getDocumentNameLabel();
if (caption) {
caption.setHtml(Ext.String.htmlEncode(name));
}
},
setMode: function (mode) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (mode == "edit") {
viewToolbar && viewToolbar.hide();
searchToolbar && searchToolbar.hide();
this.api && this.api.asc_enableKeyEvents(true);
} else {
viewToolbar && viewToolbar.show();
this.api && this.api.asc_enableKeyEvents(false);
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.tablet.Main", {
extend: "SSE.controller.Main",
requires: ["Ext.Anim"],
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar"
},
control: {}
},
launch: function () {
this.callParent(arguments);
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {
this.callParent(arguments);
},
setApi: function (o) {
this.api = o;
this.api.asc_enableKeyEvents(true);
},
setDocumentName: function (name) {
var caption = this.getDocumentNameLabel();
if (caption) {
caption.setHtml(Ext.String.htmlEncode(name));
}
},
setMode: function (mode) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (mode == "edit") {
viewToolbar && viewToolbar.hide();
searchToolbar && searchToolbar.hide();
this.api && this.api.asc_enableKeyEvents(true);
} else {
viewToolbar && viewToolbar.show();
this.api && this.api.asc_enableKeyEvents(false);
}
}
});

View File

@@ -1,261 +1,261 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.toolbar.View", {
extend: "Ext.app.Controller",
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar",
worksheetPanel: "#id-worksheets-panel",
doneButton: "#id-tb-btn-view-done",
searchButton: "#id-tb-btn-search",
fullscreenButton: "#id-tb-btn-fullscreen",
shareButton: "#id-tb-btn-view-share",
worksheetsButton: "#id-tb-btn-pages"
},
control: {
doneButton: {
tap: "onTapDoneButton"
},
searchButton: {
tap: "onTapSearchButton"
},
fullscreenButton: {
tap: "onTapFullscreenButton"
},
shareButton: {
tap: "onTapShareButton"
},
worksheetsButton: {
tap: "onTapWorksheets"
},
"#id-worksheets-panel seworksheetlist list": {
itemtap: "onSelectWorksheet"
}
},
searchMode: false,
fullscreenMode: false
},
launch: function () {
this.callParent(arguments);
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onTapEvent", Ext.bind(this.onSingleTapDocument, this));
}
},
loadConfig: function (data) {
var doneButton = this.getDoneButton();
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
doneButton.show();
}
},
applySearchMode: function (search) {
if (!Ext.isBoolean(search)) {
Ext.Logger.error("Invalid parameters.");
} else {
var me = this,
searchToolbar = me.getSearchToolbar(),
searchButton = me.getSearchButton();
if (searchToolbar) {
if (search) {
searchButton && searchButton.addCls("x-button-pressing");
if (me.getFullscreenMode()) {
searchToolbar.show({
easing: "ease-out",
preserveEndState: true,
autoClear: false,
from: {
top: "22px",
opacity: 0.3
},
to: {
top: "44px",
opacity: 0.9
}
});
} else {
searchToolbar.show();
}
} else {
if (me.getFullscreenMode()) {
searchToolbar.hide({
easing: "ease-in",
to: {
top: "22px",
opacity: 0.3
}
});
} else {
searchToolbar.hide();
}
}
}
return search;
}
},
applyFullscreenMode: function (fullscreen) {
if (!Ext.isBoolean(fullscreen)) {
Ext.Logger.error("Invalid parameters.");
} else {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar(),
fullscreenButton = this.getFullscreenButton(),
popClipCmp = Ext.ComponentQuery.query("popclip");
if (popClipCmp.length > 0) {
popClipCmp[0].hide();
}
if (viewToolbar && searchToolbar) {
if (fullscreen) {
fullscreenButton && fullscreenButton.addCls("x-button-pressing");
viewToolbar.setStyle({
position: "absolute",
left: 0,
top: 0,
right: 0,
opacity: 0.9,
"z-index": 17
});
searchToolbar.setStyle({
position: "absolute",
left: 0,
top: "44px",
right: 0,
opacity: 0.9,
"z-index": 16
});
this.setHiddenToolbars(true);
} else {
viewToolbar.setStyle({
position: "initial",
opacity: 1
});
searchToolbar.setStyle({
position: "initial",
opacity: 1
});
viewToolbar.setDocked("top");
searchToolbar.setDocked("top");
}
}
return fullscreen;
}
},
setHiddenToolbars: function (hide) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (viewToolbar && searchToolbar) {
if (hide) {
viewToolbar.hide({
easing: "ease-out",
from: {
opacity: 0.9
},
to: {
opacity: 0
}
});
searchToolbar.hide({
easing: "ease-out",
from: {
opacity: 0.9
},
to: {
opacity: 0
}
});
} else {
viewToolbar.show({
preserveEndState: true,
easing: "ease-in",
from: {
opacity: 0
},
to: {
opacity: 0.9
}
});
this.getSearchMode() && searchToolbar.show({
preserveEndState: true,
easing: "ease-in",
from: {
opacity: 0
},
to: {
opacity: 0.9
}
});
}
}
},
onTapDoneButton: function () {
Common.Gateway.goBack();
},
onTapSearchButton: function (btn) {
this.setSearchMode(!this.getSearchMode());
},
onTapFullscreenButton: function (btn) {
this.setFullscreenMode(!this.getFullscreenMode());
if (this.api) {
this.api.asc_Resize();
}
},
onTapShareButton: function () {
this.api && this.api.asc_Print();
Common.component.Analytics.trackEvent("ToolBar View", "Share");
},
onSingleTapDocument: function () {
var viewToolbar = this.getViewToolbar();
if (viewToolbar && this.getFullscreenMode()) {
this.setHiddenToolbars(!viewToolbar.isHidden());
}
},
onTapWorksheets: function () {
var worksheetPanel = this.getWorksheetPanel(),
worksheetsButton = this.getWorksheetsButton();
if (worksheetPanel) {
worksheetPanel.showBy(worksheetsButton);
}
},
onSelectWorksheet: function (dataview, index, target, record, event, eOpts) {
var worksheetPanel = this.getWorksheetPanel();
if (worksheetPanel) {
worksheetPanel.hide();
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("SSE.controller.toolbar.View", {
extend: "Ext.app.Controller",
config: {
refs: {
viewToolbar: "viewtoolbar",
searchToolbar: "searchtoolbar",
worksheetPanel: "#id-worksheets-panel",
doneButton: "#id-tb-btn-view-done",
searchButton: "#id-tb-btn-search",
fullscreenButton: "#id-tb-btn-fullscreen",
shareButton: "#id-tb-btn-view-share",
worksheetsButton: "#id-tb-btn-pages"
},
control: {
doneButton: {
tap: "onTapDoneButton"
},
searchButton: {
tap: "onTapSearchButton"
},
fullscreenButton: {
tap: "onTapFullscreenButton"
},
shareButton: {
tap: "onTapShareButton"
},
worksheetsButton: {
tap: "onTapWorksheets"
},
"#id-worksheets-panel seworksheetlist list": {
itemtap: "onSelectWorksheet"
}
},
searchMode: false,
fullscreenMode: false
},
launch: function () {
this.callParent(arguments);
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
},
initControl: function () {
this.callParent(arguments);
},
initApi: function () {},
setApi: function (o) {
this.api = o;
if (this.api) {
this.api.asc_registerCallback("asc_onTapEvent", Ext.bind(this.onSingleTapDocument, this));
}
},
loadConfig: function (data) {
var doneButton = this.getDoneButton();
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
doneButton.show();
}
},
applySearchMode: function (search) {
if (!Ext.isBoolean(search)) {
Ext.Logger.error("Invalid parameters.");
} else {
var me = this,
searchToolbar = me.getSearchToolbar(),
searchButton = me.getSearchButton();
if (searchToolbar) {
if (search) {
searchButton && searchButton.addCls("x-button-pressing");
if (me.getFullscreenMode()) {
searchToolbar.show({
easing: "ease-out",
preserveEndState: true,
autoClear: false,
from: {
top: "22px",
opacity: 0.3
},
to: {
top: "44px",
opacity: 0.9
}
});
} else {
searchToolbar.show();
}
} else {
if (me.getFullscreenMode()) {
searchToolbar.hide({
easing: "ease-in",
to: {
top: "22px",
opacity: 0.3
}
});
} else {
searchToolbar.hide();
}
}
}
return search;
}
},
applyFullscreenMode: function (fullscreen) {
if (!Ext.isBoolean(fullscreen)) {
Ext.Logger.error("Invalid parameters.");
} else {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar(),
fullscreenButton = this.getFullscreenButton(),
popClipCmp = Ext.ComponentQuery.query("popclip");
if (popClipCmp.length > 0) {
popClipCmp[0].hide();
}
if (viewToolbar && searchToolbar) {
if (fullscreen) {
fullscreenButton && fullscreenButton.addCls("x-button-pressing");
viewToolbar.setStyle({
position: "absolute",
left: 0,
top: 0,
right: 0,
opacity: 0.9,
"z-index": 17
});
searchToolbar.setStyle({
position: "absolute",
left: 0,
top: "44px",
right: 0,
opacity: 0.9,
"z-index": 16
});
this.setHiddenToolbars(true);
} else {
viewToolbar.setStyle({
position: "initial",
opacity: 1
});
searchToolbar.setStyle({
position: "initial",
opacity: 1
});
viewToolbar.setDocked("top");
searchToolbar.setDocked("top");
}
}
return fullscreen;
}
},
setHiddenToolbars: function (hide) {
var viewToolbar = this.getViewToolbar(),
searchToolbar = this.getSearchToolbar();
if (viewToolbar && searchToolbar) {
if (hide) {
viewToolbar.hide({
easing: "ease-out",
from: {
opacity: 0.9
},
to: {
opacity: 0
}
});
searchToolbar.hide({
easing: "ease-out",
from: {
opacity: 0.9
},
to: {
opacity: 0
}
});
} else {
viewToolbar.show({
preserveEndState: true,
easing: "ease-in",
from: {
opacity: 0
},
to: {
opacity: 0.9
}
});
this.getSearchMode() && searchToolbar.show({
preserveEndState: true,
easing: "ease-in",
from: {
opacity: 0
},
to: {
opacity: 0.9
}
});
}
}
},
onTapDoneButton: function () {
Common.Gateway.goBack();
},
onTapSearchButton: function (btn) {
this.setSearchMode(!this.getSearchMode());
},
onTapFullscreenButton: function (btn) {
this.setFullscreenMode(!this.getFullscreenMode());
if (this.api) {
this.api.asc_Resize();
}
},
onTapShareButton: function () {
this.api && this.api.asc_Print();
Common.component.Analytics.trackEvent("ToolBar View", "Share");
},
onSingleTapDocument: function () {
var viewToolbar = this.getViewToolbar();
if (viewToolbar && this.getFullscreenMode()) {
this.setHiddenToolbars(!viewToolbar.isHidden());
}
},
onTapWorksheets: function () {
var worksheetPanel = this.getWorksheetPanel(),
worksheetsButton = this.getWorksheetsButton();
if (worksheetPanel) {
worksheetPanel.showBy(worksheetsButton);
}
},
onSelectWorksheet: function (dataview, index, target, record, event, eOpts) {
var worksheetPanel = this.getWorksheetPanel();
if (worksheetPanel) {
worksheetPanel.hide();
}
}
});