diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js index 80dcf6bdd8..7096e2f953 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js @@ -86,27 +86,29 @@ define([ iscelllocked = cellinfo.asc_getLocked(), isTableLocked = cellinfo.asc_getLockedTable()===true; - switch ( seltype ) { - case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; - case Asc.c_oAscSelectionType.RangeRow: isrowmenu = true; break; - case Asc.c_oAscSelectionType.RangeCol: iscolmenu = true; break; - case Asc.c_oAscSelectionType.RangeMax: isallmenu = true; break; - case Asc.c_oAscSelectionType.RangeImage: isimagemenu = true; break; - case Asc.c_oAscSelectionType.RangeShape: isshapemenu = true; break; - case Asc.c_oAscSelectionType.RangeChart: ischartmenu = true; break; - case Asc.c_oAscSelectionType.RangeChartText: istextchartmenu = true; break; - case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = true; break; + if ( !iscelllocked ) { + options = opts; + + if ( !options ) { + switch (seltype) { + case Asc.c_oAscSelectionType.RangeCells: + case Asc.c_oAscSelectionType.RangeRow: + case Asc.c_oAscSelectionType.RangeCol: + case Asc.c_oAscSelectionType.RangeMax: break; + case Asc.c_oAscSelectionType.RangeImage: + case Asc.c_oAscSelectionType.RangeShape: + case Asc.c_oAscSelectionType.RangeChart: + case Asc.c_oAscSelectionType.RangeChartText: + case Asc.c_oAscSelectionType.RangeShapeText: + options = {panels: ['image','shape']}; + break; + } + } + + parentButton = !opts || !opts.button ? '#toolbar-add' : opts.button; + me._showByStack(Common.SharedSettings.get('phone')); } - if ( iscellmenu ) {} - else { - - } - - options = opts; - parentButton = !opts || !opts.button ? '#toolbar-add' : opts.button; - me._showByStack(Common.SharedSettings.get('phone')); - this.api.asc_closeCellEditor(); SSE.getController('Toolbar').getView('Toolbar').hideSearch(); }, @@ -139,7 +141,7 @@ define([ }); } - if ( !options ) + if ( !options || !(_.indexOf(options.panels, 'shape') < 0) ) addViews.push({ caption: me.textShape, id: 'add-shape', @@ -162,6 +164,14 @@ define([ }); } + if ( options && !(_.indexOf(options.panels, 'image')) ) { + addViews.push({ + caption: 'Image', + id: 'add-image', + layout: SSE.getController('AddOther').getView('AddOther').childLayout('image') + }); + } + return addViews; }, diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js index 45c5cbc6c1..218916dd21 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js @@ -78,7 +78,10 @@ define([ this.createView('AddOther').render(); }, - initEvents: function () { + initEvents: function (args) { + if ( args && !(_.indexOf(args.panels, 'image') < 0) ) { + this.onPageShow(this.getView('AddOther'), '#addother-insimage'); + } }, onPageShow: function (view, pageId) { @@ -87,6 +90,15 @@ define([ if (pageId == '#addother-sort') { var filterInfo = me.api.asc_getCellInfo().asc_getAutoFilterInfo(); view.optionAutofilter( filterInfo ? filterInfo.asc_getIsAutoFilter() : null) + } else + if (pageId == '#addother-insimage') { + $('#addimage-url').single('click', function(e) { + view.showImageFromUrl(); + }); + + $('#addimage-file').single('click', function () { + me.onInsertImage({islocal:true}); + }); } }, diff --git a/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js index f06a4269ce..75db4972e2 100644 --- a/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/view/add/AddOther.js @@ -132,6 +132,15 @@ define([ return ''; }, + childLayout: function (name) { + if (this.layout) { + if ( name == 'image' ) + return this.layout.find('#addother-insimage .page-content').html(); + } + + return ''; + }, + initControls: function () { // },