Merge branch 'develop' into feature/compare

This commit is contained in:
Julia Radzhabova 2019-10-09 17:02:05 +03:00
commit 9e9a60c466
427 changed files with 24214 additions and 10593 deletions

View file

@ -128,7 +128,8 @@
compactHeader: false,
toolbarNoTabs: false,
toolbarHideFileName: false,
reviewDisplay: 'original'
reviewDisplay: 'original',
spellcheck: true
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
@ -735,8 +736,16 @@
: config.type === "embedded"
? "embed"
: "main";
path += "/index.html";
var index = "/index.html";
if (config.editorConfig) {
var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html";
}
}
path += index;
return path;
}
@ -753,9 +762,17 @@
params += "&customer=ONLYOFFICE";
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) {
if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo;
} else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) {
if (config.type=='embedded' && config.editorConfig.customization.logo.imageEmbedded)
params += "&headerlogo=" + config.editorConfig.customization.logo.imageEmbedded;
else if (config.type!='embedded' && config.editorConfig.customization.logo.image)
params += "&headerlogo=" + config.editorConfig.customization.logo.image;
}
}
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge'))
params += "&internal=true";
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;

View file

@ -36,10 +36,14 @@ if (Common === undefined) {
Common.Locale = new(function() {
"use strict";
var l10n = {};
var l10n = null;
var loadcallback,
apply = false;
var _applyLocalization = function() {
var _applyLocalization = function(callback) {
try {
callback && (loadcallback = callback);
if (l10n) {
for (var prop in l10n) {
var p = prop.split('.');
if (p && p.length > 2) {
@ -57,6 +61,9 @@ Common.Locale = new(function() {
}
}
}
loadcallback && loadcallback();
} else
apply = true;
}
catch (e) {
}
@ -64,7 +71,7 @@ Common.Locale = new(function() {
var _get = function(prop, scope) {
var res = '';
if (scope && scope.name) {
if (l10n && scope && scope.name) {
res = l10n[scope.name + '.' + prop];
}
@ -99,10 +106,12 @@ Common.Locale = new(function() {
throw new Error('loaded');
}
}).then(function(json) {
if ( !!json ) l10n = json;
l10n = json || {};
apply && _applyLocalization();
}).catch(function(e) {
l10n = l10n || {};
apply && _applyLocalization();
if ( e.message == 'loaded' ) {
} else
console.log('fetch error: ' + e);
});
@ -110,7 +119,13 @@ Common.Locale = new(function() {
if ( !window.fetch ) {
/* use fetch polifill if native method isn't supported */
require(['../vendor/fetch/fetch.umd'], _requireLang);
var polyfills = ['../vendor/fetch/fetch.umd'];
if ( !window.Promise ) {
require(['../vendor/es6-promise/es6-promise.auto.min'],
function () {
require(polyfills, _requireLang);
});
} else require(polyfills, _requireLang);
} else _requireLang();
return {

View file

@ -319,7 +319,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
if (parentEl) {
me.setElement(parentEl, false);
@ -386,6 +386,18 @@ define([
if (modalParents.length > 0) {
me.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
me.btnMenuEl && me.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = me.btnEl.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
}

View file

@ -104,27 +104,25 @@ define([
},
render: function (parentEl) {
var me = this,
el = $(this.el);
var me = this;
if (!me.rendered) {
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.template({
labelText: this.options.labelText
}));
el = $(this.el);
} else {
el.html(this.template({
me.$el.html(this.template({
labelText: this.options.labelText
}));
}
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.$chk.on('click', _.bind(this.onItemCheck, this));
}
this.$chk = me.$el.find('input[type=button]');
this.$label = me.$el.find('label');
this.$chk.on('click', this.onItemCheck.bind(this));
this.rendered = true;
}
if (this.options.disabled)
this.setDisabled(this.options.disabled);

View file

@ -91,16 +91,14 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
var el = this.cmpEl;
el.on('click', 'span.color-item', _.bind(this.itemClick, this));
me.cmpEl.on('click', 'span.color-item', me.itemClick.bind(me));
}
me.rendered = true;

View file

@ -108,12 +108,12 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
this.cmpEl.on('click', _.bind(this.handleClick, this));
this.cmpEl.on('click', me.handleClick.bind(me));
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
me.rendered = true;

View file

@ -104,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -158,10 +157,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
@ -194,6 +193,18 @@ define([
var modalParents = el.closest('.asc-window');
if (modalParents.length > 0) {
el.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
el.find('.dropdown-menu').on('mouseenter', function(){ // hide tooltip when mouse is over menu
@ -241,7 +252,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -266,7 +276,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -631,7 +640,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
scrollYMarginOffset: 30,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible

View file

@ -148,7 +148,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
var templateEl = me.template({
id : me.id,
@ -414,10 +414,11 @@ define([
}
}
me.fieldPicker.store.reset([]); // remove all
var indexRec = store.indexOf(record);
if (indexRec < 0)
return;
var indexRec = store.indexOf(record),
countRec = store.length,
var countRec = store.length,
maxViewCount = Math.floor(Math.max(fieldPickerEl.width(), me.minWidth) / (me.itemWidth + (me.itemMarginLeft || 0) + (me.itemMarginRight || 0) + (me.itemPaddingLeft || 0) + (me.itemPaddingRight || 0) +
(me.itemBorderLeft || 0) + (me.itemBorderRight || 0))),
newStyles = [];
@ -425,9 +426,6 @@ define([
if (fieldPickerEl.height() / me.itemHeight > 2)
maxViewCount *= Math.floor(fieldPickerEl.height() / me.itemHeight);
if (indexRec < 0)
return;
indexRec = Math.floor(indexRec / maxViewCount) * maxViewCount;
if (countRec - indexRec < maxViewCount)
indexRec = Math.max(countRec - maxViewCount, 0);
@ -435,7 +433,7 @@ define([
newStyles.push(store.at(index));
}
me.fieldPicker.store.add(newStyles);
me.fieldPicker.store.reset(newStyles);
}
if (forceSelect) {

View file

@ -135,7 +135,7 @@ define([
if (_.isUndefined(this.model.id))
return this;
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template(this.model.toJSON()));
el.addClass('item');
@ -262,7 +262,6 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
@ -272,6 +271,7 @@ define([
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
groups: me.groups ? me.groups.toJSON() : null,
style: me.style
@ -766,6 +766,435 @@ define([
}
});
Common.UI.DataViewSimple = Common.UI.BaseView.extend({
options : {
handleSelect: true,
enableKeyEvents: true,
keyMoveDirection: 'both', // 'vertical', 'horizontal'
restoreHeight: 0,
scrollAlwaysVisible: false,
useBSKeydown: false
},
template: _.template([
'<div class="dataview inner" style="<%= style %>">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>',
'</div>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
me.template = me.options.template || me.template;
me.store = me.options.store || new Common.UI.DataViewStore();
me.itemTemplate = me.options.itemTemplate || null;
me.handleSelect = me.options.handleSelect;
me.parentMenu = me.options.parentMenu;
me.enableKeyEvents= me.options.enableKeyEvents;
me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu
me.style = me.options.style || '';
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false;
if (me.options.keyMoveDirection=='vertical')
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN];
else if (me.options.keyMoveDirection=='horizontal')
me.moveKeys = [Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
else
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
if (me.options.el)
me.render();
},
render: function (parentEl) {
var me = this;
this.trigger('render:before', this);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
}
var modalParents = this.cmpEl.closest('.asc-window');
if (modalParents.length < 1)
modalParents = this.cmpEl.closest('[id^="menu-container-"]'); // context menu
if (modalParents.length > 0) {
this.tipZIndex = parseInt(modalParents.css('z-index')) + 10;
}
if (!this.rendered) {
if (this.parentMenu) {
this.cmpEl.closest('li').css('height', '100%');
this.cmpEl.css('height', '100%');
this.parentMenu.on('show:after', _.bind(this.alignPosition, this));
this.parentMenu.on('show:after', _.bind(this.onAfterShowMenu, this));
} else if (this.store.length>0)
this.onAfterShowMenu();
if (this.enableKeyEvents && this.parentMenu && this.handleSelect) {
this.parentMenu.on('show:before', function(menu) { me.deselectAll(); });
this.parentMenu.on('show:after', function(menu) {
Common.NotificationCenter.trigger('dataview:focus');
_.delay(function() {
menu.cmpEl.find('.dataview').focus();
}, 10);
}).on('hide:after', function() {
Common.NotificationCenter.trigger('dataview:blur');
});
}
this.attachKeyEvents();
this.cmpEl.on( "click", "div.item", _.bind(me.onClickItem, me));
}
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
this.rendered = true;
this.cmpEl.on('click', function(e){
if (/dataview/.test(e.target.className)) return false;
});
this.trigger('render:after', this);
return this;
},
selectRecord: function(record, suspendEvents) {
if (!this.handleSelect)
return;
if (suspendEvents)
this.suspendEvents();
this.deselectAll(suspendEvents);
if (record) {
record.set({selected: true});
var idx = _.indexOf(this.store.models, record);
if (idx>=0 && this.dataViewItems && this.dataViewItems.length>idx) {
this.dataViewItems[idx].el.addClass('selected');
}
}
if (suspendEvents)
this.resumeEvents();
return record;
},
selectByIndex: function(index, suspendEvents) {
if (this.store.length > 0 && index > -1 && index < this.store.length) {
return this.selectRecord(this.store.at(index), suspendEvents);
}
},
deselectAll: function(suspendEvents) {
if (suspendEvents)
this.suspendEvents();
_.each(this.store.where({selected: true}), function(record){
record.set({selected: false});
});
this.cmpEl.find('.item.selected').removeClass('selected');
if (suspendEvents)
this.resumeEvents();
},
getSelectedRec: function() {
return this.store.findWhere({selected: true});
},
onResetItems: function() {
this.dataViewItems && _.each(this.dataViewItems, function(item) {
var tip = item.el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
}, this);
this.dataViewItems = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.find('.inner').html(template({
items: this.store.toJSON(),
itemTemplate: this.itemTemplate,
style : this.style
}));
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
if (!this.parentMenu && this.store.length>0)
this.onAfterShowMenu();
this._layoutParams = undefined;
},
setStore: function(store) {
if (store) {
this.store = store;
this.onResetItems();
}
},
onClickItem: function(e) {
if ( this.disabled ) return;
window._event = e; // for FireFox only
var index = $(e.currentTarget).closest('div.item').index(),
record = (index>=0) ? this.store.at(index) : null,
view = (index>=0) ? this.dataViewItems[index] : null;
if (!record || !view) return;
record.set({selected: true});
var tip = view.el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
if (!this.isSuspendEvents) {
this.trigger('item:click', this, view.el, record, e);
}
},
onAfterShowMenu: function(e) {
if (!this.dataViewItems) {
var me = this;
this.dataViewItems = [];
_.each(this.cmpEl.find('div.item'), function(item, index) {
var $item = $(item),
rec = me.store.at(index);
me.dataViewItems.push({el: $item});
if (rec.get('tip')) {
$item.tooltip({
title : rec.get('tip'),
placement : 'cursor',
zIndex : me.tipZIndex
});
}
});
}
},
scrollToRecord: function (record) {
if (!record) return;
var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top,
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? this.dataViewItems[idx].el : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;
var div_top = div.offset().top,
div_first = this.dataViewItems[0].el,
div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0;
if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
if (this.scroller) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
} else {
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top);
}
}
},
onKeyDown: function (e, data) {
if ( this.disabled ) return;
if (data===undefined) data = e;
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedRec();
if (data.keyCode==Common.UI.Keys.RETURN) {
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec;
this.trigger('item:click', this, this, rec, e);
if (this.parentMenu)
this.parentMenu.hide();
} else {
var idx = _.indexOf(this.store.models, rec);
if (idx<0) {
if (data.keyCode==Common.UI.Keys.LEFT) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
} else
idx = 0;
} else
idx = 0;
} else if (this.options.keyMoveDirection == 'both') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
var topIdx = this.dataViewItems[idx].topIdx,
leftIdx = this.dataViewItems[idx].leftIdx;
idx = undefined;
if (data.keyCode==Common.UI.Keys.LEFT) {
while (idx===undefined) {
leftIdx--;
if (leftIdx<0) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
break;
} else
leftIdx = this._layoutParams.columns-1;
}
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.RIGHT) {
while (idx===undefined) {
leftIdx++;
if (leftIdx>this._layoutParams.columns-1) leftIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.UP) {
while (idx===undefined) {
topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else {
while (idx===undefined) {
topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
}
} else {
idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT)
? Math.max(0, idx-1)
: Math.min(this.store.length - 1, idx + 1) ;
}
if (idx !== undefined && idx>=0) rec = this.store.at(idx);
if (rec) {
this._fromKeyDown = true;
this.selectRecord(rec);
this._fromKeyDown = false;
this.scrollToRecord(rec);
}
}
} else {
this.trigger('item:keydown', this, rec, e);
}
},
attachKeyEvents: function() {
if (this.enableKeyEvents && this.handleSelect) {
var el = $(this.el).find('.inner').addBack().filter('.inner');
el.addClass('canfocused');
el.attr('tabindex', '0');
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
}
},
setDisabled: function(disabled) {
this.disabled = disabled;
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
},
isDisabled: function() {
return this.disabled;
},
alignPosition: function() {
var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu')
? this.parentMenu.cmpEl
: this.parentMenu.cmpEl.find('[role=menu]'),
docH = Common.Utils.innerHeight()-10,
innerEl = $(this.el).find('.inner').addBack().filter('.inner'),
parent = innerEl.parent(),
margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')),
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (top + menuH > docH ) {
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
this.scroller.update(props);
} else if ( top + menuH < docH && innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - top - paddings - margins, this.options.restoreHeight)) + 'px');
this.scroller.update(props);
}
},
fillIndexesArray: function() {
if (this.dataViewItems.length<=0) return;
this._layoutParams = {
itemsIndexes: [],
columns: 0,
rows: 0
};
var el = this.dataViewItems[0].el,
itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0;
for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft)/itemW);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length-1;
}
this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
item.topIdx = topIdx;
item.leftIdx = leftIdx;
if (this._layoutParams.columns<leftIdx) this._layoutParams.columns = leftIdx;
}
this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++;
},
onResize: function() {
this._layoutParams = undefined;
}
});
$(document).on('keydown.dataview', '[data-toggle=dropdown], [role=menu]', function(e) {
if (e.keyCode !== Common.UI.Keys.UP && e.keyCode !== Common.UI.Keys.DOWN && e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.RETURN) return;

View file

@ -97,7 +97,7 @@ define([
me = this;
rootEl = $(this.el);
rootEl = me.$el || $(this.el);
me.itemSize = me.options.itemSize;
me.minRows = me.options.minRows;
@ -133,7 +133,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
return this;
},

View file

@ -82,7 +82,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el),
el = me.$el || $(this.el),
arrowSatBrightness, arrowHue,
areaSatBrightness, areaHue,
previewColor, previewTransparentColor, previewColorText,
@ -278,7 +278,7 @@ define([
},
render: function () {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
this.trigger('render:after', this);
return this;

View file

@ -94,8 +94,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -142,10 +141,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
if (!me.rendered) {

View file

@ -48,7 +48,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('masked-field user-select');
el.attr('maxlength', me.options.maxLength);
@ -75,11 +75,11 @@ define([
setValue: function(value) {
if (this.options.maskExp.test(value) && value.length<=this.options.maxLength)
$(this.el).val(value);
this.$el.val(value);
},
getValue: function() {
$(this.el).val();
this.$el.val();
}
});
});

View file

@ -208,7 +208,7 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
@ -225,7 +225,7 @@ define([
this.cmpEl = this.template({
options : me.options
});
$(this.el).append(this.cmpEl);
this.$el.append(this.cmpEl);
}
}
@ -246,7 +246,7 @@ define([
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
@ -409,6 +409,10 @@ define([
},
onAfterKeydownMenu: function(e) {
this.trigger('keydown:before', this, e);
if (e.isDefaultPrevented())
return;
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
@ -543,7 +547,7 @@ define([
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
@ -584,4 +588,447 @@ define([
})()
})
})();
Common.UI.MenuSimple = Common.UI.BaseView.extend({
options : {
cls : '',
style : '',
itemTemplate: null,
items : [],
menuAlign : 'tl-bl',
menuAlignEl : null,
offset : [0, 0],
cyclic : true,
search : false,
scrollAlwaysVisible: true
},
template: _.template([
'<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>',
'</ul>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.id = this.options.id || Common.UI.getId();
this.itemTemplate = this.options.itemTemplate || _.template([
'<a id="<%= id %>" <% if(typeof style !== "undefined") { %> style="<%= style %>" <% } %>',
'<% if(typeof canFocused !== "undefined") { %> tabindex="-1" type="menuitem" <% } %>',
'<% if(typeof stopPropagation !== "undefined") { %> data-stopPropagation="true" <% } %>',
'class="<% if (checked) { %> checked <% } %>" >',
'<% if (typeof iconCls !== "undefined") { %>',
'<span class="menu-item-icon <%= iconCls %>"></span>',
'<% } %>',
'<%= caption %>',
'</a>'
].join(''));
this.rendered = false;
this.items = this.options.items || [];
this.offset = [0, 0];
this.menuAlign = this.options.menuAlign;
this.menuAlignEl = this.options.menuAlignEl;
this.scrollAlwaysVisible = this.options.scrollAlwaysVisible;
this.search = this.options.search;
if (this.options.restoreHeight) {
this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000);
!this.options.maxHeight && (this.options.maxHeight = this.options.restoreHeight);
}
if (!this.options.cyclic) this.options.cls += ' no-cyclic';
if (this.options.el)
this.render();
Common.UI.Menu.Manager.register(this);
},
remove: function() {
Common.UI.Menu.Manager.unregister(this);
Common.UI.BaseView.prototype.remove.call(this);
},
render: function(parentEl) {
var me = this;
this.trigger('render:before', this);
this.cmpEl = me.$el || $(this.el);
parentEl && this.setElement(parentEl, false);
if (!me.rendered) {
this.cmpEl = $(this.template({
items: me.items,
itemTemplate: me.itemTemplate,
options : me.options
}));
parentEl ? parentEl.append(this.cmpEl) : this.$el.append(this.cmpEl);
}
var rootEl = this.cmpEl.parent(),
menuRoot = (rootEl.attr('role') === 'menu') ? rootEl : rootEl.find('[role=menu]');
this.menuRoot = menuRoot;
if (menuRoot) {
if (!me.rendered) {
menuRoot.on( "click", "li", _.bind(me.onItemClick, me));
menuRoot.on( "mousedown", "li", _.bind(me.onItemMouseDown, me));
}
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
menuRoot.css({
position : 'fixed',
right : 'auto',
left : -1000,
top : -1000
});
this.parentEl = menuRoot.parent();
this.parentEl.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
this.parentEl.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me));
this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me));
menuRoot.hover(
function(e) { me.isOver = true;},
function(e) { me.isOver = false; }
);
}
this.rendered = true;
this.trigger('render:after', this);
return this;
},
resetItems: function(items) {
this.items = items || [];
this.$items = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.html(template({
items: this.items,
itemTemplate: this.itemTemplate,
options : this.options
}));
},
isVisible: function() {
return this.rendered && (this.cmpEl.is(':visible'));
},
show: function() {
if (this.rendered && this.parentEl && !this.parentEl.hasClass('open')) {
this.cmpEl.dropdown('toggle');
}
},
hide: function() {
if (this.rendered && this.parentEl) {
if ( this.parentEl.hasClass('open') )
this.cmpEl.dropdown('toggle');
else if (this.parentEl.hasClass('over'))
this.parentEl.removeClass('over');
}
},
onItemClick: function(e) {
if (e.which != 1 && e.which !== undefined)
return false;
var index = $(e.currentTarget).closest('li').index(),
item = (index>=0) ? this.items[index] : null;
if (!item) return;
if (item.disabled)
return false;
if (item.checkable && !item.checked)
this.setChecked(index, !item.checked);
this.isOver = false;
if (item.stopPropagation) {
e.stopPropagation();
var me = this;
_.delay(function(){
me.$el.parent().parent().find('[data-toggle=dropdown]').focus();
}, 10);
return;
}
this.trigger('item:click', this, item, e);
},
onItemMouseDown: function(e) {
if (e.which != 1) {
e.preventDefault();
e.stopPropagation();
return false;
}
e.stopPropagation();
},
setChecked: function(index, check, suppressEvent) {
this.toggle(index, check, suppressEvent);
},
toggle: function(index, toggle, suppressEvent) {
var state = !!toggle;
var item = this.items[index];
this.clearAll();
if (item && item.checkable) {
item.checked = state;
if (this.rendered) {
var itemEl = item.el || this.cmpEl.find('#'+item.id);
if (itemEl) {
itemEl.toggleClass('checked', item.checked);
if (!_.isEmpty(item.iconCls)) {
itemEl.css('background-image', 'none');
}
}
}
if (!suppressEvent)
this.trigger('item:toggle', this, item, state);
}
},
setDisabled: function(disabled) {
this.disabled = !!disabled;
if (this.rendered)
this.cmpEl.toggleClass('disabled', this.disabled);
},
isDisabled: function() {
return this.disabled;
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
this.trigger('show:before', this, e);
this.alignPosition();
},
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
listHeight = menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
setTimeout(function(){$selected.focus();}, 1);
}
}
this._search = {};
if (this.search && !this.$items) {
var me = this;
this.$items = this.menuRoot.find('> li').find('> a');
_.each(this.$items, function(item, index) {
me.items[index].el = $(item);
});
}
},
onBeforeHideMenu: function(e) {
this.trigger('hide:before', this, e);
if (Common.UI.Scroller.isMouseCapture())
e.preventDefault();
},
onAfterHideMenu: function(e, isFromInputControl) {
this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
},
onAfterKeydownMenu: function(e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
if (li.length>0) li.click();
if (!li.hasClass('dropdown-submenu'))
Common.UI.Menu.Manager.hideAll();
if ( $(e.currentTarget).closest('li').hasClass('dropdown-submenu')) {
e.stopPropagation();
return false;
}
} else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
this.fromKeyDown = true;
} else if (e.keyCode == Common.UI.Keys.ESC) {
// Common.NotificationCenter.trigger('menu:afterkeydown', e);
// return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
(!this._search.text) && (this._search.text = '');
(!this._search.char) && (this._search.char = e.key);
(this._search.char !== e.key) && (this._search.full = true);
this._search.text += e.key;
if (this._search.index===undefined) {
this._search.index = this.$items.index(this.$items.filter(':focus'));
}
this.selectCandidate();
}
},
selectCandidate: function() {
var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
itemCandidate, idxCandidate;
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (re.test(item.caption)) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
}
}
}
if (itemCandidate) {
this._search.index = idxCandidate;
var item = itemCandidate.el;
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = this.menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
}
item.focus();
}
},
setOffset: function(offsetX, offsetY) {
this.offset[0] = _.isUndefined(offsetX) ? this.offset[0] : offsetX;
this.offset[1] = _.isUndefined(offsetY) ? this.offset[1] : offsetY;
this.alignPosition();
},
getOffset: function() {
return this.offset;
},
alignPosition: function(fixedAlign, fixedOffset) {
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
docW = Common.Utils.innerWidth(),
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
menuH = menuRoot.outerHeight(),
parentW = menuParent.outerWidth(),
parentH = menuParent.outerHeight();
var posMenu = {
'tl': [0, 0],
'bl': [0, menuH],
'tr': [menuW, 0],
'br': [menuW, menuH]
};
var posParent = {
'tl': [0, 0],
'tr': [parentW, 0],
'bl': [0, parentH],
'br': [parentW, parentH]
};
var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0];
var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1];
if (left + menuW > docW)
if (menuParent.is('li.dropdown-submenu')) {
left = offset.left - menuW + 2;
} else {
left = docW - menuW;
}
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
}
}
} else {
if (top + menuH > docH) {
if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height
m = fixedAlign.match(/^([a-z]+)-([a-z]+)/);
top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0);
} else
top = docH - menuH;
}
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)});
},
clearAll: function() {
this.cmpEl && this.cmpEl.find('li > a.checked').removeClass('checked');
_.each(this.items, function(item){
item.checked = false;
});
}
});
});

View file

