summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2011-09-06 11:50:54 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2011-09-06 11:50:54 +0200
commitf7544bb989ffc0b9bb3d19fc86b44a6a1086e0ee (patch)
treeddad548306d76c0c7e654c8c4fca47eb7cea6374 /addons/web/static/src
parentbaed408025a5c4dedf1eac52d2cf78063da78e71 (diff)
parent71cb3b3bc38bcf4f69398138c8193f0fde5d213e (diff)
[imp] lot of improvements to header & about page
bzr revid: nicolas.vanhoren@openerp.com-20110906095054-qjlpmyd83spjm79b
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base-ie7.css4
-rw-r--r--addons/web/static/src/css/base.css4
-rw-r--r--addons/web/static/src/js/chrome.js39
-rw-r--r--addons/web/static/src/js/core.js11
-rw-r--r--addons/web/static/src/js/data.js44
-rw-r--r--addons/web/static/src/xml/base.xml40
6 files changed, 117 insertions, 25 deletions
diff --git a/addons/web/static/src/css/base-ie7.css b/addons/web/static/src/css/base-ie7.css
deleted file mode 100644
index fa1f1fe74a6..00000000000
--- a/addons/web/static/src/css/base-ie7.css
+++ /dev/null
@@ -1,4 +0,0 @@
-
-.openerp .menu span {
- min-width: 0;
-}
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index b46fef45fdc..c6241cd4429 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -409,7 +409,7 @@ label.error {
float: left;
font-size: 100%;
margin: 0;
- padding: 4px 0;
+ padding: 4px 10px;
text-shadow: 0 1px 0 #111111;
}
.openerp .header_title small {
@@ -1244,7 +1244,7 @@ label.error {
position: absolute;
margin: 0;
- padding: 6px 5px;
+ padding: 6px 15px;
top: 37px;
left: 197px;
right: 0;
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index fb4104770f5..9d0f097b6eb 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -438,9 +438,9 @@ openerp.web.Login = openerp.web.Widget.extend({
if (this.has_local_storage && this.remember_creditentials) {
this.selected_db = localStorage.getItem('last_db_login_success');
this.selected_login = localStorage.getItem('last_login_login_success');
- }
- if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
- this.selected_password = this.selected_password || "a";
+ if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
+ this.selected_password = localStorage.getItem('last_password_login_success');
+ }
}
},
start: function() {
@@ -454,7 +454,7 @@ openerp.web.Login = openerp.web.Widget.extend({
},
display: function() {
var self = this;
-
+
this.$element.html(QWeb.render("Login", this));
this.database = new openerp.web.Database(
this, "oe_database", "oe_db_options");
@@ -495,9 +495,13 @@ openerp.web.Login = openerp.web.Widget.extend({
if(self.remember_creditentials) {
localStorage.setItem('last_db_login_success', db);
localStorage.setItem('last_login_login_success', login);
+ if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
+ localStorage.setItem('last_password_login_success', password);
+ }
} else {
localStorage.setItem('last_db_login_success', '');
localStorage.setItem('last_login_login_success', '');
+ localStorage.setItem('last_password_login_success', '');
}
}
self.on_login_valid();
@@ -514,7 +518,7 @@ openerp.web.Login = openerp.web.Widget.extend({
this.on_login_valid.add({
position: "last",
unique: true,
- callback: continuation
+ callback: continuation || function() {}
});
},
on_logout: function() {
@@ -534,11 +538,24 @@ openerp.web.Header = openerp.web.Widget.extend({
this._super();
},
do_update: function () {
- this.$content = $(QWeb.render("Header-content", {widget: this}));
- this.$content.appendTo(this.$element);
- this.$element.find(".logout").click(this.on_logout);
- this.$element.find("a.preferences").click(this.on_preferences);
- return this.shortcut_load();
+ var self = this;
+ var func = new openerp.web.Model(self.session, "res.users").get_func("read");
+ func(self.session.uid, ["name", "company_id"]).then(function(res) {
+ self.$content = $(QWeb.render("Header-content", {widget: self, user: res}));
+ self.$content.appendTo(self.$element);
+ self.$element.find(".logout").click(self.on_logout);
+ self.$element.find("a.preferences").click(self.on_preferences);
+ self.$element.find(".about").click(self.on_about);
+ self.shortcut_load();
+ });
+ },
+ on_about: function() {
+ var self = this;
+ self.rpc("/web/webclient/version_info", {}).then(function(res) {
+ var $help = $(QWeb.render("About-Page", {version_info: res}));
+ $help.dialog({autoOpen: true,
+ modal: true, width: 960, title: "About"});
+ });
},
do_reset: function() {
this.$content.remove();
@@ -676,7 +693,7 @@ openerp.web.Header = openerp.web.Widget.extend({
});
}
});
-},
+ },
display_error: function (error) {
return $('<div>').dialog({
modal: true,
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index 4acc8ec15c3..d826ff34a43 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -346,7 +346,6 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
this.context = {};
this.shortcuts = [];
this.active_id = null;
- this.session = this;
},
start: function() {
this.session_restore();
@@ -471,9 +470,8 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
self.user_context = result.context;
self.session_save();
self.on_session_valid();
- if (success_callback)
- success_callback();
- });
+ return true;
+ }).then(success_callback);
},
session_logout: function() {
this.uid = false;
@@ -489,7 +487,10 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
this.user_context = this.get_cookie("user_context");
// we should do an rpc to confirm that this session_id is valid and if it is retrieve the information about db and login
// then call on_session_valid
- this.on_session_valid();
+ if (this.uid)
+ this.on_session_valid();
+ else
+ this.on_session_invalid();
},
/**
* Saves the session id and uid locally
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 3797121756f..4b4523a2723 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -737,6 +737,50 @@ openerp.web.ReadOnlyDataSetSearch = openerp.web.DataSetSearch.extend({
on_unlink: function(ids) {}
});
+openerp.web.Model = openerp.web.SessionAware.extend({
+ init: function(session, model_name) {
+ this._super(session);
+ this.model_name = model_name;
+ },
+ get_func: function(method_name) {
+ var self = this;
+ return function() {
+ if (method_name == "search_read")
+ return self._search_read.apply(self, arguments);
+ return self._call(method_name, _.toArray(arguments));
+ };
+ },
+ _call: function (method, args) {
+ return this.rpc('/web/dataset/call', {
+ model: this.model_name,
+ method: method,
+ args: args
+ }).pipe(function(result) {
+ if (method == "read" && result instanceof Array && result.length > 0 && result[0]["id"]) {
+ var index = {};
+ _.each(_.range(result.length), function(i) {
+ index[result[i]["id"]] = result[i];
+ })
+ result = _.map(args[0], function(x) {return index[x];});
+ }
+ return result;
+ });
+ },
+ _search_read: function(domain, fields, offset, limit, order, context) {
+ return this.rpc('/web/dataset/search_read', {
+ model: this.model_name,
+ fields: fields,
+ offset: offset,
+ limit: limit,
+ domain: domain,
+ sort: order,
+ context: context
+ }).pipe(function(result) {
+ return result.records;
+ });;
+ }
+});
+
openerp.web.CompoundContext = openerp.web.Class.extend({
init: function () {
this.__ref = "compound_context";
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 5fa42ae62e8..677488d9d7d 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -334,26 +334,30 @@
</t>
<t t-name="Header-content">
<h1 class="header_title">
- <span class="database"><t t-esc="widget.session.db"/></span> - <t t-esc="widget.session.login"/> <br/>
- <small class="username">rpc_session_id: <t t-esc="widget.session.session_id"/></small>
+ <t t-esc="user.company_id[1]"/> (<t t-esc="widget.session.db"/>)<br/>
+ <small class="username"><t t-esc="user.name"/></small>
</h1>
<div class="header_corner">
<ul class="block">
<li>
- <a href="#home" title="Home" class="home"><img src="/web/static/src/img/header-home.png" width="16" height="16" border="0"/></a>
+ <a t-att-href="'/' + widget.qs" title="Home" class="home"><img src="/web/static/src/img/header-home.png" width="16" height="16" border="0"/></a>
</li>
+ <!--
<li>
<a href="#requests" title="Requests" class="requests"><img src="/web/static/src/img/header-requests.png" width="16" height="16" border="0"/><small>1</small></a>
</li>
+ -->
<li class="preferences">
<a href="#preferences" title="Preferences" class="preferences"><img src="/web/static/src/img/header-preferences.png" width="16" height="16" border="0"/></a>
</li>
<li>
<a href="#about" title="About" class="about"><img src="/web/static/src/img/header-about.png" width="16" height="16" border="0"/></a>
</li>
+ <!--
<li>
<a href="http://doc.openerp.com/v6.0/book?version=$version" title="Help" target="_blank" class="help"><img src="/web/static/src/img/header-help.png" width="16" height="16" border="0"/></a>
</li>
+ -->
</ul>
<div class="block">
<a href="#logout" class="logout">LOGOUT</a>
@@ -1354,4 +1358,34 @@
</table>
</form>
</t>
+<t t-name="About-Page">
+ <div>
+ <h1>OpenERP Web</h1>
+ <h3 style="padding:0 5px 5px">Version <t t-esc="version_info.version"/></h3>
+ <p>
+ Copyright © 2011-TODAY OpenERP SA. All Rights Reserved.<br />
+ OpenERP is a trademark of the <a target="_blank" href="http://openerp.com/" style="text-decoration: underline;">OpenERP SA Company</a>.
+ </p>
+ <p>
+ Licenced under the terms of <a target="_blank" href="http://www.gnu.org/licenses/agpl.html" style="text-decoration: underline;">GNU Affero General Public License</a>
+ </p>
+ <br />
+ <h1>About OpenERP</h1>
+ <p>
+ <a target="_blank" href="http://openerp.com/" style="text-decoration: underline;">OpenERP</a> is a free enterprise-scale software system that is designed to boost
+ productivity and profit through data integration. It connects, improves and
+ manages business processes in areas such as sales, finance, supply chain,
+ project management, production, services, CRM, etc...
+ </p>
+ <p>
+ The system is platform-independent, and can be installed on Windows, Mac OS X,
+ and various Linux and other Unix-based distributions. Its architecture enables
+ new functionality to be rapidly created, modifications to be made to a
+ production system and migration to a new version to be straightforward.
+ </p>
+ <p>
+ Depending on your needs, OpenERP is available through a web or application client.
+ </p>
+ </div>
+</t>
</templates>