Merge lp:~fabien-morin/unifield-web/fm-us-3172 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4877
Proposed branch: lp:~fabien-morin/unifield-web/fm-us-3172
Merge into: lp:unifield-web
Diff against target: 502 lines (+217/-23)
19 files modified
addons/openerp/controllers/__init__.py (+1/-0)
addons/openerp/controllers/shortcut_tooltip.py (+33/-0)
addons/openerp/controllers/templates/base.mako (+3/-3)
addons/openerp/controllers/templates/exp.mako (+1/-1)
addons/openerp/controllers/templates/header.mako (+1/-5)
addons/openerp/controllers/templates/imp.mako (+1/-1)
addons/openerp/controllers/templates/index.mako (+3/-0)
addons/openerp/controllers/templates/preferences/index.mako (+1/-1)
addons/openerp/controllers/templates/shortcut_tooltip.mako (+13/-0)
addons/openerp/po/messages/fr.po (+4/-0)
addons/openerp/static/css/screen.css (+10/-0)
addons/openerp/static/css/tips.css (+19/-0)
addons/openerp/static/javascript/form.js (+9/-3)
addons/openerp/static/javascript/listgrid.js (+2/-2)
addons/openerp/static/javascript/m2m.js (+3/-1)
addons/openerp/static/javascript/m2o.js (+4/-2)
addons/openerp/static/javascript/o2m.js (+7/-1)
addons/openerp/static/javascript/openerp/openerp.base.js (+2/-1)
addons/openerp/static/javascript/web_keyboard_shortcuts.js (+100/-2)
To merge this branch: bzr merge lp:~fabien-morin/unifield-web/fm-us-3172
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+331336@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/controllers/__init__.py'
2--- addons/openerp/controllers/__init__.py 2017-06-19 14:54:07 +0000
3+++ addons/openerp/controllers/__init__.py 2017-09-26 07:32:44 +0000
4@@ -16,6 +16,7 @@
5 import selection
6 import shortcuts
7 import banner
8+import shortcut_tooltip
9 import requests
10 import unifield_version
11 import openm2o
12
13=== added file 'addons/openerp/controllers/shortcut_tooltip.py'
14--- addons/openerp/controllers/shortcut_tooltip.py 1970-01-01 00:00:00 +0000
15+++ addons/openerp/controllers/shortcut_tooltip.py 2017-09-26 07:32:44 +0000
16@@ -0,0 +1,33 @@
17+###############################################################################
18+#
19+# Copyright (C) 2007-TODAY OpenERP SA. All Rights Reserved.
20+#
21+# $Id$
22+#
23+# Developed by OpenERP (http://openerp.com) and Axelor (http://axelor.com).
24+#
25+# The OpenERP web client is distributed under the "OpenERP Public License".
26+# It's based on Mozilla Public License Version (MPL) 1.1 with following
27+# restrictions:
28+#
29+# - All names, links and logos of OpenERP must be kept as in original
30+# distribution without any changes in all software screens, especially
31+# in start-up page and the software header, even if the application
32+# source code has been changed or updated or code has been added.
33+#
34+# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
35+#
36+###############################################################################
37+from openerp.controllers import SecuredController
38+from openerp.utils import rpc
39+
40+
41+class ShortcutTooltip(SecuredController):
42+
43+ _cp_path = "/openerp/shortcut_tooltip"
44+
45+ def get_show_shortcut(self):
46+ proxy = rpc.RPCProxy('sync.client.entity')
47+ return proxy.display_shortcut_message()
48+
49+# vim: ts=4 sts=4 sw=4 si et
50
51=== modified file 'addons/openerp/controllers/templates/base.mako'
52--- addons/openerp/controllers/templates/base.mako 2017-09-14 13:33:18 +0000
53+++ addons/openerp/controllers/templates/base.mako 2017-09-26 07:32:44 +0000
54@@ -10,11 +10,11 @@
55 <script type="text/javascript" src="/openerp/static/javascript/scripts.js"></script>
56 <script type="text/javascript" src="/openerp/static/javascript/form.js?v=6.0"></script>
57 <script type="text/javascript" src="/openerp/static/javascript/form_state.js?v=2.3b2"></script>
58- <script type="text/javascript" src="/openerp/static/javascript/listgrid.js?v=2.8b1"></script>
59+ <script type="text/javascript" src="/openerp/static/javascript/listgrid.js?v=2.9"></script>
60
61- <script type="text/javascript" src="/openerp/static/javascript/m2o.js?v=2.6b4"></script>
62+ <script type="text/javascript" src="/openerp/static/javascript/m2o.js?v=2.7"></script>
63 <script type="text/javascript" src="/openerp/static/javascript/m2m.js"></script>
64- <script type="text/javascript" src="/openerp/static/javascript/o2m.js"></script>
65+ <script type="text/javascript" src="/openerp/static/javascript/o2m.js?v=2.7"></script>
66 <script type="text/javascript" src="/openerp/static/javascript/binary.js"></script>
67 <script type="text/javascript" src="/openerp/static/jscal/calendar.js"></script>
68 <script type="text/javascript" src="/openerp/static/jscal/calendar-setup.js"></script>
69
70=== modified file 'addons/openerp/controllers/templates/exp.mako'
71--- addons/openerp/controllers/templates/exp.mako 2017-08-29 09:33:08 +0000
72+++ addons/openerp/controllers/templates/exp.mako 2017-09-26 07:32:44 +0000
73@@ -286,7 +286,7 @@
74 <table width="100%">
75 <tr>
76 <td class="imp-header" align="right">
77- <a class="button-a" href="javascript: void(0)" onclick="window.frameElement.close()">${_("Cancel")}</a>
78+ <a class="button-a oe_form_button_cancel" href="javascript: void(0)" onclick="window.frameElement.close()">${_("Cancel")}</a>
79 <a class="button-a" href="javascript: void(0)" onclick="do_export('view_form')">${_("Export to File")}</a>
80 </td>
81 <td width="5%"></td>
82
83=== modified file 'addons/openerp/controllers/templates/header.mako'
84--- addons/openerp/controllers/templates/header.mako 2016-06-14 16:01:53 +0000
85+++ addons/openerp/controllers/templates/header.mako 2017-09-26 07:32:44 +0000
86@@ -4,7 +4,6 @@
87 ROOT = cp.request.pool.get_controller("/openerp")
88 SHORTCUTS = cp.request.pool.get_controller("/openerp/shortcuts")
89 REQUESTS = cp.request.pool.get_controller("/openerp/requests")
90- UF_VERSION = cp.request.pool.get_controller("/openerp/unifield_version")
91
92 shortcuts = SHORTCUTS.my()
93 requests, total_request = REQUESTS.my()
94@@ -30,9 +29,6 @@
95 add_style = cp.config('server.environment') in css_style_dict.keys()
96 if add_style:
97 css_style = css_style_dict.get(cp.config('server.environment'), "")
98-
99-from openobject import release
100-version = release.version
101 %>
102 <td id="top"
103 % if add_style:
104@@ -153,6 +149,6 @@
105 src:this.href
106 }, null, {
107 height: 350
108- });
109+ }).focus();
110 });
111 </script>
112
113=== modified file 'addons/openerp/controllers/templates/imp.mako'
114--- addons/openerp/controllers/templates/imp.mako 2015-10-23 08:08:51 +0000
115+++ addons/openerp/controllers/templates/imp.mako 2017-09-26 07:32:44 +0000
116@@ -202,7 +202,7 @@
117 <table width="100%">
118 <tr>
119 <td class="imp-header" align="left">
120- <a class="button-a" href="javascript: void(0)" onclick="window.frameElement.close()">${_("Close")}</a>
121+ <a class="button-a oe_form_button_cancel" href="javascript: void(0)" onclick="window.frameElement.close()">${_("Close")}</a>
122 <a class="button-a" href="javascript: void(0)" onclick="do_import();">${_("Import File")}</a>
123 </td>
124 <td width="5%"></td>
125
126=== modified file 'addons/openerp/controllers/templates/index.mako'
127--- addons/openerp/controllers/templates/index.mako 2017-06-19 14:54:07 +0000
128+++ addons/openerp/controllers/templates/index.mako 2017-09-26 07:32:44 +0000
129@@ -94,6 +94,9 @@
130 <tr>
131 <%include file="banner.mako"/>
132 </tr>
133+ <tr>
134+ <%include file="shortcut_tooltip.mako"/>
135+ </tr>
136 % if tools is not None:
137 <tr>
138 <td id="secondary" class="sidenav-open">
139
140=== modified file 'addons/openerp/controllers/templates/preferences/index.mako'
141--- addons/openerp/controllers/templates/preferences/index.mako 2016-11-21 09:45:23 +0000
142+++ addons/openerp/controllers/templates/preferences/index.mako 2017-09-26 07:32:44 +0000
143@@ -35,7 +35,7 @@
144 <button type='button' class="static_boxes"
145 onclick="open_password(); return false;"
146 >${_("Change Password")}</button>
147- <button type='button' class="static_boxes" onclick="window.frameElement.close();">${_("Cancel")}</button>
148+ <button type='button' class="static_boxes oe_form_button_cancel" onclick="window.frameElement.close();">${_("Cancel")}</button>
149 <button type='button' class="static_boxes" onclick="submit_form('ok');">${_("Save")}</button>
150 </td>
151 </tr>
152
153=== added file 'addons/openerp/controllers/templates/shortcut_tooltip.mako'
154--- addons/openerp/controllers/templates/shortcut_tooltip.mako 1970-01-01 00:00:00 +0000
155+++ addons/openerp/controllers/templates/shortcut_tooltip.mako 2017-09-26 07:32:44 +0000
156@@ -0,0 +1,13 @@
157+<%
158+# put in try block to prevent improper redirection on connection refuse error
159+try:
160+ SHORTCUT = cp.request.pool.get_controller("/openerp/shortcut_tooltip")
161+ display_message = SHORTCUT.get_show_shortcut()
162+ message = _("You haven't recently used a keyboard shortcut. You can see what shortcuts are available on this screen by holding SHIFT + CTRL.")
163+except:
164+ display_message = False
165+ message = 'toto'
166+%>
167+% if display_message:
168+<td id="shortcut_message" colspan="3">${message | h}</td>
169+% endif
170
171=== modified file 'addons/openerp/po/messages/fr.po'
172--- addons/openerp/po/messages/fr.po 2017-01-02 14:59:00 +0000
173+++ addons/openerp/po/messages/fr.po 2017-09-26 07:32:44 +0000
174@@ -1775,3 +1775,7 @@
175 #~ msgid "Click here to add new image."
176 #~ msgstr "Cliquez ici pour ajouter une nouvelle image"
177
178+#: controllers/templates/shortcut_tooltip.mako:6
179+#, python-format
180+msgid "You haven't recently used a keyboard shortcut. You can see what shortcuts are available on this screen by holding SHIFT + CTRL."
181+msgstr "Vous n'avez pas utilisé de raccourci clavier récemment. Vous pouvez voir quels raccourcis sont disponibles sur cet écrant en utilisant CTRL + SHIFT."
182
183=== modified file 'addons/openerp/static/css/screen.css'
184--- addons/openerp/static/css/screen.css 2017-07-10 08:56:45 +0000
185+++ addons/openerp/static/css/screen.css 2017-09-26 07:32:44 +0000
186@@ -2378,3 +2378,13 @@
187 background: rgba(255, 165, 0, .6);
188 white-space: pre-line;
189 }
190+
191+#shortcut_message {
192+ font-weight: bold;
193+ font-size: 1.2em;
194+ height: 2em;
195+ text-align: center;
196+ background: rgb(184, 222, 130);
197+ background: rgba(184, 222, 130, .6);
198+ white-space: pre-line;
199+}
200
201=== modified file 'addons/openerp/static/css/tips.css'
202--- addons/openerp/static/css/tips.css 2010-11-23 10:11:52 +0000
203+++ addons/openerp/static/css/tips.css 2017-09-26 07:32:44 +0000
204@@ -39,3 +39,22 @@
205 font-size: 12px;
206 }
207
208+
209+.shortcut_tooltip {
210+ padding: 4px;
211+ text-align: center;
212+ font-family: sans-serif;
213+ font-size: 11px;
214+ color: #666666;
215+ z-index: 1000;
216+ border-radius: 6px;
217+ -moz-border-radius: 6px;
218+ -webkit-border-radius: 6px;
219+ background: #FCF9A7;
220+ border: 1px solid #999;
221+ max-width: 500px;
222+ opacity: 1;
223+ -webkit-transition: opacity 1000ms linear;
224+ transition: opacity 1000ms linear;
225+ font-weight: bold;
226+}
227
228=== modified file 'addons/openerp/static/javascript/form.js'
229--- addons/openerp/static/javascript/form.js 2017-09-11 10:35:51 +0000
230+++ addons/openerp/static/javascript/form.js 2017-09-26 07:32:44 +0000
231@@ -255,11 +255,11 @@
232 }
233
234
235-function error_display(msg) {
236+function error_display(msg, title='Warning Message') {
237 var error = jQuery("<table>",{'width': '100%', 'height': '100%'}
238 ).append(
239 jQuery("<tr>").append(
240- jQuery("<td>", {'colspan': 2, 'class': 'error_message_header'}).text(_('Warning Message'))
241+ jQuery("<td>", {'colspan': 2, 'class': 'error_message_header'}).text(_(title))
242 ),
243 jQuery("<tr>").append(
244 jQuery("<td>", {'css': 'padding: 4px 2px;'}).append(
245@@ -275,7 +275,13 @@
246 .text('OK')
247 )
248 ));
249- window.top.jQuery.fancybox(error, {scrolling: 'no'});
250+ error.find('.button-a').focus()
251+ window.top.jQuery.fancybox(error, {
252+ scrolling: 'no',
253+ onComplete: function () {
254+ $(this).find(".button-a").focus()
255+ }
256+ });
257 }
258
259 function get_sidebar_status(args, noterp) {
260
261=== modified file 'addons/openerp/static/javascript/listgrid.js'
262--- addons/openerp/static/javascript/listgrid.js 2017-06-26 09:38:41 +0000
263+++ addons/openerp/static/javascript/listgrid.js 2017-09-26 07:32:44 +0000
264@@ -1101,7 +1101,7 @@
265 }, null, {
266 height: '98%',
267 max_height: 600
268- });
269+ }).focus();
270 },
271
272 importData: function() {
273@@ -1115,7 +1115,7 @@
274 height: '98%',
275 max_height: 550,
276 width: '95%'
277- });
278+ }).focus();
279 }
280 });
281
282
283=== modified file 'addons/openerp/static/javascript/m2m.js'
284--- addons/openerp/static/javascript/m2m.js 2017-01-02 14:59:00 +0000
285+++ addons/openerp/static/javascript/m2m.js 2017-09-26 07:32:44 +0000
286@@ -190,7 +190,7 @@
287 } else {
288 url = '/openerp/search/new';
289 }
290- return $.frame_dialog({
291+ var $frame = $.frame_dialog({
292 src: openobject.http.getURL(url, options)
293 }, {
294 'source-window': $this[0],
295@@ -199,6 +199,8 @@
296 width: '90%',
297 height: '95%'
298 });
299+ $frame.focus();
300+ return $frame;
301 }
302
303 /**
304
305=== modified file 'addons/openerp/static/javascript/m2o.js'
306--- addons/openerp/static/javascript/m2o.js 2017-06-01 13:48:36 +0000
307+++ addons/openerp/static/javascript/m2o.js 2017-09-26 07:32:44 +0000
308@@ -606,7 +606,7 @@
309 } else {
310 url = '/openerp/search/new';
311 }
312- return $.frame_dialog({
313+ var $frame = $.frame_dialog({
314 src: openobject.http.getURL(url, options)
315 }, {
316 'source-window': $this[0],
317@@ -616,6 +616,8 @@
318 max_width: 1200,
319 height: '95%'
320 });
321+ $frame.focus();
322+ return $frame;
323 }
324
325 /**
326@@ -681,7 +683,7 @@
327 if(arguments[0] === "close") {
328 return close($this, arguments[1]);
329 } else {
330- return open($this, arguments[0]);
331+ return open($this, arguments[0]).focus();
332 }
333 };
334 })(jQuery);
335
336=== modified file 'addons/openerp/static/javascript/o2m.js'
337--- addons/openerp/static/javascript/o2m.js 2017-01-02 14:59:00 +0000
338+++ addons/openerp/static/javascript/o2m.js 2017-09-26 07:32:44 +0000
339@@ -252,7 +252,13 @@
340 });
341 $frame.load(function() {
342 $frame_content = $frame.contents();
343- $frame_content.find("[autofocus='autofocus']").focus();
344+ if ($frame_content.find("[autofocus='autofocus']").lenght) {
345+ // if a field have an autofocus attribute, set the focus on it
346+ $frame_content.find("[autofocus='autofocus']").focus();
347+ }
348+ else {
349+ $frame.focus(); // set the focus on the whole frame
350+ }
351 });
352 var $form = jQuery('<form>', {
353 method: 'POST',
354
355=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
356--- addons/openerp/static/javascript/openerp/openerp.base.js 2017-09-11 10:40:59 +0000
357+++ addons/openerp/static/javascript/openerp/openerp.base.js 2017-09-26 07:32:44 +0000
358@@ -187,13 +187,14 @@
359 var $dialogs = jQuery('.action-dialog');
360 switch(target) {
361 case 'new':
362- jQuery.frame_dialog({
363+ $frame = jQuery.frame_dialog({
364 src: action_url,
365 'class': 'action-dialog'
366 }, null, {
367 width: '90%',
368 height: '95%'
369 });
370+ $frame.focus();
371 if (terp_id && !$dialogs.length) {
372 if (jQuery('#_terp_id').val() == 'False') {
373 // we are opening an action on an unsaved record,
374
375=== modified file 'addons/openerp/static/javascript/web_keyboard_shortcuts.js'
376--- addons/openerp/static/javascript/web_keyboard_shortcuts.js 2017-09-12 09:54:25 +0000
377+++ addons/openerp/static/javascript/web_keyboard_shortcuts.js 2017-09-26 07:32:44 +0000
378@@ -28,9 +28,107 @@
379
380 $.ctrlshift = function(key, callback, args) {
381 $(document).keydown(function(e) {
382+ if (e.ctrlKey && e.shiftKey) {
383+ var class_to_parse = null
384+ if (key == 'S'){
385+ class_to_parse = '.oe_form_button_save, .oe_form_button_save_line, .oe_form_button_save_close';
386+ }
387+ else if (key == 'E'){
388+ class_to_parse = '.oe_form_button_save_edit, .oe_form_button_edit';
389+ }
390+ else if (key == '46'){
391+ class_to_parse = '.oe_form_button_delete';
392+ }
393+ else if (key == 'Z'){
394+ class_to_parse = '.oe_form_button_cancel';
395+ }
396+ else if (key == 'C'){
397+ class_to_parse = '.oe_form_button_create, .oe_form_button_save_create';
398+ }
399+ else if (key == 'D'){
400+ class_to_parse = '.oe_form_button_duplicate';
401+ }
402+ else if (key == '13'){
403+ class_to_parse = '.oe_form_button_search';
404+ }
405+ else if (key == '38'){
406+ class_to_parse = '.oe_button_pager[action="first"]';
407+ }
408+ else if (key == '37'){
409+ class_to_parse = '.oe_button_pager[action="previous"]';
410+ }
411+ else if (key == '39'){
412+ class_to_parse = '.oe_button_pager[action="next"]';
413+ }
414+ else if (key == '40'){
415+ class_to_parse = '.oe_button_pager[action="last"]';
416+ }
417+ if (class_to_parse != null){
418+ //$('.oe_form_button_save')
419+ $(class_to_parse).each(function() {
420+
421+ // do not display tooltips on hidden notebook-page
422+ if ($(this).closest('.notebook-page').length && !$(this).closest('.notebook-page-active').length){
423+ console.log('notebook page not active');
424+
425+ }
426+ else {
427+ if (key == '46'){
428+ key_to_display = 'Del.'
429+ }
430+ else if (key == '13') {
431+ key_to_display = 'Enter&nbsp;&#8629;' // Enter
432+ //key_to_display = 'Enter' // Enter
433+ }
434+ else if (key == '38') {
435+ key_to_display = '&#8679;' // UP
436+ }
437+ else if (key == '37') {
438+ key_to_display = '&#8678;' // Left
439+ }
440+ else if (key == '39') {
441+ key_to_display = '&#8680;' // Right
442+ }
443+ else if (key == '40') {
444+ key_to_display = '&#8681;' // Down
445+ }
446+ else {
447+ key_to_display = key
448+ }
449+ if ($(this).width() == 0) {
450+ return false;
451+ }
452+ var $newdiv1 = $( "<span class='shortcut_tooltip'>" + key_to_display + "</span>" );
453+ $( "body" ).append($newdiv1);
454+ var postion = $(this).position();
455+ var new_top = postion.top + 20;
456+ if ($(this).width() <= 20){
457+ var new_left = postion.left - $newdiv1.width()/2;
458+ }
459+ else {
460+ var new_left = postion.left + $(this).width()/2 - $newdiv1.width()/2 + 6;
461+ }
462+ $newdiv1.css({top: new_top, left: new_left, position:'absolute'});
463+ setTimeout(function() {
464+ $newdiv1.css({'opacity': '0'});
465+ }, 1000);
466+
467+ setTimeout(function() {
468+ $newdiv1.remove();
469+ }, 2000);
470+ }
471+ });
472+ }
473+ }
474 if(!args) args=[]; // IE barks when args is null
475 if((e.keyCode == key.charCodeAt(0) || e.keyCode == key) && e.ctrlKey && e.shiftKey) {
476 e.preventDefault(); // override the browser shortcut keys
477+ if (!document.nb_shortcut_used){
478+ document.nb_shortcut_used = 1;
479+ }
480+ else{
481+ document.nb_shortcut_used += 1;
482+ }
483 callback.apply(this, args);
484 return false;
485 }
486@@ -132,14 +230,14 @@
487 });
488 });
489
490-//Previous object (arrow right)
491+//Previous object (arrow left)
492 $.ctrlshift('37', function() {
493 $('.oe_button_pager[action="previous"]').each(function() {
494 fake_click(this);
495 });
496 });
497
498-//Next object (arrow left)
499+//Next object (arrow right)
500 $.ctrlshift('39', function() {
501 $('.oe_button_pager[action="next"]').each(function() {
502 fake_click(this);

Subscribers

People subscribed via source and target branches