openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #00123
[Merge] lp:~openerp-dev/openobject-client-web/web-dashboard into lp:openobject-client-web
vda(Open ERP) has proposed merging lp:~openerp-dev/openobject-client-web/web-dashboard into lp:openobject-client-web.
Requested reviews:
OpenERP SA's Web Client R&D (openerp-dev-web)
Web dashboard improvements.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/web-dashboard/+merge/37237
Your team OpenERP SA's Web Client R&D is requested to review the proposed merge of lp:~openerp-dev/openobject-client-web/web-dashboard into lp:openobject-client-web.
=== modified file 'addons/openerp/controllers/database.py'
--- addons/openerp/controllers/database.py 2010-09-20 11:27:34 +0000
+++ addons/openerp/controllers/database.py 2010-10-01 11:12:45 +0000
@@ -191,7 +191,7 @@
raise redirect('/openerp/database/create')
if ok:
- raise redirect('/openerp/menu', {'next': '/openerp/home'})
+ raise redirect('/openerp', {'next': '/openerp/home'})
raise redirect('/openerp/login', db=dbname)
@expose(template="/openerp/controllers/templates/database.mako")
=== modified file 'addons/openerp/controllers/root.py'
--- addons/openerp/controllers/root.py 2010-09-30 07:25:19 +0000
+++ addons/openerp/controllers/root.py 2010-10-01 11:12:45 +0000
@@ -47,20 +47,52 @@
_cp_path = "/openerp"
- @expose()
- def index(self, next=None):
+ @expose(template="/openerp/controllers/templates/menu.mako")
+ def index(self, active=None, next=None):
"""Index page, loads the view defined by `action_id`.
"""
- if next: arguments = {'next': next}
- else: arguments = {'next': '/openerp/home'}
-
- proxy = rpc.RPCProxy("res.users")
- act_id = proxy.read([rpc.session.uid], ['action_id', 'name'], rpc.session.context)
-
- if act_id[0]['action_id'] :
- raise redirect("/openerp/menu", **arguments)
- else:
- raise redirect('/openerp/dashboard')
+
+ if not next and rpc.session.action_id: next = rpc.session.action_id[0]
+ elif next == '/openerp/home' and not rpc.session.action_id: next = None
+ from openerp.utils import icons
+ from openerp.widgets import tree_view
+
+ try:
+ id = int(active)
+ except:
+ id = False
+ form.Form().reset_notebooks()
+
+ ctx = rpc.session.context.copy()
+ menus = rpc.RPCProxy("ir.ui.menu")
+ ids = menus.search([('parent_id', '=', False)], 0, 0, 0, ctx)
+ parents = menus.read(ids, ['name', 'action'], ctx)
+
+ if not id and ids:
+ id = ids[0]
+ for parent in parents:
+ if parent['id'] == id:
+ parent['active'] = 'active'
+ parent['url'] = url('/openerp', active=parent['id'], next=url('/openerp/custom_action', action=parent['id']))
+
+ tools = ''
+ if next:
+ ids = menus.search([('parent_id', '=', id)], 0, 0, 0, ctx)
+ tools = menus.read(ids, ['name', 'icon', 'action'], ctx)
+ view = cache.fields_view_get('ir.ui.menu', 1, 'tree', {})
+ fields = cache.fields_get(view['model'], False, ctx)
+ for tool in tools:
+ tid = tool['id']
+ tool['icon'] = icons.get_icon(tool['icon'])
+ tool['tree'] = tree = tree_view.ViewTree(view, 'ir.ui.menu', tid,
+ domain=[('parent_id', '=', tid)],
+ context=ctx, action="/openerp/tree/action", fields=fields)
+ tree._name = "tree_%s" %(tid)
+ tree.tree.onselection = None
+ tree.tree.onheaderclick = None
+ tree.tree.showheaders = 0
+
+ return dict(parents=parents, tools=tools, load_content=(next and next or ''))
def user_action(self, id='action_id'):
@@ -68,25 +100,13 @@
@param id: `action_id` or `menu_id`
"""
- proxy = rpc.RPCProxy("res.users")
- act_id = proxy.read([rpc.session.uid], [id, 'name'], rpc.session.context)
-
- if not act_id[0][id]:
- common.warning(_('You can not log into the system!\nAsk the administrator to verify\nyou have an action defined for your user.'), _('Access Denied!'))
- rpc.session.logout()
- raise redirect('/openerp')
- else:
+ users = rpc.RPCProxy("res.users")
+ act_id = users.read([rpc.session.uid], [id], rpc.session.context)
+ if act_id[0][id]:
act_id = act_id[0][id][0]
from openerp import controllers
return controllers.actions.execute_by_id(act_id)
- @expose(template="/openerp/controllers/templates/dashboard.mako")
- def dashboard(self):
- ctx = rpc.session.context.copy()
- proxy = rpc.RPCProxy("ir.ui.menu")
- ids = proxy.search([('parent_id', '=', False)], 0, 0, 0, ctx)
- parents = proxy.read(ids, ['name', 'icon', 'action'], ctx)
- return dict(parents = parents)
@expose()
def home(self):
return self.user_action('action_id')
@@ -118,49 +138,6 @@
</html>
""" % (url("/openerp/static/images/loading.gif"))
- @expose(template="/openerp/controllers/templates/menu.mako")
- def menu(self, active=None, next=None):
- from openerp.utils import icons
- from openerp.widgets import tree_view
-
- try:
- id = int(active)
- except:
- id = False
- form.Form().reset_notebooks()
- ctx = rpc.session.context.copy()
- proxy = rpc.RPCProxy("ir.ui.menu")
- ids = proxy.search([('parent_id', '=', False)], 0, 0, 0, ctx)
- parents = proxy.read(ids, ['name', 'icon', 'action'], ctx)
-
- if not id and ids:
- id = ids[0]
-
- for parent in parents:
- if parent['id'] == id:
- parent['active'] = 'active'
- # explicit next takes precedence on menu item action
- if not next and parent.get('action'):
- next = url('/openerp/custom_action', action=id)
-
- ids = proxy.search([('parent_id', '=', id)], 0, 0, 0, ctx)
- tools = proxy.read(ids, ['name', 'icon', 'action'], ctx)
- view = cache.fields_view_get('ir.ui.menu', 1, 'tree', {})
- fields = cache.fields_get(view['model'], False, ctx)
-
- for tool in tools:
- tid = tool['id']
- tool['icon'] = icons.get_icon(tool['icon'])
- tool['tree'] = tree = tree_view.ViewTree(view, 'ir.ui.menu', tid,
- domain=[('parent_id', '=', tid)],
- context=ctx, action="/openerp/tree/action", fields=fields)
- tree._name = "tree_%s" %(tid)
- tree.tree.onselection = None
- tree.tree.onheaderclick = None
- tree.tree.showheaders = 0
-
- return dict(parents=parents, tools=tools, load_content=(next and next or ''))
-
@expose(allow_json=True)
@unsecured
def login(self, db=None, user=None, password=None, style=None, location=None, **kw):
=== modified file 'addons/openerp/controllers/templates/closepopup.mako'
--- addons/openerp/controllers/templates/closepopup.mako 2010-09-15 12:29:56 +0000
+++ addons/openerp/controllers/templates/closepopup.mako 2010-10-01 11:12:45 +0000
@@ -27,7 +27,7 @@
window.close();
} else {
- window.location.href='/openerp/menu';
+ window.location.href='/openerp';
}
});
</script>
=== removed file 'addons/openerp/controllers/templates/dashboard.mako'
--- addons/openerp/controllers/templates/dashboard.mako 2010-09-30 07:25:19 +0000
+++ addons/openerp/controllers/templates/dashboard.mako 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-<%inherit file="/openerp/controllers/templates/base_dispatch.mako"/>
-<%def name="header()">
- <title>OpenERP Dashboard</title>
-
- <link href="/openerp/static/css/treegrid.css" rel="stylesheet" type="text/css"/>
- <link href="/openerp/static/css/notebook.css" rel="stylesheet" type="text/css"/>
-
- <script type="text/javascript" src="/openerp/static/javascript/accordion.js"></script>
- <script type="text/javascript" src="/openerp/static/javascript/treegrid.js"></script>
- <script type="text/javascript" src="/openerp/static/javascript/notebook/notebook.js"></script>
- <script type="text/javascript" src="/openerp/static/javascript/scroll_scut.js"></script>
-</%def>
-<%def name="content()">
- <div id="root">
- <table id="content" class="three-a" width="100%">
- <tr>
- <%include file="header.mako"/>
- </tr>
- <tr>
- <td id="main_nav" colspan="3">
- <a id="scroll_left" class="scroll_right" style="float: left; padding-top: 12px;" href="javascript: void(0);">
- <img src="/openerp/static/images/scroll_left.png" alt="">
- </a>
- <a id="scroll_right" class="scroll_right" style="float: right; margin-right: 0; padding: 12px 5px 0 0;" href="javascript: void(0);">
- <img src="/openerp/static/images/scroll_right.png" alt="">
- </a>
-
- <div id="nav" class="sc_menu">
- <ul class="sc_menu">
- %for parent in parents:
- <li id="${parent['id']}" class="menu_tabs">
- <a href="${py.url('/openerp/menu', active=parent['id'])}" target="_top" class="${parent.get('active', '')}">
- <span>${parent['name']}</span>
- </a>
- <em>[1]</em>
- </li>
- % endfor
- </ul>
- </div>
- </td>
- </tr>
- <tr>
- <td id="primary" width="100%">
- <div class="wrap" style="padding: 10px;">
- <ul class="sections-a">
- %for parent in parents:
- <li id="${parent['id']}" class="${'-'.join(parent['name'].split(' ')).lower()}">
- <span class="wrap">
- <a href="${py.url('/openerp/menu', active=parent['id'])}">
- <span>
- <strong>${parent['name']}</strong>
- </span>
- </a>
- </span>
- </li>
- % endfor
- </ul>
- </div>
- </td>
- </tr>
- </table>
- </div>
-</%def>
\ No newline at end of file
=== modified file 'addons/openerp/controllers/templates/header.mako'
--- addons/openerp/controllers/templates/header.mako 2010-09-30 10:04:42 +0000
+++ addons/openerp/controllers/templates/header.mako 2010-10-01 11:12:45 +0000
@@ -21,7 +21,7 @@
%>
<td id="top" colspan="3">
<p id="cmp_logo">
- <a href="/" target="_top">
+ <a href="http://www.openerp.com" target="_blank">
<img alt="OpenERP" id="company_logo" src="/openerp/static/images/openerp_small.png"/>
</a>
</p>
@@ -37,61 +37,60 @@
<li><a href="#footer" accesskey="f">Skip to footer [f]</a></li>
</ul>
% if logged:
- <div id="corner">
- <ul class="tools">
- <li><a href="javascript: void(0)" onclick="header_actions('/openerp/home')" class="home">${_("Home")}</a>
- <ul>
- <li class="first last"><a href="javascript: void(0)" onclick="header_actions('/openerp/home')">${_("Home")}</a></li>
- </ul>
- </li>
- <li>
- <a href="javascript: void(0)" onclick="header_actions('/openerp/requests')" class="req_messages"><small>${total_request}</small></a>
- <ul>
- <li class="first last"><a href="javascript: void(0)" onclick="header_actions('/openerp/requests')">${_("Requests")}</a></li>
- </ul>
- </li>
-
- <li><a href="javascript: void(0)" onclick="header_actions('/openerp/pref/create')" class="preferences">${_("Preferences")}</a>
- <ul>
- <li class="first last"><a href="javascript: void(0)" onclick="header_actions('/openerp/pref/create')">${_("Edit Preferences")}</a></li>
- </ul>
- </li>
- <li><a href="javascript: void(0)" onclick="header_actions('/openerp/about')" class="info">${_("About")}</a>
- <ul>
- <li class="first last"><a href="javascript: void(0)" onclick="header_actions('/openerp/about')">${_("About")}</a></li>
- </ul>
- </li>
-
- <li><a target="_blank" href="http://doc.openerp.com/" class="help">${_("Help")}</a>
- <ul>
- <li class="first last"><a target="_blank" href="http://doc.openerp.com/">${_("Help")}</a></li>
- </ul>
- </li>
-
- % if cp.config('server.environment') == 'production':
- <li id="clear_cache"><a href="javascript: void(0)" onclick="header_actions('/openerp/pref/clear_cache')" class="clear_cache">${_("Clear Cache")}</a>
- <ul>
- <li class="first last"><a href="javascript: void(0);">${_("Clear Cache")}</a></li>
- </ul>
- </li>
- % endif
- </ul>
- <p class="logout"><a href="${py.url('/openerp/logout')}" target="_top">${_("Logout")}</a></p>
- </div>
- % endif
-
+ <div id="corner">
+ <ul class="tools">
+ <li><a href="${py.url('/openerp/home')}" class="home">${_("Home")}</a>
+ <ul>
+ <li class="first last"><a href="${py.url('/openerp/home')}">${_("Home")}</a></li>
+ </ul>
+ </li>
+ <li>
+ <a href="${py.url('/openerp/requests')}" class="req_messages"><small>${total_request}</small></a>
+ <ul>
+ <li class="first last"><a href="${py.url('/openerp/requests')}">${_("Requests")}</a></li>
+ </ul>
+ </li>
+
+ <li><a href="${py.url('/openerp/pref/create')}" class="preferences">${_("Preferences")}</a>
+ <ul>
+ <li class="first last"><a href="${py.url('/openerp/pref/create')}">${_("Edit Preferences")}</a></li>
+ </ul>
+ </li>
+ <li><a href="/openerp/about" class="info">${_("About")}</a>
+ <ul>
+ <li class="first last"><a href="/openerp/about">${_("About")}</a></li>
+ </ul>
+ </li>
+
+ <li><a target="_blank" href="http://doc.openerp.com/" class="help">${_("Help")}</a>
+ <ul>
+ <li class="first last"><a target="_blank" href="http://doc.openerp.com/">${_("Help")}</a></li>
+ </ul>
+ </li>
+
+ % if cp.config('server.environment') == 'production':
+ <li id="clear_cache"><a href="${py.url('/openerp/pref/clear_cache')}" class="clear_cache">${_("Clear Cache")}</a>
+ <ul>
+ <li class="first last"><a href="javascript: void(0);">${_("Clear Cache")}</a></li>
+ </ul>
+ </li>
+ % endif
+ </ul>
+ <p class="logout"><a href="${py.url('/openerp/logout')}" target="_top">${_("Logout")}</a></p>
+ </div>
+ % endif
+
<div id="shortcuts" class="menubar">
% if logged:
<ul>
- % for i, sc in enumerate(shortcuts):
- <li class="${i == 0 and 'first' or ''}">
- <a id="shortcut_${sc['res_id']}"
- href="javascript: void(0)"
- onclick='header_actions("/openerp/tree/open","${sc['res_id']}", "ir.ui.menu")'>
- <span>${sc['name']}</span>
- </a>
- </li>
- % endfor
+ % for i, sc in enumerate(shortcuts):
+ <li class="${i == 0 and 'first' or ''}">
+ <a id="shortcut_${sc['res_id']}"
+ href="${py.url('/openerp/tree/open', id=sc['res_id'], model='ir.ui.menu')}">
+ <span>${sc['name']}</span>
+ </a>
+ </li>
+ % endfor
</ul>
% endif
</div>
=== modified file 'addons/openerp/controllers/templates/menu.mako'
--- addons/openerp/controllers/templates/menu.mako 2010-09-30 09:09:45 +0000
+++ addons/openerp/controllers/templates/menu.mako 2010-10-01 11:12:45 +0000
@@ -23,7 +23,6 @@
jQuery('.toggle-menu').toggler('#content')
});
-
</script>
</%def>
@@ -46,8 +45,8 @@
<div id="nav" class="sc_menu">
<ul class="sc_menu">
%for parent in parents:
- <li id="${parent['id']}" class="menu_tabs">
- <a href="${py.url('/openerp/menu', active=parent['id'])}" target="_top" class="${parent.get('active', '')}">
+ <li class="menu_tabs">
+ <a href="${parent['url']}" target="_top" class="${parent.get('active', '')}">
<span>${parent['name']}</span>
</a>
<em>[1]</em>
@@ -57,35 +56,63 @@
</div>
</td>
</tr>
- <tr>
- <td id="secondary" class="sidenav-open">
- <div class="wrap">
- <ul id="sidenav-a" class="accordion">
- % for tool in tools:
- % if tool.get('action'):
- <li class="accordion-title" id="${tool['id']}">
- % else:
- <li class="accordion-title">
- % endif
- <span>${tool['name']}</span>
- </li>
- <li class="accordion-content" id="content_${tool['id']}">
- ${tool['tree'].display()}
- </li>
- % endfor
- </ul>
+ % if tools:
+ <tr>
+ <td id="secondary" class="sidenav-open">
+ <div class="wrap">
+ <ul id="sidenav-a" class="accordion">
+ % for tool in tools:
+ % if tool.get('action'):
+ <li class="accordion-title" id="${tool['id']}">
+ % else:
+ <li class="accordion-title">
+ % endif
+ <span>${tool['name']}</span>
+ </li>
+ <li class="accordion-content" id="content_${tool['id']}">
+ ${tool['tree'].display()}
+ </li>
+ % endfor
+ </ul>
+ <script type="text/javascript">
+ new Accordion("sidenav-a");
+ </script>
+ </div>
+ </td>
+ <td class="toggle-menu"></td>
+ <td id="primary" width="100%">
+ <div class="wrap">
+ <div id="appContent"></div>
+ </div>
+ </td>
+ </tr>
+ % else:
+ <tr>
+ <td>
+ <div class="wrap" style="padding: 10px;">
+ <ul class="sections-a">
+ %for parent in parents:
+ <li class="${'-'.join(parent['name'].split(' ')).lower()}">
+ <span class="wrap">
+ <a href="javascript: void(0)" onclick="dashboard_action('${parent['id']}')">
+ <span>
+ <strong>${parent['name']}</strong>
+ </span>
+ </a>
+ </span>
+ </li>
+ % endfor
+ </ul>
+ </div>
<script type="text/javascript">
- new Accordion("sidenav-a");
+ function dashboard_action(action_id) {
+ var next = openobject.http.getURL('/openerp/custom_action', {'action': action_id});
+ window.location.href = openobject.http.getURL('/openerp', {'active': action_id, 'next': next});
+ }
</script>
- </div>
- </td>
- <td class="toggle-menu"></td>
- <td id="primary" width="100%">
- <div class="wrap">
- <div id="appContent"></div>
- </div>
- </td>
- </tr>
+ </td>
+ </tr>
+ % endif
<tr>
<td id="footer_section" colspan="3">
% if cp.config('server.environment') == 'development':
=== modified file 'addons/openerp/static/css/screen.css'
--- addons/openerp/static/css/screen.css 2010-09-30 09:09:45 +0000
+++ addons/openerp/static/css/screen.css 2010-10-01 11:12:45 +0000
@@ -1707,7 +1707,7 @@
background-image: url(../images/sections-a-i-wallet.png);
}
-ul.sections-a li.point span.wrap a {
+ul.sections-a li.point-of-sale span.wrap a {
background-image: url(../images/sections-a-i-tag.png);
}
=== modified file 'addons/openerp/static/javascript/accordion.js'
--- addons/openerp/static/javascript/accordion.js 2010-08-19 14:11:12 +0000
+++ addons/openerp/static/javascript/accordion.js 2010-10-01 11:12:45 +0000
@@ -105,10 +105,6 @@
});
MochiKit.DOM.addElementClass(title, "accordion-title-active");
-
- if(title.id) {
- openLink(openobject.http.getURL('/openerp/custom_action', {'action':title.id}))
- }
},
deactivate : function(title) {
=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
--- addons/openerp/static/javascript/openerp/openerp.base.js 2010-09-27 07:52:12 +0000
+++ addons/openerp/static/javascript/openerp/openerp.base.js 2010-10-01 11:12:45 +0000
@@ -120,6 +120,15 @@
});
return false;
});
+ } else {
+ if (jQuery(document).find('div#root').length) {
+ jQuery(document).delegate('a[href]:not([target]):not([href^="#"]):not([href^="javascript"]):not([rel=external])', 'click', function(){
+ window.location.href = openobject.http.getURL('/openerp', {
+ 'next': jQuery(this).attr('href')
+ })
+ return false;
+ });
+ }
}
// wash for hash changes
=== modified file 'addons/openerp/static/javascript/openerp/openerp.ui.js'
--- addons/openerp/static/javascript/openerp/openerp.ui.js 2010-09-30 14:52:52 +0000
+++ addons/openerp/static/javascript/openerp/openerp.ui.js 2010-10-01 11:12:45 +0000
@@ -158,20 +158,6 @@
}
})(jQuery);
-function header_actions(url) {
- // For shortcuts
- if(arguments[1]) {
- url = openobject.http.getURL(url, {'id': arguments[1], 'model': arguments[2]});
- }
-
- if(jQuery('#appContent').length) {
- openLink(url)
- }
- else {
- window.location.href = openobject.http.getURL('/openerp/menu', {'next': url})
- }
-}
-
jQuery(document).ready(function () {
jQuery('#shortcuts').scrollify();
});
=== modified file 'addons/openerp/utils/rpc.py'
--- addons/openerp/utils/rpc.py 2010-09-28 11:10:49 +0000
+++ addons/openerp/utils/rpc.py 2010-10-01 11:12:45 +0000
@@ -309,9 +309,10 @@
self.open = True
# read the full name of the user
- res_users = self.execute('object', 'execute', 'res.users', 'read', [uid], ['name', 'company_id', 'login'])[0]
+ res_users = self.execute('object', 'execute', 'res.users', 'read', [uid], ['name', 'company_id', 'login', 'action_id'])[0]
self.user_name = res_users['name']
self.company_id = res_users['company_id'][1]
+ self.action_id = res_users['action_id']
self.loginname = res_users['login']
# set the context
self.context_reload()
Follow ups