@ -119,8 +119,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -138,7 +137,7 @@ define([
this.hint = me.options.hint;
this.rendered = false;
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) {
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu) && !(this.menu instanceof Common.UI.MenuSimple)) {
this.menu = new Common.UI.Menu(_.extend({}, me.options.menu));
}
@ -148,7 +147,7 @@ define([
render: function() {
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
me.trigger('render:before', me);
@ -159,7 +158,7 @@ define([
el.off('click');
Common.UI.ToggleManager.unregister(me);
$(this.el).html(this.template({
el.html(this.template({
id : me.id,
caption : me.caption,
iconCls : me.iconCls,
@ -170,7 +169,7 @@ define([
if (me.menu) {
el.addClass('dropdown-submenu');
me.menu.render($(this.el));
me.menu.render(el);
el.mouseenter(_.bind(me.menu.alignPosition, me.menu));
// el.focusin(_.bind(me.onFocusItem, me));
el.focusout(_.bind(me.onBlurItem, me));
@ -214,7 +213,7 @@ define([
}
if (this.disabled)
$(this.el).toggleClass('disabled', this.disabled);
el.toggleClass('disabled', this.disabled);
el.on('click', _.bind(this.onItemClick, this));
el.on('mousedown', _.bind(this.onItemMouseDown, this));
@ -223,7 +222,7 @@ define([
}
}
me.cmpEl = $(this.el);
me.cmpEl = el;
me.rendered = true;
me.trigger('render:after', me);

View file

@ -128,7 +128,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('spinner');
@ -165,7 +165,7 @@ define([
this.setRawValue(this.value);
if (this.options.width) {
$(this.el).width(this.options.width);
el.width(this.options.width);
}
if (this.options.defaultValue===undefined)
@ -176,7 +176,7 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template);
this.$input = el.find('.form-control');
@ -189,7 +189,7 @@ define([
},
setDisabled: function(disabled) {
var el = $(this.el);
var el = this.$el || $(this.el);
if (disabled !== this.disabled) {
el.find('button').toggleClass('disabled', disabled);
el.toggleClass('disabled', disabled);

View file

@ -71,13 +71,12 @@ define([
disabled : false,
rendered : false,
template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),
template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><span><%= labelText %></span></label>'),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.name = this.options.name || Common.UI.getId();
@ -94,13 +93,14 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
labelText: this.options.labelText,
name: this.name
}));
this.$radio = el.find('input[type=button]');
this.$label = el.find('label');
this.rendered = true;
return this;
@ -145,6 +145,10 @@ define([
getValue: function() {
return this.$radio.hasClass('checked');
},
setCaption: function(text) {
this.$label.find('span').text(text);
}
});
});

View file

@ -78,7 +78,7 @@ define([
render: function() {
var me = this;
me.cmpEl = $(this.el);
me.cmpEl = me.$el || $(this.el);
if (!me.rendered) {
me.cmpEl.perfectScrollbar(_.extend({}, me.options));

View file

@ -104,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -131,10 +130,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el;
}
this.cmpEl.find('.track-center').width(me.options.width - 14);
@ -299,8 +298,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -326,10 +324,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
var el = this.cmpEl;

View file

@ -65,8 +65,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.thumbWidth = me.options.thumbWidth;
@ -89,10 +88,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
this.thumb = this.cmpEl.find('.thumb');

View file

@ -51,7 +51,7 @@ define([
this.active = false;
this.label = 'Tab';
this.cls = '';
this.template = _.template(['<li class="<% if(active){ %>active<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',
this.template = _.template(['<li class="<% if(active){ %>active selected<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',
'<a><%- label %></a>',
'</li>'].join(''));
@ -82,6 +82,10 @@ define([
this.$el.addClass('active');
},
isSelected: function() {
return this.$el.hasClass('selected');
},
deactivate: function(){
this.$el.removeClass('active');
},
@ -110,6 +114,11 @@ define([
this.$el.removeClass(cls);
},
toggleClass: function(cls) {
if (cls.length)
this.$el.toggleClass(cls);
},
hasClass: function(cls) {
return this.$el.hasClass(cls);
},

View file

@ -69,12 +69,28 @@ define([
};
StateManager.prototype.attach = function (tab) {
tab.changeState = $.proxy(function () {
tab.changeState = $.proxy(function (select) {
if (select) {
tab.toggleClass('selected');
var selectTab = _.find(this.bar.selectTabs, function (item) {return item.sheetindex === tab.sheetindex;});
if (selectTab) {
this.bar.selectTabs = _.without(this.bar.selectTabs, selectTab);
} else {
this.bar.selectTabs.push(tab);
}
} else {
if (!tab.isSelected()) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
tab.addClass('selected');
this.bar.selectTabs.length = 0;
this.bar.selectTabs.push(tab);
}
this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active');
tab.activate();
this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab);
}
}, this);
var dragHelper = new (function() {
@ -278,33 +294,111 @@ define([
document.removeEventListener('dragstart',dragDropText);
});
}
},
setHookTabs: function (e, bar, tabs) {
var me = this;
function dragComplete() {
if (!_.isUndefined(me.drag)) {
bar.dragging = false;
bar.$el.find('li.mousemove').removeClass('mousemove right');
var arrSelectIndex = [];
tabs.forEach(function (item) {
arrSelectIndex.push(item.sheetindex);
});
if (!_.isUndefined(me.drag.place)) {
me.bar.trigger('tab:move', arrSelectIndex, me.drag.place);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
} else {
me.bar.trigger('tab:move', arrSelectIndex);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
}
me.drag = undefined;
}
}
function dragMove (event) {
if (!_.isUndefined(me.drag)) {
me.drag.moveX = event.clientX*Common.Utils.zoom();
if (me.drag.moveX > me.tabBarRight) {
bar.tabs[bar.tabs.length - 1].$el.addClass('mousemove right');
me.drag.place = bar.tabs.length;
} else {
$(event.target).parent().parent().find('li.mousemove').removeClass('mousemove right');
$(event.target).parent().addClass('mousemove');
var name = event.target.parentElement.dataset.label,
currentTab = _.findWhere(bar.tabs, {label: name});
if (!_.isUndefined(currentTab)) {
me.drag.place = currentTab.sheetindex;
}
}
}
}
if (!_.isUndefined(bar) && !_.isUndefined(tabs) && bar.tabs.length > 1) {
me.bar = bar;
me.drag = {tabs: tabs};
bar.dragging = true;
this.calculateBounds();
$(document).on('mousemove.tabbar', dragMove);
$(document).on('mouseup.tabbar', function (e) {
dragComplete(e);
$(document).off('mouseup.tabbar');
$(document).off('mousemove.tabbar', dragMove);
});
}
}
}
});
tab.$el.on({
click: $.proxy(function () {
if (!tab.disabled && !tab.$el.hasClass('active')) {
click: $.proxy(function (event) {
if (!tab.disabled) {
if (event.ctrlKey || event.metaKey) {
tab.changeState(true);
} else if (event.shiftKey) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
var $active = this.bar.$el.find('ul > li.active'),
indexAct = $active.index(),
indexCur = this.bar.tabs.indexOf(tab);
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
for (var i = startIndex; i <= endIndex; i++) {
this.bar.tabs[i].changeState(true);
}
} else if (!tab.$el.hasClass('active')) {
if (this.bar.tabs.length === this.bar.selectTabs.length) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
}
if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else {
tab.changeState();
}
}
}
!tab.disabled && Common.NotificationCenter.trigger('edit:complete', this.bar);
}, this),
dblclick: $.proxy(function() {
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
}, this.bar),
contextmenu: $.proxy(function () {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab);
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs);
}, this.bar),
mousedown: $.proxy(function (e) {
if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
if (!tab.isLockTheDrag) {
if (this.bar.selectTabs.length > 1) {
dragHelper.setHookTabs(e, this.bar, this.bar.selectTabs);
} else {
dragHelper.setHook(e, this.bar, tab);
}
}
}
}, this)
});
};
@ -322,6 +416,7 @@ define([
tabs: [],
template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
selectTabs: [],
initialize : function (options) {
_.extend(this.config, options);
@ -397,6 +492,10 @@ define([
me.$bar.append(tab.render().$el);
me.tabs.push(tab);
me.manager.attach(tab);
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
}
} else {
for (i = tabs.length; i-- > 0 ; ) {
@ -410,6 +509,11 @@ define([
me.tabs.splice(index, 0, tab);
}
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
me.manager.attach(tab);
}
}
@ -462,6 +566,27 @@ define([
this.checkInvisible();
},
setSelectAll: function(isSelect) {
var me = this;
me.selectTabs.length = 0;
if (isSelect) {
me.tabs.forEach(function(tab){
if (!tab.isSelected()) {
tab.addClass('selected');
}
me.selectTabs.push(tab);
});
} else {
me.tabs.forEach(function(tab){
if (tab.isActive()) {
me.selectTabs.push(tab);
} else if (tab.isSelected()) {
tab.removeClass('selected');
}
});
}
},
getActive: function(iselem) {
return iselem ? this.$bar.find('> li.active') : this.$bar.find('> li.active').index();
},
@ -575,7 +700,7 @@ define([
//left = tab.position().left;
//right = left + tab.width();
return !(left < leftbound) && !(right > rightbound);
return !(left < leftbound) && !(right - rightbound > 0.1);
}
return false;

View file

@ -335,10 +335,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
me.rendered = true;

View file

@ -98,7 +98,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent);
@ -116,7 +116,7 @@ define([
},
render: function () {
$(this.el).html(this.template({colors: this.colors}));
this.$el.html(this.template({colors: this.colors}));
return this;
},
@ -144,7 +144,7 @@ define([
},
updateCustomColors: function() {
var el = $(this.el);
var el = this.$el || $(this.el);
if (el) {
var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
@ -221,7 +221,7 @@ define([
},
setCustomColor: function(color) {
var el = $(this.el);
var el = this.$el || $(this.el);
color = /#?([a-fA-F0-9]{6})/.exec(color);
if (color) {
this.saveCustomColor(color[1]);
@ -272,7 +272,7 @@ define([
},
select: function(color, suppressEvent) {
var el = $(this.el);
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
if (typeof(color) == 'object' ) {
@ -321,7 +321,7 @@ define([
},
selectByRGB: function(rgb, suppressEvent) {
var el = $(this.el);
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
var color = (typeof(rgb) == 'object') ? rgb.color : rgb;
@ -351,7 +351,7 @@ define([
if (effectcolors===undefined || standartcolors===undefined) return;
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
if (me.aColorElements === undefined) {
me.aColorElements = el.find('a.palette-color');
@ -407,7 +407,7 @@ define([
if (value)
this.select(value, true);
else {
var selected = $(this.el).find('a.' + this.selectedCls);
var selected = el.find('a.' + this.selectedCls);
if (selected.length && selected.hasClass('palette-color-effect')) {
this.value = selected[0].className.match(this.colorRe)[1].toUpperCase();
}
@ -416,7 +416,7 @@ define([
},
clearSelection: function(suppressEvent) {
$(this.el).find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.value = undefined;
},

View file

@ -193,7 +193,7 @@ define([
});
if (view) {
var innerEl = $(this.el).find('.inner').addBack().filter('.inner');
var innerEl = (this.$el || $(this.el)).find('.inner').addBack().filter('.inner');
if (innerEl) {
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();

View file

@ -63,6 +63,12 @@
* @cfg {Boolean} animate
* Makes the window to animate while showing or hiding
*
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* Methods
*
* @method show
@ -106,12 +112,6 @@
* @window Common.UI.warning
* Shows warning message.
* @cfg {String} msg
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* @cfg {Function} callback
* @param {String} button
* If the window is closed via shortcut or header's close tool, the 'button' will be 'close'
@ -167,7 +167,15 @@ define([
'<div class="title"><%= title %></div> ' +
'</div>' +
'<% } %>' +
'<div class="body"><%= tpl %></div>' +
'<div class="body"><%= tpl %>' +
'<% if (typeof (buttons) !== "undefined" && _.size(buttons) > 0) { %>' +
'<div class="footer">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>' +
'</div>' +
'</div>';
function _getMask() {
@ -399,31 +407,9 @@ define([
Common.UI.alert = function(options) {
var me = this.Window.prototype;
var arrBtns = {ok: me.okButtonText, cancel: me.cancelButtonText,
yes: me.yesButtonText, no: me.noButtonText,
close: me.closeButtonText};
if (!options.buttons) {
options.buttons = {};
options.buttons['ok'] = {text: arrBtns['ok'], cls: 'primary'};
} else {
if (_.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
}
options.buttons = ['ok'];
}
options.dontshow = options.dontshow || false;
@ -435,14 +421,7 @@ define([
'<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' +
'</div>' +
'</div>' +
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>' +
'<% if (_.size(buttons) > 0) { %>' +
'<div class="footer <% if (dontshow) { %> dontshow <% } %>">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>';
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>';
_.extend(options, {
cls: 'alert',
@ -500,7 +479,9 @@ define([
win.on({
'render:after': function(obj){
obj.getChild('.footer .dlg-btn').on('click', onBtnClick);
var footer = obj.getChild('.footer');
options.dontshow && footer.addClass('dontshow');
footer.find('.dlg-btn').on('click', onBtnClick);
chDontShow = new Common.UI.CheckBox({
el: win.$window.find('.dont-show-checkbox'),
labelText: win.textDontShow
@ -572,6 +553,29 @@ define([
this.initConfig = {};
this.binding = {};
var arrBtns = {ok: this.okButtonText, cancel: this.cancelButtonText,
yes: this.yesButtonText, no: this.noButtonText,
close: this.closeButtonText};
if (options.buttons && _.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
options.footerCls = options.footerCls || 'center';
}
_.extend(this.initConfig, config, options || {});
!this.initConfig.id && (this.initConfig.id = 'window-' + this.cid);
@ -632,6 +636,8 @@ define([
};
Common.NotificationCenter.on('window:close', this.binding.winclose);
this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls);
this.fireEvent('render:after',this);
return this;
},

View file

@ -172,7 +172,7 @@ define([
},
onAfterRender: function(panelPlugins) {
panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
panelPlugins.viewPluginsList && panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
this.bindViewEvents(this.panelPlugins, this.events);
var me = this;
Common.NotificationCenter.on({
@ -367,14 +367,14 @@ define([
var me = this,
isCustomWindow = variation.get_CustomWindow(),
arrBtns = variation.get_Buttons(),
newBtns = {},
newBtns = [],
size = variation.get_Size();
if (!size || size.length<2) size = [800, 600];
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
if (b.visible)
newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
newBtns[index] = {caption: b.text, value: index, primary: b.primary};
});
}

View file

@ -102,6 +102,8 @@ define([
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
@ -113,6 +115,7 @@ define([
this.currentUserId = data.config.user.id;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
}
return this;
},
setApi: function (api) {
if (api) {
@ -131,9 +134,16 @@ define([
this.popoverChanges = new Common.Collections.ReviewChanges();
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
return this;
},
loadDocument: function(data) {
this.document = data.doc;
},
SetDisabled: function(state) {
if (this.dlgChanges)
this.dlgChanges.close();
@ -678,7 +688,7 @@ define([
comments.setPreviewMode(disable);
var leftMenu = app.getController('LeftMenu');
leftMenu.leftMenu.getMenu('file').miProtect.setDisabled(disable);
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
leftMenu.setPreviewMode(disable);
if (this.view) {
@ -703,7 +713,7 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) )
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
me.view.turnSpelling(true);
if ( config.canReview ) {
@ -730,13 +740,13 @@ define([
}
});
} else if (config.canViewReview) {
config.canViewReview = me.api.asc_HaveRevisionsChanges(true); // check revisions from all users
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
if (config.canViewReview) {
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
if (val===null)
val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
me.turnDisplayMode(config.isRestrictedEdit ? 'markup' : val); // load display mode only in viewer
me.view.turnDisplayMode(config.isRestrictedEdit ? 'markup' : val);
me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
}
}
@ -784,9 +794,34 @@ define([
},
onLostEditRights: function() {
this._readonlyRights = true;
this.view && this.view.onLostEditRights();
},
changeAccessRights: function(btn,event,opts) {
if (this._docAccessDlg || this._readonlyRights) return;
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.appConfig.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.setSharingSettings({sharingSettings: rights});
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
me._docAccessDlg.show();
},
setSharingSettings: function(data) {
if (data) {
this.document.info.sharingSettings = data.sharingSettings;
Common.NotificationCenter.trigger('collaboration:sharingupdate', data.sharingSettings);
Common.NotificationCenter.trigger('mentions:clearusers', this);
}
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
},

View file

@ -41,8 +41,8 @@
function onDropDownKeyDown(e) {
var $this = $(this),
$parent = $this.parent(),
beforeEvent = jQuery.Event('keydown.before.bs.dropdown'),
afterEvent = jQuery.Event('keydown.after.bs.dropdown');
beforeEvent = jQuery.Event('keydown.before.bs.dropdown', {keyCode: e.keyCode}),
afterEvent = jQuery.Event('keydown.after.bs.dropdown', {keyCode: e.keyCode});
$parent.trigger(beforeEvent);
@ -110,8 +110,9 @@ function patchDropDownKeyDown(e) {
_.delay(function() {
var mnu = $('> [role=menu]', li),
$subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'),
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview');
if ($subitems.length>0 && $dataviews.length<1)
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'),
$internal_menu = mnu.find('> li:not(.divider):not(.disabled):visible ul.internal-menu');
if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1)
($subitems.index($subitems.filter(':focus'))<0) && $subitems.eq(0).focus();
}, 250);
}

View file

@ -363,6 +363,8 @@ Common.util.LanguageInfo = new(function() {
0x380A : ["es-UY", "Español (Uruguay)", "Spanish (Uruguay)"],
0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)", "Spanish (Venezuela)"],
0x040a : ["es-ES_tradnl", "Spanish"],
0x580a : ["es-419", "Español (América Latina y el Caribe)", "Spanish (Latin America and the Caribbean)"],
0x5C0a : ["es-CU", "Español (Cuba)", "Spanish (Cuba)"],
0x001D : ["sv", "Svenska"],
0x081D : ["sv-FI", "Svenska (Finland)", "Swedish (Finland)"],
0x041D : ["sv-SE", "Svenska (Sverige)", "Swedish (Sweden)"],
@ -446,10 +448,12 @@ Common.util.LanguageInfo = new(function() {
},
getLocalLanguageCode: function(name) {
if (name) {
for (var code in localLanguageName) {
if (localLanguageName[code][0].toLowerCase()===name.toLowerCase())
return code;
}
}
return null;
},

View file

@ -87,12 +87,12 @@ Common.Utils = _.extend(new(function() {
isSecure = /^https/i.test(window.location.protocol),
emailRe = /^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,
ipRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
emailStrongRe = /(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,
emailAddStrongRe = /(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
emailAddStrongRe = /(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%\+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
documentSettingsType = {
Paragraph : 0,
Table : 1,
@ -846,6 +846,47 @@ Common.Utils.injectComponent = function ($slot, cmp) {
}
};
jQuery.fn.extend({
elementById: function (id, parent) {
/**
* usage: $obj.findById('#id')
* $().findById('#id', $obj | node)
* $.fn.findById('#id', $obj | node)
*
* return: dom element
* */
var _el = document.getElementById(id.substring(1));
if ( !_el ) {
parent = parent || this;
if ( parent instanceof jQuery ) {
parent.each(function (i, node) {
_el = node.querySelectorAll(id);
if ( _el.length == 0 ) {
if ( ('#' + node.id) == id ) {
_el = node;
return false;
}
} else
if ( _el.length ) {
_el = _el[0];
return false;
}
})
} else {
_el = parent.querySelectorAll(id);
if ( _el && _el.length ) return _el[0];
}
}
return _el;
},
findById: function (id, parent) {
var _el = $.fn.elementById.apply(this, arguments);
return !!_el ? $(_el) : $();
}
});
Common.Utils.InternalSettings.set('toolbar-height-tabs', 32);
Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28);
Common.Utils.InternalSettings.set('toolbar-height-controls', 67);

View file

@ -45,6 +45,7 @@ define([
Common.Views.About = Common.UI.BaseView.extend(_.extend({
menu: undefined,
rendered: false,
options: {
alias: 'Common.Views.About'
},
@ -152,8 +153,10 @@ define([
},
render: function() {
var el = $(this.el);
el.html(this.template({
if ( !this.rendered ) {
this.rendered = true;
var _$l = $(this.template({
publishername: '{{PUBLISHER_NAME}}',
publisheraddr: '{{PUBLISHER_ADDRESS}}',
publisherurl: '{{PUBLISHER_URL}}',
@ -162,27 +165,36 @@ define([
scope: this
}));
el.addClass('about-dlg');
this.cntLicenseeInfo = $('#id-about-licensee-info');
this.cntLicensorInfo = $('#id-about-licensor-info');
this.divCompanyLogo = $('#id-about-company-logo');
this.lblCompanyName = $('#id-about-company-name');
this.lblCompanyAddress = $('#id-about-company-address');
this.lblCompanyMail = $('#id-about-company-mail');
this.lblCompanyUrl = $('#id-about-company-url');
this.lblCompanyLic = $('#id-about-company-lic');
this.cntLicenseeInfo = _$l.findById('#id-about-licensee-info');
this.cntLicensorInfo = _$l.findById('#id-about-licensor-info');
this.divCompanyLogo = _$l.findById('#id-about-company-logo');
this.lblCompanyName = _$l.findById('#id-about-company-name');
this.lblCompanyAddress = _$l.findById('#id-about-company-address');
this.lblCompanyMail = _$l.findById('#id-about-company-mail');
this.lblCompanyUrl = _$l.findById('#id-about-company-url');
this.lblCompanyLic = _$l.findById('#id-about-company-lic');
this.$el.html(_$l);
this.$el.addClass('about-dlg');
if ( this.licData )
this.setLicInfo(this.licData);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
}
return this;
},
setLicInfo: function(data){
if ( !this.rendered ) {
this.licData = data || true;
} else {
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
var customer = data.customer;
@ -224,9 +236,12 @@ define([
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
}
}
},
show: function () {
if ( !this.rendered ) this.render();
Common.UI.BaseView.prototype.show.call(this,arguments);
this.fireEvent('show', this );
},

View file

@ -51,7 +51,8 @@ define([
cls: 'advanced-settings-dlg',
toggleGroup: 'advanced-settings-group',
contentTemplate: '',
items: []
items: [],
buttons: ['ok', 'cancel']
}, options);
this.template = options.template || [
@ -64,11 +65,7 @@ define([
'<div class="separator"/>',
'<div class="content-panel" >' + _options.contentTemplate + '</div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
_options.tpl = _.template(this.template)(_options);
@ -190,9 +187,6 @@ define([
if (this.storageName)
Common.localStorage.setItem(this.storageName, this.getActiveCategory());
Common.UI.Window.prototype.close.call(this, suppressevent);
},
cancelButtonText: 'Cancel',
okButtonText : 'Ok'
}
}, Common.Views.AdvancedSettingsWindow || {}));
});

View file

@ -208,7 +208,7 @@ define([
var user = this.storeUsers.findOriginalUser(m.get('userid'));
m.set({
usercolor : user ? user.get('color') : null,
message : this._pickLink(Common.Utils.String.htmlEncode(m.get('message')))
message : this._pickLink(m.get('message'))
}, {silent:true});
},
@ -216,6 +216,9 @@ define([
var arr = [], offset, len;
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -223,6 +226,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;
@ -250,14 +256,13 @@ define([
arr = _.sortBy(arr, function(item){ return item.start; });
var str_res = (arr.length>0) ? ( message.substring(0, arr[0].start) + arr[0].str) : message;
var str_res = (arr.length>0) ? ( Common.Utils.String.htmlEncode(message.substring(0, arr[0].start)) + arr[0].str) : Common.Utils.String.htmlEncode(message);
for (var i=1; i<arr.length; i++) {
str_res += (message.substring(arr[i-1].end, arr[i].start) + arr[i].str);
str_res += (Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, arr[i].start)) + arr[i].str);
}
if (arr.length>0) {
str_res += message.substring(arr[i-1].end, message.length);
str_res += Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, message.length));
}
return str_res;
},

View file

@ -72,72 +72,8 @@ define([
return tpl;
}
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
el: '#left-panel-comments',
template: _.template(panelTemplate),
addCommentHeight: 45,
newCommentHeight: 110,
textBoxAutoSizeLocked: undefined, // disable autosize textbox
viewmode: false,
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.store = this.options.store;
},
render: function () {
var me = this;
if (!this.rendered) {
this.$el.html(this.template({
textAddCommentToDoc: me.textAddCommentToDoc,
textAddComment: me.textAddComment,
textCancel: me.textCancel,
textEnterCommentHint: me.textEnterCommentHint,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}));
this.buttonAddCommentToDoc = new Common.UI.Button({
el: $('.btn.new', this.$el),
enableToggle: false
});
this.buttonAdd = new Common.UI.Button({
action: 'add',
el: $('.btn.add', this.$el),
enableToggle: false
});
this.buttonCancel = new Common.UI.Button({
el: $('.btn.cancel', this.$el),
enableToggle: false
});
this.buttonAddCommentToDoc.on('click', _.bind(this.onClickShowBoxDocumentComment, this));
this.buttonAdd.on('click', _.bind(this.onClickAddDocumentComment, this));
this.buttonCancel.on('click', _.bind(this.onClickCancelDocumentComment, this));
this.txtComment = $('#comment-msg-new', this.el);
this.txtComment.keydown(function (event) {
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode == Common.UI.Keys.RETURN) {
me.onClickAddDocumentComment();
event.stopImmediatePropagation();
} else if (event.keyCode === Common.UI.Keys.TAB) {
var $this, end, start;
start = this.selectionStart;
end = this.selectionEnd;
$this = $(this);
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
this.selectionStart = this.selectionEnd = start + 1;
event.stopImmediatePropagation();
event.preventDefault();
}
});
}
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
return {
options : {
handleSelect: false,
scrollable: true,
@ -228,7 +164,185 @@ define([
}
}
})());
if (CommentsPanelDataView) {
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
el: '#left-panel-comments',
template: _.template(panelTemplate),
addCommentHeight: 45,
newCommentHeight: 110,
textBoxAutoSizeLocked: undefined, // disable autosize textbox
viewmode: false,
_commentsViewOnItemClick: function (picker, item, record, e) {
var me = this;
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
function readdresolves() {
me.update();
}
btn = $(e.target);
if (btn) {
showEditBox = record.get('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
picker.autoHeightTextBox();
readdresolves();
me.hookTextBox();
picker.autoScrollToEditButtons();
picker.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
picker.autoHeightTextBox();
readdresolves();
picker.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
picker.autoHeightTextBox();
me.hookTextBox();
picker.autoScrollToEditButtons();
picker.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, picker.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, picker.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, picker.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
},
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.store = this.options.store;
},
render: function () {
var me = this;
if (!this.rendered) {
this.$el.html(this.template({
textAddCommentToDoc: me.textAddCommentToDoc,
textAddComment: me.textAddComment,
textCancel: me.textCancel,
textEnterCommentHint: me.textEnterCommentHint,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}));
this.buttonAddCommentToDoc = new Common.UI.Button({
el: $('.btn.new', this.$el),
enableToggle: false
});
this.buttonAdd = new Common.UI.Button({
action: 'add',
el: $('.btn.add', this.$el),
enableToggle: false
});
this.buttonCancel = new Common.UI.Button({
el: $('.btn.cancel', this.$el),
enableToggle: false
});
this.buttonAddCommentToDoc.on('click', _.bind(this.onClickShowBoxDocumentComment, this));
this.buttonAdd.on('click', _.bind(this.onClickAddDocumentComment, this));
this.buttonCancel.on('click', _.bind(this.onClickCancelDocumentComment, this));
this.txtComment = $('#comment-msg-new', this.el);
this.txtComment.keydown(function (event) {
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode == Common.UI.Keys.RETURN) {
me.onClickAddDocumentComment();
event.stopImmediatePropagation();
} else if (event.keyCode === Common.UI.Keys.TAB) {
var $this, end, start;
start = this.selectionStart;
end = this.selectionEnd;
$this = $(this);
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
this.selectionStart = this.selectionEnd = start + 1;
event.stopImmediatePropagation();
event.preventDefault();
}
});
}
if (this.commentsView) {
this.commentsView.onResetItems();
} else {
@ -266,124 +380,14 @@ define([
});
view.tipsArray = arr;
};
this.commentsView.on('item:add', addtooltip);
this.commentsView.on('item:remove', addtooltip);
this.commentsView.on('item:change', addtooltip);
this.commentsView.on('item:click', function (picker, item, record, e) {
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
function readdresolves() {
me.update();
}
btn = $(e.target);
if (btn) {
showEditBox = record.get('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
this.autoHeightTextBox();
readdresolves();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
this.autoHeightTextBox();
readdresolves();
this.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
this.autoHeightTextBox();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
this.commentsView.on({
'item:add': addtooltip,
'item:remove': addtooltip,
'item:change': addtooltip,
'item:click': this._commentsViewOnItemClick.bind(this)
});
}
}
if (!this.rendered) this.setupLayout();
this.update();
@ -482,7 +486,7 @@ define([
},
setupLayout: function () {
var me = this, parent = $(me.el);
var me = this, parent = me.$el;
var add = $('.new-comment-ct', me.el),
to = $('.add-link-ct', me.el),
@ -652,9 +656,10 @@ define([
pickLink: function (message) {
var arr = [], offset, len;
message = Common.Utils.String.htmlEncode(message);
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -662,6 +667,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;
@ -689,14 +697,13 @@ define([
arr = _.sortBy(arr, function(item){ return item.start; });
var str_res = (arr.length>0) ? ( message.substring(0, arr[0].start) + arr[0].str) : message;
var str_res = (arr.length>0) ? ( Common.Utils.String.htmlEncode(message.substring(0, arr[0].start)) + arr[0].str) : Common.Utils.String.htmlEncode(message);
for (var i=1; i<arr.length; i++) {
str_res += (message.substring(arr[i-1].end, arr[i].start) + arr[i].str);
str_res += (Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, arr[i].start)) + arr[i].str);
}
if (arr.length>0) {
str_res += message.substring(arr[i-1].end, message.length);
str_res += Common.Utils.String.htmlEncode(message.substring(arr[i-1].end, message.length));
}
return str_res;
},

View file

@ -50,12 +50,14 @@ define([
options: {
width : 500,
height : 325,
cls : 'modal-dlg copy-warning'
cls : 'modal-dlg copy-warning',
buttons: ['ok']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
title: this.textTitle,
buttons: ['ok']
}, options || {});
this.template = [
@ -77,10 +79,7 @@ define([
'</div>',
'<div id="copy-warning-checkbox" style="margin-top: 20px; text-align: left;"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary">' + this.okButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.options.tpl = _.template(this.template)(this.options);

View file

@ -286,7 +286,6 @@ define([
return false;
},
cancelButtonText: 'Cancel',
addButtonText: 'Add',
textNew: 'New',
textCurrent: 'Current',

View file

@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');

View file

@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-cancel" class="btn normal dlg-btn disabled" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');

View file

@ -74,7 +74,7 @@ define([
var templateRightBox = '<section>' +
'<section id="box-doc-name">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'</section>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
@ -116,7 +116,7 @@ define([
'<div class="btn-slot" id="slot-btn-dt-redo"></div>' +
'</div>' +
'<div class="lr-separator"></div>' +
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'<label id="title-user-name" style="pointer-events: none;"></label>' +
'</section>';
@ -190,7 +190,7 @@ define([
function onUsersClick(e) {
if ( !$btnUsers.menu ) {
$panelUsers.removeClass('open');
this.fireEvent('click:users', this);
Common.NotificationCenter.trigger('collaboration:sharing');
} else {
var usertip = $btnUsers.data('bs.tooltip');
if ( usertip ) {
@ -245,7 +245,7 @@ define([
var $labelChangeRights = $panelUsers.find('#tlb-change-rights');
$labelChangeRights.on('click', function(e) {
$panelUsers.removeClass('open');
me.fireEvent('click:users', me);
Common.NotificationCenter.trigger('collaboration:sharing');
});
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
@ -489,13 +489,13 @@ define([
if ( !config.isEdit ) {
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline )
this.btnDownload = createTitleButton('svg-btn-download', $html.find('#slot-hbtn-download'));
this.btnDownload = createTitleButton('svg-btn-download', $html.findById('#slot-hbtn-download'));
if ( config.canPrint )
this.btnPrint = createTitleButton('svg-btn-print', $html.find('#slot-hbtn-print'));
this.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-hbtn-print'));
if ( config.canEdit && config.canRequestEditRights )
this.btnEdit = createTitleButton('svg-btn-edit', $html.find('#slot-hbtn-edit'));
this.btnEdit = createTitleButton('svg-btn-edit', $html.findById('#slot-hbtn-edit'));
}
me.btnOptions.render($html.find('#slot-btn-options'));
@ -519,12 +519,12 @@ define([
me.setUserName(me.options.userName);
if ( config.canPrint && config.isEdit ) {
me.btnPrint = createTitleButton('svg-btn-print', $('#slot-btn-dt-print', $html), true);
me.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-btn-dt-print'), true);
}
me.btnSave = createTitleButton('svg-btn-save', $('#slot-btn-dt-save', $html), true);
me.btnUndo = createTitleButton('svg-btn-undo', $('#slot-btn-dt-undo', $html), true);
me.btnRedo = createTitleButton('svg-btn-redo', $('#slot-btn-dt-redo', $html), true);
me.btnSave = createTitleButton('svg-btn-save', $html.findById('#slot-btn-dt-save'), true);
me.btnUndo = createTitleButton('svg-btn-undo', $html.findById('#slot-btn-dt-undo'), true);
me.btnRedo = createTitleButton('svg-btn-redo', $html.findById('#slot-btn-dt-redo'), true);
if ( me.btnSave.$icon.is('svg') ) {
me.btnSave.$icon.addClass('icon-save');

View file

@ -46,7 +46,9 @@ define([
options: {
width: 330,
header: false,
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel'],
footerCls: 'right'
},
initialize : function(options) {
@ -58,10 +60,6 @@ define([
'<label>' + (this.options.title || this.textUrl) + '</label>',
'</div>',
'<div id="id-dlg-url" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -95,7 +93,7 @@ define([
var me = this;
_.delay(function(){
me.getChild('input').focus();
},500);
},100);
},
onPrimary: function(event) {
@ -123,8 +121,6 @@ define([
},
textUrl : 'Paste an image URL:',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtEmpty : 'This field is required',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"'
}, Common.Views.ImageFromUrlDialog || {}));

View file

@ -51,7 +51,8 @@ define([
height: 156,
style: 'min-width: 230px;',
cls: 'modal-dlg',
split: false
split: false,
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -67,10 +68,6 @@ define([
'<div class="input-row" style="margin-top: 10px;">',
'<label class="text rows-text" style="width: 130px;">' + this.txtRows + '</label><div class="rows-val" style="float: right;"></div>',
'</div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -138,8 +135,6 @@ define([
txtColumns: 'Number of Columns',
txtRows: 'Number of Rows',
textInvalidRowsCols: 'You need to specify valid rows and columns count.',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtMinText: 'The minimum value for this field is {0}',
txtMaxText: 'The maximum value for this field is {0}'
}, Common.Views.InsertTableDialog || {}))

View file

@ -51,7 +51,9 @@ define([
options: {
header: false,
width: 350,
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel'],
footerCls: 'right'
},
template: '<div class="box">' +
@ -60,16 +62,11 @@ define([
'</div>' +
'<div class="input-row" id="id-document-language">' +
'</div>' +
'</div>' +
'<div class="footer right">' +
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>'+
'<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>'+
'</div>',
initialize : function(options) {
_.extend(this.options, options || {}, {
label: this.labelSelect,
btns: {ok: this.btnOk, cancel: this.btnCancel}
label: this.labelSelect
});
this.options.tpl = _.template(this.template)(this.options);
@ -144,8 +141,6 @@ define([
return false;
},
labelSelect : 'Select document language',
btnCancel : 'Cancel',
btnOk : 'Ok'
labelSelect : 'Select document language'
}, Common.Views.LanguageDialog || {}))
});

View file

@ -231,6 +231,9 @@ define([
delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null);
if (!this.closable && this.type == Common.Utils.importTextType.TXT) { //save last encoding only for opening txt files
Common.localStorage.setItem("de-settings-open-encoding", encoding);
}
this.handler.call(this, state, encoding, delimiter, delimiterChar);
}
}
@ -284,11 +287,17 @@ define([
data: listItems,
editable: false,
disabled: true,
search: true,
itemsTemplate: itemsTemplate
});
this.cmbEncoding.setDisabled(false);
this.cmbEncoding.setValue((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0]);
var encoding = (this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0];
if (!this.closable && this.type == Common.Utils.importTextType.TXT) { // only for opening txt files
var value = Common.localStorage.getItem("de-settings-open-encoding");
value && (encoding = parseInt(value));
}
this.cmbEncoding.setValue(encoding);
if (this.preview)
this.cmbEncoding.on('selected', _.bind(this.onCmbEncodingSelect, this));
@ -435,8 +444,6 @@ define([
this.updatePreview();
},
okButtonText : "OK",
cancelButtonText : "Cancel",
txtDelimiter : "Delimiter",
txtEncoding : "Encoding ",
txtSpace : "Space",

View file

@ -59,7 +59,8 @@ define([
header : true,
cls : 'modal-dlg',
contentTemplate : '',
title : t.txtTitle
title : t.txtTitle,
buttons: ['ok', 'cancel']
}, options);
@ -77,11 +78,7 @@ define([
'</div>',
'<div id="id-repeat-txt" class="input-row"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + t.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.handler = options.handler;
@ -154,8 +151,6 @@ define([
this.close();
},
okButtonText : "OK",
cancelButtonText : "Cancel",
txtTitle : "Set Password",
txtPassword : "Password",
txtDescription : "A Password is required to open this document",

View file

@ -88,22 +88,22 @@ define([
el && (this.$el = $(el));
this.$el.html(this.template({scope: this}));
this.viewPluginsList = new Common.UI.DataView({
el: $('#plugins-list'),
store: this.storePlugins,
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="item-plugins" style="display: <% if (visible) {%> block; <%} else {%> none; <% } %>">',
'<div class="plugin-icon" style="background-image: url(' + '<%= baseUrl %>' + '<%= variations[currentVariation].get("icons")[((window.devicePixelRatio > 1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);"></div>',
'<% if (variations.length>1) { %>',
'<div class="plugin-caret img-commonctrl"></div>',
'<% } %>',
'<%= name %>',
'</div>'
].join(''))
});
this.lockedControls.push(this.viewPluginsList);
this.viewPluginsList.cmpEl.off('click');
// this.viewPluginsList = new Common.UI.DataView({
// el: $('#plugins-list'),
// store: this.storePlugins,
// enableKeyEvents: false,
// itemTemplate: _.template([
// '<div id="<%= id %>" class="item-plugins" style="display: <% if (visible) {%> block; <%} else {%> none; <% } %>">',
// '<div class="plugin-icon" style="background-image: url(' + '<%= baseUrl %>' + '<%= variations[currentVariation].get("icons")[((window.devicePixelRatio > 1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);"></div>',
// '<% if (variations.length>1) { %>',
// '<div class="plugin-caret img-commonctrl"></div>',
// '<% } %>',
// '<%= name %>',
// '</div>'
// ].join(''))
// });
// this.lockedControls.push(this.viewPluginsList);
// this.viewPluginsList.cmpEl.off('click');
this.pluginName = $('#current-plugin-header label');
this.pluginsPanel = $('#plugins-box');
@ -190,7 +190,7 @@ define([
item.setDisabled(disable);
});
this.pluginsMask.css('display', disable ? 'block' : 'none');
this.pluginsMask && this.pluginsMask.css('display', disable ? 'block' : 'none');
}
},
@ -366,11 +366,6 @@ define([
'</div>',
'<% if ((typeof buttons !== "undefined") && _.size(buttons) > 0) { %>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<% for(var bt in buttons) { %>',
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',
'<% } %>',
'</div>',
'<% } %>'
].join('');

View file

@ -47,7 +47,9 @@ define([
width: 330,
header: false,
cls: 'modal-dlg',
filename: ''
filename: '',
buttons: ['ok', 'cancel'],
footerCls: 'right'
},
initialize : function(options) {
@ -59,10 +61,6 @@ define([
'<label>' + this.textName + '</label>',
'</div>',
'<div id="id-dlg-newname" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -128,8 +126,6 @@ define([
},
textName : 'File name',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtInvalidName : 'The file name cannot contain any of the following characters: '
}, Common.Views.RenameDialog || {}));
});

View file

@ -945,7 +945,7 @@ define([
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
this.selectionStart = this.selectionEnd = start + 1;
event.stopImmediatePropagation();
// event.stopImmediatePropagation();
event.preventDefault();
}
@ -954,28 +954,30 @@ define([
if (this.canRequestUsers) {
textBox && textBox.keydown(function (event) {
if ( event.keyCode == Common.UI.Keys.SPACE ||
if ( event.keyCode == Common.UI.Keys.SPACE || event.keyCode === Common.UI.Keys.TAB ||
event.keyCode == Common.UI.Keys.HOME || event.keyCode == Common.UI.Keys.END || event.keyCode == Common.UI.Keys.RIGHT ||
event.keyCode == Common.UI.Keys.LEFT || event.keyCode == Common.UI.Keys.UP) {
// hide email menu
me.onEmailListMenu();
} else if (event.keyCode == Common.UI.Keys.DOWN) {
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible())
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible()) {
_.delay(function () {
var selected = me.emailMenu.cmpEl.find('li:not(.divider):first');
selected = selected.find('a');
selected.focus();
}, 10);
event.preventDefault();
}
}
me.e = event;
});
textBox && textBox.on('input', function (event) {
var $this = $(this),
start = this.selectionStart,
val = $this.val().replace(/[\n]$/, ""),
val = $this.val(),
left = 0, right = val.length-1;
for (var i=start-1; i>=0; i--) {
if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 || val.charCodeAt(i) == 10 || val.charCodeAt(i) == 9) {
if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 /*enter*/ || val.charCodeAt(i) == 10 /*new line*/ || val.charCodeAt(i) == 9 /*tab*/) {
left = i+1; break;
}
}
@ -989,7 +991,8 @@ define([
if (res && res.length>1) {
str = res[1]; // send to show email menu
me.onEmailListMenu(str, left, right);
}
} else
me.onEmailListMenu(); // hide email menu
});
}
},
@ -1118,7 +1121,7 @@ define([
return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.toLowerCase().indexOf(str))
});
}
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= caption %></div><div style="color: #909090;"><%= options.value %></div></a>'),
var tpl = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" style="font-size: 12px;"><div><%= Common.Utils.String.htmlEncode(caption) %></div><div style="color: #909090;"><%= Common.Utils.String.htmlEncode(options.value) %></div></a>'),
divider = false;
_.each(users, function(menuItem, index) {
if (divider && !menuItem.hasAccess) {
@ -1159,9 +1162,9 @@ define([
insertEmailToTextbox: function(str, left, right) {
var textBox = this.commentsView.getTextBox(),
val = textBox.val();
textBox.val(val.substring(0, left) + '+' + str + val.substring(right+1, val.length));
textBox.val(val.substring(0, left) + '+' + str + ' ' + val.substring(right+1, val.length));
setTimeout(function(){
textBox[0].selectionStart = textBox[0].selectionEnd = left + str.length + 1;
textBox[0].selectionStart = textBox[0].selectionEnd = left + str.length + 2;
}, 10);
},

View file

@ -122,6 +122,8 @@ define([
if (msg && msg.Referer == "onlyoffice") {
if ( !_.isEmpty(msg.error) ) {
this.trigger('saveaserror', this, msg.error);
} else if (!_.isEmpty(msg.message)) {
Common.NotificationCenter.trigger('showmessage', {msg: msg.message});
}
// if ( !_.isEmpty(msg.folder) ) {
// this.trigger('saveasfolder', this, msg.folder); // save last folder url

View file

@ -98,10 +98,10 @@
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer right">',
'<button class="btn normal dlg-btn" result="replace" style="margin-right: 6px;">'+this.txtBtnReplace+'</button>',
'<button class="btn normal dlg-btn" result="replaceall" style="margin-right: 10px;">'+this.txtBtnReplaceAll+'</button>',
'<button class="btn normal dlg-btn iconic" result="back" style="margin-right: 6px;"><span class="icon img-commonctrl back" /></button>',
'<button class="btn normal dlg-btn iconic" result="next"><span class="icon img-commonctrl next" /></button>',
'<button class="btn normal dlg-btn" result="replace">'+this.txtBtnReplace+'</button>',
'<button class="btn normal dlg-btn" result="replaceall" style="margin-left: 6px;">'+this.txtBtnReplaceAll+'</button>',
'<button class="btn normal dlg-btn iconic" result="back"><span class="icon img-commonctrl back" /></button>',
'<button class="btn normal dlg-btn iconic" result="next" style="margin-left: 6px;"><span class="icon img-commonctrl next" /></button>',
'</div>'
].join('');

View file

@ -53,7 +53,8 @@ define([
options: {
width: 370,
style: 'min-width: 350px;',
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -106,10 +107,6 @@ define([
'</tr>',
'<tr><td><div id="id-dlg-sign-certificate" class="hidden" style="max-width: 212px;overflow: hidden;"></td></tr>',
'</table>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -342,8 +339,6 @@ define([
textCertificate: 'Certificate',
textValid: 'Valid from %1 to %2',
textChange: 'Change',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
textInputName: 'Input signer name',
textUseImage: 'or click \'Select Image\' to use a picture as signature',
textSelectImage: 'Select Image',

View file

@ -86,7 +86,7 @@ define([
'<div id="id-dlg-sign-settings-date"></div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn primary" result="ok">' + this.okButtonText + '</button>',
'<% if (type == "edit") { %>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'<% } %>',
@ -200,8 +200,6 @@ define([
textInfoTitle: 'Signer Title',
textInfoEmail: 'E-mail',
textInstructions: 'Instructions for Signer',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtEmpty: 'This field is required',
textAllowComment: 'Allow signer to add comment in the signature dialog',
textShowDate: 'Show sign date in signature line',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -21,11 +21,8 @@
<polygon points="14.243,7.585 11,10.829 11,4 9,4 9,10.827 5.758,7.585 4.344,9 10.001,14.656 15.657,9 "/>
</symbol>
<symbol id="svg-btn-print" viewBox="0 0 20 20">
<rect x="7" y="12" width="5" height="1"/>
<rect x="7" y="14" width="5" height="1"/>
<path d="M16,7h-2V5c0-0.552-0.447-1-1-1H6C5.448,4,5,4.448,5,5v2H3C2.448,7,2,7.448,2,8v5c0,0.553,0.448,1,1,1h2v2
c0,0.553,0.448,1,1,1h7c0.553,0,1-0.447,1-1v-2h2c0.553,0,1-0.447,1-1V8C17,7.448,16.553,7,16,7z M6,5h7v2H6V5z M5,13H3v-2h2V13z
M13,16H6v-5h7V16z M16,13h-2v-2h2V13z M3,10V8h13v2H3z"/>
<rect x="4" y="8" width="1" height="1" fill="#ffffff"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 4H6V6H14V4ZM5 4V6H3C2.44772 6 2 6.44772 2 7V12V13H3H5V15C5 15.5523 5.44772 16 6 16H14C14.5523 16 15 15.5523 15 15V13H17H18V12V7C18 6.44772 17.5523 6 17 6H15V4C15 3.44772 14.5523 3 14 3H6C5.44772 3 5 3.44772 5 4ZM15 12H17V7H14H6H3V12H5V11C5 10.4477 5.44772 10 6 10H14C14.5523 10 15 10.4477 15 11V12ZM6 11H14V15H6V11Z" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-edit" viewBox="0 0 20 20">
<polygon points="11.738,7.891 6.434,13.195 5.02,14.859 4.5,17.5 7,17.5 8.555,15.566 13.859,10.137"/>
@ -33,26 +30,23 @@
c0.391,0.391,0.391,1.023,0,1.414L15.273,8.598z"/>
</symbol>
<symbol id="svg-btn-save" viewBox="0 0 20 20">
<rect x="7" y="13" width="6" height="1"/>
<rect x="7" y="11" width="6" height="1"/>
<path d="M13,4H5C4.447,4,4,4.447,4,5v10c0,0.553,0.447,1,1,1h10c0.553,0,1-0.447,1-1V7L13,4z M11,5v2h-1V5H11z
M15,15H5V5h2v3h5V5h0.5L15,7.5V15z"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 15H4V4H6V7H12V4H12.5858L15 6.41421V15ZM11 4H10V6H11V4ZM4 3H13L16 6V15C16 15.5523 15.5523 16 15 16H4C3.44772 16 3 15.5523 3 15V4C3 3.44772 3.44772 3 4 3Z" fill="#ffffff"/>
<rect x="6" y="10" width="7" height="1" fill="#ffffff"/>
<rect x="6" y="12" width="7" height="1" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-save-coauth" viewBox="0 0 20 20">
<path d="M14,9c-2.209,0-4,1.791-4,4c0,0.348,0.059,0.679,0.142,1h1.043C11.072,13.686,11,13.353,11,13
c0-1.654,1.346-3,3-3s3,1.346,3,3s-1.346,3-3,3v-1l-2,1.5l2,1.5v-1c2.209,0,4-1.791,4-4S16.209,9,14,9z"/>
<rect x="6" y="13" width="3" height="1"/>
<rect x="6" y="11" width="3" height="1"/>
<path d="M9,15H4V5h2v3h3h2V5h0.5L14,7.5V8h1V7l-3-3H4C3.447,4,3,4.447,3,5v10c0,0.553,0.447,1,1,1h5V15z M9,5h1v2H9 V5z"/>
<rect x="6" y="10" width="3" height="1" fill="#ffffff"/>
<rect x="6" y="12" width="2" height="1" fill="#ffffff"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 12.9996C16 11.3427 14.6569 9.99957 13 9.99957C11.3431 9.99957 10 11.3427 10 12.9996C10 14.3058 10.8348 15.417 12 15.8289V16.8736C10.2748 16.4295 9 14.8634 9 12.9996C9 10.7904 10.7909 8.99957 13 8.99957C15.2091 8.99957 17 10.7904 17 12.9996C17 14.1945 16.476 15.2671 15.6453 16H17V17H14L14 16.8736V15.8289L14 14H15V15.2357C15.6137 14.6864 16 13.8881 16 12.9996Z" fill="#ffffff"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 15H4V4H6V7H12V4H12.5858L15 6.41421V8H16V6L13 3H4C3.44772 3 3 3.44772 3 4V15C3 15.5523 3.44772 16 4 16H8V15ZM10 4H11V6H10V4Z" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-save-sync" viewBox="0 0 20 20">
<path fill="#FFD112" d="M18,16c0.553,0,1-0.447,1-1v-5c0-0.553-0.447-1-1-1h-7c-0.553,0-1,0.447-1,1v5c0,0.553,0.447,1,1,1h1
l1.5,2l1.5-2H18z"/>
<rect x="12" y="11" fill="#444444" width="5" height="1"/>
<rect x="12" y="13" fill="#444444" width="5" height="1"/>
<rect x="6" y="13" width="3" height="1"/>
<rect x="6" y="11" width="3" height="1"/>
<path d="M9,15H4V5h2v3h3h2V5h0.5L14,7.5V8h1V7l-3-3H4C3.447,4,3,4.447,3,5v10c0,0.553,0.447,1,1,1h5V15z M9,5h1v2H9 V5z"/>
<rect x="6" y="10" width="3" height="1" fill="#ffffff"/>
<rect x="6" y="12" width="3" height="1" fill="#ffffff"/>
<rect x="10" y="10" width="9" height="7" rx="1" fill="#FFD114"/>
<rect x="12" y="12" width="5" height="1" fill="#444444"/>
<rect x="12" y="14" width="5" height="1" fill="#444444"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 15H9V16H4C3.44772 16 3 15.5523 3 15V4C3 3.44772 3.44772 3 4 3H13L16 6V9H15V6.41421L12.5858 4H12V7H6V4H4V15ZM10 4H11V6H10V4Z" fill="#ffffff"/>
</symbol>
<symbol id="svg-btn-undo" viewBox="0 0 20 20">
<path d="M11.355,7.625c-1.965,0-3.864,0.777-5.151,2.033L4,7.625V14h6.407l-2.091-2.219

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -11,6 +11,8 @@
only screen and (min-resolution: 2dppx),
only screen and (min-resolution: 192dpi) {
content: data-uri('@{common-image-path}/about/logo@2x.png');
display: block;
transform: scale(.5);
}
}
}

View file

@ -187,6 +187,10 @@
&.user-select {
cursor: text;
}
&.user-select::selection {
background: #3494fb;
color: white;
}
}
.user-reply {

View file

@ -16,6 +16,15 @@
}
}
&.internal-menu {
border: none;
border-radius: 0;
.box-shadow(none);
margin: 0;
padding: 0;
overflow: hidden;
}
li {
& > a {
padding: 5px 20px;
@ -48,6 +57,9 @@
margin-left: -18px;
background-position: @menu-check-offset-x @menu-check-offset-y;
}
&.custom-scale:before {
margin-top: 3px;
}
}
.menu-item-icon {

View file

@ -141,7 +141,18 @@
height: 20px;
display: inline-block;
vertical-align: middle;
.background-ximage('@{common-image-path}/header/header-logo.png', '@{common-image-path}/header/header-logo@2x.png', 86px);
background-image: ~"url('@{common-image-const-path}/header/header-logo.png')";
background-repeat: no-repeat;
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 2dppx),
only screen and (min-resolution: 192dpi) {
background-image: ~"url('@{common-image-const-path}/header/header-logo@2x.png')";
background-size: 86px auto;
}
}
&.link img {

View file

@ -80,3 +80,8 @@ input.error {
input[type="password"] {
font-size: 16px;
}
input[type="text"]::selection, textarea::selection {
background: #3494fb;
color: white;
}

View file

@ -520,7 +520,7 @@
.button-normal-icon(btn-watermark, 63, @toolbar-big-icon-size);
.button-normal-icon(btn-color-schema, 64, @toolbar-big-icon-size);
.button-normal-icon(btn-ins-formula, 65, @toolbar-big-icon-size);
.button-normal-icon(btn-autosumm, 66, @toolbar-big-icon-size);
.button-normal-icon(btn-autosum, 66, @toolbar-big-icon-size);
.button-normal-icon(btn-recent, 67, @toolbar-big-icon-size);
.button-normal-icon(btn-finance, 68, @toolbar-big-icon-size);
.button-normal-icon(btn-logic, 69, @toolbar-big-icon-size);
@ -530,6 +530,9 @@
.button-normal-icon(btn-func-math, 73, @toolbar-big-icon-size);
.button-normal-icon(btn-more, 74, @toolbar-big-icon-size);
.button-normal-icon(btn-pagenum, 75, @toolbar-big-icon-size);
.button-normal-icon(btn-caption, 76, @toolbar-big-icon-size);
.button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size);
.button-normal-icon(btn-scale, 81, @toolbar-big-icon-size);
[applang=ru] {
.btn-toolbar {
@ -557,6 +560,10 @@
.button-normal-icon(btn-sort-down, 5, @toolbar-icon-size);
.button-normal-icon(btn-sort-up, 6, @toolbar-icon-size);
.button-normal-icon(btn-currency-style, 7, @toolbar-icon-size);
.dropdown-menu.toc-menu {
--bckgHOffset: -144px;
}
}

View file

@ -236,6 +236,14 @@
cursor: inherit !important;
}
}
.footer {
button {
&:not(:first-child) {
margin-left: 10px;
}
}
}
}
.modal-dlg {

View file

@ -59,7 +59,8 @@ define([
_userId,
editUsers = [],
editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE',
displayMode = "Markup",
displayMode = "markup",
canViewReview,
arrChangeReview = [],
dateChange = [],
_fileKey;
@ -208,7 +209,7 @@ define([
me.initComments();
Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content');
} else {
if(editor === 'DE' && !this.appConfig.canReview) {
if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) {
$('#reviewing-settings').hide();
}
}
@ -273,7 +274,7 @@ define([
$('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me));
$('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me));
$('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me));
if(this.appConfig.isReviewOnly || displayMode == "Final" || displayMode == "Original" ) {
if(this.appConfig.isReviewOnly || displayMode == "final" || displayMode == "original" ) {
$('#settings-accept-all').addClass('disabled');
$('#settings-reject-all').addClass('disabled');
$('#settings-review').addClass('disabled');
@ -282,6 +283,11 @@ define([
$('#settings-reject-all').removeClass('disabled');
$('#settings-review').removeClass('disabled');
}
if (!this.appConfig.canReview) {
$('#settings-review').hide();
$('#settings-accept-all').hide();
$('#settings-reject-all').hide();
}
},
onTrackChanges: function(e) {
@ -312,12 +318,12 @@ define([
var me = this;
$('input:radio').single('change', _.bind(me.onReviewViewClick, me));
var value = displayMode;
if (value == null || value === "Markup") {
$('input[value="Markup"]').attr('checked', true);
} else if (value === 'Final') {
$('input[value="Final"]').attr('checked', true);
} else if (value === 'Original') {
$('input[value="Original"]').attr('checked', true);
if (value == null || value === "markup") {
$('input[value="markup"]').attr('checked', true);
} else if (value === 'final') {
$('input[value="final"]').attr('checked', true);
} else if (value === 'original') {
$('input[value="original"]').attr('checked', true);
}
},
@ -325,24 +331,29 @@ define([
return displayMode;
},
setCanViewReview: function(config) {
canViewReview = config;
},
onReviewViewClick: function(event) {
var value = $(event.currentTarget).val();
this.turnDisplayMode(value);
!this.appConfig.canReview && Common.localStorage.setItem("de-view-review-mode", value);
},
turnDisplayMode: function(value) {
displayMode = value;
turnDisplayMode: function(value, suppressEvent) {
displayMode = value.toLocaleLowerCase();
if (this.api) {
if (value === 'Final')
if (displayMode === 'final')
this.api.asc_BeginViewModeInReview(true);
else if (value === 'Original')
else if (displayMode === 'original')
this.api.asc_BeginViewModeInReview(false);
else
this.api.asc_EndViewModeInReview();
}
this.initReviewingSettingsView();
DE.getController('Toolbar').setDisplayMode(value);
!suppressEvent && this.initReviewingSettingsView();
DE.getController('Toolbar').setDisplayMode(displayMode);
},
@ -378,12 +389,16 @@ define([
$('#btn-delete-change').single('click', _.bind(this.onDeleteChange, this));
}
}
if(displayMode == "Final" || displayMode == "Original") {
if(displayMode == "final" || displayMode == "original") {
$('#btn-accept-change').addClass('disabled');
$('#btn-reject-change').addClass('disabled');
$('#btn-prev-change').addClass('disabled');
$('#btn-next-change').addClass('disabled');
}
if (!this.appConfig.canReview) {
$('#btn-accept-change').addClass('disabled');
$('#btn-reject-change').addClass('disabled');
}
},
onPrevChange: function() {
@ -719,7 +734,7 @@ define([
time : date.getTime(),
replys : [],
groupName : (groupname && groupname.length>1) ? groupname[1] : null
}
};
if (comment) {
var replies = this.readSDKReplies(data);
if (replies.length) {
@ -806,6 +821,13 @@ define([
return 0;
},
stringUtcToLocalDate: function (date) {
if (typeof date === 'string')
return parseInt(date) + this.timeZoneOffsetInMs;
return 0;
},
addCommentToGroupCollection: function (comment) {
var groupname = comment.groupName;
if (!this.groupCollectionComments[groupname])

View file

@ -150,7 +150,7 @@
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Markup">
<input type="radio" name="doc-orientation" value="markup">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textMarkup %></div>
@ -159,7 +159,7 @@
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Final">
<input type="radio" name="doc-orientation" value="final">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textFinal %></div>
@ -168,7 +168,7 @@
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="Original">
<input type="radio" name="doc-orientation" value="original">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textOriginal %></div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -15,170 +15,94 @@
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
z-index: 10000;
}
.loader-page {
.loadmask > .brendpanel {
width: 100%;
height: 170px;
bottom: 42%;
position: absolute;
height: 32px;
background-color: #e2e2e2;
}
.loadmask > .brendpanel > div {
display: flex;
align-items: center;
height: 100%;
}
.loadmask > .brendpanel .loading-logo {
max-width: 200px;
height: 24px;
margin: 0 auto;
text-align: center;
line-height: 10px;
}
.loader-logo {
max-height: 160px;
margin-bottom: 10px;
}
.loader-page-romb {
width: 40px;
.loadmask > .brendpanel .loading-logo > img {
display: inline-block;
max-width: 100px;
max-height: 20px;
margin-top: 2px;
opacity: 0;
}
.loader-page-text {
.loadmask > .brendpanel .circle {
vertical-align: middle;
width: 24px;
height: 24px;
border-radius: 12px;
margin: 4px 10px;
background: rgba(255, 255, 255, 0.2);
}
.loadmask > .placeholder {
background: #fbfbfb;
width: 100%;
bottom: 42%;
position: absolute;
text-align: center;
color: #888;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 20px;
height: 100%;
padding-top: 56px;
}
.loader-page-text-loading {
font-size: 14px;
.loadmask > .placeholder > .line {
height: 15px;
margin: 30px;
background: #e2e2e2;
overflow: hidden;
position: relative;
-webkit-animation: flickerAnimation 2s infinite ease-in-out;
-moz-animation: flickerAnimation 2s infinite ease-in-out;
-o-animation: flickerAnimation 2s infinite ease-in-out;
animation: flickerAnimation 2s infinite ease-in-out;
}
.loader-page-text-customer {
font-size: 16px;
margin-bottom: 5px;
@keyframes flickerAnimation {
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
@-o-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
@-moz-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
@-webkit-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #fff; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
</style>
<!--[if lt IE 9]>
@ -187,10 +111,11 @@
</head>
<body class="embed-body">
<div id="loading-mask" class="loadmask"><div class="brendpanel"><div><div class="circle"></div><div class="brand-logo loading-logo"><img src=""></div><div class="circle"></div></div></div><div class="placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<!-- debug begin -->
<script type="text/javascript">var less=less||{};less.env='development';</script>
<script src="../../../vendor/less/dist/less-1.5.1.js" type="text/javascript"></script>
<script src="../../../vendor/less/dist/less-2.7.1.js" type="text/javascript"></script>
<!-- debug end -->
<script>
@ -234,48 +159,17 @@
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
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["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
else if ( lang == 'it') loading = 'Caricamento in corso...';
else if ( lang == 'pt') loading = 'Carregando...';
else if ( lang == 'ru') loading = 'Загрузка...';
else if ( lang == 'sl') loading = 'Nalaganje...';
else if ( lang == 'tr') loading = 'Yükleniyor...';
else if ( lang == 'bg') loading = 'Зареждане...';
else if ( lang == 'cs') loading = 'Nahrávám...';
else if ( lang == 'hu') loading = 'Betöltés...';
else if ( lang == 'ja') loading = '読み込み中...';
else if ( lang == 'ko') loading = '로드 중...';
else if ( lang == 'lv') loading = 'Ieladēšana ...';
else if ( lang == 'nl') loading = 'Laden...';
else if ( lang == 'pl') loading = 'Ładowanie...';
else if ( lang == 'sk') loading = 'Nahrávam...';
else if ( lang == 'uk') loading = 'Завантаження...';
else if ( lang == 'vi') loading = 'Đang tải...';
else if ( lang == 'zh') loading = '加载中...';
document.write(
'<div id="loading-mask" class="loadmask">' +
'<div class="loader-page" style="margin-bottom: ' + margin + 'px;' + ((logo!==null) ? 'height: auto;' : '') + '">' +
((logo!==null) ? logo :
'<div class="loader-page-romb">' +
'<div class="romb" id="blue"></div>' +
'<div class="romb" id="green"></div>' +
'<div class="romb" id="red"></div>' +
'</div>') +
'</div>' +
'<div class="loader-page-text">' + customer +
'<div class="loader-page-text-loading">' + loading + '</div>' +
'</div>' +
'</div>');
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
</script>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
@ -334,6 +228,13 @@
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
require.config({
baseUrl: '../../'
});
</script>
<script type="text/javascript" src="../sdk_dev_scripts.js"></script>
<script>
window.sdk_dev_scrpipts.forEach(function(item){

View file

@ -13,168 +13,93 @@
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
position: absolute;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
z-index: 10000;
}
.loader-page {
.loadmask > .brendpanel {
width: 100%;
height: 170px;
bottom: 42%;
position: absolute;
height: 32px;
background-color: #e2e2e2;
}
.loadmask > .brendpanel > div {
display: flex;
align-items: center;
height: 100%;
}
.loadmask > .brendpanel .loading-logo {
max-width: 200px;
height: 24px;
margin: 0 auto;
text-align: center;
line-height: 10px;
}
.loader-logo {
max-height: 160px;
margin-bottom: 10px;
}
.loader-page-romb {
width: 40px;
.loadmask > .brendpanel .loading-logo > img {
display: inline-block;
max-width: 100px;
max-height: 20px;
margin-top: 2px;
opacity: 0;
}
.loader-page-text {
.loadmask > .brendpanel .circle {
vertical-align: middle;
width: 24px;
height: 24px;
border-radius: 12px;
margin: 4px 10px;
background: rgba(255, 255, 255, 0.2);
}
.loadmask > .placeholder {
background: #fbfbfb;
width: 100%;
bottom: 42%;
position: absolute;
text-align: center;
color: #888;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 20px;
height: 100%;
padding-top: 56px;
}
.loader-page-text-loading {
font-size: 14px;
.loadmask > .placeholder > .line {
height: 15px;
margin: 30px;
background: #e2e2e2;
overflow: hidden;
position: relative;
-webkit-animation: flickerAnimation 2s infinite ease-in-out;
-moz-animation: flickerAnimation 2s infinite ease-in-out;
-o-animation: flickerAnimation 2s infinite ease-in-out;
animation: flickerAnimation 2s infinite ease-in-out;
}
.loader-page-text-customer {
font-size: 16px;
margin-bottom: 5px;
@keyframes flickerAnimation {
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
@-o-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
@-moz-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #fff; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
@-webkit-keyframes flickerAnimation{
0% { opacity:0.1; }
50% { opacity:1; }
100% { opacity:0.1; }
}
</style>
@ -184,6 +109,7 @@
</head>
<body class="embed-body">
<div id="loading-mask" class="loadmask"><div class="brendpanel"><div><div class="circle"></div><div class="brand-logo loading-logo"><img src=""></div><div class="circle"></div></div></div><div class="placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<script>
var userAgent = navigator.userAgent.toLowerCase(),
@ -226,48 +152,16 @@
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
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["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
else if ( lang == 'it') loading = 'Caricamento in corso...';
else if ( lang == 'pt') loading = 'Carregando...';
else if ( lang == 'ru') loading = 'Загрузка...';
else if ( lang == 'sl') loading = 'Nalaganje...';
else if ( lang == 'tr') loading = 'Yükleniyor...';
else if ( lang == 'bg') loading = 'Зареждане...';
else if ( lang == 'cs') loading = 'Nahrávám...';
else if ( lang == 'hu') loading = 'Betöltés...';
else if ( lang == 'ja') loading = '読み込み中...';
else if ( lang == 'ko') loading = '로드 중...';
else if ( lang == 'lv') loading = 'Ieladēšana ...';
else if ( lang == 'nl') loading = 'Laden...';
else if ( lang == 'pl') loading = 'Ładowanie...';
else if ( lang == 'sk') loading = 'Nahrávam...';
else if ( lang == 'uk') loading = 'Завантаження...';
else if ( lang == 'vi') loading = 'Đang tải...';
else if ( lang == 'zh') loading = '加载中...';
document.write(
'<div id="loading-mask" class="loadmask">' +
'<div class="loader-page" style="margin-bottom: ' + margin + 'px;' + ((logo!==null) ? 'height: auto;' : '') + '">' +
((logo!==null) ? logo :
'<div class="loader-page-romb">' +
'<div class="romb" id="blue"></div>' +
'<div class="romb" id="green"></div>' +
'<div class="romb" id="red"></div>' +
'</div>') +
'</div>' +
'<div class="loader-page-text">' + customer +
'<div class="loader-page-text-loading">' + loading + '</div>' +
'</div>' +
'</div>');
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}
</script>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
@ -324,6 +218,12 @@
<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<script src="../../../vendor/requirejs/require.js"></script>
<script>
require.config({
baseUrl: '../../'
});
</script>
<!--sdk-->
<script type="text/javascript" src="../../../../sdkjs/common/AllFonts.js"></script>

View file

@ -0,0 +1,375 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Documents</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- debug begin -->
<link rel="stylesheet/less" type="text/css" href="resources/less/application.less" />
<!-- debug end -->
<!-- splash -->
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
}
.loader-page {
width: 100%;
height: 170px;
bottom: 42%;
position: absolute;
text-align: center;
line-height: 10px;
}
.loader-logo {
max-height: 160px;
margin-bottom: 10px;
}
.loader-page-romb {
width: 40px;
display: inline-block;
}
.loader-page-text {
width: 100%;
bottom: 42%;
position: absolute;
text-align: center;
color: #888;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 20px;
}
.loader-page-text-loading {
font-size: 14px;
}
.loader-page-text-customer {
font-size: 16px;
margin-bottom: 5px;
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #fff; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script>
<![endif]-->
</head>
<body class="embed-body">
<!-- debug begin -->
<script type="text/javascript">var less=less||{};less.env='development';</script>
<script src="../../../vendor/less/dist/less-1.5.1.js" type="text/javascript"></script>
<!-- debug end -->
<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); };
if (!check(/opera/) && (check(/msie/) || check(/trident/))) {
var m = /msie (\d+\.\d+)/.exec(userAgent);
if (m && parseFloat(m[1]) < 10.0) {
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
}
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;
}
function encodeUrlParam(str) {
return str.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
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;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
else if ( lang == 'it') loading = 'Caricamento in corso...';
else if ( lang == 'pt') loading = 'Carregando...';
else if ( lang == 'ru') loading = 'Загрузка...';
else if ( lang == 'sl') loading = 'Nalaganje...';
else if ( lang == 'tr') loading = 'Yükleniyor...';
else if ( lang == 'bg') loading = 'Зареждане...';
else if ( lang == 'cs') loading = 'Nahrávám...';
else if ( lang == 'hu') loading = 'Betöltés...';
else if ( lang == 'ja') loading = '読み込み中...';
else if ( lang == 'ko') loading = '로드 중...';
else if ( lang == 'lv') loading = 'Ieladēšana ...';
else if ( lang == 'nl') loading = 'Laden...';
else if ( lang == 'pl') loading = 'Ładowanie...';
else if ( lang == 'sk') loading = 'Nahrávam...';
else if ( lang == 'uk') loading = 'Завантаження...';
else if ( lang == 'vi') loading = 'Đang tải...';
else if ( lang == 'zh') loading = '加载中...';
document.write(
'<div id="loading-mask" class="loadmask">' +
'<div class="loader-page" style="margin-bottom: ' + margin + 'px;' + ((logo!==null) ? 'height: auto;' : '') + '">' +
((logo!==null) ? logo :
'<div class="loader-page-romb">' +
'<div class="romb" id="blue"></div>' +
'<div class="romb" id="green"></div>' +
'<div class="romb" id="red"></div>' +
'</div>') +
'</div>' +
'<div class="loader-page-text">' + customer +
'<div class="loader-page-text-loading">' + loading + '</div>' +
'</div>' +
'</div>');
</script>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
<div class="overlay-controls" style="margin-left: -32px">
<ul class="left">
<li id="id-btn-zoom-in"><button class="overlay svg-icon zoom-up"></button></li>
<li id="id-btn-zoom-out"><button class="overlay svg-icon zoom-down"></button></li>
</ul>
</div>
<div class="toolbar" id="toolbar">
<div class="group left">
<div id="box-tools" class="dropdown">
<button class="control-btn svg-icon tools"></button>
</div>
</div>
<div class="group center">
<span><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></span>
</div>
<div class="group right">
<div class="item"><input id="page-number" class="form-control input-xs masked" type="text" value="0"><span class="text" id="pages" tabindex="-1">of 0</span></div>
<div class="item separator"></div>
<div class="item"><button id="id-btn-close" class="control-btn close"><span aria-hidden="true">&times;</span></button></div>
</div>
</div>
<div class="modal fade error" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-sm btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/jquery.browser/dist/jquery.browser.min.js"></script>
<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../sdk_dev_scripts.js"></script>
<script>
window.sdk_dev_scrpipts.forEach(function(item){
document.write('<script type="text/javascript" src="' + item + '"><\/script>');
});
</script>
<!--application-->
<script type="text/javascript" src="../../common/locale.js"></script>
<script type="text/javascript" src="../../common/Gateway.js"></script>
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>
<script type="text/javascript" src="js/ApplicationController.js"></script>
<script type="text/javascript" src="js/application.js"></script>
<script type="text/javascript">
var isBrowserSupported = function() {
return ($.browser.msie && parseFloat($.browser.version) > 9) ||
($.browser.chrome && parseFloat($.browser.version) > 7) ||
($.browser.safari && parseFloat($.browser.version) > 4) ||
($.browser.opera && parseFloat($.browser.version) > 10.4) ||
($.browser.mozilla && parseFloat($.browser.version) > 3.9);
};
if (!isBrowserSupported()){
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
</script>
</body>
</html>

View file

@ -0,0 +1,355 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Documents</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<link href="../../../apps/documenteditor/embed/resources/css/app-all.css" rel="stylesheet">
<!-- splash -->
<style type="text/css">
.loadmask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 20002;
}
.loader-page {
width: 100%;
height: 170px;
bottom: 42%;
position: absolute;
text-align: center;
line-height: 10px;
}
.loader-logo {
max-height: 160px;
margin-bottom: 10px;
}
.loader-page-romb {
width: 40px;
display: inline-block;
}
.loader-page-text {
width: 100%;
bottom: 42%;
position: absolute;
text-align: center;
color: #888;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 20px;
}
.loader-page-text-loading {
font-size: 14px;
}
.loader-page-text-customer {
font-size: 16px;
margin-bottom: 5px;
}
.romb {
width: 40px;
height: 40px;
-webkit-transform: rotate(135deg) skew(20deg, 20deg);
-moz-transform: rotate(135deg) skew(20deg, 20deg);
-ms-transform: rotate(135deg) skew(20deg, 20deg);
-o-transform: rotate(135deg) skew(20deg, 20deg);
position: absolute;
background: red;
border-radius: 6px;
-webkit-animation: movedown 3s infinite ease;
-moz-animation: movedown 3s infinite ease;
-ms-animation: movedown 3s infinite ease;
-o-animation: movedown 3s infinite ease;
animation: movedown 3s infinite ease;
}
#blue {
z-index: 3;
background: #55bce6;
-webkit-animation-name: blue;
-moz-animation-name: blue;
-ms-animation-name: blue;
-o-animation-name: blue;
animation-name: blue;
}
#red {
z-index:1;
background: #de7a59;
-webkit-animation-name: red;
-moz-animation-name: red;
-ms-animation-name: red;
-o-animation-name: red;
animation-name: red;
}
#green {
z-index: 2;
background: #a1cb5c;
-webkit-animation-name: green;
-moz-animation-name: green;
-ms-animation-name: green;
-o-animation-name: green;
animation-name: green;
}
@-webkit-keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0;}
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@keyframes red {
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #f4f4f4; top:120px; }
15% { background: #f4f4f4; top:0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top:120px; }
100% { top:120px; background: #de7a59; }
}
@-webkit-keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@keyframes green {
0% { top:110px; background: #a1cb5c; opacity:1; }
10% { top:110px; background: #CBE0AC; opacity:1; }
14% { background: #f4f4f4; top:110px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #EFEFEF; top:0; opacity:1; }
30% { background:#E6E4E4; }
70% { top:110px; }
100% { top:110px; background: #a1cb5c; }
}
@-webkit-keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #f4f4f4; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
@keyframes blue {
0% { top:100px; background: #55bce6; opacity:1; }
10% { top:100px; background: #BFE8F8; opacity:1; }
14% { background: #f4f4f4; top:100px; opacity:1; }
15% { background: #f4f4f4; top:0; opacity:1; }
20% { background: #f4f4f4; top:0; opacity:0; }
25% { background: #fff; top:0; opacity:0; }
45% { background: #EFEFEF; top:0; opacity:0.2; }
100% { top:100px; background: #55bce6; }
}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script>
<![endif]-->
</head>
<body class="embed-body">
<script>
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); };
if (!check(/opera/) && (check(/msie/) || check(/trident/))) {
var m = /msie (\d+\.\d+)/.exec(userAgent);
if (m && parseFloat(m[1]) < 10.0) {
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
}
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;
}
function encodeUrlParam(str) {
return str.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
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;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...';
else if ( lang == 'it') loading = 'Caricamento in corso...';
else if ( lang == 'pt') loading = 'Carregando...';
else if ( lang == 'ru') loading = 'Загрузка...';
else if ( lang == 'sl') loading = 'Nalaganje...';
else if ( lang == 'tr') loading = 'Yükleniyor...';
else if ( lang == 'bg') loading = 'Зареждане...';
else if ( lang == 'cs') loading = 'Nahrávám...';
else if ( lang == 'hu') loading = 'Betöltés...';
else if ( lang == 'ja') loading = '読み込み中...';
else if ( lang == 'ko') loading = '로드 중...';
else if ( lang == 'lv') loading = 'Ieladēšana ...';
else if ( lang == 'nl') loading = 'Laden...';
else if ( lang == 'pl') loading = 'Ładowanie...';
else if ( lang == 'sk') loading = 'Nahrávam...';
else if ( lang == 'uk') loading = 'Завантаження...';
else if ( lang == 'vi') loading = 'Đang tải...';
else if ( lang == 'zh') loading = '加载中...';
document.write(
'<div id="loading-mask" class="loadmask">' +
'<div class="loader-page" style="margin-bottom: ' + margin + 'px;' + ((logo!==null) ? 'height: auto;' : '') + '">' +
((logo!==null) ? logo :
'<div class="loader-page-romb">' +
'<div class="romb" id="blue"></div>' +
'<div class="romb" id="green"></div>' +
'<div class="romb" id="red"></div>' +
'</div>') +
'</div>' +
'<div class="loader-page-text">' + customer +
'<div class="loader-page-text-loading">' + loading + '</div>' +
'</div>' +
'</div>');
</script>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>
<div class="overlay-controls" style="margin-left: -32px">
<ul class="left">
<li id="id-btn-zoom-in"><button class="overlay svg-icon zoom-up"></button></li>
<li id="id-btn-zoom-out"><button class="overlay svg-icon zoom-down"></button></li>
</ul>
</div>
<div class="toolbar" id="toolbar">
<div class="group left">
<div id="box-tools" class="dropdown">
<button class="control-btn svg-icon tools"></button>
</div>
</div>
<div class="group center">
<span><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></span>
</div>
<div class="group right">
<div class="item"><input id="page-number" class="form-control input-xs masked" type="text" value="0"><span class="text" id="pages" tabindex="-1">of 0</span></div>
<div class="item separator"></div>
<div class="item"><button id="id-btn-close" class="control-btn close"><span aria-hidden="true">&times;</span></button></div>
</div>
</div>
<div class="modal fade error" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 id="id-critical-error-title"></h4>
</div>
<div class="modal-body">
<p id="id-critical-error-message"></p>
</div>
<div class="modal-footer">
<button id="id-critical-error-close" class="btn btn-sm btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/jquery/jquery.browser.min.js"></script>
<script type="text/javascript" src="../../../vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../../vendor/sockjs/sockjs.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<!--sdk-->
<script type="text/javascript" src="../../../../sdkjs/common/AllFonts.js"></script>
<script type="text/javascript" src="../../../../sdkjs/word/sdk-all-min.js"></script>
<!--application-->
<script type="text/javascript" src="../../../apps/documenteditor/embed/app-all.js"></script>
<script type="text/javascript">
var isBrowserSupported = function() {
return ($.browser.msie && parseFloat($.browser.version) > 9) ||
($.browser.chrome && parseFloat($.browser.version) > 7) ||
($.browser.safari && parseFloat($.browser.version) > 4) ||
($.browser.opera && parseFloat($.browser.version) > 10.4) ||
($.browser.mozilla && parseFloat($.browser.version) > 3.9);
};
if (!isBrowserSupported()){
document.write(
'<div id="id-error-mask" class="errormask">',
'<div class="error-body" align="center">',
'<div id="id-error-mask-title" class="title">Your browser is not supported.</div>',
'<div id="id-error-mask-text">Sorry, ONLYOFFICE Document is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>',
'</div>',
'</div>'
);
}
</script>
</body>
</html>

View file

@ -398,6 +398,10 @@ DE.ApplicationController = new(function(){
message = me.errorUserDrop;
break;
case Asc.c_oAscError.ID.ConvertationOpenLimitError:
message = me.errorFileSizeExceed;
break;
default:
message = me.errorDefaultMessage.replace('%1', id);
break;
@ -409,7 +413,7 @@ DE.ApplicationController = new(function(){
Common.Gateway.reportError(id, message);
$('#id-critical-error-title').text(me.criticalErrorTitle);
$('#id-critical-error-message').text(message);
$('#id-critical-error-message').html(message);
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
window.location.reload();
});
@ -418,7 +422,7 @@ DE.ApplicationController = new(function(){
Common.Gateway.reportWarning(id, message);
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
$('#id-critical-error-message').text(message);
$('#id-critical-error-message').html(message);
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
$('#id-critical-error-dialog').modal('hide');
});
@ -553,6 +557,7 @@ DE.ApplicationController = new(function(){
downloadTextText: 'Downloading document...',
waitText: 'Please, wait...',
textLoadingDocument: 'Loading document',
txtClose: 'Close'
txtClose: 'Close',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.'
}
})();

View file

@ -31,7 +31,8 @@
*
*/
+function ($) {
Common.Locale.apply();
Common.Locale.apply(function() {
DE.ApplicationView.create();
DE.ApplicationController.create();
});
}();

View file

@ -12,6 +12,7 @@
"DE.ApplicationController.errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",
"DE.ApplicationController.errorDefaultMessage": "Error code: %1",
"DE.ApplicationController.errorFilePassProtect": "The file is password protected and cannot be opened.",
"DE.ApplicationController.errorFileSizeExceed": "The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.",
"DE.ApplicationController.errorUserDrop": "The file cannot be accessed right now.",
"DE.ApplicationController.notcriticalErrorTitle": "Warning",
"DE.ApplicationController.scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.",

View file

@ -169,8 +169,8 @@ require([
]
});
Common.Locale.apply();
Common.Locale.apply(
function() {
require([
'documenteditor/main/app/controller/Viewport',
'documenteditor/main/app/controller/DocumentHolder',
@ -207,6 +207,8 @@ require([
], function() {
app.start();
});
}
);
}, function(err) {
if (err.requireType == 'timeout' && !reqerr && window.requireTimeourError) {
reqerr = window.requireTimeourError();

View file

@ -134,11 +134,14 @@ define([
}
}, this));
diagramEditor.on('hide', _.bind(function(cmp, message) {
this.documentHolder.fireEvent('editcomplete', this.documentHolder);
if (this.api) {
this.api.asc_onCloseChartFrame();
this.api.asc_enableKeyEvents(true);
}
var me = this;
setTimeout(function(){
me.documentHolder.fireEvent('editcomplete', me.documentHolder);
}, 10);
}, this));
}
@ -151,10 +154,13 @@ define([
this.api.asc_setMailMergeData(data);
}, this));
mergeEditor.on('hide', _.bind(function(cmp, message) {
this.documentHolder.fireEvent('editcomplete', this.documentHolder);
if (this.api) {
this.api.asc_enableKeyEvents(true);
}
var me = this;
setTimeout(function(){
me.documentHolder.fireEvent('editcomplete', me.documentHolder);
}, 10);
}, this));
}
},

View file

@ -62,7 +62,6 @@ define([
'hide': _.bind(this.onHideChat, this)
},
'Common.Views.Header': {
'click:users': _.bind(this.clickStatusbarUsers, this),
'file:settings': _.bind(this.clickToolbarSettings,this),
'history:show': function () {
if ( !this.leftMenu.panelHistory.isVisible() )
@ -532,10 +531,6 @@ define([
},
/** coauthoring begin **/
clickStatusbarUsers: function() {
this.leftMenu.menuFile.panels['rights'].changeAccessRights();
},
onHideChat: function() {
$(this.leftMenu.btnChat.el).blur();
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');

View file

@ -45,7 +45,8 @@ define([
'documenteditor/main/app/view/NoteSettingsDialog',
'documenteditor/main/app/view/HyperlinkSettingsDialog',
'documenteditor/main/app/view/TableOfContentsSettings',
'documenteditor/main/app/view/BookmarksDialog'
'documenteditor/main/app/view/BookmarksDialog',
'documenteditor/main/app/view/CaptionDialog'
], function () {
'use strict';
@ -66,7 +67,8 @@ define([
'links:update': this.onTableContentsUpdate,
'links:notes': this.onNotesClick,
'links:hyperlink': this.onHyperlinkClick,
'links:bookmarks': this.onBookmarksClick
'links:bookmarks': this.onBookmarksClick,
'links:caption': this.onCaptionClick
},
'DocumentHolder': {
'links:contents': this.onTableContents,
@ -76,7 +78,8 @@ define([
},
onLaunch: function () {
this._state = {
prcontrolsdisable:undefined
prcontrolsdisable:undefined,
in_object: false
};
Common.Gateway.on('setactionlink', function (url) {
console.log('url with actions: ' + url);
@ -125,7 +128,8 @@ define([
header_locked = false,
in_header = false,
in_equation = false,
in_image = false;
in_image = false,
in_table = false;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@ -140,10 +144,12 @@ define([
in_image = true;
} else if (type === Asc.c_oAscTypeSelectElement.Math) {
in_equation = true;
} else if (type === Asc.c_oAscTypeSelectElement.Table) {
in_table = true;
}
}
this._state.prcontrolsdisable = paragraph_locked || header_locked;
this._state.in_object = in_image || in_table || in_equation;
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
@ -332,6 +338,19 @@ define([
})).show();
},
onCaptionClick: function(btn) {
var me = this;
(new DE.Views.CaptionDialog({
isObject: this._state.in_object,
handler: function (result, settings) {
if (result == 'ok') {
me.api.asc_AddObjectCaption(settings);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
},
onShowContentControlsActions: function(action, x, y) {
var menu = (action==1) ? this.view.contentsUpdateMenu : this.view.contentsMenu,
documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder,

View file

@ -97,38 +97,9 @@ define([
'settings:apply': _.bind(this.applySettings, this)
}
});
},
onLaunch: function() {
var me = this;
this.stackLongActions = new Common.IrregularStack({
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
this.languages = null;
this.translationTable = [];
this.isModalShowed = 0;
// Initialize viewport
if (!Common.Utils.isBrowserSupported()){
Common.Utils.showBrowserRestriction();
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
return;
}
var value = Common.localStorage.getItem("de-settings-fontrender");
if (value === null)
window.devicePixelRatio > 1 ? value = '1' : '0';
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
// Initialize api
window["flat_desine"] = true;
var styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5',
var me = this,
styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5',
'Heading 6', 'Heading 7', 'Heading 8', 'Heading 9', 'Title', 'Subtitle', 'Quote', 'Intense Quote', 'List Paragraph', 'footnote text'],
translate = {
'Series': this.txtSeries,
@ -161,19 +132,45 @@ define([
"Table Index Cannot be Zero": this.txtTableInd,
"Undefined Bookmark": this.txtUndefBookmark,
"Unexpected End of Formula": this.txtEndOfFormula,
"Hyperlink": this.txtHyperlink
"Hyperlink": this.txtHyperlink,
"Error! Main Document Only.": this.txtMainDocOnly,
"Error! Not a valid bookmark self-reference.": this.txtNotValidBookmark,
"Error! No text of specified style in document.": this.txtNoText
};
styleNames.forEach(function(item){
translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
});
me.translationTable['Header'] = this.txtHeader;
me.translationTable['Footer'] = this.txtFooter;
me.translationTable = translate;
},
this.api = new Asc.asc_docs_api({
'id-view' : 'editor_sdk',
'translate': translate
onLaunch: function() {
var me = this;
this.stackLongActions = new Common.IrregularStack({
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
this.languages = null;
this.isModalShowed = 0;
// Initialize viewport
if (!Common.Utils.isBrowserSupported()){
Common.Utils.showBrowserRestriction();
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
return;
}
var value = Common.localStorage.getItem("de-settings-fontrender");
if (value === null)
window.devicePixelRatio > 1 ? value = '1' : '0';
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
// Initialize api
window["flat_desine"] = true;
this.api = this.getApplication().getController('Viewport').getApi();
if (this.api){
this.api.SetDrawingFreeze(true);
switch (value) {
@ -196,6 +193,7 @@ define([
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
this.isShowOpenDialog = false;
@ -229,13 +227,15 @@ define([
});
$(document.body).on('blur', 'input, textarea', function(e) {
if (!me.isModalShowed && !me.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file').isVisible()) {
if (!me.isModalShowed) {
if (/form-control/.test(e.target.className))
me.inFormControl = false;
if (me.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file').isVisible())
return;
if (!e.relatedTarget ||
!/area_id/.test(e.target.id)
&& !(e.target.localName == 'input' && $(e.target).parent().find(e.relatedTarget).length>0) /* Check if focus in combobox goes from input to it's menu button or menu items, or from comment editing area to Ok/Cancel button */
&& !(e.target.localName == 'textarea' && $(e.target).closest('.asc-window').find(e.relatedTarget).length>0) /* Check if focus in comment goes from textarea to it's email menu */
&& !(e.target.localName == 'textarea' && $(e.target).closest('.asc-window').find('.dropdown-menu').find(e.relatedTarget).length>0) /* Check if focus in comment goes from textarea to it's email menu */
&& (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */
&& (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ {
if (Common.Utils.isIE && e.originalEvent && e.originalEvent.target && /area_id/.test(e.originalEvent.target.id) && (e.originalEvent.target === e.originalEvent.srcElement))
@ -363,6 +363,11 @@ define([
if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
if (!( this.editorConfig.customization && ( this.editorConfig.customization.toolbarNoTabs ||
(this.editorConfig.targetApp!=='desktop') && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)))) {
$('#editor_sdk').append('<div class="doc-placeholder">' + '<div class="line"></div>'.repeat(20) + '</div>');
}
Common.Controllers.Desktop.init(this.appOptions);
},
@ -690,7 +695,7 @@ define([
var action = {id: id, type: type};
this.stackLongActions.pop(action);
appHeader.setDocumentCaption(this.api.asc_getDocumentName());
appHeader && appHeader.setDocumentCaption(this.api.asc_getDocumentName());
this.updateWindowTitle(true);
action = this.stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information});
@ -890,7 +895,7 @@ define([
value = Common.localStorage.getItem("de-show-tableline");
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
value = Common.localStorage.getBool("de-settings-spellcheck", true);
value = Common.localStorage.getBool("de-settings-spellcheck", !(this.appOptions.customization && this.appOptions.customization.spellcheck===false));
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
me.api.asc_setSpellCheck(value);
@ -1024,7 +1029,6 @@ define([
if (me.needToUpdateVersion)
toolbarController.onApiCoAuthoringDisconnect();
me.api.UpdateInterfaceState();
me.fillTextArt(me.api.asc_getTextArtPreviews());
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
@ -1049,6 +1053,8 @@ define([
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
Common.Gateway.documentReady();
$('.doc-placeholder').remove();
},
onLicenseChanged: function(params) {
@ -1254,7 +1260,7 @@ define([
var me = this,
application = this.getApplication(),
reviewController = application.getController('Common.Controllers.ReviewChanges');
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document});
if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode
var toolbarController = application.getController('Toolbar');
@ -1486,6 +1492,10 @@ define([
config.msg = this.errorEmailClient;
break;
case Asc.c_oAscError.ID.ConvertationOpenLimitError:
config.msg = this.errorFileSizeExceed;
break;
default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break;
@ -1598,7 +1608,7 @@ define([
if (this._state.isDocModified !== isModified || force) {
var title = this.defaultTitleText;
if (!_.isEmpty(appHeader.getDocumentCaption()))
if (appHeader && !_.isEmpty(appHeader.getDocumentCaption()))
title = appHeader.getDocumentCaption() + ' - ' + title;
if (isModified) {
@ -1803,25 +1813,25 @@ define([
shapeStore.reset();
var groupscount = groupNames.length;
_.each(groupNames, function(groupName, index){
var store = new Backbone.Collection([], {
model: DE.Models.ShapeModel
});
}),
arr = [];
var cols = (shapes[index].length) > 18 ? 7 : 6,
height = Math.ceil(shapes[index].length/cols) * 35 + 3,
width = 30 * cols;
_.each(shapes[index], function(shape, idx){
store.add({
arr.push({
data : {shapeType: shape.Type},
tip : me['txtShape_' + shape.Type] || (me.textShape + ' ' + (idx+1)),
allowSelected : true,
selected: false
});
});
store.add(arr);
shapegrouparray.push({
groupName : me.shapeGroupNames[index],
groupStore : store,
@ -1831,19 +1841,20 @@ define([
});
shapeStore.add(shapegrouparray);
setTimeout(function(){
me.getApplication().getController('Toolbar').fillAutoShapes();
me.getApplication().getController('Toolbar').onApiAutoShapes();
}, 50);
},
fillTextArt: function(shapes){
if (_.isEmpty(shapes)) return;
var me = this, arr = [],
var arr = [],
artStore = this.getCollection('Common.Collections.TextArt');
if (!shapes && artStore.length>0) {// shapes == undefined when update textart collection (from asc_onSendThemeColors)
shapes = this.api.asc_getTextArtPreviews();
}
if (_.isEmpty(shapes)) return;
_.each(shapes, function(shape, index){
arr.push({
imageUrl : shape,
@ -1853,15 +1864,6 @@ define([
});
});
artStore.reset(arr);
setTimeout(function(){
me.getApplication().getController('Toolbar').fillTextArt();
}, 50);
setTimeout(function(){
me.getApplication().getController('RightMenu').fillTextArt();
}, 50);
},
updateThemeColors: function() {
@ -1869,10 +1871,6 @@ define([
setTimeout(function(){
me.getApplication().getController('RightMenu').UpdateThemeColors();
}, 50);
setTimeout(function(){
me.getApplication().getController('DocumentHolder').getView().updateThemeColors();
}, 50);
setTimeout(function(){
me.getApplication().getController('Toolbar').updateThemeColors();
}, 50);
@ -1882,7 +1880,10 @@ define([
Common.Utils.ThemeColor.setColors(colors, standart_colors);
if (window.styles_loaded) {
this.updateThemeColors();
this.fillTextArt(this.api.asc_getTextArtPreviews());
var me = this;
setTimeout(function(){
me.fillTextArt();
}, 1);
}
},
@ -2072,7 +2073,8 @@ define([
var filemenu = this.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file');
filemenu.loadDocument({doc:this.document});
filemenu.panels['info'].updateInfo(this.document);
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document);
this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document});
Common.Gateway.metaChange(meta);
},
@ -2121,6 +2123,17 @@ define([
this.beforeShowDummyComment = true;
},
DisableMailMerge: function() {
this.appOptions.mergeFolderUrl = "";
var toolbarController = this.getApplication().getController('Toolbar');
toolbarController && toolbarController.DisableMailMerge();
},
DisableVersionHistory: function() {
this.editorConfig.canUseHistory = false;
this.appOptions.canUseHistory = false;
},
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@ -2456,7 +2469,11 @@ define([
errorEmailClient: 'No email client could be found',
textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.<br>Please contact our Sales Department to get a quote.',
txtHyperlink: 'Hyperlink',
waitText: 'Please, wait...'
waitText: 'Please, wait...',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
txtMainDocOnly: 'Error! Main Document Only.',
txtNotValidBookmark: 'Error! Not a valid bookmark self-reference.',
txtNoText: 'Error! No text of specified style in document.'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -251,10 +251,6 @@ define([
this.rightmenu.textartSettings.UpdateThemeColors();
},
fillTextArt: function() {
this.rightmenu.textartSettings.fillTextArt();
},
updateMetricUnit: function() {
this.rightmenu.headerSettings.updateMetricUnit();
this.rightmenu.paragraphSettings.updateMetricUnit();
@ -276,7 +272,7 @@ define([
}
if (this.editMode && this.api) {
this.rightmenu.shapeSettings.createDelayedElements();
// this.rightmenu.shapeSettings.createDelayedElements();
var selectedElements = this.api.getSelectedElements();
if (selectedElements.length>0) {
this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings", this.rightmenu.defaultHideRightMenu));

View file

@ -104,12 +104,15 @@ define([
this.diagramEditor = null;
this._isAddingShape = false;
this.editMode = true;
this.binding = {};
this.addListeners({
'Toolbar': {
'insert:break' : this.onClickPageBreak,
'change:compact' : this.onClickChangeCompact,
'home:open' : this.onHomeOpen
'home:open' : this.onHomeOpen,
'add:chart' : this.onSelectChart,
'insert:textart' : this.onInsertTextart
},
'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'),
@ -311,8 +314,8 @@ define([
toolbar.btnCopyStyle.on('toggle', _.bind(this.onCopyStyleToggle, this));
toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this));
toolbar.mnuColorSchema.on('item:click', _.bind(this.onColorSchemaClick, this));
toolbar.mnuColorSchema.on('show:after', _.bind(this.onColorSchemaShow, this));
toolbar.btnMailRecepients.on('click', _.bind(this.onSelectRecepientsClick, this));
toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this));
toolbar.mnuPageNumberPosPicker.on('item:click', _.bind(this.onInsertPageNumberClick, this));
toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this));
toolbar.mnuPageNumCurrentPos.on('click', _.bind(this.onPageNumCurrentPosClick, this));
@ -370,7 +373,7 @@ define([
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onColumnsProps', _.bind(this.onColumnsProps, this));
this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
@ -688,7 +691,8 @@ define([
in_equation = false,
btn_eq_state = false,
in_image = false,
in_control = false;
in_control = false,
in_para = false;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@ -700,6 +704,7 @@ define([
can_add_image = pr.get_CanAddImage();
frame_pr = pr;
sh = pr.get_Shade();
in_para = true;
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
header_locked = pr.get_Locked();
in_header = true;
@ -796,9 +801,9 @@ define([
toolbar.btnInsertShape.setDisabled(need_disable);
toolbar.btnInsertText.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || !can_add_image || in_equation || control_plain;
need_disable = paragraph_locked || header_locked || in_para && !can_add_image || in_equation || control_plain;
toolbar.btnInsertImage.setDisabled(need_disable);
toolbar.btnInsertTextArt.setDisabled(need_disable || in_image || in_footnote);
toolbar.btnInsertTextArt.setDisabled(need_disable || in_footnote);
if (in_chart !== this._state.in_chart) {
toolbar.btnInsertChart.updateHint(in_chart ? toolbar.tipChangeChart : toolbar.tipInsertChart);
@ -1592,6 +1597,14 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onColorSchemaShow: function(menu) {
if (this.api) {
var value = this.api.asc_GetCurrentColorSchemeName();
var item = _.find(menu.items, function(item) { return item.value == value; });
(item) ? item.setChecked(true) : menu.clearAll();
}
},
onDropCapSelect: function(menu, item) {
if (_.isUndefined(item.value))
return;
@ -1830,11 +1843,8 @@ define([
}
},
onSelectChart: function(picker, item, record) {
if (!record) return;
onSelectChart: function(type) {
var me = this,
type = record.get('type'),
chart = false;
var selectedElements = me.api.getSelectedElements();
@ -1874,6 +1884,19 @@ define([
}
},
onInsertTextart: function (data) {
if (this.api) {
this.toolbar.fireEvent('inserttextart', this.toolbar);
this.api.AddTextArt(data);
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertTextArt);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
},
onInsertPageNumberClick: function(picker, item, record) {
if (this.api)
this.api.put_PageNum(record.get('data').type, record.get('data').subtype);
@ -1943,6 +1966,7 @@ define([
(new DE.Views.WatermarkSettingsDialog({
props: me.api.asc_GetWatermarkProps(),
api: me.api,
lang: me.mode.lang,
fontStore: me.fontstore,
handler: function(result, value) {
if (result == 'ok') {
@ -2314,33 +2338,27 @@ define([
this._state.clrtext_asccolor = color;
},
onApiAutoShapes: function() {
var me = this;
var onShowBefore = function(menu) {
me.fillAutoShapes();
menu.off('show:before', onShowBefore);
};
me.toolbar.btnInsertShape.menu.on('show:before', onShowBefore);
},
fillAutoShapes: function() {
var me = this,
shapesStore = this.getApplication().getCollection('ShapeGroups');
var onShowAfter = function(menu) {
for (var i = 0; i < shapesStore.length; i++) {
var shapeGroup = shapesStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: shapeGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-shapegroup' + i + '" class="menu-shape" style="width: ' + (shapeGroup.get('groupWidth') - 8) + 'px; margin-left: 5px;"></div>') }
]
})
});
me.toolbar.btnInsertShape.menu.addItem(menuItem);
var shapePicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-shapegroup' + i),
store: shapeGroup.get('groupStore'),
parentMenu: menuItem.menu,
showLast: false,
var shapePicker = new Common.UI.DataViewSimple({
el: $('#id-toolbar-menu-shapegroup' + i, menu.items[i].$el),
store: shapesStore.at(i).get('groupStore'),
parentMenu: menu.items[i].menu,
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>')
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
if (record) {
@ -2359,6 +2377,24 @@ define([
}
});
}
menu.off('show:after', onShowAfter);
};
me.toolbar.btnInsertShape.menu.on('show:after', onShowAfter);
for (var i = 0; i < shapesStore.length; i++) {
var shapeGroup = shapesStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: shapeGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-shapegroup' + i + '" class="menu-shape" style="width: ' + (shapeGroup.get('groupWidth') - 8) + 'px; margin-left: 5px;"></div>') }
]
})
});
me.toolbar.btnInsertShape.menu.addItem(menuItem);
}
},
fillEquations: function() {
@ -2366,55 +2402,19 @@ define([
var me = this, equationsStore = this.getApplication().getCollection('EquationGroups');
me.equationPickers = [];
me.toolbar.btnInsertEquation.menu.removeAll();
var onShowAfter = function(menu) {
for (var i = 0; i < equationsStore.length; ++i) {
var equationGroup = equationsStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: equationGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
equationGroup.get('groupHeight') + 'margin-left:5px;"></div>') }
]
})
});
me.toolbar.btnInsertEquation.menu.addItem(menuItem);
var equationPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-equationgroup' + i),
store: equationGroup.get('groupStore'),
parentMenu: menuItem.menu,
showLast: false,
var equationPicker = new Common.UI.DataViewSimple({
el: $('#id-toolbar-menu-equationgroup' + i, menu.items[i].$el),
parentMenu: menu.items[i].menu,
store: equationsStore.at(i).get('groupStore'),
scrollAlwaysVisible: true,
itemTemplate: _.template('<div class="item-equation" '+
'style="background-position:<%= posX %>px <%= posY %>px;" >' +
'<div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">')
'<div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>"></div>' +
'</div>')
});
if (equationGroup.get('groupHeight').length) {
me.equationPickers.push(equationPicker);
me.toolbar.btnInsertEquation.menu.on('show:after', function () {
if (me.equationPickers.length) {
var element = $(this.el).find('.over').find('.menu-shape');
if (element.length) {
for (var i = 0; i < me.equationPickers.length; ++i) {
if (element[0].id == me.equationPickers[i].el.id) {
me.equationPickers[i].scroller.update({alwaysVisibleY: true});
me.equationPickers.splice(i, 1);
return;
}
}
}
}
});
}
equationPicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
if (record)
@ -2434,6 +2434,25 @@ define([
}
});
}
menu.off('show:after', onShowAfter);
};
me.toolbar.btnInsertEquation.menu.on('show:after', onShowAfter);
for (var i = 0; i < equationsStore.length; ++i) {
var equationGroup = equationsStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: equationGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
equationGroup.get('groupHeight') + 'margin-left:5px;"></div>') }
]
})
});
me.toolbar.btnInsertEquation.menu.addItem(menuItem);
}
},
onInsertEquationClick: function() {
@ -2444,6 +2463,16 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation);
},
onApiMathTypes: function(equation) {
this._equationTemp = equation;
var me = this;
var onShowBefore = function(menu) {
me.onMathTypes(me._equationTemp);
me.toolbar.btnInsertEquation.menu.off('show:before', onShowBefore);
};
me.toolbar.btnInsertEquation.menu.on('show:before', onShowBefore);
},
onMathTypes: function(equation) {
var equationgrouparray = [],
equationsStore = this.getCollection('EquationGroups');
@ -2484,35 +2513,29 @@ define([
translationTable[Common.define.c_oAscMathType[name]] = this[translate];
}
}
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null;
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data;
if (equation) {
count = equation.get_Data().length;
data = equation.get_Data();
count = data.length;
if (count) {
for (var j = 0; j < count; ++j) {
id = equation.get_Data()[j].get_Id();
width = equation.get_Data()[j].get_W();
height = equation.get_Data()[j].get_H();
var group = data[j];
id = group.get_Id();
width = group.get_W();
height = group.get_H();
store = new Backbone.Collection([], {
model: DE.Models.EquationModel
});
if (store) {
var allItemsCount = 0, itemsCount = 0, ids = 0;
length = equation.get_Data()[j].get_Data().length;
var allItemsCount = 0, itemsCount = 0, ids = 0, arr = [];
length = group.get_Data().length;
for (i = 0; i < length; ++i) {
eqStore = equation.get_Data()[j].get_Data()[i];
eqStore = group.get_Data()[i];
itemsCount = eqStore.get_Data().length;
for (var p = 0; p < itemsCount; ++p) {
eq = eqStore.get_Data()[p];
ids = eq.get_Id();
@ -2521,8 +2544,7 @@ define([
if (translationTable.hasOwnProperty(ids)) {
translate = translationTable[ids];
}
store.add({
arr.push({
data : {equationType: ids},
tip : translate,
allowSelected : true,
@ -2536,7 +2558,7 @@ define([
allItemsCount += itemsCount;
}
store.add(arr);
width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt(370 / (height + 10)) * (height + 10);
@ -2548,57 +2570,12 @@ define([
});
}
}
equationsStore.add(equationgrouparray);
this.fillEquations();
}
}
},
fillTextArt: function() {
if (!this.toolbar.btnInsertTextArt.rendered) return;
var me = this;
if (this.toolbar.mnuTextArtPicker) {
var models = this.getApplication().getCollection('Common.Collections.TextArt').models,
count = this.toolbar.mnuTextArtPicker.store.length;
if (count>0 && count==models.length) {
var data = this.toolbar.mnuTextArtPicker.store.models;
_.each(models, function(template, index){
data[index].set('imageUrl', template.get('imageUrl'));
});
} else {
this.toolbar.mnuTextArtPicker.store.reset(models);
}
} else {
this.toolbar.mnuTextArtPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-insart'),
store: this.getApplication().getCollection('Common.Collections.TextArt'),
parentMenu: this.toolbar.btnInsertTextArt.menu,
showLast: false,
itemTemplate: _.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>')
});
this.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
if (record) {
me.toolbar.fireEvent('inserttextart', me.toolbar);
me.api.AddTextArt(record.get('data'));
}
if (me.toolbar.btnInsertShape.pressed)
me.toolbar.btnInsertShape.toggle(false, true);
if (e.type !== 'click')
me.toolbar.btnInsertTextArt.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
});
}
},
activateControls: function() {
_.each(this.toolbar.toolbarControls, function(item){
item.setDisabled(false);
@ -2607,7 +2584,7 @@ define([
this.toolbar.btnRedo.setDisabled(this._state.can_redo!==true);
this.toolbar.btnCopy.setDisabled(this._state.can_copycut!==true);
this.toolbar.btnPrint.setDisabled(!this.toolbar.mode.canPrint);
if (this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients)
if (!this._state.mmdisable && (this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients))
this.toolbar.btnMailRecepients.setDisabled(false);
this._state.activated = true;
@ -2615,6 +2592,11 @@ define([
this.onApiPageSize(props.get_W(), props.get_H());
},
DisableMailMerge: function() {
this._state.mmdisable = true;
this.toolbar && this.toolbar.btnMailRecepients && this.toolbar.btnMailRecepients.setDisabled(true);
},
updateThemeColors: function() {
var updateColors = function(picker, defaultColorIndex) {
if (picker) {
@ -2673,17 +2655,17 @@ define([
return;
}
listStyles.menuPicker.store.reset([]); // remove all
var arr = [];
var mainController = this.getApplication().getController('Main');
_.each(styles.get_MergedStyles(), function(style){
listStyles.menuPicker.store.add({
arr.push({
imageUrl: style.asc_getImage(),
title : style.get_Name(),
tip : mainController.translationTable[style.get_Name()] || style.get_Name(),
id : Common.UI.getId()
});
});
listStyles.menuPicker.store.reset(arr); // remove all
if (listStyles.menuPicker.store.length > 0 && listStyles.rendered){
var styleRec;
@ -2846,10 +2828,11 @@ define([
compactview = true;
}
setTimeout(function () {
me.toolbar.render(_.extend({isCompactView: compactview}, config));
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
@ -2883,6 +2866,7 @@ define([
links.setApi(me.api).setConfig({toolbar: me});
Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons());
}
}, 0);
},
onAppReady: function (config) {

View file

@ -116,11 +116,20 @@ define([
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
},
getApi: function() {
return this.api;
},
// When our application is ready, lets get started
onLaunch: function() {
// Create and render main view
this.viewport = this.createView('Viewport').render();
this.api = new Asc.asc_docs_api({
'id-view' : 'editor_sdk',
'translate': this.getApplication().getController('Main').translationTable
});
this.header = this.createView('Common.Views.Header', {
headerCaption: 'Document Editor',
storeUsers: DE.getCollection('Common.Collections.Users')

View file

@ -5,7 +5,7 @@
<label class="input-label"><%= scope.textAlign %></label>
<div id="paragraphadv-spin-text-alignment"></div>
</div>
<div class="padding-large text-only" style="display: none; float: right;">
<div class="padding-large text-only" style="float: right;">
<label class="input-label"><%= scope.strIndentsOutlinelevel %></label>
<div id="paragraphadv-spin-outline-level"></div>
</div>

View file

@ -152,6 +152,7 @@
<div class="group">
<span class="btn-slot text x-huge slot-inshyperlink"></span>
<span class="btn-slot text x-huge" id="slot-btn-bookmarks"></span>
<span class="btn-slot text x-huge" id="slot-btn-caption"></span>
</div>
</section>
</section>

View file

@ -0,0 +1,127 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* AddNewCaptionLabelDialog.js
*
* Created by Julia Svinareva on 03/10/19
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/InputField'
], function () { 'use strict';
DE.Views.AddNewCaptionLabelDialog = Common.UI.Window.extend(_.extend({
options: {
width: 330,
header: false,
cls: 'modal-dlg',
buttons: ['ok', 'cancel'],
footerCls: 'center'
},
initialize : function(options) {
_.extend(this.options, options || {});
this.template = [
'<div class="box">',
'<div class="input-row">',
'<label>' + this.textLabel + '</label>',
'</div>',
'<div id="id-dlg-label-caption" class="input-row"></div>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var me = this;
me.inputLabel = new Common.UI.InputField({
el : $('#id-dlg-label-caption'),
allowBlank : false,
blankError : me.textLabelError,
style : 'width: 100%;',
validateOnBlur: false,
validation : function(value) {
return value ? true : '';
}
});
var $window = this.getChild();
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
me.getChild('input').focus();
},50);
},
onPrimary: function(event) {
this._handleInput('ok');
return false;
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
_handleInput: function(state) {
if (this.options.handler) {
if (state == 'ok') {
if (this.inputLabel.checkValidate() !== true) {
this.inputLabel.cmpEl.find('input').focus();
return;
}
}
this.options.handler.call(this, state, this.inputLabel.getValue());
}
this.close();
},
textLabel: 'Label:',
textLabelError: 'Label must not be empty.'
}, DE.Views.AddNewCaptionLabelDialog || {}));
});

View file

@ -51,7 +51,8 @@ define([
DE.Views.BookmarksDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 310,
height: 360
height: 360,
buttons: null
},
initialize : function(options) {
@ -136,9 +137,10 @@ define([
value : '',
maxLength: 40,
validation : function(value) {
var check = me.props.asc_CheckNewBookmarkName(value);
me.btnAdd.setDisabled(!check);
return (check || _.isEmpty(value)) ? true : me.txtInvalidName;
var check = me.props.asc_CheckNewBookmarkName(value),
exist = me.props.asc_HaveBookmark(value);
me.btnAdd.setDisabled(!check && !exist);
return (check || _.isEmpty(value) || exist) ? true : me.txtInvalidName;
}
}).on ('changing', function (input, value) {
var exist = me.props.asc_HaveBookmark(value);
@ -247,6 +249,28 @@ define([
afterRender: function() {
this._setDefaults(this.props);
var me = this;
var onApiBookmarksUpdate = function() {
var rec = me.bookmarksList.getSelectedRec();
me.refreshBookmarks();
if (rec) {
rec = me.bookmarksList.store.findWhere({value: rec.get('value')});
if (rec) {
me.bookmarksList.selectRecord(rec);
me.bookmarksList.scrollToRecord(rec);
} else {
me.txtName.setValue('');
me.btnAdd.setDisabled(true);
me.btnGoto.setDisabled(true);
me.btnDelete.setDisabled(true);
me.btnGetLink.setDisabled(true);
}
}
};
this.api.asc_registerCallback('asc_onBookmarksUpdate', onApiBookmarksUpdate);
this.on('close', function(obj){
me.api.asc_unregisterCallback('asc_onBookmarksUpdate', onApiBookmarksUpdate);
});
},
show: function() {
@ -266,7 +290,6 @@ define([
_setDefaults: function (props) {
this.refreshBookmarks();
this.bookmarksList.scrollToRecord(this.bookmarksList.selectByIndex(0));
this.btnGetLink.setVisible(this.appOptions.canMakeActionLink);
},
@ -314,7 +337,10 @@ define([
gotoBookmark: function(btn, eOpts){
var rec = this.bookmarksList.getSelectedRec();
rec && this.props.asc_SelectBookmark(rec.get('value'));
if (rec)
this.props.asc_SelectBookmark(rec.get('value'));
else if (this.txtName.getValue()!=='')
this.props.asc_SelectBookmark(this.txtName.getValue());
},
addBookmark: function(btn, eOpts){

View file

@ -0,0 +1,457 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* CaptionDialog.js
*
* Created by Julia Radzhabova on 10.09.2019
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/util/utils',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/ComboBox',
'common/main/lib/view/AdvancedSettingsWindow',
'documenteditor/main/app/view/AddNewCaptionLabelDialog'
], function () { 'use strict';
DE.Views.CaptionDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 351,
height: 350
},
initialize : function(options) {
var me = this;
_.extend(this.options, {
title: this.textTitle,
template: [
'<div class="box" style="height:' + (me.options.height - 85) + 'px;">',
'<div class="content-panel" style="padding: 0 5px;"><div class="inner-content">',
'<div class="settings-panel active">',
'<table cols="4" style="width: auto;">',
'<tr>',
'<td colspan="3" class="padding-small">',
'<label class="input-label">', me.textCaption,'</label>',
'<div id="caption-txt-caption" style="margin-right: 10px;"></div>',
'</td>',
'<td class="padding-small">',
'<label class="input-label">', me.textInsert,'</label>',
'<div id="caption-combo-position" class="input-group-nr" style="width:75px;"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-small">',
'<label class="input-label">', me.textLabel,'</label>',
'<div id="caption-combo-label" class="input-group-nr" style="width:160px;margin-right: 10px;"></div>',
'</td>',
'<td class="padding-small" style="vertical-align: bottom;">',
'<button type="button" result="add" class="btn btn-text-default" id="caption-btn-add" style="margin-right: 10px;">', me.textAdd,'</button>',
'</td>',
'<td class="padding-small" style="vertical-align: bottom;">',
'<button type="button" result="add" class="btn btn-text-default" id="caption-btn-delete">', me.textDelete,'</button>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="4" class="padding-small">',
'<div id="caption-checkbox-exclude"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-large">',
'<label class="input-label" >', me.textNumbering,'</label>',
'<div id="caption-combo-numbering" class="input-group-nr" style="width:160px;"></div>',
'</td>',
'<td class="padding-large">',
'</td>',
'<td class="padding-large">',
'</td>',
'</tr>',
'<tr>',
'<td colspan="4" class="padding-small">',
'<div id="caption-checkbox-chapter"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-small">',
'<label class="input-label">', me.textChapter,'</label>',
'<div id="caption-combo-chapter" class="input-group-nr" style="width:160px;margin-right: 10px;"></div>',
'</td>',
'<td colspan="2" class="padding-small">',
'<label class="input-label" >', me.textSeparator,'</label>',
'<div id="caption-combo-separator" class="input-group-nr" style="width:160px;"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="4" class="padding-small">',
'<label class="input-label" id="caption-label-example">', me.textExamples,'</label>',
'</td>',
'</tr>',
'</table>',
'</div>',
'</div></div>',
'</div>'
].join('')
}, options);
this.isObject = options.isObject;
this.handler = options.handler;
this.props = options.props;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
render: function() {
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
var me = this;
this.txtCaption = new Common.UI.InputField({
el : $('#caption-txt-caption'),
allowBlank : false,
value : ''
});
var $captionInput = this.txtCaption.$el.find('input');
$captionInput.on('mouseup', _.bind(this.checkStartPosition, this, 'mouse'));
$captionInput.on('keydown', _.bind(this.checkStartPosition, this, 'key'));
this.cmbPosition = new Common.UI.ComboBox({
el: $('#caption-combo-position'),
cls: 'input-group-nr',
menuStyle: 'min-width: 75px;',
editable: false,
disabled: !this.isObject,
data: [
{ displayValue: this.textBefore, value: 1 },
{ displayValue: this.textAfter, value: 0 }
]
});
this.cmbPosition.setValue(0);
this.cmbPosition.on('selected', function(combo, record) {
me.props.put_Before(!!record.value);
});
var arr = Common.Utils.InternalSettings.get("de-settings-captions");
if (arr==null || arr==undefined) {
arr = Common.localStorage.getItem("de-settings-captions") || '';
Common.Utils.InternalSettings.set("de-settings-captions", arr);
}
arr = arr ? JSON.parse(arr) : [];
// 0 - not removable
this.arrLabel = arr.concat([{ displayValue: this.textEquation, value: this.textEquation, type: 0 },
{ displayValue: this.textFigure, value: this.textFigure, type: 0 },
{ displayValue: this.textTable, value: this.textTable, type: 0 }
]);
this.cmbLabel = new Common.UI.ComboBox({
el: $('#caption-combo-label'),
cls: 'input-group-nr',
menuStyle: 'min-width: 160px;max-height:155px;',
editable: false,
data: this.arrLabel,
alwaysVisibleY: true
});
this.cmbLabel.on('selected', function(combo, record) {
var value = record.value;
me.props.put_Label(value);
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
var custom = (record.type==1);
me.btnDelete.setDisabled(!custom);
me.currentLabel = value;
me.positionCaption = me.txtCaption.getValue().length;
});
var curLabel = Common.Utils.InternalSettings.get("de-settings-current-label"),
recLabel,
findIndLabel;
if (curLabel) {
findIndLabel = _.findIndex(this.arrLabel, function (item) {
return item.value === curLabel;
});
}
if (curLabel && findIndLabel !== -1) {
recLabel = this.cmbLabel.store.at(findIndLabel);
} else {
recLabel = this.cmbLabel.store.at(this.arrLabel.length-1);
}
this.cmbLabel.selectRecord(recLabel);
this.btnAdd = new Common.UI.Button({
el: $('#caption-btn-add')
});
this.btnAdd.on('click', _.bind(function (e) {
var me = this;
(new DE.Views.AddNewCaptionLabelDialog({
handler: function(result, value) {
if (result == 'ok') {
var rec = _.findWhere(me.arrLabel, {value: value});
if (rec) {
me.cmbLabel.setValue(value);
me.cmbLabel.trigger('selected', me.cmbLabel, rec);
} else {
var rec = {displayValue: value, value: value, type: 1};
me.arrLabel.unshift(rec);
me.cmbLabel.setData(me.arrLabel);
me.cmbLabel.setValue(value);
me.cmbLabel.trigger('selected', me.cmbLabel, rec);
me.cmbLabel.scroller.update({alwaysVisibleY: true});
}
}
}
})).show();
}, this));
this.btnDelete = new Common.UI.Button({
el: $('#caption-btn-delete'),
disabled: true
});
this.btnDelete.on('click', _.bind(function (e) {
var value = this.cmbLabel.getValue();
this.arrLabel = _.reject(this.arrLabel, function (item) {
return item.value === value;
});
this.cmbLabel.setData(this.arrLabel);
this.cmbLabel.setValue(this.arrLabel[0].value);
this.cmbLabel.trigger('selected', this.cmbLabel, this.arrLabel[0]);
}, this));
this.chExclude = new Common.UI.CheckBox({
el: $('#caption-checkbox-exclude'),
labelText: this.textExclude
});
this.chExclude.on('change', function(field, newValue, oldValue) {
me.props.put_ExcludeLabel(newValue=='checked');
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
});
this.cmbNumbering = new Common.UI.ComboBox({
el: $('#caption-combo-numbering'),
cls: 'input-group-nr',
menuStyle: 'min-width: 160px;',
editable: false,
data: [
{ displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal, maskExp: /[0-9]/, defValue: 1 },
{ displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter, maskExp: /[a-z]/, defValue: 'a' },
{ displayValue: 'A, B, C,...', value: Asc.c_oAscNumberingFormat.UpperLetter, maskExp: /[A-Z]/, defValue: 'A' },
{ displayValue: 'i, ii, iii,...', value: Asc.c_oAscNumberingFormat.LowerRoman, maskExp: /[ivxlcdm]/, defValue: 'i' },
{ displayValue: 'I, II, III,...', value: Asc.c_oAscNumberingFormat.UpperRoman, maskExp: /[IVXLCDM]/, defValue: 'I' }
]
});
this.cmbNumbering.setValue(Asc.c_oAscNumberingFormat.Decimal);
this.cmbNumbering.on('selected', function(combo, record) {
me.props.put_Format(record.value);
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
});
this.chChapter = new Common.UI.CheckBox({
el: $('#caption-checkbox-chapter'),
labelText: this.textChapterInc
});
this.chChapter.on('change', function(field, newValue, oldValue) {
me.props.put_IncludeChapterNumber(newValue=='checked');
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
me.cmbChapter.setDisabled(newValue!=='checked');
me.cmbSeparator.setDisabled(newValue!=='checked');
});
var _main = DE.getController('Main');
this._arrLevel = [];
for (var i=0; i<9; i++) {
this._arrLevel.push({displayValue: _main['txtStyle_Heading_' + (i+1)], value: i});
}
this.cmbChapter = new Common.UI.ComboBox({
el: $('#caption-combo-chapter'),
cls: 'input-group-nr',
menuStyle: 'min-width: 160px;max-height:135px;',
editable: false,
disabled: true,
data: this._arrLevel
});
this.cmbChapter.setValue(0);
this.cmbChapter.on('selected', function(combo, record) {
me.props.put_HeadingLvl(record.value);
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
});
this.cmbSeparator = new Common.UI.ComboBox({
el: $('#caption-combo-separator'),
cls: 'input-group-nr',
menuStyle: 'min-width: 160px;',
editable: false,
disabled: true,
data: [
{ displayValue: '- (' + this.textHyphen + ')', value: '-' },
{ displayValue: '. (' + this.textPeriod + ')', value: '.' },
{ displayValue: ': (' + this.textColon + ')', value: ':' },
{ displayValue: '— (' + this.textLongDash + ')', value: '—' },
{ displayValue: ' (' + this.textDash + ')', value: '' }
]
});
this.cmbSeparator.setValue('-');
this.cmbSeparator.on('selected', function(combo, record) {
me.props.put_Separator(record.value);
me.props.updateName();
me.txtCaption.setValue(me.props.get_Name());
});
this.lblExample = this.$window.find('#caption-label-example');
this.afterRender();
},
afterRender: function() {
this._setDefaults(this.props);
},
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
},
close: function() {
var val = _.where(this.arrLabel, {type: 1}),
valJson = JSON.stringify(val);
Common.localStorage.setItem("de-settings-captions", valJson);
Common.Utils.InternalSettings.set("de-settings-captions", valJson);
Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments);
},
_setDefaults: function (props) {
this.props = new Asc.CAscCaptionProperties();
this.props.put_Before(!!this.cmbPosition.getValue());
var valueLabel = this.cmbLabel.getValue();
this.props.put_Label(valueLabel);
var value = this.cmbLabel.getSelectedRecord();
this.btnDelete.setDisabled(!value || value.type==0);
this.props.put_ExcludeLabel(this.chExclude.getValue()=='checked');
this.props.put_Format(this.cmbNumbering.getValue());
this.props.put_IncludeChapterNumber(this.chChapter.getValue()=='checked');
this.props.put_HeadingLvl(this.cmbChapter.getValue());
this.props.put_Separator(this.cmbSeparator.getValue());
this.props.updateName();
this.txtCaption.setValue(this.props.get_Name());
this.currentLabel = valueLabel;
this.positionCaption = this.txtCaption.getValue().length;
},
getSettings: function () {
this.props.put_Additional(this.txtCaption.getValue().substr(this.positionCaption));
return this.props ;
},
onDlgBtnClick: function(event) {
this._handleInput((typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event);
},
onPrimary: function() {
this._handleInput('ok');
return false;
},
_handleInput: function(state) {
this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);
if (state == 'ok') {
Common.Utils.InternalSettings.set("de-settings-current-label", this.cmbLabel.getValue());
}
this.close();
},
checkStartPosition: function (type, event) {
var me = this,
key = event.key;
if (type === 'mouse' || key === 'ArrowLeft' || key === 'ArrowDown') {
setTimeout(function () {
if (event.target.selectionStart < me.positionCaption + 1) {
event.target.selectionStart = me.positionCaption;
}
}, 0);
} else if (key === 'ArrowUp' || key === 'Home') {
setTimeout(function () {
event.target.selectionStart = me.positionCaption;
}, 0);
} else if (event.target.selectionStart !== event.target.selectionEnd && key === 'ArrowRight') {
if (event.target.selectionEnd > me.positionCaption) {
setTimeout(function () {
event.target.selectionStart = event.target.selectionEnd;
}, 0);
} else {
setTimeout(function () {
event.target.selectionStart = me.positionCaption;
}, 0);
}
} else if (key === 'Backspace') {
if ((event.target.selectionStart === event.target.selectionEnd && event.target.selectionStart < me.positionCaption + 1) || event.target.selectionStart < me.positionCaption - 1) {
event.preventDefault();
}
} else if (key === 'Delete') {
if (event.target.selectionStart < me.positionCaption - 1) {
event.preventDefault();
}
} else if (key !== 'End') {
if (event.target.selectionStart !== event.target.selectionEnd && event.target.selectionStart === 0) {
event.preventDefault();
}
}
},
textTitle: 'Insert Caption',
textCaption: 'Caption',
textInsert: 'Insert',
textLabel: 'Label',
textAdd: 'Add label',
textDelete: 'Delete label',
textNumbering: 'Numbering',
textChapterInc: 'Include chapter number',
textChapter: 'Chapter starts with style',
textSeparator: 'Use separator',
textExamples: 'Examples: Table 2-A, Image 1.IV',
textBefore: 'Before',
textAfter: 'After',
textHyphen: 'hyphen',
textPeriod: 'period',
textColon: 'colon',
textLongDash: 'long dash',
textDash: 'dash',
textEquation: 'Equation',
textFigure: 'Figure',
textTable: 'Table',
textExclude: 'Exclude label from caption'
}, DE.Views.CaptionDialog || {}))
});

View file

@ -0,0 +1,162 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* CellsAddDialog.js
*
* Created by Julia Radzhabova on 06.09.2019
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/ComboBox',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/RadioBox'
], function () { 'use strict';
DE.Views.CellsAddDialog = Common.UI.Window.extend(_.extend({
options: {
width: 214,
header: true,
style: 'min-width: 214px;',
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box">',
'<div style="margin-bottom: 10px;">',
'<div id="table-combo-row-col" class="input-group-nr" style="display: inline-block; margin-right: 5px;"></div>',
'<div id="table-spin-row-col" style="display: inline-block;"></div>',
'</div>',
'<div id="table-radio-before" style="padding-bottom: 8px;"></div>',
'<div id="table-radio-after" style="padding-bottom: 8px;"></div>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
this.cmbRowCol = new Common.UI.ComboBox({
el: $('#table-combo-row-col'),
cls: 'input-group-nr',
style: 'width: 110px;',
menuStyle: 'min-width: 110px;',
editable: false,
scrollAlwaysVisible: true,
data: [
{ value: 0, displayValue: this.textRow},
{ value: 1, displayValue: this.textCol}
]
});
this.cmbRowCol.setValue(0);
this.cmbRowCol.on('selected', _.bind(function(combo, record) {
var row = record.value == 0;
this.spnCount.setMaxValue(row ? 100 : 64);
this.spnCount.setValue(this.spnCount.getNumberValue());
this.radioBefore.setCaption(row ? this.textUp : this.textLeft);
this.radioAfter.setCaption(row ? this.textDown : this.textRight);
}, this));
this.spnCount = new Common.UI.MetricSpinner({
el: $('#table-spin-row-col'),
step : 1,
width : 65,
value : 1,
defaultUnit : '',
maxValue : 100,
minValue : 1,
allowDecimal: false
});
this.radioBefore = new Common.UI.RadioBox({
el: $('#table-radio-before'),
labelText: this.textUp,
name: 'asc-radio-table-cells-add',
checked: true
});
this.radioAfter = new Common.UI.RadioBox({
el: $('#table-radio-after'),
labelText: this.textDown,
name: 'asc-radio-table-cells-add'
});
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, state, this.getSettings());
}
this.close();
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
getSettings: function() {
var row = this.cmbRowCol.getValue()==0;
return {row: row, before: this.radioBefore.getValue(), count: this.spnCount.getNumberValue()};
},
onPrimary: function() {
this._handleInput('ok');
return false;
},
textTitle: 'Insert Several',
textLeft: 'To the left',
textRight: 'To the right',
textUp: 'Above the cursor',
textDown: 'Below the cursor',
textRow: 'Rows',
textCol: 'Columns'
}, DE.Views.CellsAddDialog || {}))
});

View file

@ -0,0 +1,127 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* CellsRemoveDialog.js
*
* Created by Julia Radzhabova on 05.09.2019
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/RadioBox'
], function () { 'use strict';
DE.Views.CellsRemoveDialog = Common.UI.Window.extend(_.extend({
options: {
width: 214,
header: true,
style: 'min-width: 214px;',
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box">',
'<div id="table-radio-cells-left" style="padding-bottom: 8px;"></div>',
'<div id="table-radio-cells-row" style="padding-bottom: 8px;"></div>',
'<div id="table-radio-cells-col" style="padding-bottom: 8px;"></div>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
this.radioLeft = new Common.UI.RadioBox({
el: $('#table-radio-cells-left'),
labelText: this.textLeft,
name: 'asc-radio-table-cells-rem',
checked: true
});
this.radioRow = new Common.UI.RadioBox({
el: $('#table-radio-cells-row'),
labelText: this.textRow,
name: 'asc-radio-table-cells-rem'
});
this.radioCol = new Common.UI.RadioBox({
el: $('#table-radio-cells-col'),
labelText: this.textCol,
name: 'asc-radio-table-cells-rem'
});
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, state, this.getSettings());
}
this.close();
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
getSettings: function() {
return this.radioRow.getValue() ? 'row' : (this.radioCol.getValue() ? 'col' : 'left') ;
},
onPrimary: function() {
this._handleInput('ok');
return false;
},
textTitle: 'Delete Cells',
textLeft: 'Shift cells left',
textRow: 'Delete entire row',
textCol: 'Delete entire column'
}, DE.Views.CellsRemoveDialog || {}))
});

View file

@ -84,16 +84,16 @@ define([
this._originalProps = null;
this.render();
this.labelWidth = $(this.el).find('#chart-label-width');
this.labelHeight = $(this.el).find('#chart-label-height');
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
scope: this
}));
this.labelWidth = el.find('#chart-label-width');
this.labelHeight = el.find('#chart-label-height');
},
setApi: function(api) {

View file

@ -80,10 +80,6 @@ define([
'</table>',
'</div></div>',
'</div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + me.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + me.cancelButtonText + '</button>',
'</div>'
].join('')
}, options);

View file

@ -132,10 +132,6 @@ define([
'</table>',
'</div></div>',
'</div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + me.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + me.cancelButtonText + '</button>',
'</div>'
].join('')
}, options);
@ -349,8 +345,6 @@ define([
txtLockDelete: 'Content control cannot be deleted',
txtLockEdit: 'Contents cannot be edited',
textLock: 'Locking',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
textShowAs: 'Show as',
textColor: 'Color',
textBox: 'Bounding box',

View file

@ -49,7 +49,8 @@ define([
width: 300,
header: true,
style: 'min-width: 216px;',
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -69,11 +70,7 @@ define([
'<div id="custom-columns-separator"></div>',
'</div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
@ -171,8 +168,6 @@ define([
textTitle: 'Columns',
textSpacing: 'Spacing between columns',
textColumns: 'Number of columns',
textSeparator: 'Column divider',
cancelButtonText: 'Cancel',
okButtonText: 'Ok'
textSeparator: 'Column divider'
}, DE.Views.CustomColumnsDialog || {}))
});

View file

@ -54,7 +54,9 @@ define([
'documenteditor/main/app/view/ParagraphSettingsAdvanced',
'documenteditor/main/app/view/TableSettingsAdvanced',
'documenteditor/main/app/view/ControlSettingsDialog',
'documenteditor/main/app/view/NumberingValueDialog'
'documenteditor/main/app/view/NumberingValueDialog',
'documenteditor/main/app/view/CellsRemoveDialog',
'documenteditor/main/app/view/CellsAddDialog'
], function ($, _, Backbone, gateway) { 'use strict';
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
@ -741,21 +743,11 @@ define([
};
this.changeLanguageMenu = function(menu) {
var i;
if (me._currLang.id===null || me._currLang.id===undefined) {
for (i=0; i<menu.items.length; i++)
menu.items[i].setChecked(false);
menu.currentCheckedItem = undefined;
menu.clearAll();
} else {
for (i=0; i<menu.items.length; i++) {
if (menu.items[i].options.langid === me._currLang.id) {
menu.currentCheckedItem = menu.items[i];
if (!menu.items[i].checked)
menu.items[i].setChecked(true);
break;
} else if (menu.items[i].checked)
menu.items[i].setChecked(false);
}
var index = _.findIndex(menu.items, {langid: me._currLang.id});
(index>-1) && !menu.items[index].checked && menu.setChecked(index, true);
}
};
@ -1848,11 +1840,6 @@ define([
}
},
updateThemeColors: function() {
this.effectcolors = Common.Utils.ThemeColor.getEffectColors();
this.standartcolors = Common.Utils.ThemeColor.getStandartColors();
},
onCutCopyPaste: function(item, e) {
var me = this;
if (me.api) {
@ -1906,6 +1893,19 @@ define([
me.fireEvent('editcomplete', me);
},
onInsertCaption: function() {
var me = this;
(new DE.Views.CaptionDialog({
isObject: true,
handler: function (result, settings) {
if (result == 'ok') {
me.api.asc_AddObjectCaption(settings);
}
me.fireEvent('editcomplete', me);
}
})).show();
},
onContinueNumbering: function(item, e) {
this.api.asc_ContinueNumbering();
this.fireEvent('editcomplete', this);
@ -1929,6 +1929,41 @@ define([
this.fireEvent('editcomplete', this);
},
onCellsRemove: function() {
var me = this;
(new DE.Views.CellsRemoveDialog({
handler: function (result, value) {
if (result == 'ok') {
if (value == 'row')
me.api.remRow();
else if (value == 'col')
me.api.remColumn();
else
me.api.asc_RemoveTableCells();
}
me.fireEvent('editcomplete', me);
}
})).show();
this.fireEvent('editcomplete', this);
},
onCellsAdd: function() {
var me = this;
(new DE.Views.CellsAddDialog({
handler: function (result, settings) {
if (result == 'ok') {
if (settings.row) {
settings.before ? me.api.addRowAbove(settings.count) : me.api.addRowBelow(settings.count);
} else {
settings.before ? me.api.addColumnLeft(settings.count) : me.api.addColumnRight(settings.count);
}
}
me.fireEvent('editcomplete', me);
}
})).show();
this.fireEvent('editcomplete', this);
},
createDelayedElementsViewer: function() {
var me = this;
@ -2015,6 +2050,16 @@ define([
createDelayedElements: function() {
var me = this;
var menuInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var menuInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' });
var menuEquationInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var menuEquationInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' });
var menuImageAlign = new Common.UI.MenuItem({
caption : me.textAlign,
menu : (function(){
@ -2497,7 +2542,7 @@ define([
if (menuChartEdit.isVisible())
menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts());
me.pictureMenu.items[17].setVisible(menuChartEdit.isVisible());
me.pictureMenu.items[19].setVisible(menuChartEdit.isVisible());
me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined);
menuImageAdvanced.setDisabled(islocked);
@ -2550,6 +2595,8 @@ define([
me.menuImageWrap,
menuImgRotate,
{ caption: '--' },
menuInsertCaption,
menuInsertCaptionSeparator,
me.menuImgCrop,
me.menuOriginalSize,
menuImgReplace,
@ -2564,6 +2611,10 @@ define([
/* table menu*/
var menuTableInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var mnuTableMerge = new Common.UI.MenuItem({
caption : me.mergeCellsText
}).on('click', function(item) {
@ -2736,13 +2787,21 @@ define([
})
});
var langTemplate = _.template([
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="padding-left: 28px !important;" langval="<%= value %>" class="<% if (checked) { %> checked <% } %>">',
'<i class="icon <% if (spellcheck) { %> img-toolbarmenu spellcheck-lang <% } %>"></i>',
'<%= caption %>',
'</a>'
].join(''));
me.langTableMenu = new Common.UI.MenuItem({
caption : me.langText,
menu : new Common.UI.Menu({
menu : new Common.UI.MenuSimple({
cls: 'lang-menu',
menuAlign: 'tl-tr',
restoreHeight: 285,
items : [],
itemTemplate: langTemplate,
search: true
})
});
@ -2922,7 +2981,7 @@ define([
var isEquation= (value.mathProps && value.mathProps.value);
for (var i = 8; i < 25; i++) {
for (var i = 8; i < 27; i++) {
me.tableMenu.items[i].setVisible(!isEquation);
}
@ -3138,6 +3197,11 @@ define([
}).on('click', function(item) {
if (me.api)
me.api.addRowBelow();
}),
new Common.UI.MenuItem({
caption: me.textSeveral
}).on('click', function(item) {
me.onCellsAdd();
})
]
})
@ -3165,6 +3229,11 @@ define([
}).on('click', function(item) {
if (me.api)
me.api.remTable();
}),
new Common.UI.MenuItem({
caption: me.textCells
}).on('click', function(item) {
me.onCellsRemove();
})
]
})
@ -3179,6 +3248,8 @@ define([
menuTableCellAlign,
menuTableDirection,
{ caption: '--' },
menuTableInsertCaption,
{ caption: '--' },
menuTableAdvanced,
{ caption: '--' },
/** coauthoring begin **/
@ -3379,11 +3450,12 @@ define([
me.langParaMenu = new Common.UI.MenuItem({
caption : me.langText,
menu : new Common.UI.Menu({
menu : new Common.UI.MenuSimple({
cls: 'lang-menu',
menuAlign: 'tl-tr',
restoreHeight: 285,
items : [],
itemTemplate: langTemplate,
search: true
})
});
@ -3627,10 +3699,12 @@ define([
//equation menu
var eqlen = 0;
if (isEquation) {
eqlen = me.addEquationMenu(true, 13);
eqlen = me.addEquationMenu(true, 15);
} else
me.clearEquationMenu(true, 13);
me.clearEquationMenu(true, 15);
menuEquationSeparator.setVisible(isEquation && eqlen>0);
menuEquationInsertCaption.setVisible(isEquation);
menuEquationInsertCaptionSeparator.setVisible(isEquation);
menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined);
@ -3693,6 +3767,8 @@ define([
menuParaCopy,
menuParaPaste,
menuParaPrint,
menuEquationInsertCaptionSeparator,
menuEquationInsertCaption,
{ caption: '--' },
menuEquationSeparator,
menuParaRemoveControl,
@ -3781,58 +3857,39 @@ define([
var me = this;
if (langs && langs.length > 0 && me.langParaMenu && me.langTableMenu) {
me.langParaMenu.menu.removeAll();
me.langTableMenu.menu.removeAll();
_.each(langs, function(lang, index){
me.langParaMenu.menu.addItem(new Common.UI.MenuItem({
var arrPara = [], arrTable = [];
_.each(langs, function(lang) {
var item = {
caption : lang.displayValue,
value : lang.value,
checkable : true,
toggleGroup : 'popupparalang',
langid : lang.code,
spellcheck : lang.spellcheck,
template: _.template([
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="padding-left: 28px !important;" langval="<%= options.value %>">',
'<i class="icon <% if (options.spellcheck) { %> img-toolbarmenu spellcheck-lang <% } %>"></i>',
'<%= caption %>',
'</a>'
].join(''))
}).on('click', function(item, e){
spellcheck : lang.spellcheck
};
arrPara.push(item);
arrTable.push(_.clone(item));
});
me.langParaMenu.menu.resetItems(arrPara);
me.langTableMenu.menu.resetItems(arrTable);
me.langParaMenu.menu.on('item:click', function(menu, item){
if (me.api){
if (!_.isUndefined(item.options.langid))
me.api.put_TextPrLang(item.options.langid);
me._currLang.paraid = item.options.langid;
me.langParaMenu.menu.currentCheckedItem = item;
if (!_.isUndefined(item.langid))
me.api.put_TextPrLang(item.langid);
me._currLang.paraid = item.langid;
me.fireEvent('editcomplete', me);
}
}));
});
me.langTableMenu.menu.addItem(new Common.UI.MenuItem({
caption : lang.displayValue,
value : lang.value,
checkable : true,
toggleGroup : 'popuptablelang',
langid : lang.code,
spellcheck : lang.spellcheck,
template: _.template([
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="padding-left: 28px !important;" langval="<%= options.value %>">',
'<i class="icon <% if (options.spellcheck) { %> img-toolbarmenu spellcheck-lang <% } %>"></i>',
'<%= caption %>',
'</a>'
].join(''))
}).on('click', function(item, e){
me.langTableMenu.menu.on('item:click', function(menu, item, e){
if (me.api){
if (!_.isUndefined(item.options.langid))
me.api.put_TextPrLang(item.options.langid);
me._currLang.tableid = item.options.langid;
me.langTableMenu.menu.currentCheckedItem = item;
if (!_.isUndefined(item.langid))
me.api.put_TextPrLang(item.langid);
me._currLang.tableid = item.langid;
me.fireEvent('editcomplete', me);
}
}));
});
}
},
@ -4110,7 +4167,10 @@ define([
textCropFit: 'Fit',
textFollow: 'Follow move',
toDictionaryText: 'Add to Dictionary',
txtPrintSelection: 'Print Selection'
txtPrintSelection: 'Print Selection',
textCells: 'Cells',
textSeveral: 'Several Rows/Columns',
txtInsertCaption: 'Insert Caption'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -1164,8 +1164,6 @@ define([
textBorderColor: 'Border Color',
textBackColor: 'Background Color',
textBorderDesc: 'Click on diagramm or use buttons to select borders',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtNoBorders: 'No borders',
textNewColor: 'Add New Custom Color',
textPosition: 'Position',

View file

@ -49,6 +49,7 @@ define([
DE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({
el: '#file-menu-panel',
rendered: false,
options: {alias:'FileMenu'},
template: _.template(tpl),
@ -81,95 +82,109 @@ define([
},
render: function () {
this.$el = $(this.el);
this.$el.html(this.template());
var $markup = $(this.template());
this.miSave = new Common.UI.MenuItem({
el : $('#fm-btn-save',this.el),
el : $markup.elementById('#fm-btn-save'),
action : 'save',
caption : this.btnSaveCaption,
canFocused: false
});
if ( !!this.options.miSave ) {
this.miSave.setDisabled(this.options.miSave.isDisabled());
delete this.options.miSave;
}
this.miEdit = new Common.UI.MenuItem({
el : $('#fm-btn-edit',this.el),
el : $markup.elementById('#fm-btn-edit'),
action : 'edit',
caption : this.btnToEditCaption,
canFocused: false
});
this.miDownload = new Common.UI.MenuItem({
el : $('#fm-btn-download',this.el),
el : $markup.elementById('#fm-btn-download'),
action : 'saveas',
caption : this.btnDownloadCaption,
canFocused: false
});
this.miSaveCopyAs = new Common.UI.MenuItem({
el : $('#fm-btn-save-copy',this.el),
el : $markup.elementById('#fm-btn-save-copy'),
action : 'save-copy',
caption : this.btnSaveCopyAsCaption,
canFocused: false
});
this.miSaveAs = new Common.UI.MenuItem({
el : $('#fm-btn-save-desktop',this.el),
el : $markup.elementById('#fm-btn-save-desktop'),
action : 'save-desktop',
caption : this.btnSaveAsCaption,
canFocused: false
});
this.miPrint = new Common.UI.MenuItem({
el : $('#fm-btn-print',this.el),
el : $markup.elementById('#fm-btn-print'),
action : 'print',
caption : this.btnPrintCaption,
canFocused: false
});
this.miRename = new Common.UI.MenuItem({
el : $('#fm-btn-rename',this.el),
el : $markup.elementById('#fm-btn-rename'),
action : 'rename',
caption : this.btnRenameCaption,
canFocused: false
});
if ( !!this.options.miRename ) {
this.miRename.setDisabled(this.options.miRename.isDisabled());
delete this.options.miRename;
}
this.miProtect = new Common.UI.MenuItem({
el : $('#fm-btn-protect',this.el),
el : $markup.elementById('#fm-btn-protect'),
action : 'protect',
caption : this.btnProtectCaption,
canFocused: false
});
if ( !!this.options.miProtect ) {
this.miProtect.setDisabled(this.options.miProtect.isDisabled());
delete this.options.miProtect;
}
this.miRecent = new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
el : $markup.elementById('#fm-btn-recent'),
action : 'recent',
caption : this.btnRecentFilesCaption,
canFocused: false
});
this.miNew = new Common.UI.MenuItem({
el : $('#fm-btn-create',this.el),
el : $markup.elementById('#fm-btn-create'),
action : 'new',
caption : this.btnCreateNewCaption,
canFocused: false
});
this.miAccess = new Common.UI.MenuItem({
el : $('#fm-btn-rights',this.el),
el : $markup.elementById('#fm-btn-rights'),
action : 'rights',
caption : this.btnRightsCaption,
canFocused: false
});
this.miHistory = new Common.UI.MenuItem({
el : $('#fm-btn-history',this.el),
el : $markup.elementById('#fm-btn-history'),
action : 'history',
caption : this.btnHistoryCaption,
canFocused: false
});
this.miHelp = new Common.UI.MenuItem({
el : $('#fm-btn-help',this.el),
el : $markup.elementById('#fm-btn-help'),
action : 'help',
caption : this.btnHelpCaption,
canFocused: false
@ -178,7 +193,7 @@ define([
this.items = [];
this.items.push(
new Common.UI.MenuItem({
el : $('#fm-btn-return',this.el),
el : $markup.elementById('#fm-btn-return'),
action : 'back',
caption : this.btnCloseMenuCaption,
canFocused: false
@ -194,7 +209,7 @@ define([
this.miRecent,
this.miNew,
new Common.UI.MenuItem({
el : $('#fm-btn-info',this.el),
el : $markup.elementById('#fm-btn-info'),
action : 'info',
caption : this.btnInfoCaption,
canFocused: false
@ -202,29 +217,31 @@ define([
this.miAccess,
this.miHistory,
new Common.UI.MenuItem({
el : $('#fm-btn-settings',this.el),
el : $markup.elementById('#fm-btn-settings'),
action : 'opts',
caption : this.btnSettingsCaption,
canFocused: false
}),
this.miHelp,
new Common.UI.MenuItem({
el : $('#fm-btn-back',this.el),
el : $markup.elementById('#fm-btn-back'),
// el : _get_el('fm-btn-back'),
action : 'exit',
caption : this.btnBackCaption,
canFocused: false
})
);
var me = this;
me.panels = {
// 'saveas' : (new DE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(),
'opts' : (new DE.Views.FileMenuPanels.Settings({menu:me})).render(),
'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(),
'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:me})).render()
};
this.rendered = true;
this.$el.html($markup);
this.$el.find('.content-box').hide();
this.applyMode();
me.$el.find('.content-box').hide();
if ( !!this.api ) {
this.panels['info'].setApi(this.api);
if ( this.panels['protect'] )
this.panels['protect'].setApi(this.api);
}
return this;
},
@ -232,6 +249,9 @@ define([
show: function(panel, opts) {
if (this.isVisible() && panel===undefined || !this.mode) return;
if ( !this.rendered )
this.render();
var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info';
if (!panel)
panel = this.active || defPanel;
@ -250,21 +270,30 @@ define([
},
applyMode: function() {
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
this.miNew[this.mode.canCreateNew?'show':'hide']();
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
if (!this.panels) {
this.panels = {
'opts' : (new DE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:this})).render(this.$el.find('#panel-info')),
'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:this})).render(this.$el.find('#panel-rights'))
};
}
if (!this.mode) return;
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide']();
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
this.miSave[this.mode.isEdit?'show':'hide']();
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
var isVisible = this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit || this.mode.canPrint || this.mode.canProtect ||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp;
this.miProtect.$el.find('+.devider')[isVisible && !this.mode.isDisconnected?'show':'hide']();
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
this.miNew[this.mode.canCreateNew?'show':'hide']();
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.miAccess[(!this.mode.isOffline && !this.mode.isReviewOnly && this.document&&this.document.info &&
(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
@ -285,32 +314,29 @@ define([
if ( this.mode.canCreateNew ) {
if (this.mode.templates && this.mode.templates.length) {
$('a',this.miNew.$el).text(this.btnCreateNewCaption + '...');
this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
!this.panels['new'] && (this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()));
}
}
if ( this.mode.canOpenRecent ) {
if (this.mode.recent){
this.panels['recent'] = (new DE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render();
}
if ( this.mode.canOpenRecent && this.mode.recent ) {
!this.panels['recent'] && (this.panels['recent'] = (new DE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render());
}
if (this.mode.canProtect) {
// this.$el.find('#fm-btn-back').hide();
this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
!this.panels['protect'] && (this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render());
this.panels['protect'].setMode(this.mode);
}
if (this.mode.canDownload) {
this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render());
!this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()));
} else if (this.mode.canDownloadOrigin)
$('a',this.miDownload.$el).text(this.textDownload);
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render());
!this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()));
}
if (this.mode.canHelp) {
if (this.mode.canHelp && !this.panels['help']) {
this.panels['help'] = ((new DE.Views.FileMenuPanels.Help({menu: this})).render());
this.panels['help'].setLangConfig(this.mode.lang);
}
@ -330,13 +356,22 @@ define([
this.mode = mode;
}
if (!delay) this.applyMode();
if (!delay) {
if ( this.rendered )
this.applyMode();
}
return this;
},
setApi: function(api) {
this.api = api;
if ( this.rendered ) {
this.panels['info'].setApi(api);
if (this.panels['protect']) this.panels['protect'].setApi(api);
}
return this;
},
loadDocument: function(data) {
@ -370,8 +405,11 @@ define([
},
SetDisabled: function(disable) {
this.miSave[(disable || !this.mode.isEdit)?'hide':'show']();
this.miRename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
var _btn_save = this.getButton('save'),
_btn_rename = this.getButton('rename');
_btn_save[(disable || !this.mode.isEdit)?'hide':'show']();
_btn_rename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
},
isVisible: function () {
@ -379,8 +417,27 @@ define([
},
getButton: function(type) {
if (type == 'save')
if ( !this.rendered ) {
if (type == 'save') {
return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({}));
} else
if (type == 'rename') {
return this.options.miRename ? this.options.miRename : (this.options.miRename = new Common.UI.MenuItem({}));
} else
if (type == 'protect') {
return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({}));
}
} else {
if (type == 'save') {
return this.miSave;
} else
if (type == 'rename') {
return this.miRename;
}else
if (type == 'protect') {
return this.miProtect;
}
}
},
btnSaveCaption : 'Save',

View file

@ -87,12 +87,12 @@ define([
},
render: function() {
$(this.el).html(this.template({rows:this.formats}));
this.$el.html(this.template({rows:this.formats}));
$('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
@ -148,12 +148,12 @@ define([
},
render: function() {
$(this.el).html(this.template({rows:this.formats}));
this.$el.html(this.template({rows:this.formats}));
$('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
@ -247,61 +247,62 @@ define([
this.menu = options.menu;
},
render: function() {
$(this.el).html(this.template({scope: this}));
render: function(node) {
var me = this;
var $markup = $(this.template({scope: this}));
this.chInputMode = new Common.UI.CheckBox({
el: $('#fms-chb-input-mode'),
el: $markup.findById('#fms-chb-input-mode'),
labelText: this.strInputMode
});
/** coauthoring begin **/
this.chLiveComment = new Common.UI.CheckBox({
el: $('#fms-chb-live-comment'),
el: $markup.findById('#fms-chb-live-comment'),
labelText: this.strLiveComment
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
this.chResolvedComment.setDisabled(field.getValue()!=='checked');
}, this));
}).on('change', function(field, newValue, oldValue, eOpts){
me.chResolvedComment.setDisabled(field.getValue()!=='checked');
});
this.chResolvedComment = new Common.UI.CheckBox({
el: $('#fms-chb-resolved-comment'),
el: $markup.findById('#fms-chb-resolved-comment'),
labelText: this.strResolvedComment
});
/** coauthoring end **/
this.chSpell = new Common.UI.CheckBox({
el: $('#fms-chb-spell-check'),
el: $markup.findById('#fms-chb-spell-check'),
labelText: this.strSpellCheckMode
});
this.chCompatible = new Common.UI.CheckBox({
el: $('#fms-chb-compatible'),
el: $markup.findById('#fms-chb-compatible'),
labelText: this.textOldVersions
});
this.chAutosave = new Common.UI.CheckBox({
el: $('#fms-chb-autosave'),
el: $markup.findById('#fms-chb-autosave'),
labelText: this.strAutosave
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) {
this.cmbCoAuthMode.setValue(0);
this.onSelectCoAuthMode(this.cmbCoAuthMode.getSelectedRecord());
}).on('change', function(field, newValue, oldValue, eOpts){
if (field.getValue()!=='checked' && me.cmbCoAuthMode.getValue()) {
me.cmbCoAuthMode.setValue(0);
me.onSelectCoAuthMode(me.cmbCoAuthMode.getSelectedRecord());
}
}, this));
this.lblAutosave = $('#fms-lbl-autosave');
});
this.lblAutosave = $markup.findById('#fms-lbl-autosave');
this.chForcesave = new Common.UI.CheckBox({
el: $('#fms-chb-forcesave'),
el: $markup.findById('#fms-chb-forcesave'),
labelText: this.strForcesave
});
this.chAlignGuides = new Common.UI.CheckBox({
el: $('#fms-chb-align-guides'),
el: $markup.findById('#fms-chb-align-guides'),
labelText: this.strAlignGuides
});
this.cmbZoom = new Common.UI.ComboBox({
el : $('#fms-cmb-zoom'),
el : $markup.findById('#fms-cmb-zoom'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
@ -325,7 +326,7 @@ define([
/** coauthoring begin **/
this.cmbShowChanges = new Common.UI.ComboBox({
el : $('#fms-cmb-show-changes'),
el : $markup.findById('#fms-cmb-show-changes'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
@ -337,7 +338,7 @@ define([
});
this.cmbCoAuthMode = new Common.UI.ComboBox({
el : $('#fms-cmb-coauth-mode'),
el : $markup.findById('#fms-cmb-coauth-mode'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
@ -345,17 +346,17 @@ define([
{ value: 1, displayValue: this.strFast, descValue: this.strCoAuthModeDescFast},
{ value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict }
]
}).on('selected', _.bind( function(combo, record) {
if (record.value == 1 && (this.chAutosave.getValue()!=='checked'))
this.chAutosave.setValue(1);
this.onSelectCoAuthMode(record);
}, this));
}).on('selected', function(combo, record) {
if (record.value == 1 && (me.chAutosave.getValue()!=='checked'))
me.chAutosave.setValue(1);
me.onSelectCoAuthMode(record);
});
this.lblCoAuthMode = $('#fms-lbl-coauth-mode');
this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode');
/** coauthoring end **/
this.cmbFontRender = new Common.UI.ComboBox({
el : $('#fms-cmb-font-render'),
el : $markup.find('#fms-cmb-font-render'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
@ -367,7 +368,7 @@ define([
});
this.cmbUnit = new Common.UI.ComboBox({
el : $('#fms-cmb-unit'),
el : $markup.findById('#fms-cmb-unit'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
@ -379,18 +380,19 @@ define([
});
this.btnApply = new Common.UI.Button({
el: '#fms-btn-apply'
el: $markup.findById('#fms-btn-apply')
});
this.btnApply.on('click', _.bind(this.applySettings, this));
this.btnApply.on('click', this.applySettings.bind(this));
this.$el = $(node).html($markup);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
return this;
},
@ -564,7 +566,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
this.$el.html(this.template());
this.viewRecentPicker = new Common.UI.DataView({
el: $('#id-recent-view'),
@ -582,7 +584,7 @@ define([
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
@ -644,14 +646,14 @@ define([
},
render: function() {
$(this.el).html(this.template({
this.$el.html(this.template({
scope: this,
docs: this.options[0].docs
}));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
@ -768,6 +770,11 @@ define([
'</table>',
'</div></td>',
'</tr>',
'<tr class="divider"></tr>',
'<tr>',
'<td class="left"></td>',
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
'</tr>',
'</table>'
].join(''));
@ -776,25 +783,25 @@ define([
this.menu = options.menu;
this.coreProps = null;
this.authors = [];
this._locked = false;
},
render: function() {
$(this.el).html(this.template());
render: function(node) {
var me = this;
var $markup = $(me.template({scope: me}));
// server info
this.lblPlacement = $('#id-info-placement');
this.lblOwner = $('#id-info-owner');
this.lblUploaded = $('#id-info-uploaded');
this.lblPlacement = $markup.findById('#id-info-placement');
this.lblOwner = $markup.findById('#id-info-owner');
this.lblUploaded = $markup.findById('#id-info-uploaded');
// statistic info
this.lblStatPages = $('#id-info-pages');
this.lblStatWords = $('#id-info-words');
this.lblStatParagraphs = $('#id-info-paragraphs');
this.lblStatSymbols = $('#id-info-symbols');
this.lblStatSpaces = $('#id-info-spaces');
// this.lblEditTime = $('#id-info-edittime');
this.lblStatPages = $markup.findById('#id-info-pages');
this.lblStatWords = $markup.findById('#id-info-words');
this.lblStatParagraphs = $markup.findById('#id-info-paragraphs');
this.lblStatSymbols = $markup.findById('#id-info-symbols');
this.lblStatSpaces = $markup.findById('#id-info-spaces');
// this.lblEditTime = $markup.find('#id-info-edittime');
// edited info
var keyDownBefore = function(input, e){
@ -809,101 +816,86 @@ define([
};
this.inputTitle = new Common.UI.InputField({
el : $('#id-info-title'),
el : $markup.findById('#id-info-title'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputSubject = new Common.UI.InputField({
el : $('#id-info-subject'),
el : $markup.findById('#id-info-subject'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputComment = new Common.UI.InputField({
el : $('#id-info-comment'),
el : $markup.findById('#id-info-comment'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
// modify info
this.lblModifyDate = $('#id-info-modify-date');
this.lblModifyBy = $('#id-info-modify-by');
this.lblModifyDate = $markup.findById('#id-info-modify-date');
this.lblModifyBy = $markup.findById('#id-info-modify-by');
// creation info
this.lblDate = $('#id-info-date');
this.lblApplication = $('#id-info-appname');
this.tblAuthor = $('#id-info-author table');
this.trAuthor = $('#id-info-add-author').closest('tr');
this.lblDate = $markup.findById('#id-info-date');
this.lblApplication = $markup.findById('#id-info-appname');
this.tblAuthor = $markup.findById('#id-info-author table');
this.trAuthor = $markup.findById('#id-info-add-author').closest('tr');
this.authorTpl = '<tr><td><div style="display: inline-block;width: 200px;"><input type="text" spellcheck="false" class="form-control" readonly="true" value="{0}" ></div><div class="close img-commonctrl"></div></td></tr>';
this.tblAuthor.on('click', function(e) {
var btn = $(e.target);
var btn = $markup.find(e.target);
if (btn.hasClass('close') && !btn.hasClass('disabled')) {
var el = btn.closest('tr'),
idx = me.tblAuthor.find('tr').index(el);
el.remove();
me.authors.splice(idx, 1);
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
}
});
this.inputAuthor = new Common.UI.InputField({
el : $('#id-info-add-author'),
el : $markup.findById('#id-info-add-author'),
style : 'width: 200px;',
validateOnBlur: false,
placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) {
}).on('changed:after', function(input, newValue, oldValue, e) {
if (newValue == oldValue) return;
var val = newValue.trim();
if (!!val && val !== oldValue.trim()) {
var isFromApply = e && e.relatedTarget && (e.relatedTarget.id == 'fminfo-btn-apply');
val.split(/\s*[,;]\s*/).forEach(function(item){
var str = item.trim();
if (str) {
me.authors.push(item);
if (!isFromApply) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
me.authors.push(item);
}
}
});
me.inputAuthor.setValue('');
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
!isFromApply && me.inputAuthor.setValue('');
}
}).on('keydown:before', keyDownBefore);
this.btnApply = new Common.UI.Button({
el: $markup.findById('#fminfo-btn-apply')
});
this.btnApply.on('click', _.bind(this.applySettings, this));
this.rendered = true;
this.updateInfo(this.doc);
this.$el = $(node).html($markup);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
return this;
},
@ -1001,6 +993,7 @@ define([
value = props.asc_getDescription();
this.inputComment.setValue(value || '');
this.inputAuthor.setValue('');
this.tblAuthor.find('tr:not(:last-of-type)').remove();
this.authors = [];
value = props.asc_getCreator();//"123\"\"\"\<\>,456";
@ -1009,7 +1002,9 @@ define([
me.trAuthor.before(div);
me.authors.push(item);
});
this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit);
}
this.SetDisabled();
},
_ShowHideInfoItem: function(el, visible) {
@ -1048,6 +1043,11 @@ define([
},
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.btnApply.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
},
@ -1095,12 +1095,30 @@ define([
},
onLockCore: function(lock) {
this.inputTitle.setDisabled(lock);
this.inputSubject.setDisabled(lock);
this.inputComment.setDisabled(lock);
this.inputAuthor.setDisabled(lock);
this.tblAuthor.find('.close').toggleClass('disabled', lock);
!lock && this.updateFileInfo();
this._locked = lock;
this.updateFileInfo();
},
SetDisabled: function() {
var disable = !this.mode.isEdit || this._locked;
this.inputTitle.setDisabled(disable);
this.inputSubject.setDisabled(disable);
this.inputComment.setDisabled(disable);
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
this.btnApply.setDisabled(this._locked);
},
applySettings: function() {
if (this.coreProps && this.api) {
this.coreProps.asc_putTitle(this.inputTitle.getValue());
this.coreProps.asc_putSubject(this.inputSubject.getValue());
this.coreProps.asc_putDescription(this.inputComment.getValue());
this.coreProps.asc_putCreator(this.authors.join(';'));
this.api.asc_setCoreProps(this.coreProps);
}
this.menu.hide();
},
txtPlacement: 'Location',
@ -1123,7 +1141,8 @@ define([
txtAuthor: 'Author',
txtAddAuthor: 'Add Author',
txtAddText: 'Add Text',
txtMinutes: 'min'
txtMinutes: 'min',
okButtonText: 'Apply'
}, DE.Views.FileMenuPanels.DocumentInfo || {}));
DE.Views.FileMenuPanels.DocumentRights = Common.UI.BaseView.extend(_.extend({
@ -1160,12 +1179,12 @@ define([
this.menu = options.menu;
},
render: function() {
$(this.el).html(this.template());
render: function(node) {
var $markup = $(this.template());
this.cntRights = $('#id-info-rights');
this.cntRights = $markup.findById('#id-info-rights');
this.btnEditRights = new Common.UI.Button({
el: '#id-info-btn-edit'
el: $markup.elementById('#id-info-btn-edit')
});
this.btnEditRights.on('click', _.bind(this.changeAccessRights, this));
@ -1173,16 +1192,17 @@ define([
this.updateInfo(this.doc);
Common.NotificationCenter.on('collaboration:sharingupdate', this.updateSharingSettings.bind(this));
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
this.$el = $(node).html($markup);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}
Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this));
Common.NotificationCenter.on('collaboration:sharingdeny', _.bind(this.onLostEditRights, this));
return this;
},
@ -1225,36 +1245,16 @@ define([
setMode: function(mode) {
this.sharingSettingsUrl = mode.sharingSettingsUrl;
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
!!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
return this;
},
changeAccessRights: function(btn,event,opts) {
if (this._docAccessDlg || this._readonlyRights) return;
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.updateSharingSettings(rights);
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
me._docAccessDlg.show();
},
setSharingSettings: function(data) {
data && this.updateSharingSettings(data.sharingSettings);
Common.NotificationCenter.trigger('collaboration:sharing');
},
updateSharingSettings: function(rights) {
this.doc.info.sharingSettings = rights;
this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0);
this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings}));
Common.NotificationCenter.trigger('mentions:clearusers', this);
},
onLostEditRights: function() {
@ -1346,7 +1346,7 @@ define([
render: function() {
var me = this;
$(this.el).html(this.template());
this.$el.html(this.template());
this.viewHelpPicker = new Common.UI.DataView({
el: $('#id-help-contents'),
@ -1486,7 +1486,7 @@ define([
},
render: function() {
$(this.el).html(this.template({scope: this}));
this.$el.html(this.template({scope: this}));
var protection = DE.getController('Common.Controllers.Protection').getView();
@ -1513,7 +1513,7 @@ define([
this.cntSignatureView = $('#id-fms-signature-view');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
el: this.$el,
suppressScrollX: true
});
}

View file

@ -84,7 +84,7 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
scope: this
}));

View file

@ -57,7 +57,9 @@ define([
options: {
width: 350,
style: 'min-width: 230px;',
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel'],
footerCls: 'right'
},
initialize : function(options) {
@ -88,10 +90,6 @@ define([
'<label>' + this.textTooltip + '</label>',
'</div>',
'<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -399,8 +397,6 @@ define([
textUrl: 'Link to',
textDisplay: 'Display',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtEmpty: 'This field is required',
txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"',
textTooltip: 'ScreenTip text',

View file

@ -82,16 +82,16 @@ define([
this._originalProps = null;
this.render();
this.labelWidth = $(this.el).find('#image-label-width');
this.labelHeight = $(this.el).find('#image-label-height');
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
scope: this
}));
this.labelWidth = el.find('#image-label-width');
this.labelHeight = el.find('#image-label-height');
},
setApi: function(api) {

View file

@ -2029,8 +2029,6 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
textWrapInFrontTooltip: 'In Front',
textTitle: 'Image - Advanced Settings',
textKeepRatio: 'Constant Proportions',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
textBtnWrap: 'Text Wrapping',
textCenter: 'Center',
textCharacter: 'Character',

Some files were not shown because too many files have changed in this diff Show more