Commit a518abfc authored by Julia Radzhabova's avatar Julia Radzhabova

Fixed bug with initial size and resizing for plugins window.

parent c1ac28bf
......@@ -135,6 +135,9 @@ define([
variation.set_InitData(itemVar.get('initData'));
variation.set_UpdateOleOnResize(itemVar.get('isUpdateOleOnResize'));
variation.set_Buttons(itemVar.get('buttons'));
variation.set_Size(itemVar.get('size'));
variation.set_MaximumSize(itemVar.get('maximumSize'));
variation.set_MinimumSize(itemVar.get('minimumSize'));
variationsArr.push(variation);
});
plugin.set_Variations(variationsArr);
......@@ -223,7 +226,9 @@ define([
} else {
var me = this,
arrBtns = variation.get_Buttons(),
newBtns = {};
newBtns = {},
size = variation.get_Size();
if (!size || size.length<2) size = [400, 400];
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
......@@ -234,6 +239,8 @@ define([
var _baseUrl = (plugin.get_BaseUrl().length == 0) ? me.panelPlugins.pluginsPath : plugin.get_BaseUrl();
me.pluginDlg = new Common.Views.PluginDlg({
title: plugin.get_Name(),
width: size[0], // inner width
height: size[1], // inner height
url: _baseUrl + variation.get_Url(),
buttons: newBtns,
toolcallback: _.bind(this.onToolClose, this)
......
......@@ -63,7 +63,10 @@ define([
initDataType: 0,
initData: "",
isUpdateOleOnResize: false,
buttons: []
buttons: [],
size: [400, 400],
maximumSize: [],
minimumSize: []
}
}
});
......
......@@ -187,13 +187,15 @@ define([
initialize : function(options) {
var _options = {};
_.extend(_options, {
width: 800,
height: (window.innerHeight-600)<0 ? window.innerHeight: 600,
cls: 'advanced-settings-dlg',
header: true
}, options);
var header_footer = (_options.buttons && _.size(_options.buttons)>0) ? 85 : 34;
_options.width = (window.innerWidth-_options.width)<0 ? window.innerWidth: _options.width,
_options.height += header_footer;
_options.height = (window.innerHeight-_options.height)<0 ? window.innerHeight: _options.height;
this.template = [
'<div id="id-plugin-container" class="box" style="height:' + (_options.height-header_footer) + 'px;">',
'<div id="id-plugin-placeholder" style="width: 100%;height: 100%;"></div>',
......@@ -227,59 +229,47 @@ define([
iframe.frameBorder = 0;
iframe.scrolling = "no";
iframe.onload = _.bind(this._onLoad,this);
$('#id-plugin-placeholder').append(iframe);
this.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')});
this.loadMask.setTitle(this.textLoading);
this.loadMask.show();
iframe.src = this.url;
var me = this;
setTimeout(function(){
if (me.isLoaded) return;
me.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')});
me.loadMask.setTitle(this.textLoading);
me.loadMask.show();
if (me.isLoaded) me.loadMask.hide();
}, 500);
this.on('close', function(obj){
});
this.on('show', function(obj){
var h = me.getHeight();
if (window.innerHeight>h && h<600 || window.innerHeight<h) {
h = Math.min(window.innerHeight, 600);
me.setHeight(h);
}
});
iframe.src = this.url;
$('#id-plugin-placeholder').append(iframe);
},
_onLoad: function() {
this.isLoaded = true;
if (this.loadMask)
this.loadMask.hide();
},
setHeight: function(height) {
if (height >= 0) {
var min = parseInt(this.$window.css('min-height'));
height < min && (height = min);
this.$window.height(height);
var header_height = (this.initConfig.header) ? parseInt(this.$window.find('> .header').css('height')) : 0;
this.$window.find('> .body').css('height', height-header_height);
this.$window.find('> .body > .box').css('height', height-85);
var top = ((parseInt(window.innerHeight) - parseInt(height)) / 2) * 0.9;
var left = (parseInt(window.innerWidth) - parseInt(this.initConfig.width)) / 2;
this.$window.css('left',left);
this.$window.css('top',top);
}
},
setInnerSize: function(width, height) {
var maxHeight = parseInt(window.innerHeight),
maxWidth = parseInt(window.innerWidth),
header_footer = (this.options.buttons && _.size(this.options.buttons)>0) ? 85 : 34;
if (maxHeight<height + header_footer)
height = maxHeight - header_footer;
if (maxWidth<width)
width = maxWidth;
var $window = this.getChild();
var boxEl = $window.find('.body > .box');
boxEl.css('height', height);
Common.UI.Window.prototype.setHeight.call(this, height + 85);
Common.UI.Window.prototype.setHeight.call(this, height + header_footer);
Common.UI.Window.prototype.setWidth.call(this, width);
var top = ((maxHeight - height - header_footer) / 2) * 0.9;
var left = (maxWidth - width) / 2;
this.$window.css('left',(maxWidth - width) / 2);
this.$window.css('top',((maxHeight - height - header_footer) / 2) * 0.9);
},
textLoading : 'Loading'
......
......@@ -1726,7 +1726,10 @@ define([
initDataType: itemVar.initDataType,
initData: itemVar.initData,
isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons
buttons: itemVar.buttons,
size: itemVar.size,
minimumSize: itemVar.minimumSize,
maximumSize: itemVar.maximumSize
}));
});
if (variationsArr.length>0)
......
......@@ -1512,7 +1512,10 @@ define([
initDataType: itemVar.initDataType,
initData: itemVar.initData,
isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons
buttons: itemVar.buttons,
size: itemVar.size,
minimumSize: itemVar.minimumSize,
maximumSize: itemVar.maximumSize
}));
});
if (variationsArr.length>0)
......
......@@ -1721,7 +1721,10 @@ define([
initDataType: itemVar.initDataType,
initData: itemVar.initData,
isUpdateOleOnResize : itemVar.isUpdateOleOnResize,
buttons: itemVar.buttons
buttons: itemVar.buttons,
size: itemVar.size,
minimumSize: itemVar.minimumSize,
maximumSize: itemVar.maximumSize
}));
});
if (variationsArr.length>0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment