diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-12-19 10:01:28 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-12-19 10:01:28 +0100 |
| commit | fe843951277f772988571dcfec7825b76e3bcf5d (patch) | |
| tree | 36e90ad911474f4a933abb170c0e3d40d2c70a45 /addons/web/static/src | |
| parent | c3e74781ca3976d2ec919cd2a4085ca97e2fba17 (diff) | |
| parent | 56248183fc87b8eba9af50acddc81087a84bc34b (diff) | |
[MERGE] trunk
bzr revid: fme@openerp.com-20121219090128-m5z0l5rlee8mu6hj
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 39 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 27 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 70 | ||||
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 6 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 16 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 9 |
6 files changed, 147 insertions, 20 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 2665ee263a9..7e8242a8d5c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -819,6 +819,16 @@ margin-top: 1px; background-color: #f6cf3b; } +.openerp .oe_dialog_warning { + width: 100%; +} +.openerp .oe_dialog_warning p { + text-align: center; +} +.openerp .oe_dialog_icon { + padding: 5px; + width: 32px; +} .openerp .oe_login { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); text-align: center; @@ -1182,6 +1192,7 @@ padding-bottom: 16px; } .openerp a.oe_logo { + position: relative; width: 220px; display: block; text-align: center; @@ -1190,6 +1201,24 @@ margin: 14px 0; border: 0; } +.openerp a.oe_logo .oe_logo_edit { + margin: 14px 0; + position: absolute; + top: 1px; + padding: 4px; + width: 100%; + display: none; + text-align: center; + color: #eeeeee; + background: rgba(37, 37, 37, 0.9); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.openerp a.oe_logo:hover .oe_logo_edit_admin { + display: block; +} .openerp .oe_footer { position: fixed; bottom: 0; @@ -1236,7 +1265,7 @@ color: white; padding: 2px 4px; margin: 1px 6px 0 0; - border: 1px solid lightGray; + border: 1px solid lightgrey; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -1261,7 +1290,7 @@ transform: scale(1.1); } .openerp .oe_secondary_submenu .oe_active { - border-top: 1px solid lightGray; + border-top: 1px solid lightgrey; border-bottom: 1px solid #dedede; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2); @@ -2210,7 +2239,7 @@ } .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span { font-size: 80%; - color: darkGreen; + color: darkgreen; vertical-align: top; position: relative; top: -4px; @@ -3201,3 +3230,7 @@ div.ui-widget-overlay { overflow: hidden !important; } } +.blockUI.blockOverlay { + background-color: black; + opacity: 0.6; +} diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index a8445f0ff06..0369f5fd4b5 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -696,6 +696,15 @@ $sheet-padding: 16px margin-top: 1px background-color: #f6cf3b // }}} + // CrashManager {{{ + .oe_dialog_warning + width: 100% + p + text-align: center + .oe_dialog_icon + padding: 5px + width: 32px + // }}} // Login {{{ .oe_login background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) @@ -958,12 +967,26 @@ $sheet-padding: 16px text-shadow: 0 1px 1px white padding-bottom: 16px a.oe_logo + position: relative width: 220px display: block text-align: center img margin: 14px 0 border: 0 + .oe_logo_edit + margin: 14px 0 + position: absolute + top: 1px + padding: 4px + width: 100% + display: none + text-align: center + color: #eee + background: rgba(37,37,37,0.9) + @include box-sizing(border) + &:hover .oe_logo_edit_admin + display: block .oe_footer position: fixed bottom: 0 @@ -2536,5 +2559,9 @@ div.ui-widget-overlay overflow: hidden !important // }}} +.blockUI.blockOverlay + background-color: black + opacity: 0.6000000238418579 + // au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css" // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index b06dda90eca..3812a00d8f3 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -691,6 +691,7 @@ instance.web.Login = instance.web.Widget.extend({ }); instance.web.client_actions.add("login", "instance.web.Login"); + /** * Redirect to url by replacing window.location * If wait is true, sleep 1s and wait for the server i.e. after a restart. @@ -1136,6 +1137,9 @@ instance.web.Client = instance.web.Widget.extend({ instance.web.WebClient = instance.web.Client.extend({ _template: 'WebClient', + events: { + 'click .oe_logo_edit_admin': 'logo_edit' + }, init: function(parent) { this._super(parent); this._current_state = null; @@ -1206,7 +1210,29 @@ instance.web.WebClient = instance.web.Client.extend({ }, update_logo: function() { var img = this.session.url('/web/binary/company_logo'); - this.$el.find('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo img').attr('src', '').attr('src', img); + this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', this.session.uid === 1); + }, + logo_edit: function(ev) { + var self = this; + new instance.web.Model("res.users").get_func("read")(this.session.uid, ["company_id"]).then(function(res) { + self.rpc("/web/action/load", { action_id: "base.action_res_company_form" }).done(function(result) { + result.res_id = res['company_id'][0]; + result.target = "new"; + result.views = [[false, 'form']]; + result.flags = { + action_buttons: true, + }; + self.action_manager.do_action(result); + var form = self.action_manager.dialog_widget.views.form.controller; + form.on("on_button_cancel", self.action_manager.dialog, self.action_manager.dialog.close); + form.on('record_saved', self, function() { + self.action_manager.dialog.close(); + self.update_logo(); + }); + }); + }); + return false; }, check_timezone: function() { var self = this; @@ -1319,12 +1345,21 @@ instance.web.WebClient = instance.web.Client.extend({ result.context, {search_default_message_unread: true}); } - return $.when(self.action_manager.do_action(result, { + var completed = $.Deferred(); + $.when(self.action_manager.do_action(result, { clear_breadcrumbs: true, action_menu_id: self.menu.current_menu, })).fail(function() { self.menu.open_menu(options.previous_menu_id); + }).always(function() { + completed.resolve(); }); + setTimeout(function() { + completed.resolve(); + }, 2000); + // We block the menu when clicking on an element until the action has correctly finished + // loading. If something crash, there is a 2 seconds timeout before it's unblocked. + return completed; }); }); }, @@ -1352,17 +1387,17 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ _template: 'EmbedClient', init: function(parent, origin, dbname, login, key, action_id, options) { this._super(parent, origin); - - this.dbname = dbname; - this.login = login; - this.key = key; + this.bind_credentials(dbname, login, key); this.action_id = action_id; this.options = options || {}; }, start: function() { var self = this; return $.when(this._super()).then(function() { - return instance.session.session_authenticate(self.dbname, self.login, self.key, true).then(function() { + return self.authenticate().then(function() { + if (!self.action_id) { + return; + } return self.rpc("/web/action/load", { action_id: self.action_id }).done(function(result) { var action = result; action.flags = _.extend({ @@ -1373,11 +1408,30 @@ instance.web.EmbeddedClient = instance.web.Client.extend({ //pager : false }, self.options, action.flags || {}); - self.action_manager.do_action(action); + self.do_action(action); }); }); }); }, + + do_action: function(action) { + return this.action_manager.do_action(action); + }, + + authenticate: function() { + var s = instance.session; + if (s.session_is_valid() && s.db === this.dbname && s.login === this.login) { + return $.when(); + } + return instance.session.session_authenticate(this.dbname, this.login, this.key, true); + }, + + bind_credentials: function(dbname, login, key) { + this.dbname = dbname; + this.login = login; + this.key = key; + }, + }); instance.web.embed = function (origin, dbname, login, key, action, options) { diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index c88e0ca0512..eac26520301 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -30,6 +30,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess * Setup a sessionm */ session_bind: function(origin) { + if (!_.isUndefined(this.origin)) { + if (this.origin === origin) { + return $.when(); + } + throw new Error('Session already bound to ' + this.origin); + } var self = this; this.setup(origin); instance.web.qweb.default_dict['_s'] = this.origin; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index cfc8be391b4..299d579803d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -213,7 +213,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); //bounce effect on red button when click on statusbar. this.$el.find(".oe_form_field_status:not(.oe_form_status_clickable)").on('click', function (e) { - if((self.get("actual_mode") == "view")) { + if((self.get("actual_mode") == "view")) { var $button = self.$el.find(".oe_highlight:not(.oe_form_invisible)").css({'float':'left','clear':'none'}); $button.effect('bounce', {distance:18, times: 5}, 150); e.stopPropagation(); @@ -919,7 +919,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.do_update_pager(); if (this.sidebar) { this.sidebar.do_attachement_update(this.dataset, this.datarecord.id); - } + } //openerp.log("The record has been created with id #" + this.datarecord.id); return $.when(this.reload()).then(function () { self.trigger('record_created', r); @@ -2289,7 +2289,10 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we }); instance.web.form.FieldID = instance.web.form.FieldChar.extend({ - + process_modifiers: function () { + this._super(); + this.set({ readonly: true }); + }, }); instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({ @@ -2389,7 +2392,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ var self = this; this.$input = this.$el.find('input.oe_datepicker_master'); this.$input_picker = this.$el.find('input.oe_datepicker_container'); - + this.picker({ onClose: this.on_picker_select, onSelect: this.on_picker_select, @@ -5092,7 +5095,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie _.each(datas, function (data) { data.no_unlink = true; data.url = self.session.url('/web/binary/saveas', {model: 'ir.attachment', field: 'datas', filename_field: 'datas_fname', id: data.id}); - + _.each(self.get('value'), function (val, key) { if(val == data.id) { self.get('value')[key] = data; @@ -5258,7 +5261,8 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ if (this.field.type == "many2one") { var domain = []; if(!_.isEmpty(this.field.domain) || !_.isEmpty(this.node.attrs.domain)) { - domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.get('value')]]); + var d = instance.web.pyeval.eval('domain', self.build_domain()); + domain = ['|', ['id', '=', self.get('value')]].concat(d); } var ds = new instance.web.DataSetSearch(this, this.field.relation, self.build_context(), domain); return ds.read_slice(['name'], {}).then(function (records) { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 62e123f6695..a3fd74bfb00 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -36,11 +36,11 @@ <t t-name="CrashManager.warning"> <table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning"> <tr> - <td><img t-att-src='_s + "/web/static/src/img/warning.png"' class="oe_dialog_icon"/></td> + <td class="oe_dialog_icon"><img t-att-src='_s + "/web/static/src/img/warning.png"'/></td> <td> <p> <t t-js="d"> - var message = d.message ? d.message : d.error.data.fault_code; + var message = d.error.message ? d.error.message : d.error.data.fault_code; d.html_error = context.engine.tools.html_escape(message) .replace(/\n/g, '<br/>'); </t> @@ -437,7 +437,10 @@ <tr> <td class="oe_leftbar" valign="top"> <t t-set="debug" t-value="__debug__ ? '&debug' : ''"/> - <a class="oe_logo" t-attf-href="/?ts=#{Date.now()}#{debug}"><img t-att-src='widget.session.url("/web/binary/company_logo")'/></a> + <a class="oe_logo" t-attf-href="/?ts=#{Date.now()}#{debug}"> + <span class="oe_logo_edit">Edit Company data</span> + <img t-att-src='widget.session.url("/web/binary/company_logo")'/> + </a> <div class="oe_secondary_menus_container"/> <div class="oe_footer"> Powered by <a href="http://www.openerp.com" target="_blank"><span>OpenERP</span></a> |
