Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pdf forms #2915

Merged
merged 13 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@
'onRequestSelectDocument': <try to open document>, // used for compare and combine documents. must call setRequestedDocument method. use instead of onRequestCompareFile/setRevisedFile
'onRequestSelectSpreadsheet': <try to open spreadsheet>, // used for mailmerge id de. must call setRequestedSpreadsheet method. use instead of onRequestMailMergeRecipients/setMailMergeRecipients
'onRequestReferenceSource': <try to change source for external link>, // used for external links in sse. must call setReferenceSource method,
'onSaveDocument': 'save document from binary'
'onSaveDocument': 'save document from binary',
'onRequestStartFilling': <try to start filling forms> // used in pdf-form edit mode. must call startFilling method
}
}

Expand Down Expand Up @@ -357,6 +358,7 @@
_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;

Expand Down Expand Up @@ -779,6 +781,13 @@
});
};

var _startFilling = function(data) {
_sendCommand({
command: 'startFilling',
data: data
});
};

var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect();
var data = {
Expand Down Expand Up @@ -856,7 +865,8 @@
setRequestedDocument: _setRequestedDocument,
setRequestedSpreadsheet: _setRequestedSpreadsheet,
setReferenceSource: _setReferenceSource,
openDocument: _openDocumentFromBinary
openDocument: _openDocumentFromBinary,
startFilling: _startFilling
}
};

Expand Down Expand Up @@ -1069,6 +1079,8 @@
if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review )))
params += "&mode=view";
if (type && typeof type[1] === 'string' && config.document && config.document.permissions && config.document.permissions.edit === false)
params += "&mode=fillforms";

if (config.document) {
config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false;
Expand Down
8 changes: 8 additions & 0 deletions apps/common/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ if (window.Common === undefined) {

'setReferenceSource': function(data) {
$me.trigger('setreferencesource', data);
},

'startFilling': function(data) {
$me.trigger('startfilling', data);
}
};

Expand Down Expand Up @@ -394,6 +398,10 @@ if (window.Common === undefined) {
_postMessage({event:'onRequestReferenceSource'});
},

requestStartFilling: function () {
_postMessage({event:'onRequestStartFilling'});
},

pluginsReady: function() {
_postMessage({ event: 'onPluginsReady' });
},
Expand Down
30 changes: 12 additions & 18 deletions apps/common/forms/resources/less/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion apps/common/main/lib/controller/ReviewChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,8 @@ define([
documentHolder: {clear: false, disable: true},
toolbar: true,
plugins: true,
protect: true
protect: true,
header: {docmode: true}
}, 'review');
},

Expand Down
48 changes: 38 additions & 10 deletions apps/common/main/lib/view/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ define([
'<input id="rib-doc-name" autofill="off" autocomplete="off"/></input>' +
'</section>' +
'<section style="display: inherit;">' +
'<div class="hedset">' +
'<div class="btn-slot margin-right-2" id="slot-btn-header-form-submit"></div>' +
'<div class="btn-slot margin-right-2" id="slot-btn-start-fill"></div>' +
'</div>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
'<div class="btn-slot" id="slot-hbtn-print"></div>' +
Expand Down Expand Up @@ -339,6 +343,16 @@ define([
updateDocNamePosition();
}

if (me.btnStartFill) {
Common.Gateway.on('startfilling', function() {
me.btnStartFill.setVisible(false);
updateDocNamePosition();
});
me.btnStartFill.on('click', function (e) {
Common.Gateway.requestStartFilling();
});
}

if ( me.logo )
me.logo.children(0).on('click', function (e) {
var _url = !!me.branding && !!me.branding.logo && (me.branding.logo.url!==undefined) ?
Expand Down Expand Up @@ -420,13 +434,13 @@ define([
me.fireEvent('downloadas', ['original']);
});
}
}

if ( me.btnEdit ) {
me.btnEdit.updateHint(me.tipGoEdit);
me.btnEdit.on('click', function (e) {
me.fireEvent('go:editor', me);
});
}
if ( me.btnEdit ) {
me.btnEdit.updateHint(me.tipGoEdit);
me.btnEdit.on('click', function (e) {
me.fireEvent('go:editor', me);
});
}

if (me.btnSearch)
Expand Down Expand Up @@ -715,10 +729,10 @@ define([

if ( config.canQuickPrint )
this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q');

if ( config.canEdit && config.canRequestEditRights && !isPDFEditor)
this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big');
}
if ( config.canRequestEditRights && (!config.twoLevelHeader && config.canEdit && !isPDFEditor || config.isPDFForm && config.canFillForms && config.isRestrictedEdit))
this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big');

me.btnSearch.render($html.find('#slot-btn-search'));

if (!config.twoLevelHeader || config.compactHeader) {
Expand Down Expand Up @@ -787,6 +801,19 @@ define([
} else
$html.find('#slot-btn-edit-mode').hide();

if (config.canStartFilling) {
me.btnStartFill = new Common.UI.Button({
cls: 'btn-text-default auto yellow',
caption: me.textStartFill,
dataHint: '0',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
me.btnStartFill.render($html.find('#slot-btn-start-fill'));
} else {
$html.find('#slot-btn-start-fill').hide();
}

$userList = $html.find('.cousers-list');
$panelUsers = $html.find('.box-cousers');
$btnUsers = $panelUsers.find('> .btn-users');
Expand Down Expand Up @@ -1129,7 +1156,8 @@ define([
textReview: 'Reviewing',
textReviewDesc: 'Suggest changes',
tipReview: 'Reviewing',
textClose: 'Close file'
textClose: 'Close file',
textStartFill: 'Start filling'
}
}(), Common.Views.Header || {}))
});
21 changes: 21 additions & 0 deletions apps/common/main/resources/less/buttons.less
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,27 @@
opacity: @component-disabled-opacity-ie;
opacity: @component-disabled-opacity;
}

&.yellow {
.font-weight-bold();
border: 1px solid transparent;
color: @text-alt-key-hint-ie;
color: @text-alt-key-hint;
background-color: @background-fill-button-ie;
background-color: @background-fill-button;

&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @highlight-fill-button-hover-ie !important;
background-color: @highlight-fill-button-hover !important;
}

&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @highlight-fill-button-pressed-ie !important;
background-color: @highlight-fill-button-pressed !important;
}
}
}

