Open pdf-form in DE

This commit is contained in:
Julia Radzhabova
2024-02-28 22:02:40 +03:00
parent b24eb0e75b
commit 450fa70971
14 changed files with 224 additions and 46 deletions

View File

@ -477,7 +477,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;
}
@ -960,25 +960,29 @@
'word': 'documenteditor',
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor',
'pdf': 'pdfeditor'
'pdf': 'pdfeditor',
'checker': config.document && config.document.isForm ? 'documenteditor' :
config.document && config.document.isForm===false ? 'pdfeditor' : 'common'
},
appType = 'word';
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')
var type = /^(?:(pdf)|(djvu|xps|oxps))$/.exec(config.document.fileType);
if (type && typeof type[2] === 'string')
appType = 'pdf';
if (type && typeof type[1] === 'string')
appType = 'checker';
}
} 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))$/
} 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 (typeof type[4] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'pdf'; else
if (typeof type[3] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'checker';
}
}
if (appType === 'pdf' && (config.type === 'mobile' || config.type === 'embedded')) {
@ -994,7 +998,7 @@
var index = "/index.html";
if (config.editorConfig && path_type!=="forms") {
var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
if ( appType!=='checker' && typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(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')
@ -1064,6 +1068,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;
}

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ONLYOFFICE Documents</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<link rel="icon" href="resources/img/favicon.ico" type="image/x-icon">
<style type="text/css">
.loadmask {
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background: #e2e2e2;
background: var(--canvas-background, #e2e2e2);
z-index: 1002;
}
.theme-dark .loadmask, .theme-type-dark .loadmask {
background: #555;
}
</style>
<script>
function getUrlParams() {
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1),
urlParams = {};
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
return urlParams;
}
var params = getUrlParams(),
postfix = params["indexPostfix"] || '';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
</script>
<script src="lib/util/themeinit.js"></script>
</head>
<body>
<script src="lib/util/htmlutils.js"></script>
<script type="text/javascript" src="../checkExtendedPDF.js"></script>
<div id="loading-mask" class="loadmask"></div>
<script>
listenApiMsg(function (isform) {
var match = window.location.href.match(/(.*)common\/main\/index.html/i);
match && window.location.replace(match[1] + (!!isform ? 'documenteditor' : 'pdfeditor') + '/main/index' + postfix + '.html' + window.location.search + ("&isForm=" + !!isform));
});
</script>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ONLYOFFICE Documents</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<link rel="icon" href="resources/img/favicon.ico" type="image/x-icon">
<style type="text/css">
.loadmask {
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background: #e2e2e2;
background: var(--canvas-background, #e2e2e2);
z-index: 1002;
}
.theme-dark .loadmask, .theme-type-dark .loadmask {
background: #555;
}
</style>
<script>
function getUrlParams() {
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1),
urlParams = {};
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
return urlParams;
}
var params = getUrlParams(),
postfix = params["indexPostfix"] || '';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
</script>
<script src="../../../../../apps/common/main/lib/util/themeinit.js?__inline=true"></script>
</head>
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<script src="../../../../../apps/common/checkExtendedPDF.js?__inline=true"></script>
<div id="loading-mask" class="loadmask"></div>
<script>
listenApiMsg(function (isform) {
var match = window.location.href.match(/(.*)common\/main\/index.html/i);
match && window.location.replace(match[1] + (!!isform ? 'documenteditor' : 'pdfeditor') + '/main/index' + postfix + '.html' + window.location.search + ("&isForm=" + !!isform));
});
</script>
</body>
</html>

View File

@ -844,3 +844,23 @@
// }
// }
//}
.header-background-color {
background-color: @header-background-color-ie;
background-color: @header-background-color;
.pdf-form & {
background-color: @header-background-color-pdf-ie;
background-color: @header-background-color-pdf;
}
}
.header-border-color {
border-color: @header-background-color-ie !important;
border-color: @header-background-color !important;
.pdf-form & {
border-color: @header-background-color-pdf-ie !important;
border-color: @header-background-color-pdf !important;
}
}

View File

@ -1,6 +1,3 @@
@calendar-bg-color: @header-background-color-ie;
@calendar-bg-color: @header-background-color;
.calendar-window {
border-radius: 0;
box-shadow: none;

View File

@ -403,6 +403,10 @@
background-color: @icon-toolbar-header;
color: @toolbar-header-text-on-background-ie;
color: @toolbar-header-text-on-background;
.pdf-form & {
color: @toolbar-header-text-on-background-pdf-ie;
color: @toolbar-header-text-on-background-pdf;
}
vertical-align: middle;
background-size: cover;
background-position: center;
@ -517,8 +521,7 @@
}
#box-document-title {
background-color: @header-background-color-ie;
background-color: @header-background-color;
.header-background-color();
display: flex;
height: 100%;
color: @text-toolbar-header-ie;

View File

@ -29,13 +29,10 @@
&.theme-color {
.asc-synchronizetip {
background-color: @header-background-color-ie;
background-color: @header-background-color;
.header-background-color();
color: @text-toolbar-header-ie;
color: @text-toolbar-header;
border-color: @header-background-color-ie;
border-color: @header-background-color;
.header-border-color();
.close {
&:before, &:after {
background-color: @text-toolbar-header-ie;
@ -45,14 +42,11 @@
}
.tip-arrow:before {
background-color: @header-background-color-ie;
background-color: @header-background-color;
border-color: @header-background-color-ie !important;
border-color: @header-background-color !important;
.header-background-color();
.header-border-color();
}
.tip-arrow:after {
border-color: @header-background-color-ie !important;
border-color: @header-background-color !important;
.header-border-color();
}
}

View File

@ -38,9 +38,7 @@
align-items: stretch;
.extra {
background-color: @header-background-color-ie;
background-color: @header-background-color;
.header-background-color();
box-shadow: inset 0 @minus-px 0 0 @border-toolbar-active-panel-top;
}
@ -60,8 +58,7 @@
.tabs {
//flex-grow: 1;
background-color: @header-background-color-ie;
background-color: @header-background-color;
.header-background-color();
position: relative;
overflow: hidden;
display: flex;
@ -174,6 +171,10 @@
&.left{
box-shadow: 5px 0 20px 5px @header-background-color-ie;
box-shadow: 18px calc(@tabs-scroller-height - @scaled-one-px-value) 0 10px @border-toolbar-active-panel-top, 5px 0 20px 5px @header-background-color;
.pdf-form & {
box-shadow: 5px 0 20px 5px @header-background-color-pdf-ie;
box-shadow: 18px calc(@tabs-scroller-height - @scaled-one-px-value) 0 10px @border-toolbar-active-panel-top, 5px 0 20px 5px @header-background-color-pdf;
}
&:after {
transform: rotate(135deg);
@ -188,6 +189,10 @@
&.right{
box-shadow: -5px 0 20px 5px @header-background-color-ie;
box-shadow: -10px calc(@tabs-scroller-height - @scaled-one-px-value) 0 10px @border-toolbar-active-panel-top, -5px 0 20px 5px @header-background-color;
.pdf-form & {
box-shadow: -5px 0 20px 5px @header-background-color-pdf-ie;
box-shadow: -10px calc(@tabs-scroller-height - @scaled-one-px-value) 0 10px @border-toolbar-active-panel-top, -5px 0 20px 5px @header-background-color-pdf;
}
&:after {
transform: rotate(-45deg);
@ -466,7 +471,7 @@
.toolbar {
@underscore_height: 3px;
.tabs, .extra {
.tabs, .box-tabs .extra {
background-color: transparent;
box-shadow: inset 0 -1px 0 0 @border-regular-control-ie;
box-shadow: inset 0 -1px 0 0 @border-regular-control;
@ -652,8 +657,7 @@
&.editor-native-color {
.tabs li:after {
border-color: @header-background-color-ie;
border-color: @header-background-color;
.header-border-color();
}
}
}

View File

@ -40,6 +40,11 @@
@brand-danger: #d9534f;
@brand-info: #5bc0de;
@header-background-color-pdf-ie: @toolbar-header-pdf-ie;
@header-background-color-pdf: var(--toolbar-header-pdf);
@toolbar-header-text-on-background-pdf-ie: @text-toolbar-header-on-background-pdf-ie;
@toolbar-header-text-on-background-pdf: var(--text-toolbar-header-on-background-pdf);
// Scaffolding
// -------------------------

View File

@ -549,13 +549,13 @@ define([
// docInfo.put_Review(this.permissions.review);
var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
var coEditMode = (type && typeof type[1] === 'string') ? 'strict' : // offline viewer for pdf|djvu|xps|oxps
var coEditMode = (type && typeof type[1] === 'string' && !window.isPDFForm) ? 'strict' : // offline viewer for pdf|djvu|xps|oxps
!(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
this.editorConfig.coEditing.mode || 'fast';
docInfo.put_CoEditingMode(coEditMode);
if (type && typeof type[1] === 'string') {
if (type && typeof type[1] === 'string' && !window.isPDFForm) {
this.permissions.edit = this.permissions.review = false;
}
}
@ -568,8 +568,8 @@ define([
$('#editor-container').find('.doc-placeholder').css('margin-top', 19);
}
var type = data.doc ? /^(?:(docxf|oform))$/.exec(data.doc.fileType) : false;
this.appOptions.isFormCreator = !!(type && typeof type[1] === 'string') && this.appOptions.canFeatureForms; // show forms only for docxf or oform
var type = data.doc ? /^(?:(docxf|oform)|(pdf))$/.exec(data.doc.fileType) : false;
this.appOptions.isFormCreator = !!(type && (typeof type[1] === 'string' || typeof type[2] === 'string' && window.isPDFForm)) && this.appOptions.canFeatureForms; // show forms only for docxf or oform
type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false;
this.appOptions.isOForm = !!(type && typeof type[1] === 'string');
@ -642,7 +642,7 @@ define([
Asc.c_oAscFileType.PNG
];
var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType);
if (type && typeof type[1] === 'string') {
if (type && typeof type[1] === 'string' && !window.isPDFForm) {
if (!(format && (typeof format == 'string')) || type[1]===format.toLowerCase()) {
var options = new Asc.asc_CDownloadOptions();
options.asc_setIsDownloadEvent(true);
@ -1564,7 +1564,7 @@ define([
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded()) return;
var isPDFViewer = /^(?:(pdf|djvu|xps|oxps))$/.test(this.document.fileType);
var isPDFViewer = /^(?:(pdf|djvu|xps|oxps))$/.test(this.document.fileType) && !window.isPDFForm;
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;

View File

@ -59,6 +59,11 @@
background: var(--toolbar-header-document, #446995);
}
.pdf-form .loadmask > .brendpanel {
background: #AA5252;
background: var(--toolbar-header-pdf, #AA5252);
}
.loadmask > .brendpanel > div {
display: flex;
align-items: center;
@ -255,10 +260,12 @@
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null,
logoDark = params["headerlogodark"] ? encodeUrlParam(params["headerlogodark"]) : null;
logoDark = params["headerlogodark"] ? encodeUrlParam(params["headerlogodark"]) : null,
isForm = params["isForm"]==='true';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
window.isPDFForm = isForm;
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
@ -294,6 +301,7 @@
view = params["mode"] == 'view',
visible = true;
isForm && document.body.classList.add('pdf-form');
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {

View File

@ -37,6 +37,11 @@
background: var(--toolbar-header-document, #446995);
}
.pdf-form .loadmask > .brendpanel {
background: #AA5252;
background: var(--toolbar-header-pdf, #AA5252);
}
.loadmask > .brendpanel > div {
display: flex;
align-items: center;
@ -228,10 +233,12 @@
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
hideLogo = params["headerlogo"]==='',
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null,
logoDark = params["headerlogodark"] ? encodeUrlParam(params["headerlogodark"]) : null;
logoDark = params["headerlogodark"] ? encodeUrlParam(params["headerlogodark"]) : null,
isForm = params["isForm"]==='true';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
window.isPDFForm = isForm;
</script>
<link rel="stylesheet" type="text/css" href="../../../apps/documenteditor/main/resources/css/app.css">
@ -258,6 +265,7 @@
view = params["mode"] == 'view',
visible = true;
isForm && document.body.classList.add('pdf-form');
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {

View File

@ -219,9 +219,11 @@
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null,
isForm = params["isForm"]==='true';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
window.isPDFForm = isForm;
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
@ -267,7 +269,9 @@
<body>
<script src="../../common/main/lib/util/htmlutils.js"></script>
<div id="viewport"></div>
<script>
isForm && document.body.classList.add('pdf-form');
</script>
<script src="../../../vendor/svg-injector/svg-injector.min.js"></script>
<img class="inline-svg" src="../../common/main/resources/img/header/icons.svg">
<img class="inline-svg" src="../../common/main/resources/img/toolbar/shapetypes.svg">

View File

@ -241,11 +241,12 @@
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null,
isForm = params["isForm"]==='true';
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
window.isPDFForm = isForm;
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
@ -290,7 +291,9 @@
</head>
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<script>
isForm && document.body.classList.add('pdf-form');
</script>
<script>
window.requireTimeourError = function(){
var reqerr;