diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js
index d61245c723..8e9c567bd7 100644
--- a/apps/api/documents/api.js
+++ b/apps/api/documents/api.js
@@ -58,7 +58,8 @@
remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group.
},
userInfoGroups: ["Group1", ""], // show tooltips/cursors/info in header only for users in userInfoGroups groups. [""] - means users without group, [] - don't show any users, null/undefined/"" - show all users
- protect: // default = true. show/hide protect tab or protect buttons
+ protect: // default = true. show/hide protect tab or protect buttons,
+ chat:
}
},
editorConfig: {
@@ -110,7 +111,8 @@
image: url,
imageDark: url, // logo for dark theme
imageEmbedded: url, // deprecated, use image instead
- url: http://...
+ url: http://...,
+ visible: true // hide logo if visible=false
},
customer: {
name: 'SuperPuper',
@@ -131,7 +133,11 @@
url: 'http://...',
text: 'Go to London',
blank: true,
- requestClose: false // if true - goback send onRequestClose event instead opening url
+ requestClose: false // if true - goback send onRequestClose event instead opening url, deprecated, use customization.close instead
+ },
+ close: {
+ visible: true,
+ text: 'Close file'
},
reviewPermissions: {
"Group1": ["Group2"], // users from Group1 can accept/reject review changes made by users from Group2
@@ -158,11 +164,13 @@
save: false/true // save button
} / false / true,
home: {
- mailmerge: false/true // mail merge button
+ mailmerge: false/true // mail merge button // deprecated, button is moved to collaboration tab. use toolbar->collaboration->mailmerge instead
},
layout: false / true, // layout tab
references: false / true, // de references tab
- collaboration: false / true // collaboration tab
+ collaboration: {
+ mailmerge: false/true // mail merge button in de
+ } / false / true, // collaboration tab
draw: false / true // draw tab
protect: false / true, // protect tab
plugins: false / true // plugins tab
@@ -174,6 +182,7 @@
header: {
users: false/true // users list button
save: false/true // save button
+ editMode: false/true // change mode button
},
leftMenu: {
navigation: false/true,
@@ -194,18 +203,19 @@
mode: false/true // init value in de/pe
change: false/true // hide/show feature in de/pe/sse
} / false / true // if false/true - use as init value in de/pe. use instead of customization.spellcheck parameter
+ roles: false/true // hide/show Roles manager, roles settings in right panel and roles in View form button in de
},
font: {
name: "Arial",
size: "11px";
},
- chat: true,
+ chat: true, // deprecated 7.1, use permissions.chat
comments: true,
zoom: 100,
compactToolbar: false,
leftMenu: true, // must be deprecated. use layout.leftMenu instead
rightMenu: true, // must be deprecated. use layout.rightMenu instead
- hideRightMenu: false, // hide or show right panel on first loading
+ hideRightMenu: true, // hide or show right panel on first loading !! default value changed in 8.1
toolbar: true, // must be deprecated. use layout.toolbar instead
statusBar: true, // must be deprecated. use layout.statusBar instead
autosave: true,
@@ -279,7 +289,10 @@
'onRequestOpen': ,
'onRequestSelectDocument': , // used for compare and combine documents. must call setRequestedDocument method. use instead of onRequestCompareFile/setRevisedFile
'onRequestSelectSpreadsheet': , // used for mailmerge id de. must call setRequestedSpreadsheet method. use instead of onRequestMailMergeRecipients/setMailMergeRecipients
- 'onRequestReferenceSource': , // used for external links in sse. must call setReferenceSource method
+ 'onRequestReferenceSource': , // used for external links in sse. must call setReferenceSource method,
+ 'onSaveDocument': 'save document from binary',
+ 'onRequestStartFilling': // used in pdf-form edit mode. must call startFilling method
+ 'onSubmit': // send when filled form is submitted successfully
}
}
@@ -348,6 +361,8 @@
_config.editorConfig.canRequestSelectDocument = _config.events && !!_config.events.onRequestSelectDocument;
_config.editorConfig.canRequestSelectSpreadsheet = _config.events && !!_config.events.onRequestSelectSpreadsheet;
_config.editorConfig.canRequestReferenceSource = _config.events && !!_config.events.onRequestReferenceSource;
+ _config.editorConfig.canSaveDocumentToBinary = _config.events && !!_config.events.onSaveDocument;
+ _config.editorConfig.canStartFilling = _config.events && !!_config.events.onRequestStartFilling;
_config.frameEditorId = placeholderId;
_config.parentOrigin = window.location.origin;
@@ -470,7 +485,7 @@
}
}
- var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(_config.document.fileType);
+ var type = /^(?:(djvu|xps|oxps))$/.exec(_config.document.fileType);
if (type && typeof type[1] === 'string') {
_config.editorConfig.canUseHistory = false;
}
@@ -557,9 +572,9 @@
}
};
- var _sendCommand = function(cmd) {
+ var _sendCommand = function(cmd, buffer) {
if (iframe && iframe.contentWindow)
- postMessage(iframe.contentWindow, cmd);
+ postMessage(iframe.contentWindow, cmd, buffer);
};
var _init = function(editorConfig) {
@@ -580,6 +595,13 @@
});
};
+ var _openDocumentFromBinary = function(doc) {
+ doc && _sendCommand({
+ command: 'openDocumentFromBinary',
+ data: doc.buffer
+ }, doc.buffer);
+ };
+
var _showMessage = function(title, msg) {
msg = msg || title;
_sendCommand({
@@ -763,6 +785,13 @@
});
};
+ var _startFilling = function(data) {
+ _sendCommand({
+ command: 'startFilling',
+ data: data
+ });
+ };
+
var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect();
var data = {
@@ -839,7 +868,9 @@
setReferenceData : _setReferenceData,
setRequestedDocument: _setRequestedDocument,
setRequestedSpreadsheet: _setRequestedSpreadsheet,
- setReferenceSource: _setReferenceSource
+ setReferenceSource: _setReferenceSource,
+ openDocument: _openDocumentFromBinary,
+ startFilling: _startFilling
}
};
@@ -890,6 +921,12 @@
var _onMessage = function(msg) {
// TODO: check message origin
if (msg && window.JSON && _scope.frameOrigin==msg.origin ) {
+ if (msg.data && msg.data.event === 'onSaveDocument') {
+ if (_fn) {
+ _fn.call(_scope, msg.data);
+ }
+ return;
+ }
try {
var msg = window.JSON.parse(msg.data);
@@ -953,46 +990,55 @@
'word': 'documenteditor',
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor',
- 'pdf': 'pdfeditor'
+ 'pdf': 'pdfeditor',
+ 'common': 'common'
},
- appType = 'word';
+ appType = 'word',
+ type,
+ fillForms = false,
+ isForm = false;
+ if (config.document) {
+ if (typeof config.document.fileType === 'string')
+ type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(oform|docxf))$/
+ .exec(config.document.fileType);
- if (typeof config.documentType === 'string') {
- appType = config.documentType.toLowerCase();
- if (config.type !== 'mobile' && config.type !== 'embedded' && !!config.document && typeof config.document.fileType === 'string') {
- var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(config.document.fileType);
- if (type && typeof type[1] === 'string')
- appType = 'pdf';
- }
- } else
- if (!!config.document && typeof config.document.fileType === 'string') {
- var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(pdf|djvu|xps|oxps))$/
- .exec(config.document.fileType);
- if (type) {
- if (typeof type[1] === 'string') appType = 'cell'; else
- if (typeof type[2] === 'string') appType = 'slide'; else
- if (typeof type[3] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'pdf';
- }
+ if (config.document.permissions)
+ fillForms = (config.document.permissions.fillForms===undefined ? config.document.permissions.edit !== false : config.document.permissions.fillForms) &&
+ config.editorConfig && (config.editorConfig.mode !== 'view');
}
- if (appType === 'pdf' && (config.type === 'mobile' || config.type === 'embedded')) {
+ if (type && typeof type[2] === 'string') { // djvu|xps|oxps
+ appType = config.type === 'mobile' || config.type === 'embedded' ? 'word' : 'pdf';
+ } else if (type && typeof type[1] === 'string') { // pdf - need check
+ isForm = config.document ? config.document.isForm : undefined;
+ if (config.type === 'embedded')
+ appType = fillForms && isForm===undefined ? 'common' : 'word';
+ else if (config.type !== 'mobile')
+ appType = isForm===undefined ? 'common' : isForm ? 'word' : 'pdf';
+ } else if (type && typeof type[5] === 'string') { // oform|docxf
appType = 'word';
+ } else {
+ if (typeof config.documentType === 'string')
+ appType = config.documentType.toLowerCase();
+ else {
+ if (type && typeof type[3] === 'string') appType = 'cell'; else
+ if (type && typeof type[4] === 'string') appType = 'slide';
+ }
}
+ path += appMap[appType];
- path += appMap[appType] + "/";
- const path_type = config.type === "mobile"
- ? "mobile" : (config.type === "embedded")
- ? "embed" : "main";
+ const path_type = config.type === "mobile" ? "mobile" :
+ config.type === "embedded" ? (fillForms && isForm ? "forms" : "embed") : "main";
+ if (appType !== 'common')
+ path += "/" + path_type;
- path += path_type;
var index = "/index.html";
- if (config.editorConfig && path_type!=="forms") {
+ if (config.editorConfig && path_type!=="forms" && appType!=='common') {
var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
- (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
+ (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html";
} else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge' || config.editorConfig.mode === 'editole')
index = "/index_internal.html";
-
}
path += index;
return path;
@@ -1014,9 +1060,12 @@
params += "&logo=" + encodeURIComponent(config.editorConfig.customization.loaderLogo);
}
if ( config.editorConfig.customization.logo ) {
- if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded))
- params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded);
- else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
+ if (config.editorConfig.customization.logo.visible===false) {
+ params += "&headerlogo=";
+ } else if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded || config.editorConfig.customization.logo.imageDark)) {
+ (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded) && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded));
+ config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
+ } else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
}
@@ -1027,16 +1076,24 @@
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge' || config.editorConfig.mode == 'editole'))
params += "&internal=true";
+ if (config.type)
+ params += "&type=" + config.type;
+
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;
- var type = config.document ? /^(?:(pdf))$/.exec(config.document.fileType) : null;
- if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' ||
+ var type = config.document ? /^(?:(pdf)|(oform|docxf))$/.exec(config.document.fileType) : null,
+ isPdf = type && typeof type[1] === 'string',
+ oldForm = type && typeof type[2] === 'string';
+
+ if (!(isPdf || oldForm) && (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review )))
params += "&mode=view";
+ if ((isPdf || oldForm) && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view'))
+ params += "&mode=fillforms";
if (config.document) {
- config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false;
+ config.document.isForm = isPdf ? config.document.isForm : !!oldForm;
(config.document.isForm===true || config.document.isForm===false) && (params += "&isForm=" + config.document.isForm);
}
@@ -1055,6 +1112,12 @@
if (config.document && config.document.fileType)
params += "&fileType=" + config.document.fileType;
+ if (config.editorConfig) {
+ var customization = config.editorConfig.customization;
+ if ( customization && typeof(customization) == 'object' && ( customization.toolbarNoTabs || (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
+ params += "&indexPostfix=_loader";
+ }
+ }
return params;
}
@@ -1082,12 +1145,11 @@
return iframe;
}
- function postMessage(wnd, msg) {
+ function postMessage(wnd, msg, buffer) {
if (wnd && wnd.postMessage && window.JSON) {
// TODO: specify explicit origin
- wnd.postMessage(window.JSON.stringify(msg), "*");
+ buffer ? wnd.postMessage(msg, "*", [buffer]) : wnd.postMessage(window.JSON.stringify(msg), "*");
}
-
}
function extend(dest, src) {
diff --git a/apps/api/wopi/editor-wopi.ejs b/apps/api/wopi/editor-wopi.ejs
index 4f1f3ae458..74703d1e18 100644
--- a/apps/api/wopi/editor-wopi.ejs
+++ b/apps/api/wopi/editor-wopi.ejs
@@ -176,8 +176,10 @@ div {
}
var onAppReady = function () {
+ //Collabora extension field "Status"
_postMessage('App_LoadingStatus', {
- "DocumentLoadedTime": Date.now() - startTime
+ "DocumentLoadedTime": Date.now() - startTime,
+ "Status": "Document_Loaded"
});
innerAlert("App ready");
};
@@ -219,6 +221,10 @@ div {
window.open(fileInfo.HostEditUrl, "_blank");
};
+ var onRequestSaveAs = function (event) {
+ //SaveAs work via PutRelativeFile server-server request
+ };
+
var onRequestSharingSettings = function (event) {
if (fileInfo.FileSharingPostMessage)
_postMessage('UI_Sharing', {});
@@ -243,6 +249,19 @@ div {
innerAlert(event.data);
};
+ var getWopiFileUrl = function(fileInfo, userAuth) {
+ let url;
+ if (fileInfo.FileUrl) {
+ //Requests to the FileUrl can not be signed using proof keys. The FileUrl is used exactly as provided by the host, so it does not necessarily include the access token, which is required to construct the expected proof.
+ url = fileInfo.FileUrl;
+ } else if (fileInfo.TemplateSource) {
+ url = fileInfo.TemplateSource;
+ } else if (userAuth) {
+ url = userAuth.wopiSrc + "/contents?access_token=" + userAuth.access_token;
+ }
+ return url;
+ }
+
var connectEditor = function () {
fileInfo = <%- JSON.stringify(fileInfo) %>;
@@ -252,6 +271,7 @@ div {
var userAuth = <%- JSON.stringify(userAuth) %>;
var token = "<%- token %>";
var queryParams = <%- JSON.stringify(queryParams) %>;
+ var docs_api_config = <%- JSON.stringify(docs_api_config) %>;
if (!fileInfo.BaseFileName) {
showError();
@@ -266,25 +286,45 @@ div {
type = "desktop"
}
var fileType = fileInfo.BaseFileName ? fileInfo.BaseFileName.substr(fileInfo.BaseFileName.lastIndexOf('.') + 1) : "";
+ fileType = fileInfo.FileExtension ? fileInfo.FileExtension.substr(1) : fileType;
+ fileType = fileType.toLowerCase();
+ let customizationClose = !!(fileInfo.ClosePostMessage || fileInfo.CloseUrl);
+ let customizationSaveAs = fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative;
+ let customizationFormSubmit = queryParams.formsubmit === "1";
+ let permissionsEdit = !fileInfo.ReadOnly && fileInfo.UserCanWrite && !customizationFormSubmit;
+ let permissionsFillForm = permissionsEdit || customizationFormSubmit;
var config = {
"width": "100%",
"height": "100%",
+ "editorConfig": {
+ "customization": {
+ "about": true
+ },
+ "coEditing": {
+ "change": false
+ },
+ }
+ };
+ config = mergeDeep(config, docs_api_config);
+ config = mergeDeep(config, {
"type": type,
"documentType": documentType,
"token": token,
"document": {
"title": fileInfo.BreadcrumbDocName || fileInfo.BaseFileName,
- "url": userAuth.wopiSrc,
- "fileType": fileInfo.FileExtension ? fileInfo.FileExtension.substr(1) : fileType,
+ "url": getWopiFileUrl(fileInfo, userAuth),
+ "fileType": fileType,
"key": key,
"info": {
"folder": fileInfo.BreadcrumbFolderName
},
"permissions": {
- "edit": !fileInfo.ReadOnly && fileInfo.UserCanWrite,
+ "edit": permissionsEdit,
"review": (fileInfo.SupportsReviewing===false) ? false : (fileInfo.UserCanReview===false ? false : fileInfo.UserCanReview),
"copy": fileInfo.CopyPasteRestrictions!=="CurrentDocumentOnly" && fileInfo.CopyPasteRestrictions!=="BlockAll",
- "print": !fileInfo.DisablePrint && !fileInfo.HidePrintOption
+ "print": !fileInfo.DisablePrint && !fileInfo.HidePrintOption,
+ "chat": queryParams.dchat!=="1",
+ "fillForms": permissionsFillForm
},
"options": {
"WOPISrc": userAuth.wopiSrc
@@ -300,7 +340,9 @@ div {
"name": fileInfo.IsAnonymousUser ? "" : fileInfo.UserFriendlyName
},
"customization": {
- "about": true,
+ "close": {
+ "visible": customizationClose
+ },
"goback": {
"url": fileInfo.BreadcrumbFolderUrl
},
@@ -308,29 +350,30 @@ div {
"name": fileInfo.BreadcrumbBrandName,
"www": fileInfo.BreadcrumbBrandUrl
},
- "chat": queryParams.dchat!=="1",
+ "submitForm": customizationFormSubmit && customizationSaveAs,
"uiTheme": queryParams.thm==="1" ? "default-light" : (queryParams.thm==="2" ? "default-dark" : undefined)
},
"coEditing": {
- "mode": userAuth.mode !== "view" ? "fast" : "strict",
- "change": false
+ "mode": userAuth.mode !== "view" ? "fast" : "strict"
},
"wopi": {
- "FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250
+ "FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250,
+ "WOPISrc": userAuth.wopiSrc
}
},
"events": {
"onAppReady": onAppReady,
"onDocumentStateChange": fileInfo.EditNotificationPostMessage ? onDocumentStateChange : undefined,
- 'onRequestEditRights': fileInfo.EditModePostMessage || (fileInfo.HostEditUrl && !fileInfo.UserCanNotWriteRelative) ? onRequestEditRights : undefined,
+ 'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined,
+ 'onRequestSaveAs': customizationSaveAs ? onRequestSaveAs : undefined,
"onError": onError,
- "onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined,
+ "onRequestClose": customizationClose ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
"onRequestSharingSettings": fileInfo.FileSharingPostMessage || fileInfo.FileSharingUrl ? onRequestSharingSettings : undefined,
"onRequestHistory": fileInfo.FileVersionUrl || fileInfo.FileVersionPostMessage ? onRequestHistory : undefined,
"onRequestInsertImage": fileInfo.EnableInsertRemoteImage ? onRequestInsertImage : undefined
}
- };
+ });
postMessageOrigin = fileInfo.PostMessageOrigin || "*";
if (postMessageOrigin && (typeof postMessageOrigin === 'string') && postMessageOrigin.charAt(postMessageOrigin.length-1)=='/')
@@ -367,12 +410,74 @@ div {
document.body.appendChild(newDiv);
};
+ //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
+ if (typeof Object.assign !== 'function') {
+ // Must be writable: true, enumerable: false, configurable: true
+ Object.defineProperty(Object, "assign", {
+ value: function assign(target, varArgs) { // .length of function is 2
+ 'use strict';
+ if (target === null || target === undefined) {
+ throw new TypeError('Cannot convert undefined or null to object');
+ }
+
+ var to = Object(target);
+
+ for (var index = 1; index < arguments.length; index++) {
+ var nextSource = arguments[index];
+
+ if (nextSource !== null && nextSource !== undefined) {
+ for (var nextKey in nextSource) {
+ // Avoid bugs when hasOwnProperty is shadowed
+ if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
+ to[nextKey] = nextSource[nextKey];
+ }
+ }
+ }
+ }
+ return to;
+ },
+ writable: true,
+ configurable: true
+ });
+ }
+ /**
+ * Simple object check.
+ * @param item
+ * @returns {boolean}
+ */
+ var isObject = function(item) {
+ return (item && typeof item === 'object' && !Array.isArray(item));
+ }
+
+ /**
+ * Deep merge two objects.
+ * @param target
+ * @param source
+ */
+ var mergeDeep = function(target, source) {
+ //https://stackoverflow.com/a/34749873
+ if (isObject(target) && isObject(source)) {
+ for (const key in source) {
+ if (isObject(source[key])) {
+ if (!target[key]) Object.assign(target, { [key]: {} });
+ mergeDeep(target[key], source[key]);
+ } else {
+ Object.assign(target, { [key]: source[key] });
+ }
+ }
+ }
+
+ return target;
+ }
+
if (window.addEventListener) {
window.addEventListener("load", connectEditor);
window.addEventListener("resize", fixSize);
+ window.addEventListener("orientationchange", fixSize);
} else if (window.attachEvent) {
window.attachEvent("onload", connectEditor);
window.attachEvent("onresize", fixSize);
+ window.attachEvent("orientationchange", fixSize);
}
+
+
+
+
+
diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js
index e2efd153d8..5faee33ea8 100644
--- a/apps/common/Gateway.js
+++ b/apps/common/Gateway.js
@@ -47,6 +47,10 @@ if (window.Common === undefined) {
$me.trigger('opendocument', data);
},
+ 'openDocumentFromBinary': function(data) {
+ $me.trigger('opendocumentfrombinary', data);
+ },
+
'showMessage': function(data) {
$me.trigger('showmessage', data);
},
@@ -153,14 +157,18 @@ if (window.Common === undefined) {
'setReferenceSource': function(data) {
$me.trigger('setreferencesource', data);
+ },
+
+ 'startFilling': function(data) {
+ $me.trigger('startfilling', data);
}
};
- var _postMessage = function(msg) {
+ var _postMessage = function(msg, buffer) {
// TODO: specify explicit origin
if (window.parent && window.JSON) {
msg.frameEditorId = window.frameEditorId;
- window.parent.postMessage(window.JSON.stringify(msg), "*");
+ buffer ? window.parent.postMessage(msg, "*", [buffer]) : window.parent.postMessage(window.JSON.stringify(msg), "*");
}
};
@@ -169,6 +177,14 @@ if (window.Common === undefined) {
if (msg.origin !== window.parentOrigin && msg.origin !== window.location.origin && !(msg.origin==="null" && (window.parentOrigin==="file://" || window.location.origin==="file://"))) return;
var data = msg.data;
+ if (data && data.command === 'openDocumentFromBinary') {
+ handler = commandMap[data.command];
+ if (handler) {
+ handler.call(this, data.data);
+ }
+ return;
+ }
+
if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) {
return;
}
@@ -382,10 +398,25 @@ if (window.Common === undefined) {
_postMessage({event:'onRequestReferenceSource'});
},
+ requestStartFilling: function () {
+ _postMessage({event:'onRequestStartFilling'});
+ },
+
pluginsReady: function() {
_postMessage({ event: 'onPluginsReady' });
},
+ saveDocument: function(data) {
+ data && _postMessage({
+ event: 'onSaveDocument',
+ data: data.buffer
+ }, data.buffer);
+ },
+
+ submitForm: function() {
+ _postMessage({event: 'onSubmit'});
+ },
+
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)
diff --git a/apps/common/checkExtendedPDF.js b/apps/common/checkExtendedPDF.js
index be3c234889..abcefd98b4 100644
--- a/apps/common/checkExtendedPDF.js
+++ b/apps/common/checkExtendedPDF.js
@@ -30,7 +30,8 @@
*
*/
function checkExtendedPDF(directUrl, key, url, token, callback) {
- var limit = 110;
+ //110 is not enough for the new PDF form
+ var limit = 300;
if (directUrl) {
downloadPartialy(directUrl, limit, null, function(text) {
callback(isExtendedPDFFile(text))
diff --git a/apps/common/forms/resources/less/common.less b/apps/common/forms/resources/less/common.less
index a2b59125ea..0ec60b5bf3 100644
--- a/apps/common/forms/resources/less/common.less
+++ b/apps/common/forms/resources/less/common.less
@@ -241,28 +241,22 @@
}
.btn-text-default {
- width: auto;
&.colored {
padding: 0 16px;
height: 28px;
- background-color: @background-accent-button-ie;
- background-color: @background-accent-button;
- border: 1px solid transparent;
- border-radius: 3px;
- color: @text-contrast-background-ie !important;
- color: @text-contrast-background !important;
- font-weight: 700;
-
- &:hover:not(.disabled),
- .over:not(.disabled) {
- background-color: @highlight-accent-button-hover-ie !important;
- background-color: @highlight-accent-button-hover !important;
- }
- &:active:not(.disabled),
- &.active:not(.disabled) {
- background-color: @highlight-accent-button-pressed-ie !important;
- background-color: @highlight-accent-button-pressed !important;
+ &.gray {
+ background-color: #c0c0c0;
+ background-color: #c0c0c0;
+ &:hover:not(.disabled),
+ .over:not(.disabled) {
+ background-color: #adadad !important;
+ }
+
+ &:active:not(.disabled),
+ &.active:not(.disabled) {
+ background-color: #cbcbcb !important;
+ }
}
}
}
diff --git a/apps/common/index.html b/apps/common/index.html
new file mode 100644
index 0000000000..9acc67e394
--- /dev/null
+++ b/apps/common/index.html
@@ -0,0 +1,62 @@
+
+
+