diff --git a/addons/base/static/src/css/base.css b/addons/base/static/src/css/base.css index 234bf2a37d9..dbce531edce 100644 --- a/addons/base/static/src/css/base.css +++ b/addons/base/static/src/css/base.css @@ -793,7 +793,8 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%, .openerp .separator.horizontal { font-weight: bold; border-bottom-width: 1px; - margin: 6px 4px 6px 1px; + margin: 3px 4px 3px 1px; + height: 15px; } .openerp td.required input, .openerp td.required select { background-color: #D2D2FF; diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index 9ce0efa8d9f..42a314f4316 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -737,6 +737,66 @@ openerp.base.BaseWidget = openerp.base.Controller.extend({ } }); +openerp.base.Dialog = openerp.base.BaseWidget.extend({ + dialog_title: "", + identifier_prefix: 'dialog', + init: function (session, options) { + this._super(null, session); + options = _.extend({ + modal: true, + title: this.dialog_title, + width: '700px', + min_width: 0, + max_width: '100%', + height: '500px', + min_height: 0, + max_height: '100%', + buttons: {} + }, options); + + options.width = this.get_width(options.width); + options.min_width = this.get_width(options.min_width); + options.max_width = this.get_width(options.max_width); + options.height = this.get_height(options.height); + options.min_height = this.get_height(options.min_height); + options.max_height = this.get_height(options.max_height); + + if (options.width > options.max_width) options.width = options.max_width; + if (options.width < options.min_width) options.width = options.min_width; + if (options.height > options.max_height) options.height = options.max_height; + if (options.height < options.min_height) options.height = options.min_height; + + for (var f in this) { + if (f.substr(0, 10) == 'on_button_') { + options.buttons[f.substr(10)] = this[f]; + } + } + this.options = options; + }, + get_width: function(val) { + return this.get_size(val.toString(), $(window.top).width()); + }, + get_height: function(val) { + return this.get_size(val.toString(), $(window.top).height()); + }, + get_size: function(val, available_size) { + if (val == 'auto') { + return val; + } else if (val.slice(-1) == "%") { + return Math.round(available_size / 100 * parseInt(val.slice(0, -1), 10)); + } else { + return parseInt(val, 10); + } + }, + start: function () { + this.$dialog = $('
').dialog(this.options); + this._super(); + }, + stop: function () { + this.$dialog("destroy").remove(); + } +}); + openerp.base.CrashManager = openerp.base.Controller.extend({ init: function(session, element_id) { this._super(session, element_id);