commit
e262c5ddd7
|
@ -43,7 +43,8 @@ DE.ApplicationController = new(function(){
|
|||
labelDocName,
|
||||
appOptions = {},
|
||||
btnSubmit,
|
||||
_submitFail, $submitedTooltip, $requiredTooltip;
|
||||
_submitFail, $submitedTooltip, $requiredTooltip,
|
||||
$listControlMenu, listControlItems = [], listObj;
|
||||
|
||||
var LoadingDocument = -256;
|
||||
|
||||
|
@ -273,6 +274,97 @@ DE.ApplicationController = new(function(){
|
|||
}
|
||||
}
|
||||
|
||||
function onShowContentControlsActions(obj, x, y) {
|
||||
switch (obj.type) {
|
||||
case Asc.c_oAscContentControlSpecificType.Picture:
|
||||
if (obj.pr && obj.pr.get_Lock) {
|
||||
var lock = obj.pr.get_Lock();
|
||||
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked)
|
||||
return;
|
||||
}
|
||||
api.asc_addImage(obj);
|
||||
setTimeout(function(){
|
||||
api.asc_UncheckContentControlButtons();
|
||||
}, 500);
|
||||
break;
|
||||
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
||||
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
||||
onShowListActions(obj, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function onHideContentControlsActions() {
|
||||
$listControlMenu && $listControlMenu.hide();
|
||||
api.asc_UncheckContentControlButtons();
|
||||
}
|
||||
|
||||
function onShowListActions(obj, x, y) {
|
||||
var type = obj.type,
|
||||
props = obj.pr,
|
||||
specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(),
|
||||
isForm = !!props.get_FormPr();
|
||||
|
||||
var menuContainer = DE.ApplicationView.getMenuForm();
|
||||
|
||||
if (!$listControlMenu) {
|
||||
$listControlMenu = menuContainer.find('ul');
|
||||
$listControlMenu.on('click', 'li', function(e) {
|
||||
var value = $(e.target).attr('value');
|
||||
if (value) {
|
||||
value = parseInt(value);
|
||||
setTimeout(function(){
|
||||
(value!==-1) && api.asc_SelectContentControlListItem(listControlItems[value], listObj.get_InternalId());
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
$('#editor_sdk').on('click', function(e){
|
||||
if (e.target.localName == 'canvas') {
|
||||
if (me._preventClick)
|
||||
me._preventClick = false;
|
||||
else {
|
||||
$listControlMenu && $listControlMenu.hide();
|
||||
api.asc_UncheckContentControlButtons();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$listControlMenu.find('li').remove();
|
||||
listControlItems = [];
|
||||
listObj = props;
|
||||
|
||||
if (specProps) {
|
||||
var k = 0;
|
||||
if (isForm){ // for dropdown and combobox form control always add placeholder item
|
||||
var text = props.get_PlaceholderText();
|
||||
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" style="opacity: 0.6" value="0">' +
|
||||
((text.trim()!=='') ? text : me.txtEmpty) +
|
||||
'</a></li>');
|
||||
listControlItems.push('');
|
||||
}
|
||||
var count = specProps.get_ItemsCount();
|
||||
k = listControlItems.length;
|
||||
for (var i=0; i<count; i++) {
|
||||
if (specProps.get_ItemValue(i)!=='' || !isForm) {
|
||||
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" value="' + (i+k) + '">' +
|
||||
common.utils.htmlEncode(specProps.get_ItemDisplayText(i)) +
|
||||
'</a></li>');
|
||||
listControlItems.push(specProps.get_ItemValue(i));
|
||||
}
|
||||
}
|
||||
if (!isForm && listControlItems.length<1) {
|
||||
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" value="0">' +
|
||||
me.txtEmpty +
|
||||
'</a></li>');
|
||||
listControlItems.push(-1);
|
||||
}
|
||||
}
|
||||
|
||||
menuContainer.css({left: x, top : y});
|
||||
me._preventClick = true;
|
||||
$listControlMenu.show();
|
||||
}
|
||||
|
||||
function hidePreloader() {
|
||||
$('#loading-mask').fadeOut('slow');
|
||||
}
|
||||
|
@ -350,6 +442,10 @@ DE.ApplicationController = new(function(){
|
|||
api.asc_registerCallback('asc_onPrint', onPrint);
|
||||
api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
|
||||
api.asc_registerCallback('sync_onAllRequiredFormsFilled', onFillRequiredFields);
|
||||
if (appOptions.canFillForms) {
|
||||
api.asc_registerCallback('asc_onShowContentControlsActions', onShowContentControlsActions);
|
||||
api.asc_registerCallback('asc_onHideContentControlsActions', onHideContentControlsActions);
|
||||
}
|
||||
|
||||
Common.Gateway.on('processmouse', onProcessMouse);
|
||||
Common.Gateway.on('downloadas', onDownloadAs);
|
||||
|
@ -812,6 +908,7 @@ DE.ApplicationController = new(function(){
|
|||
textAnonymous: 'Anonymous',
|
||||
textRequired: 'Fill all required fields to send form.',
|
||||
textGotIt: 'Got it',
|
||||
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later."
|
||||
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",
|
||||
txtEmpty: '(Empty)'
|
||||
}
|
||||
})();
|
|
@ -36,6 +36,7 @@ if (DE === undefined) {
|
|||
|
||||
DE.ApplicationView = new(function(){
|
||||
var $btnTools;
|
||||
var $menuForm;
|
||||
|
||||
// Initialize view
|
||||
|
||||
|
@ -63,11 +64,23 @@ DE.ApplicationView = new(function(){
|
|||
return $btnTools.parent().find(name);
|
||||
}
|
||||
|
||||
function getMenuForm() {
|
||||
if (!$menuForm) {
|
||||
$menuForm = $('<div id="menu-container-form" style="position: absolute; z-index: 10000;" data-value="prevent-canvas-click">' +
|
||||
'<div class="dropdown-toggle" data-toggle="dropdown"></div>' +
|
||||
'<ul class="dropdown-menu" oo_editor_input="true" role="menu" style="right: 0; left: auto;max-height: 200px; overflow-y: auto;"></ul>' +
|
||||
'</div>');
|
||||
$('#editor_sdk').append($menuForm);
|
||||
}
|
||||
return $menuForm;
|
||||
}
|
||||
|
||||
return {
|
||||
create: createView
|
||||
, tools: {
|
||||
get: getTools
|
||||
},
|
||||
getMenuForm: getMenuForm,
|
||||
|
||||
txtDownload: 'Download',
|
||||
txtPrint: 'Print',
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||
"DE.ApplicationController.waitText": "Please, wait...",
|
||||
"DE.ApplicationController.txtEmpty": "(Empty)",
|
||||
"DE.ApplicationView.txtDownload": "Download",
|
||||
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
|
||||
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
|
||||
|
|
|
@ -194,8 +194,8 @@
|
|||
hr {
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
border-color: @border-toolbar-ie;
|
||||
border-color: @border-toolbar;
|
||||
border-top: @scaled-one-px-value-ie solid @border-divider-ie;
|
||||
border-top: @scaled-one-px-value solid @border-divider;
|
||||
}
|
||||
|
||||
.thumb-list {
|
||||
|
|
|
@ -196,7 +196,8 @@
|
|||
h3 {
|
||||
margin: 0;
|
||||
font-size: 10pt;
|
||||
color: #665;
|
||||
color: @text-normal-ie;
|
||||
color: @text-normal;
|
||||
font-weight: bold;
|
||||
padding: 0 0 10px 10px;
|
||||
white-space: nowrap;
|
||||
|
@ -230,7 +231,8 @@
|
|||
hr {
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
border-color: #e1e1e1;
|
||||
border-top: @scaled-one-px-value-ie solid @border-divider-ie;
|
||||
border-top: @scaled-one-px-value solid @border-divider;
|
||||
}
|
||||
|
||||
.thumb-list {
|
||||
|
|
|
@ -258,7 +258,8 @@
|
|||
h3 {
|
||||
margin: 0;
|
||||
font-size: 10pt;
|
||||
color: #665;
|
||||
color: @text-normal-ie;
|
||||
color: @text-normal;
|
||||
font-weight: bold;
|
||||
padding: 0 0 10px 10px;
|
||||
white-space: nowrap;
|
||||
|
@ -291,7 +292,8 @@
|
|||
hr {
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
border-color: #e1e1e1;
|
||||
border-top: @scaled-one-px-value-ie solid @border-divider-ie;
|
||||
border-top: @scaled-one-px-value solid @border-divider;
|
||||
}
|
||||
|
||||
.thumb-list {
|
||||
|
|
Loading…
Reference in a new issue