.btn-text-menu-default {
Expand Down
3 changes: 3 additions & 0 deletions apps/common/main/resources/less/colors-table-classic.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
--background-scrim: fade(#000, 20%);
--background-loader: fade(#000, 65%);
--background-contrast-popover: #fff;
--background-fill-button: #ffd112;

--highlight-button-hover: #d8dadc;
--highlight-button-pressed: #7d858c;
Expand All @@ -33,6 +34,8 @@
--highlight-header-button-pressed: fade(#000, 20%);
--highlight-toolbar-tab-underline: #444;
--highlight-text-select: #3494fb;
--highlight-fill-button-hover: #ffe165;
--highlight-fill-button-pressed: #dfb500;

--border-toolbar: #cbcbcb;
--border-divider: #cbcbcb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
--background-accent-button: #4d76a8;
--background-tab-underline: #717171;
--background-notification-popover: #5f5d81;
--background-notification-badge: #7792fd;
--background-notification-badge: #ffd112;
--background-scrim: fade(black, 60%);
--background-loader: fade(#121212, 95%);
--background-alt-key-hint: #FFD938;
--background-contrast-popover: #121212;
--background-fill-button: #ffd112;

--highlight-button-hover: #424242;
--highlight-button-pressed: #666666;
Expand All @@ -34,6 +35,8 @@
--highlight-header-button-pressed: #828282;
--highlight-toolbar-tab-underline: #d0d0d0;
--highlight-text-select: #96c8fd;
--highlight-fill-button-hover: #ffe165;
--highlight-fill-button-pressed: #dfb500;

--border-toolbar: #616161;
--border-divider: #414141;
Expand Down
3 changes: 3 additions & 0 deletions apps/common/main/resources/less/colors-table-dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
--background-loader: fade(#181818, 90%);
--background-alt-key-hint: #FFD938;
--background-contrast-popover: #313131;
--background-fill-button: #ffd112;

--highlight-button-hover: #555;
--highlight-button-pressed: #707070;
Expand All @@ -34,6 +35,8 @@
--highlight-header-button-pressed: fade(#fff, 15%);
--highlight-toolbar-tab-underline: #ddd;
--highlight-text-select: #96c8fd;
--highlight-fill-button-hover: #ffe165;
--highlight-fill-button-pressed: #dfb500;

--border-toolbar: #616161;
--border-toolbar-active-panel-top: var(--background-toolbar);
Expand Down
4 changes: 4 additions & 0 deletions apps/common/main/resources/less/colors-table-ie-fix.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@background-accent-button-ie: #446995;
@background-contrast-popover-ie: #fff;
@shadow-contrast-popover-ie: rgba(0, 0, 0, 0.3);
@background-fill-button-ie: #ffd112;

@highlight-button-hover-ie: #d8dadc;
@highlight-button-pressed-ie: #7d858c;
Expand All @@ -33,6 +34,8 @@
@highlight-text-select-ie: #3494fb;
@highlight-accent-button-hover-ie: #375478;
@highlight-accent-button-pressed-ie: #293F59;
@highlight-fill-button-hover-ie: #ffe165;
@highlight-fill-button-pressed-ie: #dfb500;

@border-toolbar-ie: #cbcbcb;
@border-divider-ie: #cbcbcb;
Expand All @@ -54,6 +57,7 @@
@text-inverse-ie: #fff;
@text-toolbar-header-ie: #fff;
@text-contrast-background-ie: #fff;
@text-alt-key-hint-ie: fade(#000, 80%);

@icon-normal-ie: #444;
@icon-normal-pressed-ie: #fff;
Expand Down
6 changes: 6 additions & 0 deletions apps/common/main/resources/less/colors-table.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
--background-alt-key-hint: #FFD938;
--background-contrast-popover: #fff;
--shadow-contrast-popover: rgba(0, 0, 0, 0.3);
--background-fill-button: #ffd112;

--highlight-button-hover: #e0e0e0;
--highlight-button-pressed: #cbcbcb;
Expand All @@ -45,6 +46,8 @@
--highlight-header-button-pressed: fade(#fff, 25%);
--highlight-toolbar-tab-underline: #444;
--highlight-text-select: #3494fb;
--highlight-fill-button-hover: #ffe165;
--highlight-fill-button-pressed: #dfb500;

--border-toolbar: #cbcbcb;
--border-toolbar-active-panel-top: var(--background-toolbar);
Expand Down Expand Up @@ -183,6 +186,7 @@
@background-accent-button: var(--background-accent-button);
@background-contrast-popover: var(--background-contrast-popover);
@shadow-contrast-popover: var(--shadow-contrast-popover);
@background-fill-button: var(--background-fill-button);

// Highlight
// -------------------------
Expand All @@ -196,6 +200,8 @@
@highlight-text-select: var(--highlight-text-select);
@highlight-accent-button-hover: var(--highlight-accent-button-hover);
@highlight-accent-button-pressed: var(--highlight-accent-button-pressed);
@highlight-fill-button-hover: var(--highlight-fill-button-hover);
@highlight-fill-button-pressed: var(--highlight-fill-button-pressed);

// Border
// -------------------------
Expand Down
10 changes: 10 additions & 0 deletions apps/common/main/resources/less/toolbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,11 @@
left: 0;
}
}

#slot-btn-start-fill,
#slot-btn-header-form-submit {
padding: 2px 0;
}
}

.style-off-tabs {
Expand Down Expand Up @@ -648,6 +653,11 @@
}
}

#slot-btn-start-fill,
#slot-btn-header-form-submit {
padding: 4px 0;
}

#rib-doc-name {
color: @text-normal-ie;
color: @text-normal;
Expand Down
Loading
Loading