[PE mobile] Disable editing in opensource version

This commit is contained in:
Julia Radzhabova 2020-02-10 12:35:59 +03:00
parent 19e4859e10
commit dc46e1b97f
9 changed files with 33 additions and 221 deletions

View file

@ -1115,7 +1115,6 @@ define([
},
onSendThemeColors: function(colors, standart_colors) {
Common.Utils.ThemeColor.setColors(colors, standart_colors);
},
onFocusObject: function(SelectedObjects) {

View file

@ -95,10 +95,6 @@ define([
onInsertByFile: function (e) {
PE.getController('AddContainer').hideModal();
if (this.api) {
this.api.asc_addImage();
}
},
onUrlChange: function (e) {
@ -115,9 +111,6 @@ define([
if (!_.isEmpty(value)) {
if ((/((^https?)|(^ftp)):\/\/.+/i.test(value))) {
PE.getController('AddContainer').hideModal();
_.defer(function () {
me.api.AddImageUrl(value);
});
} else {
uiApp.alert(me.txtNotUrl);
}

View file

@ -57,9 +57,6 @@ define([
First: 3,
Num: 4
},
_linkType = c_oHyperlinkType.WebLink,
_slideLink = 0,
_slideNum = 0,
_slidesCount = 0;
return {
@ -83,6 +80,10 @@ define([
uiApp.onPageBack('addlink-type addlink-slidenumber', function (page) {
me.initSettings();
});
this._linkType = c_oHyperlinkType.WebLink;
this._slideLink = 0;
this._slideNum = 0;
},
setApi: function (api) {
@ -103,8 +104,8 @@ define([
var $target = $(e.currentTarget);
if ($target && $target.prop('id') === 'add-link') {
_linkType = c_oHyperlinkType.WebLink;
_slideLink = _slideNum = 0;
this._linkType = c_oHyperlinkType.WebLink;
this._slideLink = this._slideNum = 0;
var text = this.api.can_AddHyperlink();
if (text !== false) {
$('#add-link-display input').val((text !== null) ? text : this.textDefault);
@ -119,17 +120,17 @@ define([
var me = this;
if (pageId == '#addlink-type') {
$('#page-addlink-type input').val([_linkType]);
$('#page-addlink-type input').val([this._linkType]);
} else if (pageId == '#addlink-slidenumber') {
_slidesCount = me.api.getCountPages();
$('#page-addlink-slidenumber input').val([_slideLink]);
$('#addlink-slide-number .item-after label').text(_slideNum+1);
$('#page-addlink-slidenumber input').val([this._slideLink]);
$('#addlink-slide-number .item-after label').text(this._slideNum+1);
} else {
$('#add-link-type .item-after').text((_linkType==c_oHyperlinkType.WebLink) ? me.textExternalLink : me.textInternalLink);
$('#add-link-url')[(_linkType==c_oHyperlinkType.WebLink) ? 'show' : 'hide']();
$('#add-link-number')[(_linkType==c_oHyperlinkType.WebLink) ? 'hide' : 'show']();
$('#add-link-type .item-after').text((this._linkType==c_oHyperlinkType.WebLink) ? me.textExternalLink : me.textInternalLink);
$('#add-link-url')[(this._linkType==c_oHyperlinkType.WebLink) ? 'show' : 'hide']();
$('#add-link-number')[(this._linkType==c_oHyperlinkType.WebLink) ? 'hide' : 'show']();
if (_linkType==c_oHyperlinkType.WebLink) {
if (this._linkType==c_oHyperlinkType.WebLink) {
$('#add-link-url input[type=url]').single('input', _.bind(function(e) {
$('#add-link-insert').toggleClass('disabled', _.isEmpty($('#add-link-url input').val()));
}, this));
@ -138,7 +139,7 @@ define([
}, 1000);
} else {
var slidename = '';
switch (_slideLink) {
switch (this._slideLink) {
case 0:
slidename = me.textNext;
break;
@ -152,13 +153,13 @@ define([
slidename = me.textLast;
break;
case 4:
slidename = me.textSlide + ' ' + (_slideNum+1);
slidename = me.textSlide + ' ' + (this._slideNum+1);
break;
}
$('#add-link-number .item-after').text(slidename);
}
$('#add-link-insert').toggleClass('disabled', (_linkType==c_oHyperlinkType.WebLink) && _.isEmpty($('#add-link-url input').val()));
$('#add-link-insert').toggleClass('disabled', (this._linkType==c_oHyperlinkType.WebLink) && _.isEmpty($('#add-link-url input').val()));
}
},
@ -174,66 +175,6 @@ define([
// Handlers
onInsertLink: function (e) {
var me = this,
display = $('#add-link-display input').val(),
tip = $('#add-link-tip input').val(),
props = new Asc.CHyperlinkProperty(),
def_display = '';
if (_linkType==c_oHyperlinkType.WebLink) {
var url = $('#add-link-url input').val(),
urltype = me.api.asc_getUrlType($.trim(url)),
isEmail = (urltype == 2);
if (urltype < 1) {
uiApp.alert(me.txtNotUrl);
return;
}
url = url.replace(/^\s+|\s+$/g,'');
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) )
url = (isEmail ? 'mailto:' : 'http://' ) + url;
url = url.replace(new RegExp("%20",'g')," ");
props.put_Value( url );
props.put_ToolTip(tip);
def_display = url;
} else {
var url = "ppaction://hlink";
var slidetip = '';
switch (_slideLink) {
case 0:
url = url + "showjump?jump=nextslide";
slidetip = this.textNext;
break;
case 1:
url = url + "showjump?jump=previousslide";
slidetip = this.textPrev;
break;
case 2:
url = url + "showjump?jump=firstslide";
slidetip = this.textFirst;
break;
case 3:
url = url + "showjump?jump=lastslide";
slidetip = this.textLast;
break;
case 4:
url = url + "sldjumpslide" + _slideNum;
slidetip = this.textSlide + ' ' + (_slideNum+1);
break;
}
props.put_Value( url );
props.put_ToolTip(_.isEmpty(tip) ? slidetip : tip);
def_display = slidetip;
}
if (!$('#add-link-display').hasClass('disabled')) {
props.put_Text(_.isEmpty(display) ? def_display : display);
} else
props.put_Text(null);
me.api.add_Hyperlink(props);
PE.getController('AddContainer').hideModal();
},
@ -241,7 +182,7 @@ define([
var $target = $(e.currentTarget).find('input');
if ($target && this.api) {
_linkType = parseFloat($target.prop('value'));
this._linkType = parseFloat($target.prop('value'));
}
},
@ -249,20 +190,20 @@ define([
var $target = $(e.currentTarget).find('input');
if ($target && this.api) {
_slideLink = parseFloat($target.prop('value'));
this._slideLink = parseFloat($target.prop('value'));
}
},
onSlideNumber: function (e) {
var $button = $(e.currentTarget),
slide = _slideNum;
slide = this._slideNum;
if ($button.hasClass('decrement')) {
slide = Math.max(0, --slide);
} else {
slide = Math.min(_slidesCount-1, ++slide);
}
_slideNum = slide;
this._slideNum = slide;
$('#addlink-slide-number .item-after label').text(slide+1);
},

View file

@ -212,13 +212,6 @@ define([
},
onShapeClick: function (e) {
var me = this,
$target = $(e.currentTarget);
if ($target && me.api) {
me.api.AddShapeOnCurrentPage($target.data('type'));
}
PE.getController('AddContainer').hideModal();
},

View file

@ -48,8 +48,6 @@ define([
'use strict';
PE.Controllers.AddSlide = Backbone.Controller.extend(_.extend((function() {
var _layouts = [];
return {
models: [],
collections: [],
@ -59,12 +57,12 @@ define([
initialize: function () {
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
this._layouts = [];
},
setApi: function (api) {
var me = this;
me.api = api;
me.api.asc_registerCallback('asc_onUpdateLayout', _.bind(me.onUpdateLayout, me));
},
onLaunch: function () {
@ -73,49 +71,18 @@ define([
initEvents: function () {
var me = this;
me.getView('AddSlide').updateLayouts(_layouts);
me.getView('AddSlide').updateLayouts(this._layouts);
$('#add-slide .slide-layout li').single('click', _.buffered(me.onLayoutClick, 100, me));
},
onLayoutClick: function (e) {
var me = this,
$target = $(e.currentTarget),
type = $target.data('type');
me.api.AddSlide(type);
PE.getController('AddContainer').hideModal();
},
// Public
getLayouts: function () {
return _layouts;
},
// API handlers
onUpdateLayout: function(layouts){
var me = this;
_layouts = [];
if (!_.isEmpty(layouts)){
_.each(layouts, function(layout){
var name = layout.get_Name();
_layouts.push({
imageUrl : layout.get_Image(),
title : (name !== '') ? name : PE.getController('Main').layoutNames[layout.getType()],
itemWidth : layout.get_Width(),
itemHeight : layout.get_Height(),
idx : layout.getIndex()
});
});
}
Common.SharedSettings.set('slidelayouts', _layouts);
Common.NotificationCenter.trigger('slidelayouts:load', _layouts);
this.getView('AddSlide').updateLayouts(_layouts);
$('#add-slide .slide-layout li').single('click', _.buffered(me.onLayoutClick, 100, me));
return this._layouts;
}
}
})(), PE.Controllers.AddSlide || {}))

View file

@ -48,8 +48,7 @@ define([
'use strict';
PE.Controllers.AddTable = Backbone.Controller.extend(_.extend((function() {
var _styles = [],
_initDefaultStyles = false;
var _initDefaultStyles = false;
return {
models: [],
@ -60,13 +59,12 @@ define([
initialize: function () {
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
this._styles = [];
},
setApi: function (api) {
var me = this;
me.api = api;
me.api.asc_registerCallback('asc_onInitTableTemplates', _.bind(me.onApiInitTemplates, me));
},
onLaunch: function () {
@ -78,7 +76,7 @@ define([
if (!_initDefaultStyles) {
_initDefaultStyles = true;
_styles = [];
me._styles = [];
me.api.asc_GetDefaultTableStyles && me.api.asc_GetDefaultTableStyles();
}
@ -159,27 +157,11 @@ define([
// Public
getStyles: function () {
return _styles;
return this._styles;
},
// API handlers
onApiInitTemplates: function(templates){
if (_styles.length < 1) {
_.each(templates, function(template){
_styles.push({
imageUrl : template.asc_getImage(),
templateId : template.asc_getId()
});
});
this.getView('AddTable').render();
}
Common.SharedSettings.set('tablestyles', _styles);
Common.NotificationCenter.trigger('tablestyles:load', _styles);
},
textTableSize: 'Table Size',
textColumns: 'Columns',
textRows: 'Rows',

View file

@ -52,7 +52,6 @@ define([
PE.Controllers.EditChart = Backbone.Controller.extend(_.extend((function() {
// Private
var _stack = [],
_chartObject = undefined,
_shapeObject = undefined,
_metricText = Common.Utils.Metric.getCurrentMetricName(),
_borderColor = 'transparent';
@ -99,6 +98,7 @@ define([
'page:show': this.onPageShow
}
});
this._chartObject = undefined;
},
setApi: function (api) {
@ -106,7 +106,6 @@ define([
me.api = api;
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onApiFocusObject, me));
me.api.asc_registerCallback('asc_onUpdateChartStyles', _.bind(me.onApiUpdateChartStyles, me));
},
onLaunch: function () {
@ -139,9 +138,9 @@ define([
initSettings: function (pageId) {
var me = this;
if (_chartObject) {
if (me._chartObject) {
if (pageId == '#edit-chart-style') {
me._updateChartStyles(me.api.asc_getChartPreviews(_chartObject.getType()));
me._updateChartStyles(me.api.asc_getChartPreviews(me._chartObject.getType()));
me._initStyleView();
} else if (pageId == '#edit-chart-border-color-view') {
me._initStyleView();
@ -151,7 +150,7 @@ define([
_initStyleView: function (updateStyles) {
var me = this,
chartProperties = _chartObject,
chartProperties = me._chartObject,
shapeProperties = _shapeObject,
paletteFillColor = me.getView('EditChart').paletteFillColor,
paletteBorderColor = me.getView('EditChart').paletteBorderColor;
@ -228,25 +227,12 @@ define([
// Public
getChart: function () {
return _chartObject;
return this._chartObject;
},
// Handlers
onType: function (e) {
var me = this,
$target = $(e.currentTarget),
type = $target.data('type');
var chart = new Asc.CAscChartProp();
chart.changeType(type);
me.api.ChartApply(chart);
$('.chart-types li').removeClass('active');
$target.addClass('active');
// Force update styles
me._updateChartStyles(me.api.asc_getChartPreviews(chart.getType()));
},
onStyle: function (e) {
@ -405,23 +391,13 @@ define([
}
};
_chartObject = getTopObject(charts);
this._chartObject = getTopObject(charts);
_shapeObject = getTopObject(shapes);
},
onApiUpdateChartStyles: function () {
if (this.api && _chartObject) {
this._updateChartStyles(this.api.asc_getChartPreviews(_chartObject.getType()));
}
},
// Helpers
_updateChartStyles: function(styles) {
Common.SharedSettings.set('chartstyles', styles);
Common.NotificationCenter.trigger('chartstyles:load', styles);
$('#tab-chart-style li').single('click', _.bind(this.onStyle, this));
},
_closeIfNeed: function () {

View file

@ -234,18 +234,6 @@ define([
},
onReorder: function (e) {
var $target = $(e.currentTarget),
type = $target.data('type');
if ('all-up' == type) {
this.api.shapes_bringToFront();
} else if ('all-down' == type) {
this.api.shapes_bringToBack();
} else if ('move-up' == type) {
this.api.shapes_bringForward();
} else if ('move-down' == type) {
this.api.shapes_bringBackward();
}
},
onAlign: function (e) {
@ -272,10 +260,6 @@ define([
},
onReplace: function (e) {
var $target = $(e.currentTarget),
type = $target.data('type');
this.api.ChangeShapeType(type);
},
onBorderSize: function (e) {

View file

@ -112,9 +112,6 @@ define([
setApi: function (api) {
var me = this;
me.api = api;
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onApiFocusObject, me));
me.api.asc_registerCallback('asc_onInitTableTemplates', _.bind(me.onApiInitTemplates, me));
},
onLaunch: function () {
@ -124,13 +121,6 @@ define([
initEvents: function () {
var me = this;
$('#table-remove-all').single('click', _.bind(function(){me.api.remTable(); me._closeIfNeed()}, me));
$('#insert-column-left').single('click', _.bind(function(){me.api.addColumnLeft(); me._closeIfNeed()}, me));
$('#insert-column-right').single('click', _.bind(function(){me.api.addColumnRight(); me._closeIfNeed()}, me));
$('#insert-row-above').single('click', _.bind(function(){me.api.addRowAbove(); me._closeIfNeed()}, me));
$('#insert-row-below').single('click', _.bind(function(){me.api.addRowBelow(); me._closeIfNeed()}, me));
$('#remove-column').single('click', _.bind(function(){me.api.remColumn(); me._closeIfNeed()}, me));
$('#remove-row').single('click', _.bind(function(){me.api.remRow(); me._closeIfNeed()}, me));
$('#table-options-margins input').single('change touchend', _.buffered(me.onOptionMargin, 100, me));
$('#table-options-margins input').single('input', _.bind(me.onOptionMarginChanging, me));
@ -548,19 +538,6 @@ define([
});
return tableExist;
},
onApiInitTemplates: function(templates) {
var styles = [];
_.each(templates, function(template){
styles.push({
imageUrl : template.asc_getImage(),
templateId : template.asc_getId()
});
});
this.getView('EditTable').updateStyles(styles);
}
}
})(), PE.Controllers.EditTable || {}))