Merge lp:~openerp-dev/openerp-web/trunk-process_view-vja into lp:~openerp-dev/openerp-web/trunk-process-view

Proposed by Vishmita Jadeja (openerp)
Status: Merged
Merged at revision: 2977
Proposed branch: lp:~openerp-dev/openerp-web/trunk-process_view-vja
Merge into: lp:~openerp-dev/openerp-web/trunk-process-view
Diff against target: 12896 lines (+6532/-2707)
37 files modified
addons/web/static/src/css/Makefile (+1/-1)
addons/web/static/src/css/base.css (+70/-19)
addons/web/static/src/css/base.sass (+29/-15)
addons/web/static/src/js/chrome.js (+55/-55)
addons/web/static/src/js/corelib.js (+22/-22)
addons/web/static/src/js/coresetup.js (+80/-76)
addons/web/static/src/js/data_export.js (+59/-59)
addons/web/static/src/js/data_import.js (+28/-28)
addons/web/static/src/js/search.js (+83/-83)
addons/web/static/src/js/view_form.js (+128/-121)
addons/web/static/src/js/view_list.js (+28/-28)
addons/web/static/src/js/view_list_editable.js (+19/-19)
addons/web/static/src/js/view_tree.js (+13/-13)
addons/web/static/src/js/views.js (+36/-36)
addons/web/static/src/xml/base.xml (+1/-1)
addons/web/static/test/Widget.js (+22/-22)
addons/web_calendar/static/src/js/calendar.js (+10/-10)
addons/web_diagram/static/src/js/diagram.js (+9/-9)
addons/web_gantt/static/src/js/gantt.js (+5/-5)
addons/web_graph/static/src/js/graph.js (+14/-14)
addons/web_graph/static/src/xml/web_graph.xml (+1/-1)
addons/web_kanban/static/src/js/kanban.js (+44/-44)
addons/web_kanban/static/src/xml/web_kanban.xml (+1/-1)
addons/web_mobile/static/src/js/chrome_mobile.js (+29/-29)
addons/web_mobile/static/src/js/form_mobile.js (+6/-6)
addons/web_mobile/static/src/js/list_mobile.js (+5/-5)
addons/web_process/__openerp__.py (+2/-1)
addons/web_process/static/lib/dracula/dracula_algorithms.js (+0/-599)
addons/web_process/static/lib/dracula/dracula_graffle.js (+0/-107)
addons/web_process/static/lib/dracula/dracula_graph.coffee (+0/-524)
addons/web_process/static/lib/dracula/dracula_graph.js (+0/-527)
addons/web_process/static/lib/js/raphael.js (+5501/-0)
addons/web_process/static/src/css/process.css (+10/-13)
addons/web_process/static/src/js/process.js (+140/-142)
addons/web_process/static/src/xml/web_process.xml (+28/-19)
addons/web_tests/static/src/js/web_tests.js (+2/-2)
addons/web_view_editor/static/src/js/view_editor.js (+51/-51)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-process_view-vja
Reviewer Review Type Date Requested Status
Jiten (OpenERP) Approve
Review via email: mp+121157@code.launchpad.net

Description of the change

Replace dracula library with raphale JS in process view

To post a comment you must log in.
2973. By Vishmita Jadeja (openerp)

[Fix]css changes

2974. By Vishmita Jadeja (openerp)

[Merge]Merge trunk

2975. By Vishmita Jadeja (openerp)

[Fix]Resolve conflicts

Revision history for this message
Jiten (OpenERP) (jiten-openerp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/css/Makefile'
--- addons/web/static/src/css/Makefile 2012-03-27 22:20:41 +0000
+++ addons/web/static/src/css/Makefile 2012-08-27 06:09:20 +0000
@@ -1,3 +1,3 @@
1base.css: base.sass1base.css: base.sass
2 sass -t expanded base.sass base.css2 sass --trace -t expanded base.sass base.css
33
44
=== modified file 'addons/web/static/src/css/base.css'
--- addons/web/static/src/css/base.css 2012-08-24 10:44:36 +0000
+++ addons/web/static/src/css/base.css 2012-08-27 06:09:20 +0000
@@ -141,13 +141,6 @@
141 background-image: -o-linear-gradient(top, #eeeeee, #dedede);141 background-image: -o-linear-gradient(top, #eeeeee, #dedede);
142 background-image: linear-gradient(to bottom, #eeeeee, #dedede);142 background-image: linear-gradient(to bottom, #eeeeee, #dedede);
143}143}
144.openerp ul, .openerp li, .openerp ol {
145 margin: 0;
146 padding: 0;
147}
148.openerp li {
149 list-style-type: none;
150}
151.openerp input, .openerp textarea, .openerp select {144.openerp input, .openerp textarea, .openerp select {
152 padding: 2px 4px;145 padding: 2px 4px;
153 border: 1px solid #cccccc;146 border: 1px solid #cccccc;
@@ -162,6 +155,13 @@
162.openerp h4 {155.openerp h4 {
163 margin: 4px 0;156 margin: 4px 0;
164}157}
158.openerp .oe_semantic_html_override ul, .openerp .oe_semantic_html_override li, .openerp .oe_semantic_html_override ol {
159 margin: 0;
160 padding: 0;
161}
162.openerp .oe_semantic_html_override ul li, .openerp .oe_semantic_html_override li li, .openerp .oe_semantic_html_override ol li {
163 list-style-type: none;
164}
165.openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button {165.openerp a.button:link, .openerp a.button:visited, .openerp button, .openerp input[type='submit'], .openerp .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button {
166 display: inline-block;166 display: inline-block;
167 border: 1px solid #ababab;167 border: 1px solid #ababab;
@@ -454,13 +454,6 @@
454 -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);454 -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
455 box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);455 box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
456}456}
457.openerp ul.oe_flatlist, .openerp ol.oe_flatlist {
458 margin: 0;
459 padding: 0;
460}
461.openerp ul.oe_flatlist li, .openerp ol.oe_flatlist li {
462 list-style-type: none;
463}
464.openerp .oe_form_dirty .oe_highlight_on_dirty {457.openerp .oe_form_dirty .oe_highlight_on_dirty {
465 color: white;458 color: white;
466 background: #dc5f59;459 background: #dc5f59;
@@ -633,6 +626,18 @@
633 padding: 0 16px;626 padding: 0 16px;
634 list-style: none;627 list-style: none;
635 zoom: 1;628 zoom: 1;
629 margin: 0;
630 padding: 0;
631}
632.openerp .oe_notebook li {
633 list-style-type: none;
634}
635.openerp .oe_notebook ul, .openerp .oe_notebook li, .openerp .oe_notebook ol {
636 margin: 0;
637 padding: 0;
638}
639.openerp .oe_notebook ul li, .openerp .oe_notebook li li, .openerp .oe_notebook ol li {
640 list-style-type: none;
636}641}
637.openerp .oe_notebook.ui-corner-all {642.openerp .oe_notebook.ui-corner-all {
638 -moz-border-radius: 0;643 -moz-border-radius: 0;
@@ -937,6 +942,13 @@
937 -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);942 -webkit-box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
938 box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);943 box-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
939}944}
945.openerp .oe_login .oe_login_pane ul, .openerp .oe_login .oe_login_pane li, .openerp .oe_login .oe_login_pane ol {
946 margin: 0;
947 padding: 0;
948}
949.openerp .oe_login .oe_login_pane ul li, .openerp .oe_login .oe_login_pane li li, .openerp .oe_login .oe_login_pane ol li {
950 list-style-type: none;
951}
940.openerp .oe_login .oe_login_pane h2 {952.openerp .oe_login .oe_login_pane h2 {
941 margin-top: 0;953 margin-top: 0;
942 font-size: 18px;954 font-size: 18px;
@@ -1016,6 +1028,13 @@
1016 background-image: -o-linear-gradient(top, #646060, #262626);1028 background-image: -o-linear-gradient(top, #646060, #262626);
1017 background-image: linear-gradient(to bottom, #646060, #262626);1029 background-image: linear-gradient(to bottom, #646060, #262626);
1018}1030}
1031.openerp .oe_topbar ul, .openerp .oe_topbar li, .openerp .oe_topbar ol {
1032 margin: 0;
1033 padding: 0;
1034}
1035.openerp .oe_topbar ul li, .openerp .oe_topbar li li, .openerp .oe_topbar ol li {
1036 list-style-type: none;
1037}
1019.openerp .oe_topbar .oe_topbar_item {1038.openerp .oe_topbar .oe_topbar_item {
1020 display: block;1039 display: block;
1021 padding: 5px 10px 7px;1040 padding: 5px 10px 7px;
@@ -1088,6 +1107,13 @@
1088 text-shadow: 0 1px 1px white;1107 text-shadow: 0 1px 1px white;
1089 padding-bottom: 16px;1108 padding-bottom: 16px;
1090}1109}
1110.openerp .oe_leftbar ul, .openerp .oe_leftbar li, .openerp .oe_leftbar ol {
1111 margin: 0;
1112 padding: 0;
1113}
1114.openerp .oe_leftbar ul li, .openerp .oe_leftbar li li, .openerp .oe_leftbar ol li {
1115 list-style-type: none;
1116}
1091.openerp a.oe_logo {1117.openerp a.oe_logo {
1092 width: 220px;1118 width: 220px;
1093 display: block;1119 display: block;
@@ -1213,6 +1239,13 @@
1213 margin: 0px;1239 margin: 0px;
1214 padding: 1px 4px;1240 padding: 1px 4px;
1215}1241}
1242.openerp .oe_secondary_submenu .oe_menu_counter:hover {
1243 cursor: pointer;
1244 border: 1px solid #c81010;
1245 -moz-box-shadow: 0 0 2px #c81010;
1246 -webkit-box-shadow: 0 0 2px #c81010;
1247 box-shadow: 0 0 2px #c81010;
1248}
1216.openerp .oe_secondary_submenu .oe_active {1249.openerp .oe_secondary_submenu .oe_active {
1217 background: #7c7bad;1250 background: #7c7bad;
1218 border-top: 1px solid lightGray;1251 border-top: 1px solid lightGray;
@@ -1283,6 +1316,13 @@
1283 width: 100%;1316 width: 100%;
1284 table-layout: fixed;1317 table-layout: fixed;
1285}1318}
1319.openerp .oe_view_manager table.oe_view_manager_header ul, .openerp .oe_view_manager table.oe_view_manager_header li, .openerp .oe_view_manager table.oe_view_manager_header ol {
1320 margin: 0;
1321 padding: 0;
1322}
1323.openerp .oe_view_manager table.oe_view_manager_header ul li, .openerp .oe_view_manager table.oe_view_manager_header li li, .openerp .oe_view_manager table.oe_view_manager_header ol li {
1324 list-style-type: none;
1325}
1286.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row {1326.openerp .oe_view_manager table.oe_view_manager_header .oe_header_row {
1287 clear: both;1327 clear: both;
1288 text-shadow: 0 1px 1px white;1328 text-shadow: 0 1px 1px white;
@@ -1952,7 +1992,7 @@
1952.openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator {1992.openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator {
1953 margin: 12px 0 8px 0;1993 margin: 12px 0 8px 0;
1954}1994}
1955.openerp .oe_form div.oe_form_configuration p {1995.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol {
1956 color: #aaaaaa;1996 color: #aaaaaa;
1957 max-width: 650px;1997 max-width: 650px;
1958}1998}
@@ -2401,6 +2441,20 @@
2401 float: right;2441 float: right;
2402 padding-left: 2px;2442 padding-left: 2px;
2403}2443}
2444.openerp .oe_form_field_status {
2445 margin: 0;
2446 padding: 0;
2447}
2448.openerp .oe_form_field_status ul, .openerp .oe_form_field_status li, .openerp .oe_form_field_status ol {
2449 margin: 0;
2450 padding: 0;
2451}
2452.openerp .oe_form_field_status ul li, .openerp .oe_form_field_status li li, .openerp .oe_form_field_status ol li {
2453 list-style-type: none;
2454}
2455.openerp .oe_form_field_status li {
2456 list-style-type: none;
2457}
2404.openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page {2458.openerp .oe_form .oe_form_field_one2many > .oe_view_manager .oe_list_pager_single_page {
2405 display: none;2459 display: none;
2406}2460}
@@ -2763,6 +2817,7 @@
2763 -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);2817 -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
2764 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);2818 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
2765 margin-top: 4px;2819 margin-top: 4px;
2820 border: 1px solid #afafb6;
2766}2821}
2767.ui-menu .ui-menu-item {2822.ui-menu .ui-menu-item {
2768 width: 100%;2823 width: 100%;
@@ -2788,7 +2843,3 @@
2788 -webkit-border-radius: 3px;2843 -webkit-border-radius: 3px;
2789 border-radius: 3px;2844 border-radius: 3px;
2790}2845}
2791
2792.ui-widget-content {
2793 border: 1px solid #afafb6;
2794}
27952846
=== modified file 'addons/web/static/src/css/base.sass'
--- addons/web/static/src/css/base.sass 2012-08-24 10:44:36 +0000
+++ addons/web/static/src/css/base.sass 2012-08-27 06:09:20 +0000
@@ -111,6 +111,16 @@
111 content: $icon-name111 content: $icon-name
112 color: $color112 color: $color
113113
114@mixin ul-html-override()
115 margin: 0
116 padding: 0
117 li
118 list-style-type: none
119
120@mixin semantic-html-override()
121 ul, li, ol
122 @include ul-html-override()
123
114// }}}124// }}}
115// CSS animation bounces {{{125// CSS animation bounces {{{
116@-moz-keyframes bounce126@-moz-keyframes bounce
@@ -194,11 +204,6 @@
194 @include vertical-gradient(#f0f0fa, #eeeef6)204 @include vertical-gradient(#f0f0fa, #eeeef6)
195 .zebra tbody tr:hover td205 .zebra tbody tr:hover td
196 @include vertical-gradient(#eee, #dedede)206 @include vertical-gradient(#eee, #dedede)
197 ul, li, ol
198 margin: 0
199 padding: 0
200 li
201 list-style-type: none
202 input, textarea, select207 input, textarea, select
203 padding: 2px 4px208 padding: 2px 4px
204 border: 1px solid #ccc209 border: 1px solid #ccc
@@ -208,6 +213,8 @@
208 vertical-align: middle213 vertical-align: middle
209 h4214 h4
210 margin: 4px 0215 margin: 4px 0
216 .oe_semantic_html_override
217 @include semantic-html-override
211 // }}}218 // }}}
212 // Button style {{{219 // Button style {{{
213 a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button220 a.button:link, a.button:visited, button, input[type='submit'], .ui-dialog-buttonpane .ui-dialog-buttonset .ui-button
@@ -391,12 +398,6 @@
391 //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%))398 //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%))
392 @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2))399 @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2))
393400
394 ul.oe_flatlist, ol.oe_flatlist
395 margin: 0
396 padding: 0
397 li
398 list-style-type: none
399
400 .oe_form_dirty401 .oe_form_dirty
401 .oe_highlight_on_dirty402 .oe_highlight_on_dirty
402 color: white403 color: white
@@ -515,6 +516,8 @@
515 padding: 0 16px516 padding: 0 16px
516 list-style: none517 list-style: none
517 zoom: 1518 zoom: 1
519 @include ul-html-override
520 @include semantic-html-override
518 .oe_notebook.ui-corner-all521 .oe_notebook.ui-corner-all
519 @include radius(0)522 @include radius(0)
520 .oe_notebook:before, .oe_notebook:after523 .oe_notebook:before, .oe_notebook:after
@@ -734,6 +737,7 @@
734 text-align: left737 text-align: left
735 @include radius(8px)738 @include radius(8px)
736 @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9))739 @include box-shadow(0 0 18px rgba(0, 0, 0, 0.9))
740 @include semantic-html-override
737 h2741 h2
738 margin-top: 0742 margin-top: 0
739 font-size: 18px743 font-size: 18px
@@ -799,6 +803,7 @@
799 height: 31px803 height: 31px
800 border-top: solid 1px #d3d3d3804 border-top: solid 1px #d3d3d3
801 @include vertical-gradient(#646060, #262626)805 @include vertical-gradient(#646060, #262626)
806 @include semantic-html-override
802 .oe_topbar_item807 .oe_topbar_item
803 display: block808 display: block
804 padding: 5px 10px 7px809 padding: 5px 10px 7px
@@ -849,6 +854,7 @@
849 border-right: 1px solid $tag-border854 border-right: 1px solid $tag-border
850 text-shadow: 0 1px 1px white855 text-shadow: 0 1px 1px white
851 padding-bottom: 16px856 padding-bottom: 16px
857 @include semantic-html-override
852 a.oe_logo858 a.oe_logo
853 width: 220px859 width: 220px
854 display: block860 display: block
@@ -951,6 +957,10 @@
951 text-shadow: 0 1px 1px rgba(0,0,0,0.2)957 text-shadow: 0 1px 1px rgba(0,0,0,0.2)
952 margin: 0px958 margin: 0px
953 padding: 1px 4px959 padding: 1px 4px
960 &:hover
961 cursor: pointer
962 border: 1px solid #C81010
963 @include box-shadow(0 0 2px #C81010)
954 .oe_active964 .oe_active
955 background: $link-color965 background: $link-color
956 border-top: 1px solid lightGray966 border-top: 1px solid lightGray
@@ -1009,6 +1019,7 @@
1009 table.oe_view_manager_header1019 table.oe_view_manager_header
1010 width: 100%1020 width: 100%
1011 table-layout: fixed1021 table-layout: fixed
1022 @include semantic-html-override
1012 .oe_header_row1023 .oe_header_row
1013 //min-height: 26px1024 //min-height: 26px
1014 //line-height: 26px1025 //line-height: 26px
@@ -1521,7 +1532,7 @@
1521 div.oe_form_configuration1532 div.oe_form_configuration
1522 div.oe_horizontal_separator 1533 div.oe_horizontal_separator
1523 margin: 12px 0 8px 01534 margin: 12px 0 8px 0
1524 p1535 p, ul, ol
1525 color: #aaa1536 color: #aaa
1526 max-width: 650px1537 max-width: 650px
1527 label1538 label
@@ -1856,6 +1867,11 @@
1856 float: right1867 float: right
1857 padding-left: 2px1868 padding-left: 2px
1858 // }}}1869 // }}}
1870 // FormView.fieldstatus {{{
1871 .oe_form_field_status
1872 @include semantic-html-override
1873 @include ul-html-override
1874 // }}}
1859 // FormView.one2many {{{1875 // FormView.one2many {{{
1860 .oe_form .oe_form_field_one2many > .oe_view_manager1876 .oe_form .oe_form_field_one2many > .oe_view_manager
1861 .oe_list_pager_single_page1877 .oe_list_pager_single_page
@@ -2161,6 +2177,7 @@
2161 padding: 2px 02177 padding: 2px 0
2162 @include box-shadow(0 1px 4px rgba(0,0,0,0.3))2178 @include box-shadow(0 1px 4px rgba(0,0,0,0.3))
2163 margin-top: 4px2179 margin-top: 4px
2180 border: 1px solid $tag-border
2164 .ui-menu-item2181 .ui-menu-item
2165 width: 100%2182 width: 100%
2166 padding: 02183 padding: 0
@@ -2178,8 +2195,5 @@
2178.ui-corner-all2195.ui-corner-all
2179 @include radius(3px)2196 @include radius(3px)
21802197
2181.ui-widget-content
2182 border: 1px solid $tag-border
2183
2184// au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css"2198// au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers <afile> > "%:p:r.css"
2185// vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:2199// vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:
21862200
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js 2012-08-21 17:12:05 +0000
+++ addons/web/static/src/js/chrome.js 2012-08-27 06:09:20 +0000
@@ -13,7 +13,7 @@
13 },13 },
14 start: function() {14 start: function() {
15 this._super.apply(this, arguments);15 this._super.apply(this, arguments);
16 this.$element.notify({16 this.$el.notify({
17 speed: 500,17 speed: 500,
18 expires: 250018 expires: 2500
19 });19 });
@@ -24,7 +24,7 @@
24 if (sticky) {24 if (sticky) {
25 opts.expires = false;25 opts.expires = false;
26 }26 }
27 this.$element.notify('create', {27 this.$el.notify('create', {
28 title: title,28 title: title,
29 text: text29 text: text
30 }, opts);30 }, opts);
@@ -35,7 +35,7 @@
35 if (sticky) {35 if (sticky) {
36 opts.expires = false;36 opts.expires = false;
37 }37 }
38 this.$element.notify('create', 'oe_notification_alert', {38 this.$el.notify('create', 'oe_notification_alert', {
39 title: title,39 title: title,
40 text: text40 text: text
41 }, opts);41 }, opts);
@@ -123,22 +123,22 @@
123 if (! this.dialog_inited)123 if (! this.dialog_inited)
124 this.init_dialog();124 this.init_dialog();
125 var o = this.get_options(options);125 var o = this.get_options(options);
126 instance.web.dialog(this.$element, o).dialog('open');126 instance.web.dialog(this.$el, o).dialog('open');
127 if (o.height === 'auto' && o.max_height) {127 if (o.height === 'auto' && o.max_height) {
128 this.$element.css({ 'max-height': o.max_height, 'overflow-y': 'auto' });128 this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' });
129 }129 }
130 return this;130 return this;
131 },131 },
132 init_dialog: function(options) {132 init_dialog: function(options) {
133 this.renderElement();133 this.renderElement();
134 var o = this.get_options(options);134 var o = this.get_options(options);
135 instance.web.dialog(this.$element, o);135 instance.web.dialog(this.$el, o);
136 var res = this.start();136 var res = this.start();
137 this.dialog_inited = true;137 this.dialog_inited = true;
138 return res;138 return res;
139 },139 },
140 close: function() {140 close: function() {
141 this.$element.dialog('close');141 this.$el.dialog('close');
142 },142 },
143 on_close: function() {143 on_close: function() {
144 if (this.__tmp_dialog_destroying)144 if (this.__tmp_dialog_destroying)
@@ -161,7 +161,7 @@
161 this.__tmp_dialog_destroying = undefined;161 this.__tmp_dialog_destroying = undefined;
162 }162 }
163 if (! this.isDestroyed()) {163 if (! this.isDestroyed()) {
164 this.$element.dialog('destroy');164 this.$el.dialog('destroy');
165 }165 }
166 this._super();166 this._super();
167 }167 }
@@ -224,7 +224,7 @@
224 min_height: '600px',224 min_height: '600px',
225 buttons: buttons225 buttons: buttons
226 }).open();226 }).open();
227 dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.session, error: error}));227 dialog.$el.html(QWeb.render('CrashManager.error', {session: instance.session, error: error}));
228 },228 },
229 on_javascript_exception: function(exception) {229 on_javascript_exception: function(exception) {
230 this.on_traceback({230 this.on_traceback({
@@ -270,12 +270,12 @@
270 this.count += increment;270 this.count += increment;
271 if (this.count > 0) {271 if (this.count > 0) {
272 if (instance.session.debug) {272 if (instance.session.debug) {
273 this.$element.text(_.str.sprintf( _t("Loading (%d)"), this.count));273 this.$el.text(_.str.sprintf( _t("Loading (%d)"), this.count));
274 } else {274 } else {
275 this.$element.text(_t("Loading"));275 this.$el.text(_t("Loading"));
276 }276 }
277 this.$element.show();277 this.$el.show();
278 this.getParent().$element.addClass('oe_wait');278 this.getParent().$el.addClass('oe_wait');
279 } else {279 } else {
280 this.count = 0;280 this.count = 0;
281 clearTimeout(this.long_running_timer);281 clearTimeout(this.long_running_timer);
@@ -284,8 +284,8 @@
284 this.blocked_ui = false;284 this.blocked_ui = false;
285 instance.web.unblockUI();285 instance.web.unblockUI();
286 }286 }
287 this.$element.fadeOut();287 this.$el.fadeOut();
288 this.getParent().$element.removeClass('oe_wait');288 this.getParent().$el.removeClass('oe_wait');
289 }289 }
290 }290 }
291});291});
@@ -317,7 +317,7 @@
317 do_render: function() {317 do_render: function() {
318 var self = this;318 var self = this;
319 instance.webclient.toggle_bars(true);319 instance.webclient.toggle_bars(true);
320 self.$element.html(QWeb.render("DatabaseManager", { widget : self }));320 self.$el.html(QWeb.render("DatabaseManager", { widget : self }));
321 $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self }));321 $('.oe_user_menu_placeholder').append(QWeb.render("DatabaseManager.user_menu",{ widget : self }));
322 $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self }));322 $('.oe_secondary_menus_container').append(QWeb.render("DatabaseManager.menu",{ widget : self }));
323 $('ul.oe_secondary_submenu > li:first').addClass('oe_active')323 $('ul.oe_secondary_submenu > li:first').addClass('oe_active')
@@ -329,14 +329,14 @@
329 event.preventDefault();329 event.preventDefault();
330 });330 });
331 $('#back-to-login').click(self.do_exit);331 $('#back-to-login').click(self.do_exit);
332 self.$element.find("td").addClass("oe_form_group_cell");332 self.$el.find("td").addClass("oe_form_group_cell");
333 self.$element.find("tr td:first-child").addClass("oe_form_group_cell_label");333 self.$el.find("tr td:first-child").addClass("oe_form_group_cell_label");
334 self.$element.find("label").addClass("oe_form_label");334 self.$el.find("label").addClass("oe_form_label");
335 self.$element.find("form[name=create_db_form]").validate({ submitHandler: self.do_create });335 self.$el.find("form[name=create_db_form]").validate({ submitHandler: self.do_create });
336 self.$element.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop });336 self.$el.find("form[name=drop_db_form]").validate({ submitHandler: self.do_drop });
337 self.$element.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup });337 self.$el.find("form[name=backup_db_form]").validate({ submitHandler: self.do_backup });
338 self.$element.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore });338 self.$el.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore });
339 self.$element.find("form[name=change_pwd_form]").validate({339 self.$el.find("form[name=change_pwd_form]").validate({
340 messages: {340 messages: {
341 old_pwd: "Please enter your previous password",341 old_pwd: "Please enter your previous password",
342 new_pwd: "Please enter your new password",342 new_pwd: "Please enter your new password",
@@ -349,7 +349,7 @@
349 });349 });
350 },350 },
351 destroy: function () {351 destroy: function () {
352 this.$element.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty();352 this.$el.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login').unbind('click').end().empty();
353 this._super();353 this._super();
354 },354 },
355 /**355 /**
@@ -500,7 +500,7 @@
500 });500 });
501 },501 },
502 do_exit: function () {502 do_exit: function () {
503 this.$element.remove();503 this.$el.remove();
504 instance.webclient.toggle_bars(false);504 instance.webclient.toggle_bars(false);
505 this.do_action('login');505 this.do_action('login');
506 }506 }
@@ -533,8 +533,8 @@
533 },533 },
534 start: function() {534 start: function() {
535 var self = this;535 var self = this;
536 self.$element.find("form").submit(self.on_submit);536 self.$el.find("form").submit(self.on_submit);
537 self.$element.find('.oe_login_manage_db').click(function() {537 self.$el.find('.oe_login_manage_db').click(function() {
538 self.do_action("database_manager");538 self.do_action("database_manager");
539 });539 });
540 var d;540 var d;
@@ -584,7 +584,7 @@
584 */584 */
585 do_login: function (db, login, password) {585 do_login: function (db, login, password) {
586 var self = this;586 var self = this;
587 this.$element.removeClass('oe_login_invalid');587 this.$el.removeClass('oe_login_invalid');
588 self.$(".oe_login_pane").fadeOut("slow");588 self.$(".oe_login_pane").fadeOut("slow");
589 return this.session.session_authenticate(db, login, password).pipe(function() {589 return this.session.session_authenticate(db, login, password).pipe(function() {
590 if (self.has_local_storage) {590 if (self.has_local_storage) {
@@ -603,7 +603,7 @@
603 self.trigger('login_successful');603 self.trigger('login_successful');
604 },function () {604 },function () {
605 self.$(".oe_login_pane").fadeIn("fast", function() {605 self.$(".oe_login_pane").fadeIn("fast", function() {
606 self.$element.addClass("oe_login_invalid");606 self.$el.addClass("oe_login_invalid");
607 });607 });
608 });608 });
609 },609 },
@@ -663,7 +663,7 @@
663 template: "ChangePassword",663 template: "ChangePassword",
664 start: function() {664 start: function() {
665 var self = this;665 var self = this;
666 self.$element.validate({666 self.$el.validate({
667 submitHandler: function (form) {667 submitHandler: function (form) {
668 self.rpc("/web/session/change_password",{668 self.rpc("/web/session/change_password",{
669 'fields': $(form).serializeArray()669 'fields': $(form).serializeArray()
@@ -700,7 +700,7 @@
700 },700 },
701 start: function() {701 start: function() {
702 this._super.apply(this, arguments);702 this._super.apply(this, arguments);
703 this.$secondary_menus = this.getParent().$element.find('.oe_secondary_menus_container');703 this.$secondary_menus = this.getParent().$el.find('.oe_secondary_menus_container');
704 this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click);704 this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click);
705 return this.do_reload();705 return this.do_reload();
706 },706 },
@@ -718,7 +718,7 @@
718 $toplevel.hide();718 $toplevel.hide();
719 }719 }
720 this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this }));720 this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this }));
721 this.$element.on('click', 'a[data-menu]', this.on_menu_click);721 this.$el.on('click', 'a[data-menu]', this.on_menu_click);
722 // Hide second level submenus722 // Hide second level submenus
723 this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide();723 this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide();
724 if (self.current_menu) {724 if (self.current_menu) {
@@ -733,7 +733,7 @@
733 }733 }
734 if (maximum_visible_links < this.data.data.children.length) {734 if (maximum_visible_links < this.data.data.children.length) {
735 var $more = $(QWeb.render('Menu.more')),735 var $more = $(QWeb.render('Menu.more')),
736 $index = this.$element.find('li').eq(maximum_visible_links - 1);736 $index = this.$el.find('li').eq(maximum_visible_links - 1);
737 $index.after($more);737 $index.after($more);
738 //$('.oe_topbar').append($more);738 //$('.oe_topbar').append($more);
739 $more.find('.oe_menu_more').append($index.next().nextAll());739 $more.find('.oe_menu_more').append($index.next().nextAll());
@@ -752,19 +752,19 @@
752 */752 */
753 open_menu: function (id) {753 open_menu: function (id) {
754 var $clicked_menu, $sub_menu, $main_menu;754 var $clicked_menu, $sub_menu, $main_menu;
755 $clicked_menu = this.$element.add(this.$secondary_menus).find('a[data-menu=' + id + ']');755 $clicked_menu = this.$el.add(this.$secondary_menus).find('a[data-menu=' + id + ']');
756 this.trigger('open_menu', id, $clicked_menu);756 this.trigger('open_menu', id, $clicked_menu);
757757
758 if (this.$secondary_menus.has($clicked_menu).length) {758 if (this.$secondary_menus.has($clicked_menu).length) {
759 $sub_menu = $clicked_menu.parents('.oe_secondary_menu');759 $sub_menu = $clicked_menu.parents('.oe_secondary_menu');
760 $main_menu = this.$element.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']');760 $main_menu = this.$el.find('a[data-menu=' + $sub_menu.data('menu-parent') + ']');
761 } else {761 } else {
762 $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + $clicked_menu.attr('data-menu') + ']');762 $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + $clicked_menu.attr('data-menu') + ']');
763 $main_menu = $clicked_menu;763 $main_menu = $clicked_menu;
764 }764 }
765765
766 // Activate current main menu766 // Activate current main menu
767 this.$element.find('.oe_active').removeClass('oe_active');767 this.$el.find('.oe_active').removeClass('oe_active');
768 $main_menu.addClass('oe_active');768 $main_menu.addClass('oe_active');
769769
770 // Show current sub menu770 // Show current sub menu
@@ -791,7 +791,7 @@
791 * @param {Number} id the action_id to match791 * @param {Number} id the action_id to match
792 */792 */
793 open_action: function (id) {793 open_action: function (id) {
794 var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]');794 var $menu = this.$el.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]');
795 var menu_id = $menu.data('menu');795 var menu_id = $menu.data('menu');
796 if (menu_id) {796 if (menu_id) {
797 this.open_menu(menu_id);797 this.open_menu(menu_id);
@@ -807,14 +807,14 @@
807 if (!id) { return; }807 if (!id) { return; }
808808
809 // find back the menuitem in dom to get the action809 // find back the menuitem in dom to get the action
810 var $item = this.$element.find('a[data-menu=' + id + ']');810 var $item = this.$el.find('a[data-menu=' + id + ']');
811 if (!$item.length) {811 if (!$item.length) {
812 $item = this.$secondary_menus.find('a[data-menu=' + id + ']');812 $item = this.$secondary_menus.find('a[data-menu=' + id + ']');
813 }813 }
814 var action_id = $item.data('action-id');814 var action_id = $item.data('action-id');
815 // If first level menu doesnt have action trigger first leaf815 // If first level menu doesnt have action trigger first leaf
816 if (!action_id) {816 if (!action_id) {
817 if(this.$element.has($item).length) {817 if(this.$el.has($item).length) {
818 var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');818 var $sub_menu = this.$secondary_menus.find('.oe_secondary_menu[data-menu-parent=' + id + ']');
819 var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');819 var $items = $sub_menu.find('a[data-action-id]').filter('[data-action-id!=""]');
820 if($items.length) {820 if($items.length) {
@@ -855,7 +855,7 @@
855 start: function() {855 start: function() {
856 var self = this;856 var self = this;
857 this._super.apply(this, arguments);857 this._super.apply(this, arguments);
858 this.$element.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) {858 this.$el.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) {
859 ev.preventDefault();859 ev.preventDefault();
860 var f = self['on_menu_' + $(this).data('menu')];860 var f = self['on_menu_' + $(this).data('menu')];
861 if (f) {861 if (f) {
@@ -866,7 +866,7 @@
866 do_update: function () {866 do_update: function () {
867 var self = this;867 var self = this;
868 var fct = function() {868 var fct = function() {
869 var $avatar = self.$element.find('.oe_topbar_avatar');869 var $avatar = self.$el.find('.oe_topbar_avatar');
870 $avatar.attr('src', $avatar.data('default-src'));870 $avatar.attr('src', $avatar.data('default-src'));
871 if (!self.session.uid)871 if (!self.session.uid)
872 return;872 return;
@@ -877,7 +877,7 @@
877 topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db);877 topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db);
878 if(res.company_id[0] > 1)878 if(res.company_id[0] > 1)
879 topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]);879 topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]);
880 self.$element.find('.oe_topbar_name').text(topbar_name);880 self.$el.find('.oe_topbar_name').text(topbar_name);
881 var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=image_small&id=%s', self.session.prefix, self.session.session_id, self.session.uid);881 var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=image_small&id=%s', self.session.prefix, self.session.session_id, self.session.uid);
882 $avatar.attr('src', avatar_src);882 $avatar.attr('src', avatar_src);
883 });883 });
@@ -927,10 +927,10 @@
927 },927 },
928 bind_events: function() {928 bind_events: function() {
929 var self = this;929 var self = this;
930 this.$element.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() {930 this.$el.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() {
931 $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter');931 $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter');
932 });932 });
933 this.$element.on('click', '.oe_dropdown_toggle', function(ev) {933 this.$el.on('click', '.oe_dropdown_toggle', function(ev) {
934 ev.preventDefault();934 ev.preventDefault();
935 var $toggle = $(this);935 var $toggle = $(this);
936 var $menu = $toggle.siblings('.oe_dropdown_menu');936 var $menu = $toggle.siblings('.oe_dropdown_menu');
@@ -954,7 +954,7 @@
954 instance.web.bus.on('click', this, function(ev) {954 instance.web.bus.on('click', this, function(ev) {
955 $.fn.tipsy.clear();955 $.fn.tipsy.clear();
956 if (!$(ev.target).is('input[type=file]')) {956 if (!$(ev.target).is('input[type=file]')) {
957 self.$element.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened');957 self.$el.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened');
958 }958 }
959 });959 });
960 },960 },
@@ -963,9 +963,9 @@
963 this.crashmanager = new instance.web.CrashManager();963 this.crashmanager = new instance.web.CrashManager();
964 instance.session.on_rpc_error.add(this.crashmanager.on_rpc_error);964 instance.session.on_rpc_error.add(this.crashmanager.on_rpc_error);
965 self.notification = new instance.web.Notification(this);965 self.notification = new instance.web.Notification(this);
966 self.notification.appendTo(self.$element);966 self.notification.appendTo(self.$el);
967 self.loading = new instance.web.Loading(self);967 self.loading = new instance.web.Loading(self);
968 self.loading.appendTo(self.$element);968 self.loading.appendTo(self.$el);
969 self.action_manager = new instance.web.ActionManager(self);969 self.action_manager = new instance.web.ActionManager(self);
970 self.action_manager.appendTo(self.$('.oe_application'));970 self.action_manager.appendTo(self.$('.oe_application'));
971 },971 },
@@ -1035,17 +1035,17 @@
1035 var self = this;1035 var self = this;
1036 self.toggle_bars(true);1036 self.toggle_bars(true);
1037 self.menu = new instance.web.Menu(self);1037 self.menu = new instance.web.Menu(self);
1038 self.menu.replace(this.$element.find('.oe_menu_placeholder'));1038 self.menu.replace(this.$el.find('.oe_menu_placeholder'));
1039 self.menu.on('menu_click', this, this.on_menu_action);1039 self.menu.on('menu_click', this, this.on_menu_action);
1040 self.user_menu = new instance.web.UserMenu(self);1040 self.user_menu = new instance.web.UserMenu(self);
1041 self.user_menu.replace(this.$element.find('.oe_user_menu_placeholder'));1041 self.user_menu.replace(this.$el.find('.oe_user_menu_placeholder'));
1042 self.user_menu.on_menu_logout.add(this.proxy('on_logout'));1042 self.user_menu.on_menu_logout.add(this.proxy('on_logout'));
1043 self.user_menu.on_action.add(this.proxy('on_menu_action'));1043 self.user_menu.on_action.add(this.proxy('on_menu_action'));
1044 self.user_menu.do_update();1044 self.user_menu.do_update();
1045 self.bind_hashchange();1045 self.bind_hashchange();
1046 if (!self.session.openerp_entreprise) {1046 if (!self.session.openerp_entreprise) {
1047 var version_label = _t("OpenERP - Unsupported/Community Version");1047 var version_label = _t("OpenERP - Unsupported/Community Version");
1048 self.$element.find('.oe_footer_powered').append(_.str.sprintf('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">%s</a></span>', version_label));1048 self.$el.find('.oe_footer_powered').append(_.str.sprintf('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">%s</a></span>', version_label));
1049 }1049 }
1050 self.set_title();1050 self.set_title();
1051 },1051 },
@@ -1053,7 +1053,7 @@
1053 _.each(_.clone(this.getChildren()), function(el) {1053 _.each(_.clone(this.getChildren()), function(el) {
1054 el.destroy();1054 el.destroy();
1055 });1055 });
1056 this.$element.children().remove();1056 this.$el.children().remove();
1057 },1057 },
1058 do_reload: function() {1058 do_reload: function() {
1059 var self = this;1059 var self = this;
@@ -1085,7 +1085,7 @@
1085 var state = $.bbq.getState(true);1085 var state = $.bbq.getState(true);
1086 if (_.isEmpty(state) || state.action == "login") {1086 if (_.isEmpty(state) || state.action == "login") {
1087 self.menu.has_been_loaded.then(function() {1087 self.menu.has_been_loaded.then(function() {
1088 var first_menu_id = self.menu.$element.find("a:first").data("menu");1088 var first_menu_id = self.menu.$el.find("a:first").data("menu");
1089 if(first_menu_id) {1089 if(first_menu_id) {
1090 self.menu.menu_click(first_menu_id);1090 self.menu.menu_click(first_menu_id);
1091 }1091 }
@@ -1140,10 +1140,10 @@
1140 },1140 },
1141 set_content_full_screen: function(fullscreen) {1141 set_content_full_screen: function(fullscreen) {
1142 if (fullscreen) {1142 if (fullscreen) {
1143 $(".oe_webclient", this.$element).addClass("oe_content_full_screen");1143 $(".oe_webclient", this.$el).addClass("oe_content_full_screen");
1144 $("body").css({'overflow-y':'hidden'});1144 $("body").css({'overflow-y':'hidden'});
1145 } else {1145 } else {
1146 $(".oe_webclient", this.$element).removeClass("oe_content_full_screen");1146 $(".oe_webclient", this.$el).removeClass("oe_content_full_screen");
1147 $("body").css({'overflow-y':'scroll'});1147 $("body").css({'overflow-y':'scroll'});
1148 }1148 }
1149 }1149 }
11501150
=== modified file 'addons/web/static/src/js/corelib.js'
--- addons/web/static/src/js/corelib.js 2012-08-14 15:29:00 +0000
+++ addons/web/static/src/js/corelib.js 2012-08-27 06:09:20 +0000
@@ -525,8 +525,8 @@
525 _.each(this.getChildren(), function(el) {525 _.each(this.getChildren(), function(el) {
526 el.destroy();526 el.destroy();
527 });527 });
528 if(this.$element) {528 if(this.$el) {
529 this.$element.remove();529 this.$el.remove();
530 }530 }
531 instance.web.PropertiesMixin.destroy.call(this);531 instance.web.PropertiesMixin.destroy.call(this);
532 },532 },
@@ -538,7 +538,7 @@
538 appendTo: function(target) {538 appendTo: function(target) {
539 var self = this;539 var self = this;
540 return this.__widgetRenderAndInsert(function(t) {540 return this.__widgetRenderAndInsert(function(t) {
541 self.$element.appendTo(t);541 self.$el.appendTo(t);
542 }, target);542 }, target);
543 },543 },
544 /**544 /**
@@ -549,7 +549,7 @@
549 prependTo: function(target) {549 prependTo: function(target) {
550 var self = this;550 var self = this;
551 return this.__widgetRenderAndInsert(function(t) {551 return this.__widgetRenderAndInsert(function(t) {
552 self.$element.prependTo(t);552 self.$el.prependTo(t);
553 }, target);553 }, target);
554 },554 },
555 /**555 /**
@@ -560,7 +560,7 @@
560 insertAfter: function(target) {560 insertAfter: function(target) {
561 var self = this;561 var self = this;
562 return this.__widgetRenderAndInsert(function(t) {562 return this.__widgetRenderAndInsert(function(t) {
563 self.$element.insertAfter(t);563 self.$el.insertAfter(t);
564 }, target);564 }, target);
565 },565 },
566 /**566 /**
@@ -571,7 +571,7 @@
571 insertBefore: function(target) {571 insertBefore: function(target) {
572 var self = this;572 var self = this;
573 return this.__widgetRenderAndInsert(function(t) {573 return this.__widgetRenderAndInsert(function(t) {
574 self.$element.insertBefore(t);574 self.$el.insertBefore(t);
575 }, target);575 }, target);
576 },576 },
577 /**577 /**
@@ -581,7 +581,7 @@
581 */581 */
582 replace: function(target) {582 replace: function(target) {
583 return this.__widgetRenderAndInsert(_.bind(function(t) {583 return this.__widgetRenderAndInsert(_.bind(function(t) {
584 this.$element.replaceAll(t);584 this.$el.replaceAll(t);
585 }, this), target);585 }, this), target);
586 },586 },
587 __widgetRenderAndInsert: function(insertion, target) {587 __widgetRenderAndInsert: function(insertion, target) {
@@ -640,8 +640,8 @@
640 * // stuff that you want to init before the rendering640 * // stuff that you want to init before the rendering
641 * },641 * },
642 * start: function() {642 * start: function() {
643 * // stuff you want to make after the rendering, `this.$element` holds a correct value643 * // stuff you want to make after the rendering, `this.$el` holds a correct value
644 * this.$element.find(".my_button").click(/* an example of event binding * /);644 * this.$el.find(".my_button").click(/* an example of event binding * /);
645 *645 *
646 * // if you have some asynchronous operations, it's a good idea to return646 * // if you have some asynchronous operations, it's a good idea to return
647 * // a promise in start()647 * // a promise in start()
@@ -718,15 +718,15 @@
718 * @returns {*} this718 * @returns {*} this
719 */719 */
720 replaceElement: function ($el) {720 replaceElement: function ($el) {
721 var $oldel = this.$element;721 var $oldel = this.$el;
722 this.setElement($el);722 this.setElement($el);
723 if ($oldel && !$oldel.is(this.$element)) {723 if ($oldel && !$oldel.is(this.$el)) {
724 $oldel.replaceWith(this.$element);724 $oldel.replaceWith(this.$el);
725 }725 }
726 return this;726 return this;
727 },727 },
728 /**728 /**
729 * Re-sets the widget's root element (el/$el/$element).729 * Re-sets the widget's root element (el/$el/$el).
730 *730 *
731 * Includes:731 * Includes:
732 * * re-delegating events732 * * re-delegating events
@@ -738,14 +738,14 @@
738 * @return {*} this738 * @return {*} this
739 */739 */
740 setElement: function (element) {740 setElement: function (element) {
741 // NB: completely useless, as WidgetMixin#init creates a $element741 // NB: completely useless, as WidgetMixin#init creates a $el
742 // always742 // always
743 if (this.$element) {743 if (this.$el) {
744 this.undelegateEvents();744 this.undelegateEvents();
745 }745 }
746746
747 this.$element = (element instanceof $) ? element : $(element);747 this.$el = (element instanceof $) ? element : $(element);
748 this.el = this.$element[0];748 this.el = this.$el[0];
749749
750 this.delegateEvents();750 this.delegateEvents();
751751
@@ -797,23 +797,23 @@
797797
798 event += '.widget_events';798 event += '.widget_events';
799 if (!selector) {799 if (!selector) {
800 this.$element.on(event, method);800 this.$el.on(event, method);
801 } else {801 } else {
802 this.$element.on(event, selector, method);802 this.$el.on(event, selector, method);
803 }803 }
804 }804 }
805 },805 },
806 undelegateEvents: function () {806 undelegateEvents: function () {
807 this.$element.off('.widget_events');807 this.$el.off('.widget_events');
808 },808 },
809 /**809 /**
810 * Shortcut for ``this.$element.find(selector)``810 * Shortcut for ``this.$el.find(selector)``
811 *811 *
812 * @param {String} selector CSS selector, rooted in $el812 * @param {String} selector CSS selector, rooted in $el
813 * @returns {jQuery} selector match813 * @returns {jQuery} selector match
814 */814 */
815 $: function(selector) {815 $: function(selector) {
816 return this.$element.find(selector);816 return this.$el.find(selector);
817 },817 },
818 /**818 /**
819 * Informs the action manager to do an action. This supposes that819 * Informs the action manager to do an action. This supposes that
820820
=== modified file 'addons/web/static/src/js/coresetup.js'
--- addons/web/static/src/js/coresetup.js 2012-08-21 09:30:00 +0000
+++ addons/web/static/src/js/coresetup.js 2012-08-27 06:09:20 +0000
@@ -520,82 +520,6 @@
520 return old_async_when.apply(this, arguments);520 return old_async_when.apply(this, arguments);
521};521};
522522
523/** Setup blockui */
524if ($.blockUI) {
525 $.blockUI.defaults.baseZ = 1100;
526 $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">';
527 $.blockUI.defaults.css.border = '0';
528 $.blockUI.defaults.css["background-color"] = '';
529}
530
531var messages_by_seconds = [
532 [0, "Loading..."],
533 [30, "Still Loading..."],
534 [60, "Still Loading...<br />Please be patient."],
535 [120, "Hey, guess what?<br />It's still loading."],
536 [300, "You may not believe it,<br/>but the application is actually loading..."],
537];
538
539instance.web.Throbber = instance.web.Widget.extend({
540 template: "Throbber",
541 start: function() {
542 var opts = {
543 lines: 13, // The number of lines to draw
544 length: 7, // The length of each line
545 width: 4, // The line thickness
546 radius: 10, // The radius of the inner circle
547 rotate: 0, // The rotation offset
548 color: '#FFF', // #rgb or #rrggbb
549 speed: 1, // Rounds per second
550 trail: 60, // Afterglow percentage
551 shadow: false, // Whether to render a shadow
552 hwaccel: false, // Whether to use hardware acceleration
553 className: 'spinner', // The CSS class to assign to the spinner
554 zIndex: 2e9, // The z-index (defaults to 2000000000)
555 top: 'auto', // Top position relative to parent in px
556 left: 'auto' // Left position relative to parent in px
557 };
558 this.spin = new Spinner(opts).spin(this.$element[0]);
559 this.start_time = new Date().getTime();
560 this.act_message();
561 },
562 act_message: function() {
563 var self = this;
564 setTimeout(function() {
565 if (self.isDestroyed())
566 return;
567 var seconds = (new Date().getTime() - self.start_time) / 1000;
568 var mes;
569 _.each(messages_by_seconds, function(el) {
570 if (seconds >= el[0])
571 mes = el[1];
572 });
573 self.$(".oe_throbber_message").html(mes);
574 self.act_message();
575 }, 1000);
576 },
577 destroy: function() {
578 if (this.spin)
579 this.spin.stop();
580 this._super();
581 },
582});
583instance.web.Throbber.throbbers = [];
584
585instance.web.blockUI = function() {
586 var tmp = $.blockUI.apply($, arguments);
587 var throbber = new instance.web.Throbber();
588 instance.web.Throbber.throbbers.push(throbber);
589 throbber.appendTo($(".oe_blockui_spin_container"));
590 return tmp;
591}
592instance.web.unblockUI = function() {
593 _.each(instance.web.Throbber.throbbers, function(el) {
594 el.destroy();
595 });
596 return $.unblockUI.apply($, arguments);
597}
598
599/** Setup default session */523/** Setup default session */
600instance.session = new instance.web.Session();524instance.session = new instance.web.Session();
601525
@@ -679,6 +603,86 @@
679 $.timeago.settings.translator = instance.web._t;603 $.timeago.settings.translator = instance.web._t;
680});604});
681605
606/** Setup blockui */
607if ($.blockUI) {
608 $.blockUI.defaults.baseZ = 1100;
609 $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">';
610 $.blockUI.defaults.css.border = '0';
611 $.blockUI.defaults.css["background-color"] = '';
612}
613
614var messages_by_seconds = function() {
615 return [
616 [0, _t("Loading...")],
617 [30, _t("Still loading...")],
618 [60, _t("Still loading...<br />Please be patient.")],
619 [120, _t("Don't leave yet,<br />it's still loading...")],
620 [300, _t("You may not believe it,<br />but the application is actually loading...")],
621 [600, _t("You know, sometimes,<br />OpenERP can be a little bit slow,<br />because it's loading...")],
622 [3600, _t("Maybe you should consider pressing F5...")],
623 ];
624};
625
626instance.web.Throbber = instance.web.Widget.extend({
627 template: "Throbber",
628 start: function() {
629 var opts = {
630 lines: 13, // The number of lines to draw
631 length: 7, // The length of each line
632 width: 4, // The line thickness
633 radius: 10, // The radius of the inner circle
634 rotate: 0, // The rotation offset
635 color: '#FFF', // #rgb or #rrggbb
636 speed: 1, // Rounds per second
637 trail: 60, // Afterglow percentage
638 shadow: false, // Whether to render a shadow
639 hwaccel: false, // Whether to use hardware acceleration
640 className: 'spinner', // The CSS class to assign to the spinner
641 zIndex: 2e9, // The z-index (defaults to 2000000000)
642 top: 'auto', // Top position relative to parent in px
643 left: 'auto' // Left position relative to parent in px
644 };
645 this.spin = new Spinner(opts).spin(this.$el[0]);
646 this.start_time = new Date().getTime();
647 this.act_message();
648 },
649 act_message: function() {
650 var self = this;
651 setTimeout(function() {
652 if (self.isDestroyed())
653 return;
654 var seconds = (new Date().getTime() - self.start_time) / 1000;
655 var mes;
656 _.each(messages_by_seconds(), function(el) {
657 if (seconds >= el[0])
658 mes = el[1];
659 });
660 self.$(".oe_throbber_message").html(mes);
661 self.act_message();
662 }, 1000);
663 },
664 destroy: function() {
665 if (this.spin)
666 this.spin.stop();
667 this._super();
668 },
669});
670instance.web.Throbber.throbbers = [];
671
672instance.web.blockUI = function() {
673 var tmp = $.blockUI.apply($, arguments);
674 var throbber = new instance.web.Throbber();
675 instance.web.Throbber.throbbers.push(throbber);
676 throbber.appendTo($(".oe_blockui_spin_container"));
677 return tmp;
678}
679instance.web.unblockUI = function() {
680 _.each(instance.web.Throbber.throbbers, function(el) {
681 el.destroy();
682 });
683 return $.unblockUI.apply($, arguments);
684}
685
682/**686/**
683 * Registry for all the client actions key: tag value: widget687 * Registry for all the client actions key: tag value: widget
684 */688 */
685689
=== modified file 'addons/web/static/src/js/data_export.js'
--- addons/web/static/src/js/data_export.js 2012-07-24 14:12:20 +0000
+++ addons/web/static/src/js/data_export.js 2012-08-27 06:09:20 +0000
@@ -21,31 +21,31 @@
21 ],21 ],
22 close: function(event, ui){ self.close();}22 close: function(event, ui){ self.close();}
23 });23 });
24 self.$element.removeClass('ui-dialog-content ui-widget-content');24 self.$el.removeClass('ui-dialog-content ui-widget-content');
25 self.$element.find('#add_field').click(function() {25 self.$el.find('#add_field').click(function() {
26 if ($('#field-tree-structure tr.ui-selected')) {26 if ($('#field-tree-structure tr.ui-selected')) {
27 var fld = self.$element.find('#field-tree-structure tr.ui-selected').find('a');27 var fld = self.$el.find('#field-tree-structure tr.ui-selected').find('a');
28 for (var i = 0; i < fld.length; i++) {28 for (var i = 0; i < fld.length; i++) {
29 var id = $(fld[i]).attr('id').split('-')[1];29 var id = $(fld[i]).attr('id').split('-')[1];
30 var string = $(fld[i]).attr('string');30 var string = $(fld[i]).attr('string');
31 self.add_field(id, string);31 self.add_field(id, string);
32 }32 }
33 self.$element.find('#field-tree-structure tr').removeClass('ui-selected');33 self.$el.find('#field-tree-structure tr').removeClass('ui-selected');
34 }34 }
35 });35 });
36 self.$element.find('#remove_field').click(function() {36 self.$el.find('#remove_field').click(function() {
37 self.$element.find('#fields_list option:selected').remove();37 self.$el.find('#fields_list option:selected').remove();
38 });38 });
39 self.$element.find('#remove_all_field').click(function() {39 self.$el.find('#remove_all_field').click(function() {
40 self.$element.find('#fields_list').empty();40 self.$el.find('#fields_list').empty();
41 });41 });
42 this.$element.find('#export_new_list').click(this.on_show_save_list);42 this.$el.find('#export_new_list').click(this.on_show_save_list);
4343
44 var got_fields = new $.Deferred();44 var got_fields = new $.Deferred();
45 this.$element.find('#import_compat').change(function() {45 this.$el.find('#import_compat').change(function() {
46 self.$element.find('#fields_list').empty();46 self.$el.find('#fields_list').empty();
47 self.$element.find('#field-tree-structure').remove();47 self.$el.find('#field-tree-structure').remove();
48 var import_comp = self.$element.find("#import_compat").val();48 var import_comp = self.$el.find("#import_compat").val();
49 self.rpc("/web/export/get_fields", {49 self.rpc("/web/export/get_fields", {
50 model: self.dataset.model,50 model: self.dataset.model,
51 import_compat: Boolean(import_comp)51 import_compat: Boolean(import_comp)
@@ -61,7 +61,7 @@
61 this.show_exports_list());61 this.show_exports_list());
62 },62 },
63 do_setup_export_formats: function (formats) {63 do_setup_export_formats: function (formats) {
64 var $fmts = this.$element.find('#export_format');64 var $fmts = this.$el.find('#export_format');
65 _(formats).each(function (format) {65 _(formats).each(function (format) {
66 var opt = new Option(format.label, format.tag);66 var opt = new Option(format.label, format.tag);
67 if (format.error) {67 if (format.error) {
@@ -76,8 +76,8 @@
76 },76 },
77 show_exports_list: function() {77 show_exports_list: function() {
78 var self = this;78 var self = this;
79 if (self.$element.find('#saved_export_list').is(':hidden')) {79 if (self.$el.find('#saved_export_list').is(':hidden')) {
80 self.$element.find('#ExistsExportList').show();80 self.$el.find('#ExistsExportList').show();
81 return;81 return;
82 }82 }
83 return this.exports.read_slice(['name'], {83 return this.exports.read_slice(['name'], {
@@ -86,35 +86,35 @@
86 if (!export_list.length) {86 if (!export_list.length) {
87 return;87 return;
88 }88 }
89 self.$element.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list}));89 self.$el.find('#ExistsExportList').append(QWeb.render('Exists.ExportList', {'existing_exports': export_list}));
90 self.$element.find('#saved_export_list').change(function() {90 self.$el.find('#saved_export_list').change(function() {
91 self.$element.find('#fields_list option').remove();91 self.$el.find('#fields_list option').remove();
92 var export_id = self.$element.find('#saved_export_list option:selected').val();92 var export_id = self.$el.find('#saved_export_list option:selected').val();
93 if (export_id) {93 if (export_id) {
94 self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field);94 self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field);
95 }95 }
96 });96 });
97 self.$element.find('#delete_export_list').click(function() {97 self.$el.find('#delete_export_list').click(function() {
98 var select_exp = self.$element.find('#saved_export_list option:selected');98 var select_exp = self.$el.find('#saved_export_list option:selected');
99 if (select_exp.val()) {99 if (select_exp.val()) {
100 self.exports.unlink([parseInt(select_exp.val(), 10)]);100 self.exports.unlink([parseInt(select_exp.val(), 10)]);
101 select_exp.remove();101 select_exp.remove();
102 if (self.$element.find('#saved_export_list option').length <= 1) {102 if (self.$el.find('#saved_export_list option').length <= 1) {
103 self.$element.find('#ExistsExportList').hide();103 self.$el.find('#ExistsExportList').hide();
104 }104 }
105 }105 }
106 });106 });
107 });107 });
108 },108 },
109 do_load_export_field: function(field_list) {109 do_load_export_field: function(field_list) {
110 var export_node = this.$element.find("#fields_list");110 var export_node = this.$el.find("#fields_list");
111 _(field_list).each(function (field) {111 _(field_list).each(function (field) {
112 export_node.append(new Option(field.label, field.name));112 export_node.append(new Option(field.label, field.name));
113 });113 });
114 },114 },
115 on_show_save_list: function() {115 on_show_save_list: function() {
116 var self = this;116 var self = this;
117 var current_node = self.$element.find("#savenewlist");117 var current_node = self.$el.find("#savenewlist");
118 if (!(current_node.find("label")).length) {118 if (!(current_node.find("label")).length) {
119 current_node.append(QWeb.render('ExportNewList'));119 current_node.append(QWeb.render('ExportNewList'));
120 current_node.find("#add_export_list").click(function() {120 current_node.find("#add_export_list").click(function() {
@@ -150,14 +150,14 @@
150 if (!export_list_id.result) {150 if (!export_list_id.result) {
151 return;151 return;
152 }152 }
153 self.$element.find("#saved_export_list").append(153 self.$el.find("#saved_export_list").append(
154 new Option(value, export_list_id.result));154 new Option(value, export_list_id.result));
155 if (self.$element.find("#saved_export_list").is(":hidden")) {155 if (self.$el.find("#saved_export_list").is(":hidden")) {
156 self.show_exports_list();156 self.show_exports_list();
157 }157 }
158 });158 });
159 this.on_show_save_list();159 this.on_show_save_list();
160 this.$element.find("#fields_list option").remove();160 this.$el.find("#fields_list option").remove();
161 },161 },
162 on_click: function(id, record) {162 on_click: function(id, record) {
163 var self = this;163 var self = this;
@@ -173,7 +173,7 @@
173 }173 }
174174
175 if (!record.loaded) {175 if (!record.loaded) {
176 var import_comp = self.$element.find("#import_compat").val();176 var import_comp = self.$el.find("#import_compat").val();
177 self.rpc("/web/export/get_fields", {177 self.rpc("/web/export/get_fields", {
178 model: model,178 model: model,
179 prefix: prefix,179 prefix: prefix,
@@ -191,44 +191,44 @@
191 },191 },
192 on_show_data: function(result, after) {192 on_show_data: function(result, after) {
193 var self = this;193 var self = this;
194 var imp_cmpt = Boolean(self.$element.find("#import_compat").val());194 var imp_cmpt = Boolean(self.$el.find("#import_compat").val());
195195
196 if (after) {196 if (after) {
197 var current_tr = self.$element.find("tr[id='treerow-" + after + "']");197 var current_tr = self.$el.find("tr[id='treerow-" + after + "']");
198 current_tr.addClass('open');198 current_tr.addClass('open');
199 current_tr.find('img').attr('src','/web/static/src/img/collapse.gif');199 current_tr.find('img').attr('src','/web/static/src/img/collapse.gif');
200 current_tr.after(QWeb.render('ExportTreeView-Secondary.children', {'fields': result}));200 current_tr.after(QWeb.render('ExportTreeView-Secondary.children', {'fields': result}));
201 } else {201 } else {
202 self.$element.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result}));202 self.$el.find('#left_field_panel').append(QWeb.render('ExportTreeView-Secondary', {'fields': result}));
203 }203 }
204 _.each(result, function(record) {204 _.each(result, function(record) {
205 self.records[record.id] = record.value;205 self.records[record.id] = record.value;
206 if (record.required) {206 if (record.required) {
207 var required_fld = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column');207 var required_fld = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column');
208 required_fld.addClass("oe_export_requiredfield");208 required_fld.addClass("oe_export_requiredfield");
209 }209 }
210 self.$element.find("img[id='parentimg-" + record.id +"']").click(function() {210 self.$el.find("img[id='parentimg-" + record.id +"']").click(function() {
211 self.on_click(this.id, record);211 self.on_click(this.id, record);
212 });212 });
213213
214 self.$element.find("tr[id='treerow-" + record.id + "']").click(function(e) {214 self.$el.find("tr[id='treerow-" + record.id + "']").click(function(e) {
215 if (e.shiftKey) {215 if (e.shiftKey) {
216 var frst_click, scnd_click = '';216 var frst_click, scnd_click = '';
217 if (self.row_index == 0) {217 if (self.row_index == 0) {
218 self.row_index = this.rowIndex;218 self.row_index = this.rowIndex;
219 frst_click = self.$element.find("tr[id^='treerow-']")[self.row_index-1];219 frst_click = self.$el.find("tr[id^='treerow-']")[self.row_index-1];
220 $(frst_click).addClass("ui-selected");220 $(frst_click).addClass("ui-selected");
221 } else {221 } else {
222 if (this.rowIndex >=self.row_index) {222 if (this.rowIndex >=self.row_index) {
223 for (var i = (self.row_index-1); i < this.rowIndex; i++) {223 for (var i = (self.row_index-1); i < this.rowIndex; i++) {
224 scnd_click = self.$element.find("tr[id^='treerow-']")[i];224 scnd_click = self.$el.find("tr[id^='treerow-']")[i];
225 if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) {225 if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) {
226 $(scnd_click).addClass("ui-selected");226 $(scnd_click).addClass("ui-selected");
227 }227 }
228 }228 }
229 } else {229 } else {
230 for (var i = (self.row_index-1); i >= (this.rowIndex-1); i--) {230 for (var i = (self.row_index-1); i >= (this.rowIndex-1); i--) {
231 scnd_click = self.$element.find("tr[id^='treerow-']")[i];231 scnd_click = self.$el.find("tr[id^='treerow-']")[i];
232 if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) {232 if (!$(scnd_click).find('#tree-column').hasClass("oe_export_readonlyfield")) {
233 $(scnd_click).addClass("ui-selected");233 $(scnd_click).addClass("ui-selected");
234 }234 }
@@ -238,10 +238,10 @@
238 }238 }
239 self.row_index = this.rowIndex;239 self.row_index = this.rowIndex;
240240
241 self.$element.find("tr[id='treerow-" + record.id + "']").keyup(function() {241 self.$el.find("tr[id='treerow-" + record.id + "']").keyup(function() {
242 self.row_index = 0;242 self.row_index = 0;
243 });243 });
244 var o2m_selection = self.$element.find("tr[id='treerow-" + record.id + "']").find('#tree-column');244 var o2m_selection = self.$el.find("tr[id='treerow-" + record.id + "']").find('#tree-column');
245 if ($(o2m_selection).hasClass("oe_export_readonlyfield")) {245 if ($(o2m_selection).hasClass("oe_export_readonlyfield")) {
246 return false;246 return false;
247 }247 }
@@ -252,14 +252,14 @@
252 $(this).addClass('ui-selected').find('a').focus();252 $(this).addClass('ui-selected').find('a').focus();
253 }253 }
254 } else if (!e.shiftKey) {254 } else if (!e.shiftKey) {
255 self.$element.find("tr.ui-selected")255 self.$el.find("tr.ui-selected")
256 .removeClass("ui-selected").find('a').blur();256 .removeClass("ui-selected").find('a').blur();
257 $(this).addClass("ui-selected").find('a').focus();257 $(this).addClass("ui-selected").find('a').focus();
258 }258 }
259 return false;259 return false;
260 });260 });
261261
262 self.$element.find("tr[id='treerow-" + record.id + "']").keydown(function(e) {262 self.$el.find("tr[id='treerow-" + record.id + "']").keydown(function(e) {
263 var keyCode = e.keyCode || e.which;263 var keyCode = e.keyCode || e.which;
264 var arrow = {left: 37, up: 38, right: 39, down: 40 };264 var arrow = {left: 37, up: 38, right: 39, down: 40 };
265 switch (keyCode) {265 switch (keyCode) {
@@ -297,19 +297,19 @@
297 break;297 break;
298 }298 }
299 });299 });
300 self.$element.find("tr[id='treerow-" + record.id + "']").dblclick(function() {300 self.$el.find("tr[id='treerow-" + record.id + "']").dblclick(function() {
301 var $o2m_selection = self.$element.find("tr[id^='treerow-" + record.id + "']").find('#tree-column');301 var $o2m_selection = self.$el.find("tr[id^='treerow-" + record.id + "']").find('#tree-column');
302 if (!$o2m_selection.hasClass("oe_export_readonlyfield")) {302 if (!$o2m_selection.hasClass("oe_export_readonlyfield")) {
303 self.add_field(record.id, $(this).find("a").attr("string"));303 self.add_field(record.id, $(this).find("a").attr("string"));
304 }304 }
305 });305 });
306 });306 });
307 self.$element.find('#fields_list').mouseover(function(event) {307 self.$el.find('#fields_list').mouseover(function(event) {
308 if (event.relatedTarget) {308 if (event.relatedTarget) {
309 if (event.relatedTarget.attributes['id'] && event.relatedTarget.attributes['string']) {309 if (event.relatedTarget.attributes['id'] && event.relatedTarget.attributes['string']) {
310 var field_id = event.relatedTarget.attributes["id"]["value"];310 var field_id = event.relatedTarget.attributes["id"]["value"];
311 if (field_id && field_id.split("-")[0] === 'export') {311 if (field_id && field_id.split("-")[0] === 'export') {
312 if (!self.$element.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) {312 if (!self.$el.find("tr[id='treerow-" + field_id.split("-")[1] + "']").find('#tree-column').hasClass("oe_export_readonlyfield")) {
313 self.add_field(field_id.split("-")[1], event.relatedTarget.attributes["string"]["value"]);313 self.add_field(field_id.split("-")[1], event.relatedTarget.attributes["string"]["value"]);
314 }314 }
315 }315 }
@@ -319,7 +319,7 @@
319 },319 },
320 showcontent: function(id) {320 showcontent: function(id) {
321 // show & hide the contents321 // show & hide the contents
322 var $this = this.$element.find("tr[id='treerow-" + id + "']");322 var $this = this.$el.find("tr[id='treerow-" + id + "']");
323 var is_open = $this.hasClass('open');323 var is_open = $this.hasClass('open');
324 $this.toggleClass('open');324 $this.toggleClass('open');
325325
@@ -329,7 +329,7 @@
329 } else {329 } else {
330 first_child.attr('src', '/web/static/src/img/collapse.gif');330 first_child.attr('src', '/web/static/src/img/collapse.gif');
331 }331 }
332 var child_field = this.$element.find("tr[id^='treerow-" + id +"/']");332 var child_field = this.$el.find("tr[id^='treerow-" + id +"/']");
333 var child_len = (id.split("/")).length + 1;333 var child_len = (id.split("/")).length + 1;
334 for (var i = 0; i < child_field.length; i++) {334 for (var i = 0; i < child_field.length; i++) {
335 var $child = $(child_field[i]);335 var $child = $(child_field[i]);
@@ -345,15 +345,15 @@
345 }345 }
346 },346 },
347 add_field: function(field_id, string) {347 add_field: function(field_id, string) {
348 var field_list = this.$element.find('#fields_list');348 var field_list = this.$el.find('#fields_list');
349 if (this.$element.find("#fields_list option[value='" + field_id + "']")349 if (this.$el.find("#fields_list option[value='" + field_id + "']")
350 && !this.$element.find("#fields_list option[value='" + field_id + "']").length) {350 && !this.$el.find("#fields_list option[value='" + field_id + "']").length) {
351 field_list.append(new Option(string, field_id));351 field_list.append(new Option(string, field_id));
352 }352 }
353 },353 },
354 get_fields: function() {354 get_fields: function() {
355 var export_field = [];355 var export_field = [];
356 this.$element.find("#fields_list option").each(function() {356 this.$el.find("#fields_list option").each(function() {
357 export_field.push($(this).val());357 export_field.push($(this).val());
358 });358 });
359 if (!export_field.length) {359 if (!export_field.length) {
@@ -363,7 +363,7 @@
363 },363 },
364 on_click_export_data: function() {364 on_click_export_data: function() {
365 var self = this;365 var self = this;
366 var exported_fields = this.$element.find('#fields_list option').map(function () {366 var exported_fields = this.$el.find('#fields_list option').map(function () {
367 // DOM property is textContent, but IE8 only knows innerText367 // DOM property is textContent, but IE8 only knows innerText
368 return {name: self.records[this.value] || this.value,368 return {name: self.records[this.value] || this.value,
369 label: this.textContent || this.innerText};369 label: this.textContent || this.innerText};
@@ -375,7 +375,7 @@
375 }375 }
376376
377 exported_fields.unshift({name: 'id', label: 'External ID'});377 exported_fields.unshift({name: 'id', label: 'External ID'});
378 var export_format = this.$element.find("#export_format").val();378 var export_format = this.$el.find("#export_format").val();
379 instance.web.blockUI();379 instance.web.blockUI();
380 this.session.get_file({380 this.session.get_file({
381 url: '/web/export/' + export_format,381 url: '/web/export/' + export_format,
@@ -385,13 +385,13 @@
385 ids: this.dataset.ids,385 ids: this.dataset.ids,
386 domain: this.dataset.domain,386 domain: this.dataset.domain,
387 import_compat: Boolean(387 import_compat: Boolean(
388 this.$element.find("#import_compat").val())388 this.$el.find("#import_compat").val())
389 })},389 })},
390 complete: instance.web.unblockUI390 complete: instance.web.unblockUI
391 });391 });
392 },392 },
393 close: function() {393 close: function() {
394 this.$element.remove();394 this.$el.remove();
395 this._super();395 this._super();
396 }396 }
397});397});
398398
=== modified file 'addons/web/static/src/js/data_import.js'
--- addons/web/static/src/js/data_import.js 2012-08-02 14:46:23 +0000
+++ addons/web/static/src/js/data_import.js 2012-08-27 06:09:20 +0000
@@ -75,9 +75,9 @@
75 }75 }
76 });76 });
77 this.toggle_import_button(false);77 this.toggle_import_button(false);
78 this.$element.find('#csvfile').change(this.on_autodetect_data);78 this.$el.find('#csvfile').change(this.on_autodetect_data);
79 this.$element.find('fieldset').change(this.on_autodetect_data);79 this.$el.find('fieldset').change(this.on_autodetect_data);
80 this.$element.delegate('fieldset legend', 'click', function() {80 this.$el.delegate('fieldset legend', 'click', function() {
81 $(this).parent().toggleClass('oe_closed');81 $(this).parent().toggleClass('oe_closed');
82 });82 });
83 this.ready.push(new instance.web.DataSet(this, this.model).call(83 this.ready.push(new instance.web.DataSet(this, this.model).call(
@@ -156,19 +156,19 @@
156 });156 });
157 },157 },
158 toggle_import_button: function (newstate) {158 toggle_import_button: function (newstate) {
159 instance.web.dialog(this.$element, 'widget')159 instance.web.dialog(this.$el, 'widget')
160 .find('.oe_import_dialog_button')160 .find('.oe_import_dialog_button')
161 .button('option', 'disabled', !newstate);161 .button('option', 'disabled', !newstate);
162 },162 },
163 do_import: function() {163 do_import: function() {
164 if(!this.$element.find('#csvfile').val()) { return; }164 if(!this.$el.find('#csvfile').val()) { return; }
165 var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10);165 var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10);
166 var with_headers = this.$element.find('#file_has_headers').prop('checked');166 var with_headers = this.$el.find('#file_has_headers').prop('checked');
167 if (!lines_to_skip && with_headers) {167 if (!lines_to_skip && with_headers) {
168 lines_to_skip = 1;168 lines_to_skip = 1;
169 }169 }
170 var indices = [], fields = [];170 var indices = [], fields = [];
171 this.$element.find(".sel_fields").each(function(index, element) {171 this.$el.find(".sel_fields").each(function(index, element) {
172 var val = element.value;172 var val = element.value;
173 if (!val) {173 if (!val) {
174 return;174 return;
@@ -177,7 +177,7 @@
177 fields.push(val);177 fields.push(val);
178 });178 });
179179
180 jsonp(this.$element.find('#import_data'), {180 jsonp(this.$el.find('#import_data'), {
181 url: '/web/import/import_data',181 url: '/web/import/import_data',
182 data: {182 data: {
183 model: this.model,183 model: this.model,
@@ -190,19 +190,19 @@
190 }, this.on_import_results);190 }, this.on_import_results);
191 },191 },
192 on_autodetect_data: function() {192 on_autodetect_data: function() {
193 if(!this.$element.find('#csvfile').val()) { return; }193 if(!this.$el.find('#csvfile').val()) { return; }
194 jsonp(this.$element.find('#import_data'), {194 jsonp(this.$el.find('#import_data'), {
195 url: '/web/import/detect_data'195 url: '/web/import/detect_data'
196 }, this.on_import_results);196 }, this.on_import_results);
197 },197 },
198 on_import_results: function(results) {198 on_import_results: function(results) {
199 this.$element.find('#result').empty();199 this.$el.find('#result').empty();
200 var headers, result_node = this.$element.find("#result");200 var headers, result_node = this.$el.find("#result");
201201
202 if (results['error']) {202 if (results['error']) {
203 result_node.append(QWeb.render('ImportView.error', {203 result_node.append(QWeb.render('ImportView.error', {
204 'error': results['error']}));204 'error': results['error']}));
205 this.$element.find('fieldset').removeClass('oe_closed');205 this.$el.find('fieldset').removeClass('oe_closed');
206 return;206 return;
207 }207 }
208 if (results['success']) {208 if (results['success']) {
@@ -214,8 +214,8 @@
214 }214 }
215215
216 if (results['records']) {216 if (results['records']) {
217 var lines_to_skip = parseInt(this.$element.find('#csv_skip').val(), 10),217 var lines_to_skip = parseInt(this.$el.find('#csv_skip').val(), 10),
218 with_headers = this.$element.find('#file_has_headers').prop('checked');218 with_headers = this.$el.find('#file_has_headers').prop('checked');
219 headers = with_headers ? results.records[0] : null;219 headers = with_headers ? results.records[0] : null;
220220
221 result_node.append(QWeb.render('ImportView.result', {221 result_node.append(QWeb.render('ImportView.result', {
@@ -224,17 +224,17 @@
224 : with_headers ? results.records.slice(1)224 : with_headers ? results.records.slice(1)
225 : results.records225 : results.records
226 }));226 }));
227 this.$element.find('fieldset').addClass('oe_closed');227 this.$el.find('fieldset').addClass('oe_closed');
228 }228 }
229 this.$element.find('form').removeClass('oe_import_no_result');229 this.$el.find('form').removeClass('oe_import_no_result');
230230
231 this.$element.delegate('.oe_m2o_drop_down_button', 'click', function () {231 this.$el.delegate('.oe_m2o_drop_down_button', 'click', function () {
232 $(this).prev('input').focus();232 $(this).prev('input').focus();
233 });233 });
234234
235 var self = this;235 var self = this;
236 this.ready.then(function () {236 this.ready.then(function () {
237 var $fields = self.$element.find('.sel_fields').bind('blur', function () {237 var $fields = self.$el.find('.sel_fields').bind('blur', function () {
238 if (this.value && !_(self.all_fields).contains(this.value)) {238 if (this.value && !_(self.all_fields).contains(this.value)) {
239 this.value = '';239 this.value = '';
240 }240 }
@@ -315,9 +315,9 @@
315 find_duplicate_fields: function() {315 find_duplicate_fields: function() {
316 // Maps values to DOM nodes, in order to discover duplicates316 // Maps values to DOM nodes, in order to discover duplicates
317 var values = {}, duplicates = {};317 var values = {}, duplicates = {};
318 this.$element.find(".sel_fields").each(function(index, element) {318 this.$el.find(".sel_fields").each(function(index, element) {
319 var value = element.value;319 var value = element.value;
320 var $element = $(element).removeClass('duplicate_fld');320 var $el = $(element).removeClass('duplicate_fld');
321 if (!value) { return; }321 if (!value) { return; }
322322
323 if (!(value in values)) {323 if (!(value in values)) {
@@ -329,13 +329,13 @@
329 } else {329 } else {
330 duplicates[value] = [same_valued_field, element];330 duplicates[value] = [same_valued_field, element];
331 }331 }
332 $element.add(same_valued_field).addClass('duplicate_fld');332 $el.add(same_valued_field).addClass('duplicate_fld');
333 }333 }
334 });334 });
335 return duplicates;335 return duplicates;
336 },336 },
337 on_check_field_values: function () {337 on_check_field_values: function () {
338 this.$element.find("#message, #msg").remove();338 this.$el.find("#message, #msg").remove();
339339
340 var required_valid = this.check_required();340 var required_valid = this.check_required();
341341
@@ -343,7 +343,7 @@
343 if (_.isEmpty(duplicates)) {343 if (_.isEmpty(duplicates)) {
344 this.toggle_import_button(required_valid);344 this.toggle_import_button(required_valid);
345 } else {345 } else {
346 var $err = $('<div id="msg" style="color: red;">'+_t("Destination fields should only be selected once, some fields are selected more than once:")+'</div>').insertBefore(this.$element.find('#result'));346 var $err = $('<div id="msg" style="color: red;">'+_t("Destination fields should only be selected once, some fields are selected more than once:")+'</div>').insertBefore(this.$el.find('#result'));
347 var $dupes = $('<dl>').appendTo($err);347 var $dupes = $('<dl>').appendTo($err);
348 _(duplicates).each(function(elements, value) {348 _(duplicates).each(function(elements, value) {
349 $('<dt>').text(value).appendTo($dupes);349 $('<dt>').text(value).appendTo($dupes);
@@ -372,7 +372,7 @@
372 return f.id;372 return f.id;
373 };373 };
374374
375 var selected_fields = _(this.$element.find('.sel_fields').get()).chain()375 var selected_fields = _(this.$el.find('.sel_fields').get()).chain()
376 .pluck('value')376 .pluck('value')
377 .compact()377 .compact()
378 .map(resolve_field_id)378 .map(resolve_field_id)
@@ -380,13 +380,13 @@
380380
381 var missing_fields = _.difference(this.required_fields, selected_fields);381 var missing_fields = _.difference(this.required_fields, selected_fields);
382 if (missing_fields.length) {382 if (missing_fields.length) {
383 this.$element.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>');383 this.$el.find("#result").before('<div id="message" style="color:red">' + _t("*Required Fields are not selected :") + missing_fields + '.</div>');
384 return false;384 return false;
385 }385 }
386 return true;386 return true;
387 },387 },
388 destroy: function() {388 destroy: function() {
389 this.$element.remove();389 this.$el.remove();
390 this._super();390 this._super();
391 }391 }
392});392});
393393
=== modified file 'addons/web/static/src/js/search.js'
--- addons/web/static/src/js/search.js 2012-08-14 15:29:00 +0000
+++ addons/web/static/src/js/search.js 2012-08-27 06:09:20 +0000
@@ -126,21 +126,21 @@
126 template: 'SearchView.InputView',126 template: 'SearchView.InputView',
127 start: function () {127 start: function () {
128 var p = this._super.apply(this, arguments);128 var p = this._super.apply(this, arguments);
129 this.$element.on('focus', this.proxy('onFocus'));129 this.$el.on('focus', this.proxy('onFocus'));
130 this.$element.on('blur', this.proxy('onBlur'));130 this.$el.on('blur', this.proxy('onBlur'));
131 this.$element.on('keydown', this.proxy('onKeydown'));131 this.$el.on('keydown', this.proxy('onKeydown'));
132 return p;132 return p;
133 },133 },
134 onFocus: function () {134 onFocus: function () {
135 this.trigger('focused', this);135 this.trigger('focused', this);
136 },136 },
137 onBlur: function () {137 onBlur: function () {
138 this.$element.text('');138 this.$el.text('');
139 this.trigger('blurred', this);139 this.trigger('blurred', this);
140 },140 },
141 getSelection: function () {141 getSelection: function () {
142 // get Text node142 // get Text node
143 var root = this.$element[0].childNodes[0];143 var root = this.$el[0].childNodes[0];
144 if (!root || !root.textContent) {144 if (!root || !root.textContent) {
145 // if input does not have a child node, or the child node is an145 // if input does not have a child node, or the child node is an
146 // empty string, then the selection can only be (0, 0)146 // empty string, then the selection can only be (0, 0)
@@ -202,7 +202,7 @@
202 break;202 break;
203 case $.ui.keyCode.RIGHT:203 case $.ui.keyCode.RIGHT:
204 sel = this.getSelection();204 sel = this.getSelection();
205 var len = this.$element.text().length;205 var len = this.$el.text().length;
206 if (sel.start !== len || sel.start !== sel.end) {206 if (sel.start !== len || sel.start !== sel.end) {
207 e.stopPropagation();207 e.stopPropagation();
208 }208 }
@@ -223,17 +223,17 @@
223 },223 },
224 start: function () {224 start: function () {
225 var self = this;225 var self = this;
226 this.$element.on('focus', function () { self.trigger('focused', self); });226 this.$el.on('focus', function () { self.trigger('focused', self); });
227 this.$element.on('blur', function () { self.trigger('blurred', self); });227 this.$el.on('blur', function () { self.trigger('blurred', self); });
228 this.$element.on('click', function (e) {228 this.$el.on('click', function (e) {
229 if ($(e.target).is('.oe_facet_remove')) {229 if ($(e.target).is('.oe_facet_remove')) {
230 self.model.destroy();230 self.model.destroy();
231 return false;231 return false;
232 }232 }
233 self.$element.focus();233 self.$el.focus();
234 e.stopPropagation();234 e.stopPropagation();
235 });235 });
236 this.$element.on('keydown', function (e) {236 this.$el.on('keydown', function (e) {
237 var keys = $.ui.keyCode;237 var keys = $.ui.keyCode;
238 switch (e.which) {238 switch (e.which) {
239 case keys.BACKSPACE:239 case keys.BACKSPACE:
@@ -242,7 +242,7 @@
242 return false;242 return false;
243 }243 }
244 });244 });
245 var $e = self.$element.find('> span:last-child');245 var $e = self.$el.find('> span:last-child');
246 var q = $.when(this._super());246 var q = $.when(this._super());
247 return q.pipe(function () {247 return q.pipe(function () {
248 var values = self.model.values.map(function (value) {248 var values = self.model.values.map(function (value) {
@@ -253,7 +253,7 @@
253 });253 });
254 },254 },
255 model_changed: function () {255 model_changed: function () {
256 this.$element.text(this.$element.text() + '*');256 this.$el.text(this.$el.text() + '*');
257 }257 }
258});258});
259my.FacetValueView = instance.web.Widget.extend({259my.FacetValueView = instance.web.Widget.extend({
@@ -268,7 +268,7 @@
268 this._super();268 this._super();
269 },269 },
270 model_changed: function () {270 model_changed: function () {
271 this.$element.text(this.$element.text() + '*');271 this.$el.text(this.$el.text() + '*');
272 }272 }
273});273});
274274
@@ -313,7 +313,7 @@
313 .on('add change reset remove', this.proxy('renderFacets'));313 .on('add change reset remove', this.proxy('renderFacets'));
314314
315 if (this.hidden) {315 if (this.hidden) {
316 this.$element.hide();316 this.$el.hide();
317 }317 }
318 if (this.headless) {318 if (this.headless) {
319 this.ready.resolve();319 this.ready.resolve();
@@ -331,12 +331,12 @@
331 }331 }
332332
333 // Launch a search on clicking the oe_searchview_search button333 // Launch a search on clicking the oe_searchview_search button
334 this.$element.on('click', 'button.oe_searchview_search', function (e) {334 this.$el.on('click', 'button.oe_searchview_search', function (e) {
335 e.stopImmediatePropagation();335 e.stopImmediatePropagation();
336 self.do_search();336 self.do_search();
337 });337 });
338338
339 this.$element.on('keydown',339 this.$el.on('keydown',
340 '.oe_searchview_input, .oe_searchview_facet', function (e) {340 '.oe_searchview_input, .oe_searchview_facet', function (e) {
341 switch(e.which) {341 switch(e.which) {
342 case $.ui.keyCode.LEFT:342 case $.ui.keyCode.LEFT:
@@ -350,31 +350,31 @@
350 }350 }
351 });351 });
352352
353 this.$element.on('click', '.oe_searchview_clear', function (e) {353 this.$el.on('click', '.oe_searchview_clear', function (e) {
354 e.stopImmediatePropagation();354 e.stopImmediatePropagation();
355 self.query.reset();355 self.query.reset();
356 });356 });
357 this.$element.on('click', '.oe_searchview_unfold_drawer', function (e) {357 this.$el.on('click', '.oe_searchview_unfold_drawer', function (e) {
358 e.stopImmediatePropagation();358 e.stopImmediatePropagation();
359 self.$element.toggleClass('oe_searchview_open_drawer');359 self.$el.toggleClass('oe_searchview_open_drawer');
360 });360 });
361 instance.web.bus.on('click', this, function(ev) {361 instance.web.bus.on('click', this, function(ev) {
362 if ($(ev.target).parents('.oe_searchview').length === 0) {362 if ($(ev.target).parents('.oe_searchview').length === 0) {
363 self.$element.removeClass('oe_searchview_open_drawer');363 self.$el.removeClass('oe_searchview_open_drawer');
364 }364 }
365 });365 });
366 // Focus last input if the view itself is clicked (empty section of366 // Focus last input if the view itself is clicked (empty section of
367 // facets element)367 // facets element)
368 this.$element.on('click', function (e) {368 this.$el.on('click', function (e) {
369 if (e.target === self.$element.find('.oe_searchview_facets')[0]) {369 if (e.target === self.$el.find('.oe_searchview_facets')[0]) {
370 self.$element.find('.oe_searchview_input:last').focus();370 self.$el.find('.oe_searchview_input:last').focus();
371 }371 }
372 });372 });
373 // when the completion list opens/refreshes, automatically select the373 // when the completion list opens/refreshes, automatically select the
374 // first completion item so if the user just hits [RETURN] or [TAB] it374 // first completion item so if the user just hits [RETURN] or [TAB] it
375 // automatically selects it375 // automatically selects it
376 this.$element.on('autocompleteopen', function () {376 this.$el.on('autocompleteopen', function () {
377 var menu = self.$element.data('autocomplete').menu;377 var menu = self.$el.data('autocomplete').menu;
378 menu.activate(378 menu.activate(
379 $.Event({ type: "mouseenter" }),379 $.Event({ type: "mouseenter" }),
380 menu.element.children().first());380 menu.element.children().first());
@@ -383,15 +383,15 @@
383 return $.when(p, this.ready);383 return $.when(p, this.ready);
384 },384 },
385 show: function () {385 show: function () {
386 this.$element.show();386 this.$el.show();
387 },387 },
388 hide: function () {388 hide: function () {
389 this.$element.hide();389 this.$el.hide();
390 },390 },
391391
392 subviewForRoot: function (subview_root) {392 subviewForRoot: function (subview_root) {
393 return _(this.input_subviews).detect(function (subview) {393 return _(this.input_subviews).detect(function (subview) {
394 return subview.$element[0] === subview_root;394 return subview.$el[0] === subview_root;
395 });395 });
396 },396 },
397 siblingSubview: function (subview, direction, wrap_around) {397 siblingSubview: function (subview, direction, wrap_around) {
@@ -406,12 +406,12 @@
406 focusPreceding: function (subview_root) {406 focusPreceding: function (subview_root) {
407 return this.siblingSubview(407 return this.siblingSubview(
408 this.subviewForRoot(subview_root), -1, true)408 this.subviewForRoot(subview_root), -1, true)
409 .$element.focus();409 .$el.focus();
410 },410 },
411 focusFollowing: function (subview_root) {411 focusFollowing: function (subview_root) {
412 return this.siblingSubview(412 return this.siblingSubview(
413 this.subviewForRoot(subview_root), +1, true)413 this.subviewForRoot(subview_root), +1, true)
414 .$element.focus();414 .$el.focus();
415 },415 },
416416
417 /**417 /**
@@ -430,19 +430,19 @@
430430
431 // autocomplete only correctly handles being initialized on the actual431 // autocomplete only correctly handles being initialized on the actual
432 // editable element (and only an element with a @value in 1.8 e.g.432 // editable element (and only an element with a @value in 1.8 e.g.
433 // input or textarea), cheat by setting val() on $element433 // input or textarea), cheat by setting val() on $el
434 this.$element.on('keydown', function () {434 this.$el.on('keydown', function () {
435 // keydown is triggered *before* the element's value is set, so435 // keydown is triggered *before* the element's value is set, so
436 // delay this. Pray that setTimeout are executed in FIFO (if they436 // delay this. Pray that setTimeout are executed in FIFO (if they
437 // have the same delay) as autocomplete uses the exact same trick.437 // have the same delay) as autocomplete uses the exact same trick.
438 // FIXME: brittle as fuck438 // FIXME: brittle as fuck
439 setTimeout(function () {439 setTimeout(function () {
440 self.$element.val(self.currentInputValue());440 self.$el.val(self.currentInputValue());
441 }, 0);441 }, 0);
442442
443 });443 });
444444
445 this.$element.autocomplete({445 this.$el.autocomplete({
446 source: this.proxy('complete_global_search'),446 source: this.proxy('complete_global_search'),
447 select: this.proxy('select_completion'),447 select: this.proxy('select_completion'),
448 focus: function (e) { e.preventDefault(); },448 focus: function (e) { e.preventDefault(); },
@@ -479,7 +479,7 @@
479 * div[contenteditable].oe_searchview_input)479 * div[contenteditable].oe_searchview_input)
480 */480 */
481 currentInputValue: function () {481 currentInputValue: function () {
482 return this.$element.find('div.oe_searchview_input:focus').text();482 return this.$el.find('div.oe_searchview_input:focus').text();
483 },483 },
484 /**484 /**
485 * Provide auto-completion result for req.term (an array to `resp`)485 * Provide auto-completion result for req.term (an array to `resp`)
@@ -509,22 +509,22 @@
509509
510 var input_index = _(this.input_subviews).indexOf(510 var input_index = _(this.input_subviews).indexOf(
511 this.subviewForRoot(511 this.subviewForRoot(
512 this.$element.find('div.oe_searchview_input:focus')[0]));512 this.$el.find('div.oe_searchview_input:focus')[0]));
513 this.query.add(ui.item.facet, {at: input_index / 2});513 this.query.add(ui.item.facet, {at: input_index / 2});
514 },514 },
515 childFocused: function () {515 childFocused: function () {
516 this.$element.addClass('oe_focused');516 this.$el.addClass('oe_focused');
517 },517 },
518 childBlurred: function () {518 childBlurred: function () {
519 var val = this.$element.val();519 var val = this.$el.val();
520 this.$element.val('');520 this.$el.val('');
521 var complete = this.$element.data('autocomplete');521 var complete = this.$el.data('autocomplete');
522 if ((val && complete.term === undefined) || complete.previous !== undefined) {522 if ((val && complete.term === undefined) || complete.previous !== undefined) {
523 throw new Error("new jquery.ui version altering implementation" +523 throw new Error("new jquery.ui version altering implementation" +
524 " details relied on");524 " details relied on");
525 }525 }
526 delete complete.term;526 delete complete.term;
527 this.$element.removeClass('oe_focused')527 this.$el.removeClass('oe_focused')
528 .trigger('blur');528 .trigger('blur');
529 },529 },
530 /**530 /**
@@ -538,7 +538,7 @@
538 // _2: undefined if event=change, otherwise model538 // _2: undefined if event=change, otherwise model
539 var self = this;539 var self = this;
540 var started = [];540 var started = [];
541 var $e = this.$element.find('div.oe_searchview_facets');541 var $e = this.$el.find('div.oe_searchview_facets');
542 _.invoke(this.input_subviews, 'destroy');542 _.invoke(this.input_subviews, 'destroy');
543 this.input_subviews = [];543 this.input_subviews = [];
544544
@@ -569,7 +569,7 @@
569 input_to_focus = self.input_subviews[(options.at + 1) * 2];569 input_to_focus = self.input_subviews[(options.at + 1) * 2];
570 }570 }
571571
572 input_to_focus.$element.focus();572 input_to_focus.$el.focus();
573 });573 });
574 },574 },
575575
@@ -664,7 +664,7 @@
664 // build drawer664 // build drawer
665 var drawer_started = $.when.apply(665 var drawer_started = $.when.apply(
666 null, _(this.select_for_drawer()).invoke(666 null, _(this.select_for_drawer()).invoke(
667 'appendTo', this.$element.find('.oe_searchview_drawer')));667 'appendTo', this.$el.find('.oe_searchview_drawer')));
668 668
669 // load defaults669 // load defaults
670 var defaults_fetched = $.when.apply(null, _(this.inputs).invoke(670 var defaults_fetched = $.when.apply(null, _(this.inputs).invoke(
@@ -680,7 +680,7 @@
680 */680 */
681 on_filters_management: function(e) {681 on_filters_management: function(e) {
682 var self = this;682 var self = this;
683 var select = this.$element.find(".oe_search-view-filters-management");683 var select = this.$el.find(".oe_search-view-filters-management");
684 var val = select.val();684 var val = select.val();
685 switch(val) {685 switch(val) {
686 case 'advanced_filter':686 case 'advanced_filter':
@@ -989,7 +989,7 @@
989 this.view.query.on('add remove change reset', this.proxy('search_change'));989 this.view.query.on('add remove change reset', this.proxy('search_change'));
990 },990 },
991 start: function () {991 start: function () {
992 this.$element.on('click', 'li', this.proxy('toggle_filter'));992 this.$el.on('click', 'li', this.proxy('toggle_filter'));
993 return $.when(null);993 return $.when(null);
994 },994 },
995 /**995 /**
@@ -998,7 +998,7 @@
998 */998 */
999 search_change: function () {999 search_change: function () {
1000 var self = this;1000 var self = this;
1001 var $filters = this.$element.find('> li').removeClass('oe_selected');1001 var $filters = this.$el.find('> li').removeClass('oe_selected');
1002 var facet = this.view.query.find(_.bind(this.match_facet, this));1002 var facet = this.view.query.find(_.bind(this.match_facet, this));
1003 if (!facet) { return; }1003 if (!facet) { return; }
1004 facet.values.each(function (v) {1004 facet.values.each(function (v) {
@@ -1299,17 +1299,17 @@
1299});1299});
1300instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{1300instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{
1301 value_from: function () {1301 value_from: function () {
1302 if (!this.$element.val()) {1302 if (!this.$el.val()) {
1303 return null;1303 return null;
1304 }1304 }
1305 var val = this.parse(this.$element.val()),1305 var val = this.parse(this.$el.val()),
1306 check = Number(this.$element.val());1306 check = Number(this.$el.val());
1307 if (isNaN(val) || val !== check) {1307 if (isNaN(val) || val !== check) {
1308 this.$element.addClass('error');1308 this.$el.addClass('error');
1309 throw new instance.web.search.Invalid(1309 throw new instance.web.search.Invalid(
1310 this.attrs.name, this.$element.val(), this.error_message);1310 this.attrs.name, this.$el.val(), this.error_message);
1311 }1311 }
1312 this.$element.removeClass('error');1312 this.$el.removeClass('error');
1313 return val;1313 return val;
1314 }1314 }
1315});1315});
@@ -1542,9 +1542,9 @@
1542 self.clear_selection();1542 self.clear_selection();
1543 })1543 })
1544 .on('reset', this.proxy('clear_selection'));1544 .on('reset', this.proxy('clear_selection'));
1545 this.$element.on('submit', 'form', this.proxy('save_current'));1545 this.$el.on('submit', 'form', this.proxy('save_current'));
1546 this.$element.on('click', 'h4', function () {1546 this.$el.on('click', 'h4', function () {
1547 self.$element.toggleClass('oe_opened');1547 self.$el.toggleClass('oe_opened');
1548 });1548 });
1549 // FIXME: local eval of domain and context to get rid of special endpoint1549 // FIXME: local eval of domain and context to get rid of special endpoint
1550 return this.rpc('/web/searchview/get_filters', {1550 return this.rpc('/web/searchview/get_filters', {
@@ -1552,7 +1552,7 @@
1552 }).pipe(this.proxy('set_filters'));1552 }).pipe(this.proxy('set_filters'));
1553 },1553 },
1554 clear_selection: function () {1554 clear_selection: function () {
1555 this.$element.find('li.oe_selected').removeClass('oe_selected');1555 this.$el.find('li.oe_selected').removeClass('oe_selected');
1556 },1556 },
1557 append_filter: function (filter) {1557 append_filter: function (filter) {
1558 var self = this;1558 var self = this;
@@ -1564,7 +1564,7 @@
1564 } else {1564 } else {
1565 var id = filter.id;1565 var id = filter.id;
1566 $filter = this.filters[key] = $('<li></li>')1566 $filter = this.filters[key] = $('<li></li>')
1567 .appendTo(this.$element.find('.oe_searchview_custom_list'))1567 .appendTo(this.$el.find('.oe_searchview_custom_list'))
1568 .addClass(filter.user_id ? 'oe_searchview_custom_private'1568 .addClass(filter.user_id ? 'oe_searchview_custom_private'
1569 : 'oe_searchview_custom_public')1569 : 'oe_searchview_custom_public')
1570 .text(filter.name);1570 .text(filter.name);
@@ -1599,8 +1599,8 @@
1599 },1599 },
1600 save_current: function () {1600 save_current: function () {
1601 var self = this;1601 var self = this;
1602 var $name = this.$element.find('input:first');1602 var $name = this.$el.find('input:first');
1603 var private_filter = !this.$element.find('input:last').prop('checked');1603 var private_filter = !this.$el.find('input:last').prop('checked');
16041604
1605 var search = this.view.build_search_data();1605 var search = this.view.build_search_data();
1606 this.rpc('/web/session/eval_domain_and_context', {1606 this.rpc('/web/session/eval_domain_and_context', {
@@ -1622,7 +1622,7 @@
1622 return self.model.call('create_or_replace', [filter]).then(function (id) {1622 return self.model.call('create_or_replace', [filter]).then(function (id) {
1623 filter.id = id;1623 filter.id = id;
1624 self.append_filter(filter);1624 self.append_filter(filter);
1625 self.$element1625 self.$el
1626 .removeClass('oe_opened')1626 .removeClass('oe_opened')
1627 .find('form')[0].reset();1627 .find('form')[0].reset();
1628 });1628 });
@@ -1667,8 +1667,8 @@
1667 }1667 }
16681668
1669 return $.when(1669 return $.when(
1670 this.render_column(col1, $('<div>').appendTo(this.$element)),1670 this.render_column(col1, $('<div>').appendTo(this.$el)),
1671 this.render_column(col2, $('<div>').appendTo(this.$element)));1671 this.render_column(col2, $('<div>').appendTo(this.$el)));
1672 },1672 },
1673 render_column: function (column, $el) {1673 render_column: function (column, $el) {
1674 return $.when.apply(null, _(column).map(function (group) {1674 return $.when.apply(null, _(column).map(function (group) {
@@ -1684,10 +1684,10 @@
1684 _in_drawer: true,1684 _in_drawer: true,
1685 start: function () {1685 start: function () {
1686 var self = this;1686 var self = this;
1687 this.$element1687 this.$el
1688 .on('keypress keydown keyup', function (e) { e.stopPropagation(); })1688 .on('keypress keydown keyup', function (e) { e.stopPropagation(); })
1689 .on('click', 'h4', function () {1689 .on('click', 'h4', function () {
1690 self.$element.toggleClass('oe_opened');1690 self.$el.toggleClass('oe_opened');
1691 }).on('click', 'button.oe_add_condition', function () {1691 }).on('click', 'button.oe_add_condition', function () {
1692 self.append_proposition();1692 self.append_proposition();
1693 }).on('submit', 'form', function (e) {1693 }).on('submit', 'form', function (e) {
@@ -1706,7 +1706,7 @@
1706 },1706 },
1707 append_proposition: function () {1707 append_proposition: function () {
1708 return (new instance.web.search.ExtendedSearchProposition(this, this.fields))1708 return (new instance.web.search.ExtendedSearchProposition(this, this.fields))
1709 .appendTo(this.$element.find('ul'));1709 .appendTo(this.$el.find('ul'));
1710 },1710 },
1711 commit_search: function () {1711 commit_search: function () {
1712 var self = this;1712 var self = this;
@@ -1733,7 +1733,7 @@
1733 // add new empty proposition1733 // add new empty proposition
1734 this.append_proposition();1734 this.append_proposition();
1735 // TODO: API on searchview1735 // TODO: API on searchview
1736 this.view.$element.removeClass('oe_searchview_open_drawer');1736 this.view.$el.removeClass('oe_searchview_open_drawer');
1737 }1737 }
1738});1738});
17391739
@@ -1757,16 +1757,16 @@
1757 },1757 },
1758 start: function () {1758 start: function () {
1759 var _this = this;1759 var _this = this;
1760 this.$element.find(".searchview_extended_prop_field").change(function() {1760 this.$el.find(".searchview_extended_prop_field").change(function() {
1761 _this.changed();1761 _this.changed();
1762 });1762 });
1763 this.$element.find('.searchview_extended_delete_prop').click(function () {1763 this.$el.find('.searchview_extended_delete_prop').click(function () {
1764 _this.destroy();1764 _this.destroy();
1765 });1765 });
1766 this.changed();1766 this.changed();
1767 },1767 },
1768 changed: function() {1768 changed: function() {
1769 var nval = this.$element.find(".searchview_extended_prop_field").val();1769 var nval = this.$el.find(".searchview_extended_prop_field").val();
1770 if(this.attrs.selected == null || nval != this.attrs.selected.name) {1770 if(this.attrs.selected == null || nval != this.attrs.selected.name) {
1771 this.select_field(_.detect(this.fields, function(x) {return x.name == nval;}));1771 this.select_field(_.detect(this.fields, function(x) {return x.name == nval;}));
1772 }1772 }
@@ -1781,7 +1781,7 @@
1781 if(this.attrs.selected != null) {1781 if(this.attrs.selected != null) {
1782 this.value.destroy();1782 this.value.destroy();
1783 this.value = null;1783 this.value = null;
1784 this.$element.find('.searchview_extended_prop_op').html('');1784 this.$el.find('.searchview_extended_prop_op').html('');
1785 }1785 }
1786 this.attrs.selected = field;1786 this.attrs.selected = field;
1787 if(field == null) {1787 if(field == null) {
@@ -1797,9 +1797,9 @@
1797 _.each(this.value.operators, function(operator) {1797 _.each(this.value.operators, function(operator) {
1798 $('<option>', {value: operator.value})1798 $('<option>', {value: operator.value})
1799 .text(String(operator.text))1799 .text(String(operator.text))
1800 .appendTo(self.$element.find('.searchview_extended_prop_op'));1800 .appendTo(self.$el.find('.searchview_extended_prop_op'));
1801 });1801 });
1802 var $value_loc = this.$element.find('.searchview_extended_prop_value').empty();1802 var $value_loc = this.$el.find('.searchview_extended_prop_value').empty();
1803 this.value.appendTo($value_loc);1803 this.value.appendTo($value_loc);
18041804
1805 },1805 },
@@ -1807,7 +1807,7 @@
1807 if ( this.attrs.selected == null)1807 if ( this.attrs.selected == null)
1808 return null;1808 return null;
1809 var field = this.attrs.selected;1809 var field = this.attrs.selected;
1810 var op = this.$element.find('.searchview_extended_prop_op')[0];1810 var op = this.$el.find('.searchview_extended_prop_op')[0];
1811 var operator = op.options[op.selectedIndex];1811 var operator = op.options[op.selectedIndex];
1812 return {1812 return {
1813 label: _.str.sprintf(_t('%(field)s %(operator)s "%(value)s"'), {1813 label: _.str.sprintf(_t('%(field)s %(operator)s "%(value)s"'), {
@@ -1851,7 +1851,7 @@
1851 {value: "!=", text: _lt("is not equal to")}1851 {value: "!=", text: _lt("is not equal to")}
1852 ],1852 ],
1853 get_value: function() {1853 get_value: function() {
1854 return this.$element.val();1854 return this.$el.val();
1855 }1855 }
1856});1856});
1857instance.web.search.ExtendedSearchProposition.DateTime = instance.web.search.ExtendedSearchProposition.Field.extend({1857instance.web.search.ExtendedSearchProposition.DateTime = instance.web.search.ExtendedSearchProposition.Field.extend({
@@ -1875,7 +1875,7 @@
1875 start: function() {1875 start: function() {
1876 var ready = this._super();1876 var ready = this._super();
1877 this.datewidget = new (this.widget())(this);1877 this.datewidget = new (this.widget())(this);
1878 this.datewidget.appendTo(this.$element);1878 this.datewidget.appendTo(this.$el);
1879 return ready;1879 return ready;
1880 }1880 }
1881});1881});
@@ -1893,11 +1893,11 @@
1893 {value: "<=", text: _lt("less or equal than")}1893 {value: "<=", text: _lt("less or equal than")}
1894 ],1894 ],
1895 toString: function () {1895 toString: function () {
1896 return this.$element.val();1896 return this.$el.val();
1897 },1897 },
1898 get_value: function() {1898 get_value: function() {
1899 try {1899 try {
1900 return instance.web.parse_value(this.$element.val(), {'widget': 'integer'});1900 return instance.web.parse_value(this.$el.val(), {'widget': 'integer'});
1901 } catch (e) {1901 } catch (e) {
1902 return "";1902 return "";
1903 }1903 }
@@ -1917,11 +1917,11 @@
1917 {value: "<=", text: _lt("less or equal than")}1917 {value: "<=", text: _lt("less or equal than")}
1918 ],1918 ],
1919 toString: function () {1919 toString: function () {
1920 return this.$element.val();1920 return this.$el.val();
1921 },1921 },
1922 get_value: function() {1922 get_value: function() {
1923 try {1923 try {
1924 return instance.web.parse_value(this.$element.val(), {'widget': 'float'});1924 return instance.web.parse_value(this.$el.val(), {'widget': 'float'});
1925 } catch (e) {1925 } catch (e) {
1926 return "";1926 return "";
1927 }1927 }
@@ -1934,12 +1934,12 @@
1934 {value: "!=", text: _lt("is not")}1934 {value: "!=", text: _lt("is not")}
1935 ],1935 ],
1936 toString: function () {1936 toString: function () {
1937 var select = this.$element[0];1937 var select = this.$el[0];
1938 var option = select.options[select.selectedIndex];1938 var option = select.options[select.selectedIndex];
1939 return option.label || option.text;1939 return option.label || option.text;
1940 },1940 },
1941 get_value: function() {1941 get_value: function() {
1942 return this.$element.val();1942 return this.$el.val();
1943 }1943 }
1944});1944});
1945instance.web.search.ExtendedSearchProposition.Boolean = instance.web.search.ExtendedSearchProposition.Field.extend({1945instance.web.search.ExtendedSearchProposition.Boolean = instance.web.search.ExtendedSearchProposition.Field.extend({
19461946
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-08-23 15:37:10 +0000
+++ addons/web/static/src/js/view_form.js 2012-08-27 06:09:20 +0000
@@ -102,8 +102,8 @@
102 w.off('focused blurred');102 w.off('focused blurred');
103 w.destroy();103 w.destroy();
104 });104 });
105 if (this.$element) {105 if (this.$el) {
106 this.$element.off('.formBlur');106 this.$el.off('.formBlur');
107 }107 }
108 this._super();108 this._super();
109 },109 },
@@ -122,11 +122,11 @@
122 this.rendering_engine.set_tags_registry(this.tags_registry);122 this.rendering_engine.set_tags_registry(this.tags_registry);
123 if (!this.extract_qweb_template(data)) {123 if (!this.extract_qweb_template(data)) {
124 this.rendering_engine.set_fields_view(data);124 this.rendering_engine.set_fields_view(data);
125 var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container');125 var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container');
126 this.rendering_engine.render_to($dest);126 this.rendering_engine.render_to($dest);
127 }127 }
128128
129 this.$element.on('mousedown.formBlur', function () {129 this.$el.on('mousedown.formBlur', function () {
130 self.__clicked_inside = true;130 self.__clicked_inside = true;
131 });131 });
132132
@@ -134,14 +134,14 @@
134 if (this.options.$buttons) {134 if (this.options.$buttons) {
135 this.$buttons.appendTo(this.options.$buttons);135 this.$buttons.appendTo(this.options.$buttons);
136 } else {136 } else {
137 this.$element.find('.oe_form_buttons').replaceWith(this.$buttons);137 this.$el.find('.oe_form_buttons').replaceWith(this.$buttons);
138 }138 }
139 this.$buttons.on('click','.oe_form_button_create',this.on_button_create);139 this.$buttons.on('click','.oe_form_button_create',this.on_button_create);
140 this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit);140 this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit);
141 this.$buttons.on('click','.oe_form_button_save',this.on_button_save);141 this.$buttons.on('click','.oe_form_button_save',this.on_button_save);
142 this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel);142 this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel);
143143
144 this.$sidebar = this.options.$sidebar || this.$element.find('.oe_form_sidebar');144 this.$sidebar = this.options.$sidebar || this.$el.find('.oe_form_sidebar');
145 if (!this.sidebar && this.options.$sidebar) {145 if (!this.sidebar && this.options.$sidebar) {
146 this.sidebar = new instance.web.Sidebar(this);146 this.sidebar = new instance.web.Sidebar(this);
147 this.sidebar.appendTo(this.$sidebar);147 this.sidebar.appendTo(this.$sidebar);
@@ -158,7 +158,7 @@
158 this.has_been_loaded.resolve();158 this.has_been_loaded.resolve();
159159
160 // Add bounce effect on button 'Edit' when click on readonly page view.160 // Add bounce effect on button 'Edit' when click on readonly page view.
161 this.$element.find(".oe_form_field,label").on('click', function (e) {161 this.$el.find(".oe_form_field,label").on('click', function (e) {
162 if(self.get("actual_mode") == "view") {162 if(self.get("actual_mode") == "view") {
163 var $button = self.options.$buttons.find(".oe_form_button_edit");163 var $button = self.options.$buttons.find(".oe_form_button_edit");
164 $button.effect('bounce', {distance: 18, times: 5}, 150)164 $button.effect('bounce', {distance: 18, times: 5}, 150)
@@ -215,7 +215,7 @@
215 this.default_focus_field = null;215 this.default_focus_field = null;
216 this.default_focus_button = null;216 this.default_focus_button = null;
217 this.translatable_fields = [];217 this.translatable_fields = [];
218 this.$element.find('.oe_form_container').empty();218 this.$el.find('.oe_form_container').empty();
219 },219 },
220220
221 widgetFocused: function() {221 widgetFocused: function() {
@@ -263,7 +263,7 @@
263 var self = this;263 var self = this;
264 options = options || {};264 options = options || {};
265 if (this.sidebar) {265 if (this.sidebar) {
266 this.sidebar.$element.show();266 this.sidebar.$el.show();
267 }267 }
268 if (this.$buttons) {268 if (this.$buttons) {
269 this.$buttons.show();269 this.$buttons.show();
@@ -271,11 +271,11 @@
271 if (this.$pager) {271 if (this.$pager) {
272 this.$pager.show();272 this.$pager.show();
273 }273 }
274 this.$element.show().css({274 this.$el.show().css({
275 opacity: '0',275 opacity: '0',
276 filter: 'alpha(opacity = 0)'276 filter: 'alpha(opacity = 0)'
277 });277 });
278 this.$element.add(this.$buttons).removeClass('oe_form_dirty');278 this.$el.add(this.$buttons).removeClass('oe_form_dirty');
279279
280 var shown = this.has_been_loaded;280 var shown = this.has_been_loaded;
281 if (options.reload !== false) {281 if (options.reload !== false) {
@@ -293,7 +293,7 @@
293 }293 }
294 return shown.pipe(function() {294 return shown.pipe(function() {
295 self._actualize_mode(options.mode || self.options.initial_mode);295 self._actualize_mode(options.mode || self.options.initial_mode);
296 self.$element.css({296 self.$el.css({
297 opacity: '1',297 opacity: '1',
298 filter: 'alpha(opacity = 100)'298 filter: 'alpha(opacity = 100)'
299 });299 });
@@ -301,7 +301,7 @@
301 },301 },
302 do_hide: function () {302 do_hide: function () {
303 if (this.sidebar) {303 if (this.sidebar) {
304 this.sidebar.$element.hide();304 this.sidebar.$el.hide();
305 }305 }
306 if (this.$buttons) {306 if (this.$buttons) {
307 this.$buttons.hide();307 this.$buttons.hide();
@@ -325,7 +325,7 @@
325 if (this.qweb) {325 if (this.qweb) {
326 this.kill_current_form();326 this.kill_current_form();
327 this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record));327 this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record));
328 var $dest = this.$element.hasClass("oe_form_container") ? this.$element : this.$element.find('.oe_form_container');328 var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container');
329 this.rendering_engine.render_to($dest);329 this.rendering_engine.render_to($dest);
330 }330 }
331331
@@ -357,7 +357,7 @@
357 } else {357 } else {
358 self.do_push_state({});358 self.do_push_state({});
359 }359 }
360 self.$element.add(self.$buttons).removeClass('oe_form_dirty');360 self.$el.add(self.$buttons).removeClass('oe_form_dirty');
361 self.autofocus();361 self.autofocus();
362 });362 });
363 },363 },
@@ -379,7 +379,7 @@
379 this.trigger("view_content_has_changed");379 this.trigger("view_content_has_changed");
380 },380 },
381 do_notify_change: function() {381 do_notify_change: function() {
382 this.$element.add(this.$buttons).addClass('oe_form_dirty');382 this.$el.add(this.$buttons).addClass('oe_form_dirty');
383 },383 },
384 on_pager_action: function(action) {384 on_pager_action: function(action) {
385 if (this.can_be_discarded()) {385 if (this.can_be_discarded()) {
@@ -410,7 +410,7 @@
410 if (this.options.$pager) {410 if (this.options.$pager) {
411 this.$pager.appendTo(this.options.$pager);411 this.$pager.appendTo(this.options.$pager);
412 } else {412 } else {
413 this.$element.find('.oe_form_pager').replaceWith(this.$pager);413 this.$el.find('.oe_form_pager').replaceWith(this.$pager);
414 }414 }
415 this.$pager.on('click','a[data-pager-action]',function() {415 this.$pager.on('click','a[data-pager-action]',function() {
416 var action = $(this).data('pager-action');416 var action = $(this).data('pager-action');
@@ -653,7 +653,7 @@
653 check_actual_mode: function(source, options) {653 check_actual_mode: function(source, options) {
654 var self = this;654 var self = this;
655 if(this.get("actual_mode") === "view") {655 if(this.get("actual_mode") === "view") {
656 self.$element.removeClass('oe_form_editable').addClass('oe_form_readonly');656 self.$el.removeClass('oe_form_editable').addClass('oe_form_readonly');
657 self.$buttons.find('.oe_form_buttons_edit').hide();657 self.$buttons.find('.oe_form_buttons_edit').hide();
658 self.$buttons.find('.oe_form_buttons_view').show();658 self.$buttons.find('.oe_form_buttons_view').show();
659 self.$sidebar.show();659 self.$sidebar.show();
@@ -661,7 +661,7 @@
661 field.set({"force_readonly": true});661 field.set({"force_readonly": true});
662 });662 });
663 } else {663 } else {
664 self.$element.removeClass('oe_form_readonly').addClass('oe_form_editable');664 self.$el.removeClass('oe_form_readonly').addClass('oe_form_editable');
665 self.$buttons.find('.oe_form_buttons_edit').show();665 self.$buttons.find('.oe_form_buttons_edit').show();
666 self.$buttons.find('.oe_form_buttons_view').hide();666 self.$buttons.find('.oe_form_buttons_view').hide();
667 self.$sidebar.hide();667 self.$sidebar.hide();
@@ -752,7 +752,7 @@
752 return def.promise();752 return def.promise();
753 },753 },
754 can_be_discarded: function() {754 can_be_discarded: function() {
755 return !this.$element.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded."));755 return !this.$el.is('.oe_form_dirty') || confirm(_t("Warning, the record has been modified, your changes will be discarded."));
756 },756 },
757 /**757 /**
758 * Triggers saving the form's record. Chooses between creating a new758 * Triggers saving the form's record. Chooses between creating a new
@@ -993,14 +993,14 @@
993 buttons: [993 buttons: [
994 {text: _t("Close"), click: function () { d.close(); }},994 {text: _t("Close"), click: function () { d.close(); }},
995 {text: _t("Save default"), click: function () {995 {text: _t("Save default"), click: function () {
996 var $defaults = d.$element.find('#formview_default_fields');996 var $defaults = d.$el.find('#formview_default_fields');
997 var field_to_set = $defaults.val();997 var field_to_set = $defaults.val();
998 if (!field_to_set) {998 if (!field_to_set) {
999 $defaults.parent().addClass('oe_form_invalid');999 $defaults.parent().addClass('oe_form_invalid');
1000 return;1000 return;
1001 }1001 }
1002 var condition = d.$element.find('#formview_default_conditions').val(),1002 var condition = d.$el.find('#formview_default_conditions').val(),
1003 all_users = d.$element.find('#formview_default_all').is(':checked');1003 all_users = d.$el.find('#formview_default_all').is(':checked');
1004 new instance.web.DataSet(self, 'ir.values').call(1004 new instance.web.DataSet(self, 'ir.values').call(
1005 'set_default', [1005 'set_default', [
1006 self.dataset.model,1006 self.dataset.model,
@@ -1054,7 +1054,7 @@
1054instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({1054instance.web.form.FormRenderingEngineInterface = instance.web.Class.extend({
1055 set_fields_view: function(fields_view) {},1055 set_fields_view: function(fields_view) {},
1056 set_fields_registry: function(fields_registry) {},1056 set_fields_registry: function(fields_registry) {},
1057 render_to: function($element) {},1057 render_to: function($el) {},
1058});1058});
10591059
1060/**1060/**
@@ -1459,7 +1459,7 @@
1459 this.form = new instance.web.FormView(this, this.dataset, this.view_id, {1459 this.form = new instance.web.FormView(this, this.dataset, this.view_id, {
1460 pager: false1460 pager: false
1461 });1461 });
1462 this.form.appendTo(this.$element);1462 this.form.appendTo(this.$el);
1463 this.form.on_created.add_last(this.on_form_dialog_saved);1463 this.form.on_created.add_last(this.on_form_dialog_saved);
1464 this.form.on_saved.add_last(this.on_form_dialog_saved);1464 this.form.on_saved.add_last(this.on_form_dialog_saved);
1465 return this;1465 return this;
@@ -1551,7 +1551,7 @@
1551/**1551/**
1552 * Must be applied over an class already possessing the PropertiesMixin.1552 * Must be applied over an class already possessing the PropertiesMixin.
1553 *1553 *
1554 * Apply the result of the "invisible" domain to this.$element.1554 * Apply the result of the "invisible" domain to this.$el.
1555 */1555 */
1556instance.web.form.InvisibilityChangerMixin = {1556instance.web.form.InvisibilityChangerMixin = {
1557 init: function(field_manager, invisible_domain) {1557 init: function(field_manager, invisible_domain) {
@@ -1582,16 +1582,16 @@
1582 this._check_visibility();1582 this._check_visibility();
1583 },1583 },
1584 _check_visibility: function() {1584 _check_visibility: function() {
1585 this.$element.toggleClass('oe_form_invisible', this.get("effective_invisible"));1585 this.$el.toggleClass('oe_form_invisible', this.get("effective_invisible"));
1586 },1586 },
1587};1587};
15881588
1589instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, {1589instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, {
1590 init: function(parent, field_manager, invisible_domain, $element) {1590 init: function(parent, field_manager, invisible_domain, $el) {
1591 this.setParent(parent);1591 this.setParent(parent);
1592 instance.web.PropertiesMixin.init.call(this);1592 instance.web.PropertiesMixin.init.call(this);
1593 instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain);1593 instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain);
1594 this.$element = $element;1594 this.$el = $el;
1595 this.start();1595 this.start();
1596 },1596 },
1597});1597});
@@ -1615,7 +1615,7 @@
1615 },1615 },
1616 renderElement: function() {1616 renderElement: function() {
1617 this._super();1617 this._super();
1618 this.$element.addClass(this.node.attrs["class"] || "");1618 this.$el.addClass(this.node.attrs["class"] || "");
1619 },1619 },
1620 destroy: function() {1620 destroy: function() {
1621 $.fn.tipsy.clear();1621 $.fn.tipsy.clear();
@@ -1649,7 +1649,7 @@
1649 },1649 },
1650 do_attach_tooltip: function(widget, trigger, options) {1650 do_attach_tooltip: function(widget, trigger, options) {
1651 widget = widget || this;1651 widget = widget || this;
1652 trigger = trigger || this.$element;1652 trigger = trigger || this.$el;
1653 options = _.extend({1653 options = _.extend({
1654 delayIn: 500,1654 delayIn: 500,
1655 delayOut: 0,1655 delayOut: 0,
@@ -1736,11 +1736,11 @@
1736 },1736 },
1737 start: function() {1737 start: function() {
1738 this._super.apply(this, arguments);1738 this._super.apply(this, arguments);
1739 this.$element.click(this.on_click);1739 this.$el.click(this.on_click);
1740 if (this.node.attrs.help || instance.session.debug) {1740 if (this.node.attrs.help || instance.session.debug) {
1741 this.do_attach_tooltip();1741 this.do_attach_tooltip();
1742 }1742 }
1743 this.setupFocus(this.$element);1743 this.setupFocus(this.$el);
1744 },1744 },
1745 on_click: function() {1745 on_click: function() {
1746 var self = this;1746 var self = this;
@@ -1799,8 +1799,8 @@
1799 },1799 },
1800 check_disable: function() {1800 check_disable: function() {
1801 var disabled = (this.force_disabled || !this.view.is_interactible_record());1801 var disabled = (this.force_disabled || !this.view.is_interactible_record());
1802 this.$element.prop('disabled', disabled);1802 this.$el.prop('disabled', disabled);
1803 this.$element.css('color', disabled ? 'grey' : '');1803 this.$el.css('color', disabled ? 'grey' : '');
1804 }1804 }
1805});1805});
18061806
@@ -1929,14 +1929,14 @@
1929 var self = this;1929 var self = this;
1930 this._super();1930 this._super();
1931 if (this.field.translate) {1931 if (this.field.translate) {
1932 this.$element.addClass('oe_form_field_translatable');1932 this.$el.addClass('oe_form_field_translatable');
1933 this.$element.find('.oe_field_translate').click(_.bind(function() {1933 this.$el.find('.oe_field_translate').click(_.bind(function() {
1934 this.field_manager.open_translate_dialog(this);1934 this.field_manager.open_translate_dialog(this);
1935 }, this));1935 }, this));
1936 }1936 }
1937 this.$label = this.view.$element.find('label[for=' + this.id_for_label + ']');1937 this.$label = this.view.$el.find('label[for=' + this.id_for_label + ']');
1938 if (instance.session.debug) {1938 if (instance.session.debug) {
1939 this.do_attach_tooltip(this, this.$label[0] || this.$element);1939 this.do_attach_tooltip(this, this.$label[0] || this.$el);
1940 this.$label.off('dblclick').on('dblclick', function() {1940 this.$label.off('dblclick').on('dblclick', function() {
1941 console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view);1941 console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view);
1942 window.w = self;1942 window.w = self;
@@ -1955,7 +1955,7 @@
1955 * Private. Do not use.1955 * Private. Do not use.
1956 */1956 */
1957 _set_required: function() {1957 _set_required: function() {
1958 this.$element.toggleClass('oe_form_required', this.get("required"));1958 this.$el.toggleClass('oe_form_required', this.get("required"));
1959 },1959 },
1960 set_value: function(value_) {1960 set_value: function(value_) {
1961 this._inhibit_on_change = true;1961 this._inhibit_on_change = true;
@@ -1980,11 +1980,11 @@
1980 },1980 },
1981 _check_css_flags: function() {1981 _check_css_flags: function() {
1982 if (this.field.translate) {1982 if (this.field.translate) {
1983 this.$element.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode());1983 this.$el.find('.oe_field_translate').toggle(!this.field_manager.is_create_mode());
1984 }1984 }
1985 if (!this.disable_utility_classes) {1985 if (!this.disable_utility_classes) {
1986 if (this.field_manager.get('display_invalid_fields')) {1986 if (this.field_manager.get('display_invalid_fields')) {
1987 this.$element.toggleClass('oe_form_invalid', !this.is_valid());1987 this.$el.toggleClass('oe_form_invalid', !this.is_valid());
1988 }1988 }
1989 }1989 }
1990 },1990 },
@@ -2042,7 +2042,7 @@
2042 },2042 },
2043 initialize_content: function() {2043 initialize_content: function() {
2044 var self = this;2044 var self = this;
2045 var $input = this.$element.find('input');2045 var $input = this.$el.find('input');
2046 $input.change(function() {2046 $input.change(function() {
2047 self.set({'value': instance.web.parse_value($input.val(), self)});2047 self.set({'value': instance.web.parse_value($input.val(), self)});
2048 });2048 });
@@ -2055,18 +2055,18 @@
2055 render_value: function() {2055 render_value: function() {
2056 var show_value = instance.web.format_value(this.get('value'), this, '');2056 var show_value = instance.web.format_value(this.get('value'), this, '');
2057 if (!this.get("effective_readonly")) {2057 if (!this.get("effective_readonly")) {
2058 this.$element.find('input').val(show_value);2058 this.$el.find('input').val(show_value);
2059 } else {2059 } else {
2060 if (this.password) {2060 if (this.password) {
2061 show_value = new Array(show_value.length + 1).join('*');2061 show_value = new Array(show_value.length + 1).join('*');
2062 }2062 }
2063 this.$element.text(show_value);2063 this.$el.text(show_value);
2064 }2064 }
2065 },2065 },
2066 is_syntax_valid: function() {2066 is_syntax_valid: function() {
2067 if (!this.get("effective_readonly")) {2067 if (!this.get("effective_readonly")) {
2068 try {2068 try {
2069 var value_ = instance.web.parse_value(this.$element.find('input').val(), this, '');2069 var value_ = instance.web.parse_value(this.$el.find('input').val(), this, '');
2070 return true;2070 return true;
2071 } catch(e) {2071 } catch(e) {
2072 return false;2072 return false;
@@ -2090,7 +2090,7 @@
2090 template: 'FieldEmail',2090 template: 'FieldEmail',
2091 initialize_content: function() {2091 initialize_content: function() {
2092 this._super();2092 this._super();
2093 var $button = this.$element.find('button');2093 var $button = this.$el.find('button');
2094 $button.click(this.on_button_clicked);2094 $button.click(this.on_button_clicked);
2095 this.setupFocus($button);2095 this.setupFocus($button);
2096 },2096 },
@@ -2098,7 +2098,7 @@
2098 if (!this.get("effective_readonly")) {2098 if (!this.get("effective_readonly")) {
2099 this._super();2099 this._super();
2100 } else {2100 } else {
2101 this.$element.find('a')2101 this.$el.find('a')
2102 .attr('href', 'mailto:' + this.get('value'))2102 .attr('href', 'mailto:' + this.get('value'))
2103 .text(this.get('value') || '');2103 .text(this.get('value') || '');
2104 }2104 }
@@ -2116,7 +2116,7 @@
2116 template: 'FieldUrl',2116 template: 'FieldUrl',
2117 initialize_content: function() {2117 initialize_content: function() {
2118 this._super();2118 this._super();
2119 var $button = this.$element.find('button');2119 var $button = this.$el.find('button');
2120 $button.click(this.on_button_clicked);2120 $button.click(this.on_button_clicked);
2121 this.setupFocus($button);2121 this.setupFocus($button);
2122 },2122 },
@@ -2129,7 +2129,7 @@
2129 if (!s) {2129 if (!s) {
2130 tmp = "http://" + this.get('value');2130 tmp = "http://" + this.get('value');
2131 }2131 }
2132 this.$element.find('a').attr('href', tmp).text(this.get('value') ? tmp : '');2132 this.$el.find('a').attr('href', tmp).text(this.get('value') ? tmp : '');
2133 }2133 }
2134 },2134 },
2135 on_button_clicked: function() {2135 on_button_clicked: function() {
@@ -2178,8 +2178,8 @@
2178 },2178 },
2179 start: function() {2179 start: function() {
2180 var self = this;2180 var self = this;
2181 this.$input = this.$element.find('input.oe_datepicker_master');2181 this.$input = this.$el.find('input.oe_datepicker_master');
2182 this.$input_picker = this.$element.find('input.oe_datepicker_container');2182 this.$input_picker = this.$el.find('input.oe_datepicker_container');
2183 this.$input.change(this.on_change);2183 this.$input.change(this.on_change);
2184 this.picker({2184 this.picker({
2185 onClose: this.on_picker_select,2185 onClose: this.on_picker_select,
@@ -2189,7 +2189,7 @@
2189 showWeek: true,2189 showWeek: true,
2190 showButtonPanel: true2190 showButtonPanel: true
2191 });2191 });
2192 this.$element.find('img.oe_datepicker_trigger').click(function() {2192 this.$el.find('img.oe_datepicker_trigger').click(function() {
2193 if (self.get("effective_readonly") || self.picker('widget').is(':visible')) {2193 if (self.get("effective_readonly") || self.picker('widget').is(':visible')) {
2194 self.$input.focus();2194 self.$input.focus();
2195 return;2195 return;
@@ -2226,7 +2226,7 @@
2226 set_readonly: function(readonly) {2226 set_readonly: function(readonly) {
2227 this.readonly = readonly;2227 this.readonly = readonly;
2228 this.$input.prop('readonly', this.readonly);2228 this.$input.prop('readonly', this.readonly);
2229 this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly);2229 this.$el.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly);
2230 },2230 },
2231 is_valid_: function() {2231 is_valid_: function() {
2232 var value_ = this.$input.val();2232 var value_ = this.$input.val();
@@ -2276,7 +2276,7 @@
2276 this.datewidget.on_change.add_last(_.bind(function() {2276 this.datewidget.on_change.add_last(_.bind(function() {
2277 this.set({'value': this.datewidget.get_value()});2277 this.set({'value': this.datewidget.get_value()});
2278 }, this));2278 }, this));
2279 this.datewidget.appendTo(this.$element);2279 this.datewidget.appendTo(this.$el);
2280 this.setupFocus(this.datewidget.$input);2280 this.setupFocus(this.datewidget.$input);
2281 }2281 }
2282 },2282 },
@@ -2288,7 +2288,7 @@
2288 if (!this.get("effective_readonly")) {2288 if (!this.get("effective_readonly")) {
2289 this.datewidget.set_value(this.get('value'));2289 this.datewidget.set_value(this.get('value'));
2290 } else {2290 } else {
2291 this.$element.text(instance.web.format_value(this.get('value'), this, ''));2291 this.$el.text(instance.web.format_value(this.get('value'), this, ''));
2292 }2292 }
2293 },2293 },
2294 is_syntax_valid: function() {2294 is_syntax_valid: function() {
@@ -2317,7 +2317,7 @@
2317instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {2317instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
2318 template: 'FieldText',2318 template: 'FieldText',
2319 initialize_content: function() {2319 initialize_content: function() {
2320 this.$textarea = this.$element.find('textarea');2320 this.$textarea = this.$el.find('textarea');
2321 if (!this.get("effective_readonly")) {2321 if (!this.get("effective_readonly")) {
2322 this.$textarea.change(_.bind(function() {2322 this.$textarea.change(_.bind(function() {
2323 this.set({'value': instance.web.parse_value(this.$textarea.val(), this)});2323 this.set({'value': instance.web.parse_value(this.$textarea.val(), this)});
@@ -2325,7 +2325,7 @@
2325 } else {2325 } else {
2326 this.$textarea.attr('disabled', 'disabled');2326 this.$textarea.attr('disabled', 'disabled');
2327 }2327 }
2328 this.$element.keyup(function (e) {2328 this.$el.keyup(function (e) {
2329 if (e.which === $.ui.keyCode.ENTER) {2329 if (e.which === $.ui.keyCode.ENTER) {
2330 e.stopPropagation();2330 e.stopPropagation();
2331 }2331 }
@@ -2357,7 +2357,7 @@
2357 is_false: function() {2357 is_false: function() {
2358 return this.get('value') === '' || this._super();2358 return this.get('value') === '' || this._super();
2359 },2359 },
2360 focus: function($element) {2360 focus: function($el) {
2361 this.$textarea.focus();2361 this.$textarea.focus();
2362 },2362 },
2363 do_resize: function(max_height) {2363 do_resize: function(max_height) {
@@ -2402,7 +2402,7 @@
2402 var self = this;2402 var self = this;
2403 if (! this.get("effective_readonly")) {2403 if (! this.get("effective_readonly")) {
2404 self._updating_editor = false;2404 self._updating_editor = false;
2405 this.$textarea = this.$element.find('textarea');2405 this.$textarea = this.$el.find('textarea');
2406 var width = ((this.node.attrs || {}).editor_width || 468);2406 var width = ((this.node.attrs || {}).editor_width || 468);
2407 var height = ((this.node.attrs || {}).editor_height || 100);2407 var height = ((this.node.attrs || {}).editor_height || 100);
2408 this.$textarea.cleditor({2408 this.$textarea.cleditor({
@@ -2435,7 +2435,7 @@
2435 this.$cleditor.updateFrame();2435 this.$cleditor.updateFrame();
2436 this._updating_editor = false;2436 this._updating_editor = false;
2437 } else {2437 } else {
2438 this.$element.html(this.get('value'));2438 this.$el.html(this.get('value'));
2439 }2439 }
2440 },2440 },
2441});2441});
@@ -2445,9 +2445,9 @@
2445 start: function() {2445 start: function() {
2446 var self = this;2446 var self = this;
2447 this._super.apply(this, arguments);2447 this._super.apply(this, arguments);
2448 this.$checkbox = $("input", this.$element);2448 this.$checkbox = $("input", this.$el);
2449 this.setupFocus(this.$checkbox);2449 this.setupFocus(this.$checkbox);
2450 this.$element.click(_.bind(function() {2450 this.$el.click(_.bind(function() {
2451 this.set({'value': this.$checkbox.is(':checked')});2451 this.set({'value': this.$checkbox.is(':checked')});
2452 }, this));2452 }, this));
2453 var check_readonly = function() {2453 var check_readonly = function() {
@@ -2469,7 +2469,7 @@
2469 template: 'FieldProgressBar',2469 template: 'FieldProgressBar',
2470 start: function() {2470 start: function() {
2471 this._super.apply(this, arguments);2471 this._super.apply(this, arguments);
2472 this.$element.progressbar({2472 this.$el.progressbar({
2473 value: this.get('value'),2473 value: this.get('value'),
2474 disabled: this.get("effective_readonly")2474 disabled: this.get("effective_readonly")
2475 });2475 });
@@ -2481,7 +2481,7 @@
2481 show_value = 0;2481 show_value = 0;
2482 }2482 }
2483 var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0');2483 var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0');
2484 this.$element.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%');2484 this.$el.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%');
2485 }2485 }
2486});2486});
24872487
@@ -2512,9 +2512,9 @@
2512 // changing the selected value), takes the action as validating the2512 // changing the selected value), takes the action as validating the
2513 // row2513 // row
2514 var ischanging = false;2514 var ischanging = false;
2515 var $select = this.$element.find('select')2515 var $select = this.$el.find('select')
2516 .change(_.bind(function() {2516 .change(_.bind(function() {
2517 this.set({'value': this.values[this.$element.find('select')[0].selectedIndex][0]});2517 this.set({'value': this.values[this.$el.find('select')[0].selectedIndex][0]});
2518 }, this))2518 }, this))
2519 .change(function () { ischanging = true; })2519 .change(function () { ischanging = true; })
2520 .click(function () { ischanging = false; })2520 .click(function () { ischanging = false; })
@@ -2537,23 +2537,23 @@
2537 for (var i = 0, ii = this.values.length; i < ii; i++) {2537 for (var i = 0, ii = this.values.length; i < ii; i++) {
2538 if (this.values[i][0] === this.get('value')) index = i;2538 if (this.values[i][0] === this.get('value')) index = i;
2539 }2539 }
2540 this.$element.find('select')[0].selectedIndex = index;2540 this.$el.find('select')[0].selectedIndex = index;
2541 } else {2541 } else {
2542 var self = this;2542 var self = this;
2543 var option = _(this.values)2543 var option = _(this.values)
2544 .detect(function (record) { return record[0] === self.get('value'); });2544 .detect(function (record) { return record[0] === self.get('value'); });
2545 this.$element.text(option ? option[1] : this.values[0][1]);2545 this.$el.text(option ? option[1] : this.values[0][1]);
2546 }2546 }
2547 },2547 },
2548 is_syntax_valid: function() {2548 is_syntax_valid: function() {
2549 if (this.get("effective_readonly")) {2549 if (this.get("effective_readonly")) {
2550 return true;2550 return true;
2551 }2551 }
2552 var value_ = this.values[this.$element.find('select')[0].selectedIndex];2552 var value_ = this.values[this.$el.find('select')[0].selectedIndex];
2553 return !! value_;2553 return !! value_;
2554 },2554 },
2555 focus: function() {2555 focus: function() {
2556 this.$element.find('select:first').focus();2556 this.$el.find('select:first').focus();
2557 }2557 }
2558});2558});
25592559
@@ -2641,7 +2641,7 @@
2641 }2641 }
2642 // create...2642 // create...
2643 values.push({label: _t("<em>   Create and Edit...</em>"), action: function() {2643 values.push({label: _t("<em>   Create and Edit...</em>"), action: function() {
2644 self._search_create_popup("form", undefined, {});2644 self._search_create_popup("form", undefined, self._create_context(search_val));
2645 }});2645 }});
26462646
2647 return values;2647 return values;
@@ -2653,7 +2653,7 @@
2653 _quick_create: function(name) {2653 _quick_create: function(name) {
2654 var self = this;2654 var self = this;
2655 var slow_create = function () {2655 var slow_create = function () {
2656 self._search_create_popup("form", undefined, {"default_name": name});2656 self._search_create_popup("form", undefined, self._create_context(name));
2657 };2657 };
2658 if (self.options.quick_create === undefined || self.options.quick_create) {2658 if (self.options.quick_create === undefined || self.options.quick_create) {
2659 new instance.web.DataSet(this, this.field.relation, self.build_context())2659 new instance.web.DataSet(this, this.field.relation, self.build_context())
@@ -2690,6 +2690,13 @@
2690 * To implement.2690 * To implement.
2691 */2691 */
2692 add_id: function(id) {},2692 add_id: function(id) {},
2693 _create_context: function(name) {
2694 var tmp = {};
2695 var field = (this.options || {}).create_name_field;
2696 if (field)
2697 tmp["default_" + field] = name;
2698 return tmp;
2699 },
2693};2700};
26942701
2695instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, {2702instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, {
@@ -2724,7 +2731,7 @@
2724 },2731 },
2725 render_editable: function() {2732 render_editable: function() {
2726 var self = this;2733 var self = this;
2727 this.$input = this.$element.find("input");2734 this.$input = this.$el.find("input");
27282735
2729 self.$input.tipsy({2736 self.$input.tipsy({
2730 title: function() {2737 title: function() {
@@ -2744,8 +2751,8 @@
2744 self.$input.tipsy("hide");2751 self.$input.tipsy("hide");
2745 });2752 });
27462753
2747 this.$drop_down = this.$element.find(".oe_m2o_drop_down_button");2754 this.$drop_down = this.$el.find(".oe_m2o_drop_down_button");
2748 this.$follow_button = $(".oe_m2o_cm_button", this.$element);2755 this.$follow_button = $(".oe_m2o_cm_button", this.$el);
27492756
2750 this.$follow_button.click(function() {2757 this.$follow_button.click(function() {
2751 if (!self.get('value')) {2758 if (!self.get('value')) {
@@ -2919,7 +2926,7 @@
2919 if (follow)2926 if (follow)
2920 link += "<br />";2927 link += "<br />";
2921 }2928 }
2922 var $link = this.$element.find('.oe_form_uri')2929 var $link = this.$el.find('.oe_form_uri')
2923 .unbind('click')2930 .unbind('click')
2924 .html(link);2931 .html(link);
2925 if (! this.options.no_open)2932 if (! this.options.no_open)
@@ -2934,7 +2941,7 @@
2934 });2941 });
2935 return false;2942 return false;
2936 });2943 });
2937 $(".oe_form_m2o_follow", this.$element).html(follow);2944 $(".oe_form_m2o_follow", this.$el).html(follow);
2938 }2945 }
2939 },2946 },
2940 set_value: function(value_) {2947 set_value: function(value_) {
@@ -3035,7 +3042,7 @@
3035 },3042 },
3036 start: function() {3043 start: function() {
3037 this._super.apply(this, arguments);3044 this._super.apply(this, arguments);
3038 this.$element.addClass('oe_form_field oe_form_field_one2many');3045 this.$el.addClass('oe_form_field oe_form_field_one2many');
30393046
3040 var self = this;3047 var self = this;
30413048
@@ -3145,7 +3152,7 @@
3145 }3152 }
3146 } else if (view_type === "form") {3153 } else if (view_type === "form") {
3147 if (self.get("effective_readonly")) {3154 if (self.get("effective_readonly")) {
3148 $(".oe_form_buttons", controller.$element).children().remove();3155 $(".oe_form_buttons", controller.$el).children().remove();
3149 }3156 }
3150 controller.on_record_loaded.add_last(function() {3157 controller.on_record_loaded.add_last(function() {
3151 once.resolve();3158 once.resolve();
@@ -3166,7 +3173,7 @@
3166 });3173 });
3167 this.is_setted.then(function() {3174 this.is_setted.then(function() {
3168 $.async_when().then(function () {3175 $.async_when().then(function () {
3169 self.viewmanager.appendTo(self.$element);3176 self.viewmanager.appendTo(self.$el);
3170 });3177 });
3171 });3178 });
3172 return def;3179 return def;
@@ -3387,7 +3394,7 @@
3387 },3394 },
3388 start: function () {3395 start: function () {
3389 var ret = this._super();3396 var ret = this._super();
3390 this.$element3397 this.$el
3391 .off('mousedown.handleButtons')3398 .off('mousedown.handleButtons')
3392 .on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));3399 .on('mousedown.handleButtons', 'table button', this.proxy('_button_down'));
3393 return ret;3400 return ret;
@@ -3401,7 +3408,7 @@
3401 // If the form has not been modified, the view can only be valid3408 // If the form has not been modified, the view can only be valid
3402 // NB: is_dirty will also be set on defaults/onchanges/whatever?3409 // NB: is_dirty will also be set on defaults/onchanges/whatever?
3403 // oe_form_dirty seems to only be set on actual user actions3410 // oe_form_dirty seems to only be set on actual user actions
3404 if (!form.$element.is('.oe_form_dirty')) {3411 if (!form.$el.is('.oe_form_dirty')) {
3405 return true;3412 return true;
3406 }3413 }
3407 this.o2m._dirty_flag = true;3414 this.o2m._dirty_flag = true;
@@ -3515,7 +3522,7 @@
3515 return;3522 return;
3516 }3523 }
3517 // FIXME: why isn't there an API for this?3524 // FIXME: why isn't there an API for this?
3518 if (this.editor.form.$element.hasClass('oe_form_dirty')) {3525 if (this.editor.form.$el.hasClass('oe_form_dirty')) {
3519 this.save_edition();3526 this.save_edition();
3520 return;3527 return;
3521 }3528 }
@@ -3643,7 +3650,7 @@
3643 if (this.get("effective_readonly"))3650 if (this.get("effective_readonly"))
3644 return;3651 return;
3645 var self = this;3652 var self = this;
3646 self.$text = $("textarea", this.$element);3653 self.$text = $("textarea", this.$el);
3647 self.$text.textext({3654 self.$text.textext({
3648 plugins : 'tags arrow autocomplete',3655 plugins : 'tags arrow autocomplete',
3649 autocomplete: {3656 autocomplete: {
@@ -3701,7 +3708,7 @@
3701 self._drop_shown = true;3708 self._drop_shown = true;
3702 });3709 });
3703 self.tags = self.$text.textext()[0].tags();3710 self.tags = self.$text.textext()[0].tags();
3704 $("textarea", this.$element).focusout(function() {3711 $("textarea", this.$el).focusout(function() {
3705 self.$text.trigger("setInputData", "");3712 self.$text.trigger("setInputData", "");
3706 }).keydown(function(e) {3713 }).keydown(function(e) {
3707 if (e.which === $.ui.keyCode.TAB && self._drop_shown) {3714 if (e.which === $.ui.keyCode.TAB && self._drop_shown) {
@@ -3735,10 +3742,10 @@
3735 data = _.map(values, function(el) { return indexed[el]; });3742 data = _.map(values, function(el) { return indexed[el]; });
3736 if (! self.get("effective_readonly")) {3743 if (! self.get("effective_readonly")) {
3737 self.tags.containerElement().children().remove();3744 self.tags.containerElement().children().remove();
3738 $("textarea", self.$element).css("padding-left", "3px");3745 $("textarea", self.$el).css("padding-left", "3px");
3739 self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};}));3746 self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};}));
3740 } else {3747 } else {
3741 self.$element.html(QWeb.render("FieldMany2ManyTag", {elements: data}));3748 self.$el.html(QWeb.render("FieldMany2ManyTag", {elements: data}));
3742 }3749 }
3743 };3750 };
3744 if (! values || values.length > 0) {3751 if (! values || values.length > 0) {
@@ -3766,7 +3773,7 @@
3766 },3773 },
3767 start: function() {3774 start: function() {
3768 this._super.apply(this, arguments);3775 this._super.apply(this, arguments);
3769 this.$element.addClass('oe_form_field oe_form_field_many2many');3776 this.$el.addClass('oe_form_field oe_form_field_many2many');
37703777
3771 var self = this;3778 var self = this;
37723779
@@ -3829,7 +3836,7 @@
3829 loaded.resolve();3836 loaded.resolve();
3830 });3837 });
3831 $.async_when().then(function () {3838 $.async_when().then(function () {
3832 self.list_view.appendTo(self.$element);3839 self.list_view.appendTo(self.$el);
3833 });3840 });
3834 return loaded;3841 return loaded;
3835 },3842 },
@@ -3957,7 +3964,7 @@
3957 });3964 });
3958 this.kanban_view.do_switch_view.add_last(_.bind(this.open_popup, this));3965 this.kanban_view.do_switch_view.add_last(_.bind(this.open_popup, this));
3959 $.async_when().then(function () {3966 $.async_when().then(function () {
3960 self.kanban_view.appendTo(self.$element);3967 self.kanban_view.appendTo(self.$el);
3961 });3968 });
3962 return loaded;3969 return loaded;
3963 },3970 },
@@ -4041,7 +4048,7 @@
4041 },4048 },
4042 start: function () {4049 start: function () {
4043 var self = this;4050 var self = this;
4044 self.$text = this.$element.find('input').css("width", "200px");4051 self.$text = this.$el.find('input').css("width", "200px");
4045 self.$text.textext({4052 self.$text.textext({
4046 plugins : 'arrow autocomplete',4053 plugins : 'arrow autocomplete',
4047 autocomplete: {4054 autocomplete: {
@@ -4149,8 +4156,8 @@
4149 },4156 },
4150 title: this.options.title || "",4157 title: this.options.title || "",
4151 buttons: [{text:"tmp"}],4158 buttons: [{text:"tmp"}],
4152 }, this.$element).open();4159 }, this.$el).open();
4153 this.$buttonpane = dialog.$element.dialog("widget").find(".ui-dialog-buttonpane").html("");4160 this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html("");
4154 this.start();4161 this.start();
4155 },4162 },
4156 on_write_completed: function() {},4163 on_write_completed: function() {},
@@ -4173,7 +4180,7 @@
4173 if (this.options.alternative_form_view) {4180 if (this.options.alternative_form_view) {
4174 this.view_form.set_embedded_view(this.options.alternative_form_view);4181 this.view_form.set_embedded_view(this.options.alternative_form_view);
4175 }4182 }
4176 this.view_form.appendTo(this.$element.find(".oe_popup_form"));4183 this.view_form.appendTo(this.$el.find(".oe_popup_form"));
4177 this.view_form.on_loaded.add_last(function() {4184 this.view_form.on_loaded.add_last(function() {
4178 var multi_select = self.row_id === null && ! self.options.disable_multiple_selection;4185 var multi_select = self.row_id === null && ! self.options.disable_multiple_selection;
4179 self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", {4186 self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", {
@@ -4213,7 +4220,7 @@
4213 this.destroy();4220 this.destroy();
4214 },4221 },
4215 destroy: function () {4222 destroy: function () {
4216 this.$element.dialog('close');4223 this.$el.dialog('close');
4217 this._super();4224 this._super();
4218 },4225 },
4219});4226});
@@ -4305,7 +4312,7 @@
4305 e.cancel = true;4312 e.cancel = true;
4306 });4313 });
4307 self.view_list.popup = self;4314 self.view_list.popup = self;
4308 self.view_list.appendTo($(".oe_popup_list", self.$element)).pipe(function() {4315 self.view_list.appendTo($(".oe_popup_list", self.$el)).pipe(function() {
4309 self.view_list.do_show();4316 self.view_list.do_show();
4310 }).pipe(function() {4317 }).pipe(function() {
4311 self.searchview.do_search();4318 self.searchview.do_search();
@@ -4323,7 +4330,7 @@
4323 });4330 });
4324 });4331 });
4325 });4332 });
4326 this.searchview.appendTo($(".oe_popup_list", self.$element));4333 this.searchview.appendTo($(".oe_popup_list", self.$el));
4327 },4334 },
4328 do_search: function(domains, contexts, groupbys) {4335 do_search: function(domains, contexts, groupbys) {
4329 var self = this;4336 var self = this;
@@ -4349,7 +4356,7 @@
4349 this.searchview.hide();4356 this.searchview.hide();
4350 }4357 }
4351 if (this.view_list) {4358 if (this.view_list) {
4352 this.view_list.$element.hide();4359 this.view_list.$el.hide();
4353 }4360 }
4354 this.setup_form_view();4361 this.setup_form_view();
4355 },4362 },
@@ -4382,7 +4389,7 @@
4382 var sel = this.selection.get_value();4389 var sel = this.selection.get_value();
4383 this.m2o.field.relation = sel;4390 this.m2o.field.relation = sel;
4384 this.m2o.set_value(false);4391 this.m2o.set_value(false);
4385 this.m2o.$element.toggle(sel !== false);4392 this.m2o.$el.toggle(sel !== false);
4386 }4393 }
4387 },4394 },
4388 destroy_content: function() {4395 destroy_content: function() {
@@ -4486,9 +4493,9 @@
4486 this._super.apply(this, arguments);4493 this._super.apply(this, arguments);
4487 },4494 },
4488 initialize_content: function() {4495 initialize_content: function() {
4489 this.$element.find('input.oe_form_binary_file').change(this.on_file_change);4496 this.$el.find('input.oe_form_binary_file').change(this.on_file_change);
4490 this.$element.find('button.oe_form_binary_file_save').click(this.on_save_as);4497 this.$el.find('button.oe_form_binary_file_save').click(this.on_save_as);
4491 this.$element.find('.oe_form_binary_file_clear').click(this.on_clear);4498 this.$el.find('.oe_form_binary_file_clear').click(this.on_clear);
4492 },4499 },
4493 human_filesize : function(size) {4500 human_filesize : function(size) {
4494 var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];4501 var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
@@ -4505,10 +4512,10 @@
4505 // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler4512 // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler
45064513
4507 if ($(e.target).val() !== '') {4514 if ($(e.target).val() !== '') {
4508 this.$element.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id);4515 this.$el.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id);
4509 this.$element.find('form.oe_form_binary_form').submit();4516 this.$el.find('form.oe_form_binary_form').submit();
4510 this.$element.find('.oe_form_binary_progress').show();4517 this.$el.find('.oe_form_binary_progress').show();
4511 this.$element.find('.oe_form_binary').hide();4518 this.$el.find('.oe_form_binary').hide();
4512 }4519 }
4513 },4520 },
4514 on_file_uploaded: function(size, name, content_type, file_base64) {4521 on_file_uploaded: function(size, name, content_type, file_base64) {
@@ -4520,8 +4527,8 @@
4520 this.filename = name;4527 this.filename = name;
4521 this.on_file_uploaded_and_valid.apply(this, arguments);4528 this.on_file_uploaded_and_valid.apply(this, arguments);
4522 }4529 }
4523 this.$element.find('.oe_form_binary_progress').hide();4530 this.$el.find('.oe_form_binary_progress').hide();
4524 this.$element.find('.oe_form_binary').show();4531 this.$el.find('.oe_form_binary').show();
4525 },4532 },
4526 on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {4533 on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
4527 },4534 },
@@ -4575,7 +4582,7 @@
4575 this._super();4582 this._super();
4576 if (this.get("effective_readonly")) {4583 if (this.get("effective_readonly")) {
4577 var self = this;4584 var self = this;
4578 this.$element.find('a').click(function() {4585 this.$el.find('a').click(function() {
4579 if (self.get('value')) {4586 if (self.get('value')) {
4580 self.on_save_as();4587 self.on_save_as();
4581 }4588 }
@@ -4595,12 +4602,12 @@
4595 } else {4602 } else {
4596 show_value = (this.get('value') != null && this.get('value') !== false) ? this.get('value') : '';4603 show_value = (this.get('value') != null && this.get('value') !== false) ? this.get('value') : '';
4597 }4604 }
4598 this.$element.find('input').eq(0).val(show_value);4605 this.$el.find('input').eq(0).val(show_value);
4599 } else {4606 } else {
4600 this.$element.find('a').show(!!this.get('value'));4607 this.$el.find('a').show(!!this.get('value'));
4601 if (this.get('value')) {4608 if (this.get('value')) {
4602 var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || '');4609 var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || '');
4603 this.$element.find('a').text(show_value);4610 this.$el.find('a').text(show_value);
4604 }4611 }
4605 }4612 }
4606 },4613 },
@@ -4608,7 +4615,7 @@
4608 this.binary_value = true;4615 this.binary_value = true;
4609 this.set({'value': file_base64});4616 this.set({'value': file_base64});
4610 var show_value = name + " (" + this.human_filesize(size) + ")";4617 var show_value = name + " (" + this.human_filesize(size) + ")";
4611 this.$element.find('input').eq(0).val(show_value);4618 this.$el.find('input').eq(0).val(show_value);
4612 this.set_filename(name);4619 this.set_filename(name);
4613 },4620 },
4614 set_filename: function(value_) {4621 set_filename: function(value_) {
@@ -4619,7 +4626,7 @@
4619 },4626 },
4620 on_clear: function() {4627 on_clear: function() {
4621 this._super.apply(this, arguments);4628 this._super.apply(this, arguments);
4622 this.$element.find('input').eq(0).val('');4629 this.$el.find('input').eq(0).val('');
4623 this.set_filename('');4630 this.set_filename('');
4624 }4631 }
4625});4632});
@@ -4646,8 +4653,8 @@
4646 url = "/web/static/src/img/placeholder.png";4653 url = "/web/static/src/img/placeholder.png";
4647 }4654 }
4648 var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url }));4655 var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url }));
4649 this.$element.find('> img').remove();4656 this.$el.find('> img').remove();
4650 this.$element.prepend($img);4657 this.$el.prepend($img);
4651 $img.load(function() {4658 $img.load(function() {
4652 if (! self.options.size)4659 if (! self.options.size)
4653 return;4660 return;
@@ -4685,11 +4692,11 @@
4685 // backward compatibility4692 // backward compatibility
4686 this.loaded = new $.Deferred();4693 this.loaded = new $.Deferred();
4687 if (this.options.clickable) {4694 if (this.options.clickable) {
4688 this.$element.on('click','li',this.on_click_stage);4695 this.$el.on('click','li',this.on_click_stage);
4689 }4696 }
4690 // TODO move the following into css :after4697 // TODO move the following into css :after
4691 if (this.$element.parent().is('header')) {4698 if (this.$el.parent().is('header')) {
4692 this.$element.after('<div class="oe_clear"/>');4699 this.$el.after('<div class="oe_clear"/>');
4693 }4700 }
4694 },4701 },
4695 set_value: function(value_) {4702 set_value: function(value_) {
@@ -4750,7 +4757,7 @@
4750 render_elements: function () {4757 render_elements: function () {
4751 var self = this;4758 var self = this;
4752 var content = instance.web.qweb.render("FieldStatus.content", {widget: this});4759 var content = instance.web.qweb.render("FieldStatus.content", {widget: this});
4753 this.$element.html(content);4760 this.$el.html(content);
4754 var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}");4761 var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}");
4755 var color = colors[this.selected_value];4762 var color = colors[this.selected_value];
4756 if (color) {4763 if (color) {
47574764
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js 2012-08-14 15:29:00 +0000
+++ addons/web/static/src/js/view_list.js 2012-08-27 06:09:20 +0000
@@ -145,7 +145,7 @@
145 * @returns {$.Deferred} loading promise145 * @returns {$.Deferred} loading promise
146 */146 */
147 start: function() {147 start: function() {
148 this.$element.addClass('oe_list');148 this.$el.addClass('oe_list');
149 return this.reload_view(null, null, true);149 return this.reload_view(null, null, true);
150 },150 },
151 /**151 /**
@@ -248,20 +248,20 @@
248248
249 this.setup_columns(this.fields_view.fields, grouped);249 this.setup_columns(this.fields_view.fields, grouped);
250250
251 this.$element.html(QWeb.render(this._template, this));251 this.$el.html(QWeb.render(this._template, this));
252 this.$element.addClass(this.fields_view.arch.attrs['class']);252 this.$el.addClass(this.fields_view.arch.attrs['class']);
253 // Head hook253 // Head hook
254 // Selecting records254 // Selecting records
255 this.$element.find('.oe_list_record_selector').click(function(){255 this.$el.find('.oe_list_record_selector').click(function(){
256 self.$element.find('.oe_list_record_selector input').prop('checked',256 self.$el.find('.oe_list_record_selector input').prop('checked',
257 self.$element.find('.oe_list_record_selector').prop('checked') || false);257 self.$el.find('.oe_list_record_selector').prop('checked') || false);
258 var selection = self.groups.get_selection();258 var selection = self.groups.get_selection();
259 $(self.groups).trigger(259 $(self.groups).trigger(
260 'selected', [selection.ids, selection.records]);260 'selected', [selection.ids, selection.records]);
261 });261 });
262262
263 // Sorting columns263 // Sorting columns
264 this.$element.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) {264 this.$el.find('thead').delegate('th.oe_sortable[data-id]', 'click', function (e) {
265 e.stopPropagation();265 e.stopPropagation();
266 var $this = $(this);266 var $this = $(this);
267 self.dataset.sort($this.data('id'));267 self.dataset.sort($this.data('id'));
@@ -281,7 +281,7 @@
281 if (this.options.$buttons) {281 if (this.options.$buttons) {
282 this.$buttons.appendTo(this.options.$buttons);282 this.$buttons.appendTo(this.options.$buttons);
283 } else {283 } else {
284 this.$element.find('.oe_list_buttons').replaceWith(this.$buttons);284 this.$el.find('.oe_list_buttons').replaceWith(this.$buttons);
285 }285 }
286 this.$buttons.find('.oe_list_add')286 this.$buttons.find('.oe_list_add')
287 .click(this.proxy('do_add_record'))287 .click(this.proxy('do_add_record'))
@@ -298,7 +298,7 @@
298 if (this.options.$buttons) {298 if (this.options.$buttons) {
299 this.$pager.appendTo(this.options.$pager);299 this.$pager.appendTo(this.options.$pager);
300 } else {300 } else {
301 this.$element.find('.oe_list_pager').replaceWith(this.$pager);301 this.$el.find('.oe_list_pager').replaceWith(this.$pager);
302 }302 }
303303
304 this.$pager304 this.$pager
@@ -357,7 +357,7 @@
357 { label: _t('Delete'), callback: this.do_delete_selected }357 { label: _t('Delete'), callback: this.do_delete_selected }
358 ]);358 ]);
359 this.sidebar.add_toolbar(this.fields_view.toolbar);359 this.sidebar.add_toolbar(this.fields_view.toolbar);
360 this.sidebar.$element.hide();360 this.sidebar.$el.hide();
361 }361 }
362 },362 },
363 /**363 /**
@@ -450,7 +450,7 @@
450 },450 },
451 do_hide: function () {451 do_hide: function () {
452 if (this.sidebar) {452 if (this.sidebar) {
453 this.sidebar.$element.hide();453 this.sidebar.$el.hide();
454 }454 }
455 if (this.$buttons) {455 if (this.$buttons) {
456 this.$buttons.hide();456 this.$buttons.hide();
@@ -490,10 +490,10 @@
490 */490 */
491 reload_content: function () {491 reload_content: function () {
492 var self = this;492 var self = this;
493 self.$element.find('.oe_list_record_selector').prop('checked', false);493 self.$el.find('.oe_list_record_selector').prop('checked', false);
494 this.records.reset();494 this.records.reset();
495 var reloaded = $.Deferred();495 var reloaded = $.Deferred();
496 this.$element.find('.oe_list_content').append(496 this.$el.find('.oe_list_content').append(
497 this.groups.render(function () {497 this.groups.render(function () {
498 if (self.dataset.index == null) {498 if (self.dataset.index == null) {
499 var has_one = false;499 var has_one = false;
@@ -595,7 +595,7 @@
595 if (!ids.length) {595 if (!ids.length) {
596 this.dataset.index = 0;596 this.dataset.index = 0;
597 if (this.sidebar) {597 if (this.sidebar) {
598 this.sidebar.$element.hide();598 this.sidebar.$el.hide();
599 }599 }
600 this.compute_aggregates();600 this.compute_aggregates();
601 return;601 return;
@@ -603,7 +603,7 @@
603603
604 this.dataset.index = _(this.dataset.ids).indexOf(ids[0]);604 this.dataset.index = _(this.dataset.ids).indexOf(ids[0]);
605 if (this.sidebar) {605 if (this.sidebar) {
606 this.sidebar.$element.show();606 this.sidebar.$el.show();
607 }607 }
608608
609 this.compute_aggregates(_(records).map(function (record) {609 this.compute_aggregates(_(records).map(function (record) {
@@ -763,7 +763,7 @@
763 },763 },
764 display_aggregates: function (aggregation) {764 display_aggregates: function (aggregation) {
765 var self = this;765 var self = this;
766 var $footer_cells = this.$element.find('.oe_list_footer');766 var $footer_cells = this.$el.find('.oe_list_footer');
767 _(this.aggregate_columns).each(function (column) {767 _(this.aggregate_columns).each(function (column) {
768 if (!column['function']) {768 if (!column['function']) {
769 return;769 return;
@@ -789,7 +789,7 @@
789 pad_columns: function (count, options) {789 pad_columns: function (count, options) {
790 options = options || {};790 options = options || {};
791 // padding for action/pager header791 // padding for action/pager header
792 var $first_header = this.$element.find('thead tr:first th');792 var $first_header = this.$el.find('thead tr:first th');
793 var colspan = $first_header.attr('colspan');793 var colspan = $first_header.attr('colspan');
794 if (colspan) {794 if (colspan) {
795 if (!this.previous_colspan) {795 if (!this.previous_colspan) {
@@ -798,7 +798,7 @@
798 $first_header.attr('colspan', parseInt(colspan, 10) + count);798 $first_header.attr('colspan', parseInt(colspan, 10) + count);
799 }799 }
800 // Padding for column titles, footer and data rows800 // Padding for column titles, footer and data rows
801 var $rows = this.$element801 var $rows = this.$el
802 .find('.oe_list_header_columns, tr:not(thead tr)')802 .find('.oe_list_header_columns, tr:not(thead tr)')
803 .not(options['except']);803 .not(options['except']);
804 var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>');804 var newcols = new Array(count+1).join('<td class="oe_list_padding"></td>');
@@ -812,23 +812,23 @@
812 * Removes all padding columns of the table812 * Removes all padding columns of the table
813 */813 */
814 unpad_columns: function () {814 unpad_columns: function () {
815 this.$element.find('.oe_list_padding').remove();815 this.$el.find('.oe_list_padding').remove();
816 if (this.previous_colspan) {816 if (this.previous_colspan) {
817 this.$element817 this.$el
818 .find('thead tr:first th')818 .find('thead tr:first th')
819 .attr('colspan', this.previous_colspan);819 .attr('colspan', this.previous_colspan);
820 this.previous_colspan = null;820 this.previous_colspan = null;
821 }821 }
822 },822 },
823 no_result: function () {823 no_result: function () {
824 this.$element.find('.oe_view_nocontent').remove();824 this.$el.find('.oe_view_nocontent').remove();
825 if (this.groups.group_by825 if (this.groups.group_by
826 || !this.options.action826 || !this.options.action
827 || !this.options.action.help) {827 || !this.options.action.help) {
828 return;828 return;
829 }829 }
830 this.$element.find('table:first').hide();830 this.$el.find('table:first').hide();
831 this.$element.prepend(831 this.$el.prepend(
832 $('<div class="oe_view_nocontent">').html(this.options.action.help)832 $('<div class="oe_view_nocontent">').html(this.options.action.help)
833 );833 );
834 }834 }
@@ -1478,27 +1478,27 @@
1478 },1478 },
1479 render: function (post_render) {1479 render: function (post_render) {
1480 var self = this;1480 var self = this;
1481 var $element = $('<tbody>');1481 var $el = $('<tbody>');
1482 this.elements = [$element[0]];1482 this.elements = [$el[0]];
14831483
1484 this.datagroup.list(1484 this.datagroup.list(
1485 _(this.view.visible_columns).chain()1485 _(this.view.visible_columns).chain()
1486 .filter(function (column) { return column.tag === 'field' })1486 .filter(function (column) { return column.tag === 'field' })
1487 .pluck('name').value(),1487 .pluck('name').value(),
1488 function (groups) {1488 function (groups) {
1489 $element[0].appendChild(1489 $el[0].appendChild(
1490 self.render_groups(groups));1490 self.render_groups(groups));
1491 if (post_render) { post_render(); }1491 if (post_render) { post_render(); }
1492 }, function (dataset) {1492 }, function (dataset) {
1493 self.render_dataset(dataset).then(function (list) {1493 self.render_dataset(dataset).then(function (list) {
1494 self.children[null] = list;1494 self.children[null] = list;
1495 self.elements =1495 self.elements =
1496 [list.$current.replaceAll($element)[0]];1496 [list.$current.replaceAll($el)[0]];
1497 self.setup_resequence_rows(list, dataset);1497 self.setup_resequence_rows(list, dataset);
1498 if (post_render) { post_render(); }1498 if (post_render) { post_render(); }
1499 });1499 });
1500 });1500 });
1501 return $element;1501 return $el;
1502 },1502 },
1503 /**1503 /**
1504 * Returns the ids of all selected records for this group, and the records1504 * Returns the ids of all selected records for this group, and the records
15051505
=== modified file 'addons/web/static/src/js/view_list_editable.js'
--- addons/web/static/src/js/view_list_editable.js 2012-08-08 19:38:42 +0000
+++ addons/web/static/src/js/view_list_editable.js 2012-08-27 06:09:20 +0000
@@ -45,10 +45,10 @@
45 }45 }
46 });46 });
47 this.on('edit:after', this, function () {47 this.on('edit:after', this, function () {
48 self.$element.add(self.$buttons).addClass('oe_editing');48 self.$el.add(self.$buttons).addClass('oe_editing');
49 });49 });
50 this.on('save:after cancel:after', this, function () {50 this.on('save:after cancel:after', this, function () {
51 self.$element.add(self.$buttons).removeClass('oe_editing');51 self.$el.add(self.$buttons).removeClass('oe_editing');
52 });52 });
53 },53 },
54 destroy: function () {54 destroy: function () {
@@ -87,8 +87,8 @@
87 */87 */
88 do_add_record: function () {88 do_add_record: function () {
89 if (this.editable()) {89 if (this.editable()) {
90 this.$element.find('table:first').show();90 this.$el.find('table:first').show();
91 this.$element.find('.oe_view_nocontent').remove();91 this.$el.find('.oe_view_nocontent').remove();
92 this.start_edition();92 this.start_edition();
93 } else {93 } else {
94 this._super();94 this._super();
@@ -99,7 +99,7 @@
99 // tree/@editable takes priority on everything else if present.99 // tree/@editable takes priority on everything else if present.
100 var result = this._super(data, grouped);100 var result = this._super(data, grouped);
101 if (this.editable()) {101 if (this.editable()) {
102 this.$element.addClass('oe_list_editable');102 this.$el.addClass('oe_list_editable');
103 // FIXME: any hook available to ensure this is only done once?103 // FIXME: any hook available to ensure this is only done once?
104 this.$buttons104 this.$buttons
105 .off('click', '.oe_list_save')105 .off('click', '.oe_list_save')
@@ -109,7 +109,7 @@
109 e.preventDefault();109 e.preventDefault();
110 self.cancel_edition();110 self.cancel_edition();
111 });111 });
112 this.$element112 this.$el
113 .off('click', 'tbody td:not(.oe_list_field_cell)')113 .off('click', 'tbody td:not(.oe_list_field_cell)')
114 .on('click', 'tbody td:not(.oe_list_field_cell)', function () {114 .on('click', 'tbody td:not(.oe_list_field_cell)', function () {
115 if (!self.editor.is_editing()) {115 if (!self.editor.is_editing()) {
@@ -120,12 +120,12 @@
120 // Editor is not restartable due to formview not being120 // Editor is not restartable due to formview not being
121 // restartable121 // restartable
122 this.editor = this.make_editor();122 this.editor = this.make_editor();
123 var editor_ready = this.editor.prependTo(this.$element)123 var editor_ready = this.editor.prependTo(this.$el)
124 .then(this.proxy('setup_events'));124 .then(this.proxy('setup_events'));
125125
126 return $.when(result, editor_ready);126 return $.when(result, editor_ready);
127 } else {127 } else {
128 this.$element.removeClass('oe_list_editable');128 this.$el.removeClass('oe_list_editable');
129 }129 }
130130
131 return result;131 return result;
@@ -203,7 +203,7 @@
203 }203 }
204204
205 // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow205 // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow
206 field.$element.attr('data-fieldname', field_name);206 field.$el.attr('data-fieldname', field_name);
207 self.fields_for_resize.push({field: field, cell: cell});207 self.fields_for_resize.push({field: field, cell: cell});
208 }, options).pipe(function () {208 }, options).pipe(function () {
209 $recordRow.addClass('oe_edition');209 $recordRow.addClass('oe_edition');
@@ -249,8 +249,8 @@
249 var position = $cell.position();249 var position = $cell.position();
250250
251 // jquery does not understand !important251 // jquery does not understand !important
252 field.$element.attr('style', 'width: '+$cell.outerWidth()+'px !important')252 field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important')
253 field.$element.css({253 field.$el.css({
254 top: position.top,254 top: position.top,
255 left: position.left,255 left: position.left,
256 minHeight: $cell.outerHeight()256 minHeight: $cell.outerHeight()
@@ -391,7 +391,7 @@
391 },391 },
392 setup_events: function () {392 setup_events: function () {
393 var self = this;393 var self = this;
394 this.editor.$element.on('keyup keydown', function (e) {394 this.editor.$el.on('keyup keydown', function (e) {
395 if (!self.editor.is_editing()) { return; }395 if (!self.editor.is_editing()) { return; }
396 var key = _($.ui.keyCode).chain()396 var key = _($.ui.keyCode).chain()
397 .map(function (v, k) { return {name: k, code: v}; })397 .map(function (v, k) { return {name: k, code: v}; })
@@ -540,7 +540,7 @@
540 if (--field_index < 0) { return $.when(); }540 if (--field_index < 0) { return $.when(); }
541541
542 field = fields[fields_order[field_index]];542 field = fields[fields_order[field_index]];
543 } while (!field.$element.is(':visible'));543 } while (!field.$el.is(':visible'));
544544
545 // and focus it545 // and focus it
546 field.focus();546 field.focus();
@@ -563,7 +563,7 @@
563 if (++field_index >= fields_order.length) { return $.when(); }563 if (++field_index >= fields_order.length) { return $.when(); }
564564
565 field = fields[fields_order[field_index]];565 field = fields[fields_order[field_index]];
566 } while (!field.$element.is(':visible'));566 } while (!field.$el.is(':visible'));
567567
568 field.focus();568 field.focus();
569 return $.when();569 return $.when();
@@ -572,11 +572,11 @@
572 var form = this.editor.form;572 var form = this.editor.form;
573 var last_field = _(form.fields_order).chain()573 var last_field = _(form.fields_order).chain()
574 .map(function (name) { return form.fields[name]; })574 .map(function (name) { return form.fields[name]; })
575 .filter(function (field) { return field.$element.is(':visible'); })575 .filter(function (field) { return field.$el.is(':visible'); })
576 .last()576 .last()
577 .value();577 .value();
578 // tabbed from last field in form578 // tabbed from last field in form
579 if (last_field && last_field.$element.has(e.target).length) {579 if (last_field && last_field.$el.has(e.target).length) {
580 e.preventDefault();580 e.preventDefault();
581 return this._next();581 return this._next();
582 }582 }
@@ -620,7 +620,7 @@
620 var _super = this._super();620 var _super = this._super();
621 this.form.embedded_view = this._validate_view(621 this.form.embedded_view = this._validate_view(
622 this.delegate.edition_view(this));622 this.delegate.edition_view(this));
623 var form_ready = this.form.appendTo(this.$element).then(623 var form_ready = this.form.appendTo(this.$el).then(
624 self.form.proxy('do_hide'));624 self.form.proxy('do_hide'));
625 return $.when(_super, form_ready);625 return $.when(_super, form_ready);
626 },626 },
@@ -678,7 +678,7 @@
678 // Is actually in the form678 // Is actually in the form
679 && (field = form.fields[focus_field])679 && (field = form.fields[focus_field])
680 // And is visible680 // And is visible
681 && field.$element.is(':visible')) {681 && field.$el.is(':visible')) {
682 // focus it682 // focus it
683 field.focus();683 field.focus();
684 return;684 return;
@@ -687,7 +687,7 @@
687 _(form.fields_order).detect(function (name) {687 _(form.fields_order).detect(function (name) {
688 // look for first visible field in fields_order, focus it688 // look for first visible field in fields_order, focus it
689 var field = form.fields[name];689 var field = form.fields[name];
690 if (!field.$element.is(':visible')) {690 if (!field.$el.is(':visible')) {
691 return false;691 return false;
692 }692 }
693 // Stop as soon as a field got focused693 // Stop as soon as a field got focused
694694
=== modified file 'addons/web/static/src/js/view_tree.js'
--- addons/web/static/src/js/view_tree.js 2012-07-03 13:35:08 +0000
+++ addons/web/static/src/js/view_tree.js 2012-08-27 06:09:20 +0000
@@ -84,13 +84,13 @@
84 });84 });
85 this.fields = fields_view.fields;85 this.fields = fields_view.fields;
86 this.hook_row_click();86 this.hook_row_click();
87 this.$element.html(QWeb.render('TreeView', {87 this.$el.html(QWeb.render('TreeView', {
88 'title': this.fields_view.arch.attrs.string,88 'title': this.fields_view.arch.attrs.string,
89 'fields_view': this.fields_view.arch.children,89 'fields_view': this.fields_view.arch.children,
90 'fields': this.fields,90 'fields': this.fields,
91 'toolbar': has_toolbar91 'toolbar': has_toolbar
92 }));92 }));
93 this.$element.addClass(this.fields_view.arch.attrs['class']);93 this.$el.addClass(this.fields_view.arch.attrs['class']);
9494
95 this.dataset.read_slice(this.fields_list()).then(function(records) {95 this.dataset.read_slice(this.fields_list()).then(function(records) {
96 self.store_record(records);96 self.store_record(records);
@@ -102,7 +102,7 @@
102 return;102 return;
103 }103 }
104104
105 var $select = self.$element.find('select')105 var $select = self.$el.find('select')
106 .change(function () {106 .change(function () {
107 var $option = $(this).find(':selected');107 var $option = $(this).find(':selected');
108 self.getdata($option.val());108 self.getdata($option.val());
@@ -120,10 +120,10 @@
120 $select.change();120 $select.change();
121 }121 }
122 });122 });
123 this.$element.find("#tree_view_expand").click(function(){123 this.$el.find("#tree_view_expand").click(function(){
124 self.expand_all();124 self.expand_all();
125 });125 });
126 this.$element.find("#tree_view_collapse").click(function(){126 this.$el.find("#tree_view_collapse").click(function(){
127 self.collpase_all();127 self.collpase_all();
128 });128 });
129 // TODO store open nodes in url ?...129 // TODO store open nodes in url ?...
@@ -143,14 +143,14 @@
143 },143 },
144 expand_all: function(){144 expand_all: function(){
145 var self = this;145 var self = this;
146 var tr = this.$element.find(".oe-treeview-table tbody tr[id^='treerow_']");146 var tr = this.$el.find(".oe-treeview-table tbody tr[id^='treerow_']");
147 _.each(tr,function(rec){147 _.each(tr,function(rec){
148 self.showcontent($(rec).attr('data-id'),true);148 self.showcontent($(rec).attr('data-id'),true);
149 });149 });
150 },150 },
151 collpase_all: function(){151 collpase_all: function(){
152 var self = this;152 var self = this;
153 var root_tr = this.$element.find(".oe-treeview-table tbody tr[data-level='"+1+"']");153 var root_tr = this.$el.find(".oe-treeview-table tbody tr[data-level='"+1+"']");
154 _.each(root_tr,function(rec){154 _.each(root_tr,function(rec){
155 if($(rec).hasClass('oe_open')){155 if($(rec).hasClass('oe_open')){
156 self.showcontent($(rec).attr('data-id'),false);156 self.showcontent($(rec).attr('data-id'),false);
@@ -187,12 +187,12 @@
187 */187 */
188 hook_row_click: function () {188 hook_row_click: function () {
189 var self = this;189 var self = this;
190 this.$element.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) {190 this.$el.delegate('.treeview-td span, .treeview-tr span', 'click', function (e) {
191 e.stopImmediatePropagation();191 e.stopImmediatePropagation();
192 self.activate($(this).closest('tr').data('id'));192 self.activate($(this).closest('tr').data('id'));
193 });193 });
194194
195 this.$element.delegate('.treeview-tr', 'click', function () {195 this.$el.delegate('.treeview-tr', 'click', function () {
196 var $this = $(this),196 var $this = $(this),
197 record_id = $this.data('id'),197 record_id = $this.data('id'),
198 bool = $this.parent().hasClass('oe_open');198 bool = $this.parent().hasClass('oe_open');
@@ -220,7 +220,7 @@
220 render_data: function(groupby){220 render_data: function(groupby){
221 var self = this;221 var self = this;
222 _.each(_.keys(groupby),function(key){222 _.each(_.keys(groupby),function(key){
223 var $curr_node = self.$element.find('#treerow_' + key);223 var $curr_node = self.$el.find('#treerow_' + key);
224 var record = groupby[key];224 var record = groupby[key];
225 var children_rows = QWeb.render('TreeView.rows', {225 var children_rows = QWeb.render('TreeView.rows', {
226 'records': record,226 'records': record,
@@ -235,7 +235,7 @@
235 $curr_node.addClass('oe_open');235 $curr_node.addClass('oe_open');
236 $curr_node.after(children_rows);236 $curr_node.after(children_rows);
237 } else {237 } else {
238 self.$element.find('tbody').html(children_rows);238 self.$el.find('tbody').html(children_rows);
239 }239 }
240 });240 });
241 self.collpase_all();241 self.collpase_all();
@@ -272,11 +272,11 @@
272272
273 // show & hide the contents273 // show & hide the contents
274 showcontent: function (record_id, show) {274 showcontent: function (record_id, show) {
275 this.$element.find('#treerow_' + record_id)275 this.$el.find('#treerow_' + record_id)
276 .toggleClass('oe_open', show);276 .toggleClass('oe_open', show);
277277
278 _(this.records[record_id][this.children_field]).each(function (child_id) {278 _(this.records[record_id][this.children_field]).each(function (child_id) {
279 var $child_row = this.$element.find('#treerow_' + child_id);279 var $child_row = this.$el.find('#treerow_' + child_id);
280 if ($child_row.hasClass('oe_open')) {280 if ($child_row.hasClass('oe_open')) {
281 this.showcontent(child_id, false);281 this.showcontent(child_id, false);
282 }282 }
283283
=== modified file 'addons/web/static/src/js/views.js'
--- addons/web/static/src/js/views.js 2012-08-16 23:55:45 +0000
+++ addons/web/static/src/js/views.js 2012-08-27 06:09:20 +0000
@@ -20,7 +20,7 @@
20 },20 },
21 start: function() {21 start: function() {
22 this._super.apply(this, arguments);22 this._super.apply(this, arguments);
23 this.$element.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked);23 this.$el.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked);
24 },24 },
25 dialog_stop: function () {25 dialog_stop: function () {
26 if (this.dialog) {26 if (this.dialog) {
@@ -53,10 +53,10 @@
53 }53 }
54 var item = _.extend({54 var item = _.extend({
55 show: function(index) {55 show: function(index) {
56 this.widget.$element.show();56 this.widget.$el.show();
57 },57 },
58 hide: function() {58 hide: function() {
59 this.widget.$element.hide();59 this.widget.$el.hide();
60 },60 },
61 destroy: function() {61 destroy: function() {
62 this.widget.destroy();62 this.widget.destroy();
@@ -277,14 +277,14 @@
277 }277 }
278 this.dialog.dialog_title = action.name;278 this.dialog.dialog_title = action.name;
279 this.dialog_widget = widget;279 this.dialog_widget = widget;
280 this.dialog_widget.appendTo(this.dialog.$element);280 this.dialog_widget.appendTo(this.dialog.$el);
281 this.dialog.open();281 this.dialog.open();
282 } else {282 } else {
283 this.dialog_stop();283 this.dialog_stop();
284 this.inner_action = action;284 this.inner_action = action;
285 this.inner_widget = widget;285 this.inner_widget = widget;
286 post_process();286 post_process();
287 this.inner_widget.appendTo(this.$element);287 this.inner_widget.appendTo(this.$el);
288 }288 }
289 },289 },
290 ir_actions_act_window: function (action, on_close) {290 ir_actions_act_window: function (action, on_close) {
@@ -376,7 +376,7 @@
376 start: function() {376 start: function() {
377 this._super();377 this._super();
378 var self = this;378 var self = this;
379 this.$element.find('.oe_view_manager_switch a').click(function() {379 this.$el.find('.oe_view_manager_switch a').click(function() {
380 self.on_mode_switch($(this).data('view-type'));380 self.on_mode_switch($(this).data('view-type'));
381 }).tipsy();381 }).tipsy();
382 var views_ids = {};382 var views_ids = {};
@@ -385,9 +385,9 @@
385 deferred : $.Deferred(),385 deferred : $.Deferred(),
386 controller : null,386 controller : null,
387 options : _.extend({387 options : _.extend({
388 $buttons : self.$element.find('.oe_view_manager_buttons'),388 $buttons : self.$el.find('.oe_view_manager_buttons'),
389 $sidebar : self.flags.sidebar ? self.$element.find('.oe_view_manager_sidebar') : undefined,389 $sidebar : self.flags.sidebar ? self.$el.find('.oe_view_manager_sidebar') : undefined,
390 $pager : self.$element.find('.oe_view_manager_pager'),390 $pager : self.$el.find('.oe_view_manager_pager'),
391 action : self.action,391 action : self.action,
392 action_views_ids : views_ids392 action_views_ids : views_ids
393 }, self.flags, self.flags[view.view_type] || {}, view.options || {})393 }, self.flags, self.flags[view.view_type] || {}, view.options || {})
@@ -395,7 +395,7 @@
395 views_ids[view.view_type] = view.view_id;395 views_ids[view.view_type] = view.view_id;
396 });396 });
397 if (this.flags.views_switcher === false) {397 if (this.flags.views_switcher === false) {
398 this.$element.find('.oe_view_manager_switch').hide();398 this.$el.find('.oe_view_manager_switch').hide();
399 }399 }
400 // If no default view defined, switch to the first one in sequence400 // If no default view defined, switch to the first one in sequence
401 var default_view = this.flags.default_view || this.views_src[0].view_type;401 var default_view = this.flags.default_view || this.views_src[0].view_type;
@@ -432,9 +432,9 @@
432 this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show']();432 this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show']();
433 }433 }
434434
435 this.$element435 this.$el
436 .find('.oe_view_manager_switch a').parent().removeClass('active');436 .find('.oe_view_manager_switch a').parent().removeClass('active');
437 this.$element437 this.$el
438 .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]')438 .find('.oe_view_manager_switch a').filter('[data-view-type="' + view_type + '"]')
439 .parent().addClass('active');439 .parent().addClass('active');
440440
@@ -442,7 +442,7 @@
442 _.each(_.keys(self.views), function(view_name) {442 _.each(_.keys(self.views), function(view_name) {
443 var controller = self.views[view_name].controller;443 var controller = self.views[view_name].controller;
444 if (controller) {444 if (controller) {
445 var container = self.$element.find(".oe_view_manager_view_" + view_name + ":first");445 var container = self.$el.find(".oe_view_manager_view_" + view_name + ":first");
446 if (view_name === view_type) {446 if (view_name === view_type) {
447 container.show();447 container.show();
448 controller.do_show(view_options || {});448 controller.do_show(view_options || {});
@@ -451,10 +451,10 @@
451 controller.do_hide();451 controller.do_hide();
452 }452 }
453 // put the <footer> in the dialog's buttonpane453 // put the <footer> in the dialog's buttonpane
454 if (self.$element.parent('.ui-dialog-content') && self.$element.find('footer')) {454 if (self.$el.parent('.ui-dialog-content') && self.$el.find('footer')) {
455 self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide()455 self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide()
456 self.$element.find('footer').appendTo(456 self.$el.find('footer').appendTo(
457 self.$element.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane')457 self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane')
458 );458 );
459 }459 }
460 }460 }
@@ -491,7 +491,7 @@
491 controller.do_switch_view.add_last(_.bind(this.switch_view, this));491 controller.do_switch_view.add_last(_.bind(this.switch_view, this));
492492
493 controller.do_prev_view.add_last(this.on_prev_view);493 controller.do_prev_view.add_last(this.on_prev_view);
494 var container = this.$element.find(".oe_view_manager_view_" + view_type);494 var container = this.$el.find(".oe_view_manager_view_" + view_type);
495 var view_promise = controller.appendTo(container);495 var view_promise = controller.appendTo(container);
496 this.views[view_type].controller = controller;496 this.views[view_type].controller = controller;
497 this.views[view_type].deferred.resolve(view_type);497 this.views[view_type].deferred.resolve(view_type);
@@ -505,7 +505,7 @@
505 });505 });
506 },506 },
507 set_title: function(title) {507 set_title: function(title) {
508 this.$element.find('.oe_view_title_text:first').text(title);508 this.$el.find('.oe_view_title_text:first').text(title);
509 },509 },
510 add_breadcrumb: function() {510 add_breadcrumb: function() {
511 var self = this;511 var self = this;
@@ -524,7 +524,7 @@
524 action: this.action,524 action: this.action,
525 show: function(index) {525 show: function(index) {
526 var view_to_select = views[index];526 var view_to_select = views[index];
527 self.$element.show();527 self.$el.show();
528 if (self.active_view !== view_to_select) {528 if (self.active_view !== view_to_select) {
529 self.on_mode_switch(view_to_select);529 self.on_mode_switch(view_to_select);
530 }530 }
@@ -600,7 +600,7 @@
600 this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false);600 this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false);
601601
602 this.searchview.on_search.add(this.do_searchview_search);602 this.searchview.on_search.add(this.do_searchview_search);
603 return this.searchview.appendTo(this.$element.find(".oe_view_manager_view_search"));603 return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search"));
604 },604 },
605 do_searchview_search: function(domains, contexts, groupbys) {605 do_searchview_search: function(domains, contexts, groupbys) {
606 var self = this,606 var self = this,
@@ -717,8 +717,8 @@
717717
718 var manager_ready = $.when(searchview_loaded, main_view_loaded);718 var manager_ready = $.when(searchview_loaded, main_view_loaded);
719719
720 this.$element.find('.oe_debug_view').change(this.on_debug_changed);720 this.$el.find('.oe_debug_view').change(this.on_debug_changed);
721 this.$element.addClass("oe_view_manager_" + (this.action.target || 'current'));721 this.$el.addClass("oe_view_manager_" + (this.action.target || 'current'));
722 return manager_ready;722 return manager_ready;
723 },723 },
724 on_debug_changed: function (evt) {724 on_debug_changed: function (evt) {
@@ -730,7 +730,7 @@
730 switch (val) {730 switch (val) {
731 case 'fvg':731 case 'fvg':
732 var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open();732 var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open();
733 $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$element);733 $('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el);
734 break;734 break;
735 case 'perm_read':735 case 'perm_read':
736 var ids = current_view.get_selected_ids();736 var ids = current_view.get_selected_ids();
@@ -828,7 +828,7 @@
828 var controller = self.views[self.active_view].controller,828 var controller = self.views[self.active_view].controller,
829 fvg = controller.fields_view,829 fvg = controller.fields_view,
830 view_id = (fvg && fvg.view_id) || '--';830 view_id = (fvg && fvg.view_id) || '--';
831 self.$element.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', {831 self.$el.find('.oe_debug_view').html(QWeb.render('ViewManagerDebug', {
832 view: controller,832 view: controller,
833 view_manager: self833 view_manager: self
834 }));834 }));
@@ -842,7 +842,7 @@
842 return r;842 return r;
843 },843 },
844 set_title: function(title) {844 set_title: function(title) {
845 this.$element.find('.oe_breadcrumb_title:first').html(this.getParent().get_title());845 this.$el.find('.oe_breadcrumb_title:first').html(this.getParent().get_title());
846 },846 },
847 do_push_state: function(state) {847 do_push_state: function(state) {
848 if (this.getParent() && this.getParent().do_push_state) {848 if (this.getParent() && this.getParent().do_push_state) {
@@ -901,7 +901,7 @@
901 var self = this;901 var self = this;
902 this._super(this);902 this._super(this);
903 this.redraw();903 this.redraw();
904 this.$element.on('click','.oe_dropdown_menu li a', function(event) {904 this.$el.on('click','.oe_dropdown_menu li a', function(event) {
905 var section = $(this).data('section');905 var section = $(this).data('section');
906 var index = $(this).data('index');906 var index = $(this).data('index');
907 var item = self.items[section][index];907 var item = self.items[section][index];
@@ -917,7 +917,7 @@
917 },917 },
918 redraw: function() {918 redraw: function() {
919 var self = this;919 var self = this;
920 self.$element.html(QWeb.render('Sidebar', {widget: self}));920 self.$el.html(QWeb.render('Sidebar', {widget: self}));
921921
922 // Hides Sidebar sections when item list is empty922 // Hides Sidebar sections when item list is empty
923 this.$('.oe_form_dropdown_section').each(function() {923 this.$('.oe_form_dropdown_section').each(function() {
@@ -1024,12 +1024,12 @@
1024 self.items['files'] = attachments;1024 self.items['files'] = attachments;
1025 self.redraw();1025 self.redraw();
1026 this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed);1026 this.$('.oe_sidebar_add_attachment .oe_form_binary_file').change(this.on_attachment_changed);
1027 this.$element.find('.oe_sidebar_delete_item').click(this.on_attachment_delete);1027 this.$el.find('.oe_sidebar_delete_item').click(this.on_attachment_delete);
1028 },1028 },
1029 on_attachment_changed: function(e) {1029 on_attachment_changed: function(e) {
1030 var $e = $(e.target);1030 var $e = $(e.target);
1031 if ($e.val() !== '') {1031 if ($e.val() !== '') {
1032 this.$element.find('form.oe_form_binary_form').submit();1032 this.$el.find('form.oe_form_binary_form').submit();
1033 $e.parent().find('input[type=file]').prop('disabled', true);1033 $e.parent().find('input[type=file]').prop('disabled', true);
1034 $e.parent().find('button').prop('disabled', true).find('img, span').toggle();1034 $e.parent().find('button').prop('disabled', true).find('img, span').toggle();
1035 this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...'));1035 this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...'));
@@ -1078,8 +1078,8 @@
1078 var self = this;1078 var self = this;
1079 this._super();1079 this._super();
1080 $.when(this.languages_loaded).then(function() {1080 $.when(this.languages_loaded).then(function() {
1081 self.$element.html(instance.web.qweb.render('TranslateDialog', { widget: self }));1081 self.$el.html(instance.web.qweb.render('TranslateDialog', { widget: self }));
1082 self.$fields_form = self.$element.find('.oe_translation_form');1082 self.$fields_form = self.$el.find('.oe_translation_form');
1083 self.$fields_form.find('.oe_trad_field').change(function() {1083 self.$fields_form.find('.oe_trad_field').change(function() {
1084 $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value')));1084 $(this).toggleClass('touched', ($(this).val() != $(this).attr('data-value')));
1085 });1085 });
@@ -1125,8 +1125,8 @@
1125 if (self.view.translatable_fields && self.view.translatable_fields.length) {1125 if (self.view.translatable_fields && self.view.translatable_fields.length) {
1126 self.do_load_fields_values(function() {1126 self.do_load_fields_values(function() {
1127 if (field) {1127 if (field) {
1128 var $field_input = self.$element.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child');1128 var $field_input = self.$el.find('tr[data-field="' + field.name + '"] td:nth-child(2) *:first-child');
1129 self.$element.scrollTo($field_input);1129 self.$el.scrollTo($field_input);
1130 $field_input.focus();1130 $field_input.focus();
1131 }1131 }
1132 });1132 });
@@ -1302,10 +1302,10 @@
1302 this.embedded_view = embedded_view;1302 this.embedded_view = embedded_view;
1303 },1303 },
1304 do_show: function () {1304 do_show: function () {
1305 this.$element.show();1305 this.$el.show();
1306 },1306 },
1307 do_hide: function () {1307 do_hide: function () {
1308 this.$element.hide();1308 this.$el.hide();
1309 },1309 },
1310 do_push_state: function(state) {1310 do_push_state: function(state) {
1311 if (this.getParent() && this.getParent().do_push_state) {1311 if (this.getParent() && this.getParent().do_push_state) {
13121312
=== modified file 'addons/web/static/src/xml/base.xml'
--- addons/web/static/src/xml/base.xml 2012-08-21 09:30:00 +0000
+++ addons/web/static/src/xml/base.xml 2012-08-27 06:09:20 +0000
@@ -1083,7 +1083,7 @@
1083 </span>1083 </span>
1084</t>1084</t>
1085<t t-name="FieldStatus">1085<t t-name="FieldStatus">
1086 <ul t-att-class="widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps'" t-att-style="widget.node.attrs.style"/>1086 <ul t-att-class="'oe_form_field_status ' + (widget.options.clickable ? 'oe_form_steps_clickable' : 'oe_form_steps')" t-att-style="widget.node.attrs.style"/>
1087</t>1087</t>
1088<t t-name="FieldStatus.content">1088<t t-name="FieldStatus.content">
1089 <t t-foreach="widget.selection" t-as="i">1089 <t t-foreach="widget.selection" t-as="i">
10901090
=== modified file 'addons/web/static/test/Widget.js'
--- addons/web/static/test/Widget.js 2012-08-01 12:59:10 +0000
+++ addons/web/static/test/Widget.js 2012-08-27 06:09:20 +0000
@@ -86,17 +86,17 @@
86 test('no template, default', function () {86 test('no template, default', function () {
87 var w = new (instance.web.Widget.extend({ }));87 var w = new (instance.web.Widget.extend({ }));
8888
89 var $original = w.$element;89 var $original = w.$el;
90 ok($original, "should initially have a root element");90 ok($original, "should initially have a root element");
91 w.renderElement();91 w.renderElement();
92 ok(w.$element, "should have generated a root element");92 ok(w.$el, "should have generated a root element");
93 ok($original !== w.$element, "should have generated a new root element");93 ok($original !== w.$el, "should have generated a new root element");
94 strictEqual(w.$element, w.$element, "should provide $element alias");94 strictEqual(w.$el, w.$el, "should provide $el alias");
95 ok(w.$element.is(w.el), "should provide raw DOM alias");95 ok(w.$el.is(w.el), "should provide raw DOM alias");
9696
97 equal(w.el.nodeName, 'DIV', "should have generated the default element");97 equal(w.el.nodeName, 'DIV', "should have generated the default element");
98 equal(w.el.attributes.length, 0, "should not have generated any attribute");98 equal(w.el.attributes.length, 0, "should not have generated any attribute");
99 ok(_.isEmpty(w.$element.html(), "should not have generated any content"));99 ok(_.isEmpty(w.$el.html(), "should not have generated any content"));
100 });100 });
101 test('no template, custom tag', function () {101 test('no template, custom tag', function () {
102 var w = new (instance.web.Widget.extend({102 var w = new (instance.web.Widget.extend({
@@ -113,7 +113,7 @@
113 w.renderElement();113 w.renderElement();
114114
115 equal(w.el.attributes.length, 1, "should have one attribute");115 equal(w.el.attributes.length, 1, "should have one attribute");
116 equal(w.$element.attr('id'), 'foo', "should have generated the id attribute");116 equal(w.$el.attr('id'), 'foo', "should have generated the id attribute");
117 equal(w.el.id, 'foo', "should also be available via property");117 equal(w.el.id, 'foo', "should also be available via property");
118 });118 });
119 test('no template, @className', function () {119 test('no template, @className', function () {
@@ -123,7 +123,7 @@
123 w.renderElement();123 w.renderElement();
124124
125 equal(w.el.className, 'oe_some_class', "should have the right property");125 equal(w.el.className, 'oe_some_class', "should have the right property");
126 equal(w.$element.attr('class'), 'oe_some_class', "should have the right attribute");126 equal(w.$el.attr('class'), 'oe_some_class', "should have the right attribute");
127 });127 });
128 test('no template, bunch of attributes', function () {128 test('no template, bunch of attributes', function () {
129 var w = new (instance.web.Widget.extend({129 var w = new (instance.web.Widget.extend({
@@ -140,16 +140,16 @@
140 equal(w.el.attributes.length, 5, "should have all the specified attributes");140 equal(w.el.attributes.length, 5, "should have all the specified attributes");
141141
142 equal(w.el.id, 'some_id');142 equal(w.el.id, 'some_id');
143 equal(w.$element.attr('id'), 'some_id');143 equal(w.$el.attr('id'), 'some_id');
144144
145 equal(w.el.className, 'some_class');145 equal(w.el.className, 'some_class');
146 equal(w.$element.attr('class'), 'some_class');146 equal(w.$el.attr('class'), 'some_class');
147147
148 equal(w.$element.attr('data-foo'), 'data attribute');148 equal(w.$el.attr('data-foo'), 'data attribute');
149 equal(w.$element.data('foo'), 'data attribute');149 equal(w.$el.data('foo'), 'data attribute');
150150
151 equal(w.$element.attr('clark'), 'gable');151 equal(w.$el.attr('clark'), 'gable');
152 equal(w.$element.attr('spoiler'), 'snape kills dumbledore');152 equal(w.$el.attr('spoiler'), 'snape kills dumbledore');
153 });153 });
154154
155 test('template', function () {155 test('template', function () {
@@ -159,7 +159,7 @@
159 w.renderElement();159 w.renderElement();
160160
161 equal(w.el.nodeName, 'OL');161 equal(w.el.nodeName, 'OL');
162 equal(w.$element.children().length, 5);162 equal(w.$el.children().length, 5);
163 equal(w.el.textContent, '01234');163 equal(w.el.textContent, '01234');
164 });164 });
165165
@@ -170,7 +170,7 @@
170 }));170 }));
171 w.renderElement();171 w.renderElement();
172172
173 ok(w.$('li:eq(3)').is(w.$element.find('li:eq(3)')),173 ok(w.$('li:eq(3)').is(w.$el.find('li:eq(3)')),
174 "should do the same thing as calling find on the widget root");174 "should do the same thing as calling find on the widget root");
175 });175 });
176176
@@ -191,7 +191,7 @@
191 }));191 }));
192 w.renderElement();192 w.renderElement();
193193
194 w.$element.click();194 w.$el.click();
195 w.$('li:eq(3)').click();195 w.$('li:eq(3)').click();
196 w.$('input:last').val('foo').change();196 w.$('input:last').val('foo').change();
197197
@@ -206,7 +206,7 @@
206 events: { 'click li': function () { clicked = true; } }206 events: { 'click li': function () { clicked = true; } }
207 }));207 }));
208 w.renderElement();208 w.renderElement();
209 w.$element.on('click', 'li', function () { newclicked = true });209 w.$el.on('click', 'li', function () { newclicked = true });
210210
211 w.$('li').click();211 w.$('li').click();
212 ok(clicked, "should trigger bound events");212 ok(clicked, "should trigger bound events");
@@ -229,11 +229,11 @@
229 .always(start)229 .always(start)
230 .done(function () {230 .done(function () {
231 equal($fix.find('p').text(), '42', "DOM fixture should contain initial value");231 equal($fix.find('p').text(), '42', "DOM fixture should contain initial value");
232 equal(w.$element.text(), '42', "should set initial value");232 equal(w.$el.text(), '42', "should set initial value");
233 w.value = 36;233 w.value = 36;
234 w.renderElement();234 w.renderElement();
235 equal($fix.find('p').text(), '36', "DOM fixture should use new value");235 equal($fix.find('p').text(), '36', "DOM fixture should use new value");
236 equal(w.$element.text(), '36', "should set new value");236 equal(w.$el.text(), '36', "should set new value");
237 });237 });
238 });238 });
239});239});
240240
=== modified file 'addons/web_calendar/static/src/js/calendar.js'
--- addons/web_calendar/static/src/js/calendar.js 2012-08-16 10:03:53 +0000
+++ addons/web_calendar/static/src/js/calendar.js 2012-08-27 06:09:20 +0000
@@ -49,7 +49,7 @@
49 },49 },
50 on_loaded: function(data) {50 on_loaded: function(data) {
51 this.fields_view = data;51 this.fields_view = data;
52 this.$element.addClass(this.fields_view.arch.attrs['class']);52 this.$el.addClass(this.fields_view.arch.attrs['class']);
53 this.calendar_fields = {};53 this.calendar_fields = {};
54 this.ids = this.dataset.ids;54 this.ids = this.dataset.ids;
55 this.color_values = [];55 this.color_values = [];
@@ -104,7 +104,7 @@
104104
105 if (!this.sidebar && this.options.$sidebar) {105 if (!this.sidebar && this.options.$sidebar) {
106 this.sidebar = new instance.web_calendar.Sidebar(this);106 this.sidebar = new instance.web_calendar.Sidebar(this);
107 this.has_been_loaded.pipe(this.sidebar.appendTo(this.$element.find('.oe_calendar_sidebar_container')));107 this.has_been_loaded.pipe(this.sidebar.appendTo(this.$el.find('.oe_calendar_sidebar_container')));
108 }108 }
109109
110 return this.has_been_loaded.resolve();110 return this.has_been_loaded.resolve();
@@ -170,10 +170,10 @@
170 }170 }
171 };171 };
172172
173 scheduler.init(this.$element.find('.oe_calendar')[0], null, this.mode || 'month');173 scheduler.init(this.$el.find('.oe_calendar')[0], null, this.mode || 'month');
174174
175 // Remove hard coded style attributes from dhtmlx scheduler175 // Remove hard coded style attributes from dhtmlx scheduler
176 this.$element.find(".dhx_cal_navline div").removeAttr('style');176 this.$el.find(".dhx_cal_navline div").removeAttr('style');
177177
178 scheduler.detachAllEvents();178 scheduler.detachAllEvents();
179 scheduler.attachEvent('onEventAdded', this.do_create_event);179 scheduler.attachEvent('onEventAdded', this.do_create_event);
@@ -186,7 +186,7 @@
186 this.refresh_scheduler();186 this.refresh_scheduler();
187 },187 },
188 on_view_changed: function(mode, date) {188 on_view_changed: function(mode, date) {
189 this.$element.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode);189 this.$el.find('.oe_calendar').removeClass('oe_cal_day oe_cal_week oe_cal_month').addClass('oe_cal_' + mode);
190 if (!date.between(this.range_start, this.range_stop)) {190 if (!date.between(this.range_start, this.range_stop)) {
191 this.update_range_dates(date);191 this.update_range_dates(date);
192 this.do_ranged_search();192 this.do_ranged_search();
@@ -429,7 +429,7 @@
429 do_show: function () {429 do_show: function () {
430 var self = this;430 var self = this;
431 $.when(this.has_been_loaded).then(function() {431 $.when(this.has_been_loaded).then(function() {
432 self.$element.show();432 self.$el.show();
433 self.do_push_state({});433 self.do_push_state({});
434 });434 });
435 },435 },
@@ -452,7 +452,7 @@
452 this.form = new instance.web.FormView(this, this.dataset, this.view_id, {452 this.form = new instance.web.FormView(this, this.dataset, this.view_id, {
453 pager: false453 pager: false
454 });454 });
455 var def = this.form.appendTo(this.$element);455 var def = this.form.appendTo(this.$el);
456 this.form.on_created.add_last(this.on_form_dialog_saved);456 this.form.on_created.add_last(this.on_form_dialog_saved);
457 this.form.on_saved.add_last(this.on_form_dialog_saved);457 this.form.on_saved.add_last(this.on_form_dialog_saved);
458 this.form.on_button_cancel = function() {458 this.form.on_button_cancel = function() {
@@ -482,7 +482,7 @@
482 start: function() {482 start: function() {
483 this._super();483 this._super();
484 this.mini_calendar = scheduler.renderCalendar({484 this.mini_calendar = scheduler.renderCalendar({
485 container: this.$element.find('.oe_calendar_mini')[0],485 container: this.$el.find('.oe_calendar_mini')[0],
486 navigation: true,486 navigation: true,
487 date: scheduler._date,487 date: scheduler._date,
488 handler: function(date, calendar) {488 handler: function(date, calendar) {
@@ -490,7 +490,7 @@
490 }490 }
491 });491 });
492 this.filter = new instance.web_calendar.SidebarFilter(this, this.getParent());492 this.filter = new instance.web_calendar.SidebarFilter(this, this.getParent());
493 this.filter.appendTo(this.$element.find('.oe_calendar_filter'));493 this.filter.appendTo(this.$el.find('.oe_calendar_filter'));
494 }494 }
495});495});
496instance.web_calendar.SidebarFilter = instance.web.Widget.extend({496instance.web_calendar.SidebarFilter = instance.web.Widget.extend({
@@ -503,7 +503,7 @@
503 },503 },
504 on_events_loaded: function(filters) {504 on_events_loaded: function(filters) {
505 var selected_filters = this.view.selected_filters.slice(0);505 var selected_filters = this.view.selected_filters.slice(0);
506 this.$element.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters }));506 this.$el.html(QWeb.render('CalendarView.sidebar.responsible', { filters: filters }));
507 this.$('div.oe_calendar_responsible input').each(function() {507 this.$('div.oe_calendar_responsible input').each(function() {
508 if (_.indexOf(selected_filters, $(this).val()) > -1) {508 if (_.indexOf(selected_filters, $(this).val()) > -1) {
509 $(this).click();509 $(this).click();
510510
=== modified file 'addons/web_diagram/static/src/js/diagram.js'
--- addons/web_diagram/static/src/js/diagram.js 2012-08-19 12:46:07 +0000
+++ addons/web_diagram/static/src/js/diagram.js 2012-08-27 06:09:20 +0000
@@ -47,15 +47,15 @@
47 return label.tag == "label";47 return label.tag == "label";
48 });48 });
4949
50 this.$element.html(QWeb.render("DiagramView", this));50 this.$el.html(QWeb.render("DiagramView", this));
51 this.$element.addClass(this.fields_view.arch.attrs['class']);51 this.$el.addClass(this.fields_view.arch.attrs['class']);
5252
53 _.each(self.labels,function(label){53 _.each(self.labels,function(label){
54 html_label = '<p style="padding: 4px;">' + label.attrs.string + "</p>";54 html_label = '<p style="padding: 4px;">' + label.attrs.string + "</p>";
55 self.$element.find('.oe_diagram_header').append(html_label);55 self.$el.find('.oe_diagram_header').append(html_label);
56 })56 })
5757
58 this.$element.find('div.oe_diagram_pager button[data-pager-action]').click(function() {58 this.$el.find('div.oe_diagram_pager button[data-pager-action]').click(function() {
59 var action = $(this).data('pager-action');59 var action = $(this).data('pager-action');
60 self.on_pager_action(action);60 self.on_pager_action(action);
61 });61 });
@@ -63,7 +63,7 @@
63 this.do_update_pager();63 this.do_update_pager();
6464
65 // New Node,Edge65 // New Node,Edge
66 this.$element.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();});66 this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();});
6767
68 if(this.id) {68 if(this.id) {
69 self.get_diagram_info();69 self.get_diagram_info();
@@ -126,7 +126,7 @@
126 var res_nodes = result['nodes'];126 var res_nodes = result['nodes'];
127 var res_edges = result['conn'];127 var res_edges = result['conn'];
128 this.parent_field = result.parent_field;128 this.parent_field = result.parent_field;
129 this.$element.find('h3.oe_diagram_title').text(result.name);129 this.$el.find('h3.oe_diagram_title').text(result.name);
130130
131 var id_to_node = {};131 var id_to_node = {};
132132
@@ -161,7 +161,7 @@
161 };161 };
162162
163 // remove previous diagram163 // remove previous diagram
164 var canvas = self.$element.find('div.oe_diagram_diagram')164 var canvas = self.$el.find('div.oe_diagram_diagram')
165 .empty().get(0);165 .empty().get(0);
166166
167 var r = new Raphael(canvas, '100%','100%');167 var r = new Raphael(canvas, '100%','100%');
@@ -332,7 +332,7 @@
332 });332 });
333 // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes.333 // We want to destroy the dummy edge after a creation cancel. This destroys it even if we save the changes.
334 // This is not a problem since the diagram is completely redrawn on saved changes.334 // This is not a problem since the diagram is completely redrawn on saved changes.
335 pop.$element.bind("dialogbeforeclose",function(){335 pop.$el.bind("dialogbeforeclose",function(){
336 if(dummy_cuteedge){336 if(dummy_cuteedge){
337 dummy_cuteedge.remove();337 dummy_cuteedge.remove();
338 }338 }
@@ -370,7 +370,7 @@
370 },370 },
371371
372 do_update_pager: function(hide_index) {372 do_update_pager: function(hide_index) {
373 var $pager = this.$element.find('div.oe_diagram_pager');373 var $pager = this.$el.find('div.oe_diagram_pager');
374 var index = hide_index ? '-' : this.dataset.index + 1;374 var index = hide_index ? '-' : this.dataset.index + 1;
375 if(!this.dataset.count) {375 if(!this.dataset.count) {
376 this.dataset.count = this.dataset.ids.length;376 this.dataset.count = this.dataset.ids.length;
377377
=== modified file 'addons/web_gantt/static/src/js/gantt.js'
--- addons/web_gantt/static/src/js/gantt.js 2012-06-27 15:17:33 +0000
+++ addons/web_gantt/static/src/js/gantt.js 2012-08-27 06:09:20 +0000
@@ -19,7 +19,7 @@
19 on_loaded: function(fields_view_get, fields_get) {19 on_loaded: function(fields_view_get, fields_get) {
20 var self = this;20 var self = this;
21 this.fields_view = fields_view_get;21 this.fields_view = fields_view_get;
22 this.$element.addClass(this.fields_view.arch.attrs['class']);22 this.$el.addClass(this.fields_view.arch.attrs['class']);
23 return this.rpc("/web/searchview/fields_get", {"model": this.dataset.model}).pipe(function(fields_get) {23 return this.rpc("/web/searchview/fields_get", {"model": this.dataset.model}).pipe(function(fields_get) {
24 self.fields = fields_get.fields;24 self.fields = fields_get.fields;
25 self.has_been_loaded.resolve();25 self.has_been_loaded.resolve();
@@ -69,7 +69,7 @@
69 },69 },
70 on_data_loaded_2: function(tasks, group_bys) {70 on_data_loaded_2: function(tasks, group_bys) {
71 var self = this;71 var self = this;
72 $(".oe_gantt", this.$element).html("");72 $(".oe_gantt", this.$el).html("");
73 73
74 //prevent more that 1 group by74 //prevent more that 1 group by
75 if (group_bys.length > 0) {75 if (group_bys.length > 0) {
@@ -177,7 +177,7 @@
177 gantt.create(this.chart_id);177 gantt.create(this.chart_id);
178 178
179 // bind event to display task when we click the item in the tree179 // bind event to display task when we click the item in the tree
180 $(".taskNameItem", self.$element).click(function(event) {180 $(".taskNameItem", self.$el).click(function(event) {
181 var task_info = task_ids[event.target.id];181 var task_info = task_ids[event.target.id];
182 if (task_info) {182 if (task_info) {
183 self.on_task_display(task_info.internal_task);183 self.on_task_display(task_info.internal_task);
@@ -185,10 +185,10 @@
185 });185 });
186 186
187 // insertion of create button187 // insertion of create button
188 var td = $($("table td", self.$element)[0]);188 var td = $($("table td", self.$el)[0]);
189 var rendered = QWeb.render("GanttView-create-button");189 var rendered = QWeb.render("GanttView-create-button");
190 $(rendered).prependTo(td);190 $(rendered).prependTo(td);
191 $(".oe_gantt_button_create", this.$element).click(this.on_task_create);191 $(".oe_gantt_button_create", this.$el).click(this.on_task_create);
192 },192 },
193 on_task_changed: function(task_obj) {193 on_task_changed: function(task_obj) {
194 var self = this;194 var self = this;
195195
=== modified file 'addons/web_graph/static/src/js/graph.js'
--- addons/web_graph/static/src/js/graph.js 2012-06-27 15:17:33 +0000
+++ addons/web_graph/static/src/js/graph.js 2012-08-27 06:09:20 +0000
@@ -53,20 +53,20 @@
53 // TODO: move to load_view and document53 // TODO: move to load_view and document
54 var self = this;54 var self = this;
55 this.fields_view = fields_view_get;55 this.fields_view = fields_view_get;
56 this.$element.addClass(this.fields_view.arch.attrs['class']);56 this.$el.addClass(this.fields_view.arch.attrs['class']);
5757
58 this.mode = this.fields_view.arch.attrs.type || 'bar';58 this.mode = this.fields_view.arch.attrs.type || 'bar';
59 this.orientation = this.fields_view.arch.attrs.orientation == 'horizontal';59 this.orientation = this.fields_view.arch.attrs.orientation == 'horizontal';
6060
61 var width = this.$element.parent().width();61 var width = this.$el.parent().width();
62 this.$element.css("width", width);62 this.$el.css("width", width);
63 this.container = this.$element.find("#editor-render-body").css({63 this.container = this.$el.find("#editor-render-body").css({
64 width: width,64 width: width,
65 height: Math.min(500, width * 0.8)65 height: Math.min(500, width * 0.8)
66 })[0];66 })[0];
6767
68 var graph_render = this.proxy('graph_render');68 var graph_render = this.proxy('graph_render');
69 this.$element.on('click', '.oe_graph_options a', function (evt) {69 this.$el.on('click', '.oe_graph_options a', function (evt) {
70 var $el = $(evt.target);70 var $el = $(evt.target);
7171
72 self.graph_render({data: filter_values({72 self.graph_render({data: filter_values({
@@ -77,18 +77,18 @@
77 })});77 })});
78 });78 });
7979
80 this.$element.find("#graph_show_data").click(function () {80 this.$el.find("#graph_show_data").click(function () {
81 self.spreadsheet = ! self.spreadsheet;81 self.spreadsheet = ! self.spreadsheet;
82 self.graph_render();82 self.graph_render();
83 });83 });
84 this.$element.find("#graph_switch").click(function () {84 this.$el.find("#graph_switch").click(function () {
85 if (self.mode != 'radar') {85 if (self.mode != 'radar') {
86 self.orientation = ! self.orientation;86 self.orientation = ! self.orientation;
87 }87 }
88 self.graph_render();88 self.graph_render();
89 });89 });
9090
91 this.$element.find("#graph_download").click(function () {91 this.$el.find("#graph_download").click(function () {
92 if (self.legend == "top") { self.legend = "inside"; }92 if (self.legend == "top") { self.legend = "inside"; }
93 self.forcehtml = true;93 self.forcehtml = true;
9494
@@ -110,7 +110,7 @@
110 switch (this.legend) {110 switch (this.legend) {
111 case 'top':111 case 'top':
112 legend.noColumns = 4;112 legend.noColumns = 4;
113 legend.container = this.$element.find("div.graph_header_legend")[0];113 legend.container = this.$el.find("div.graph_header_legend")[0];
114 break;114 break;
115 case 'inside':115 case 'inside':
116 legend.position = 'nw';116 legend.position = 'nw';
@@ -257,24 +257,24 @@
257 }257 }
258258
259 // Render the graph259 // Render the graph
260 this.$element.find(".graph_header_legend").children().remove();260 this.$el.find(".graph_header_legend").children().remove();
261 this.graph = this.make_graph(this.mode, this.container, data);261 this.graph = this.make_graph(this.mode, this.container, data);
262262
263 // Update styles of menus263 // Update styles of menus
264264
265 this.$element.find("a").removeClass("active");265 this.$el.find("a").removeClass("active");
266266
267 var $active = this.$element.find('a[data-mode=' + this.mode + ']');267 var $active = this.$el.find('a[data-mode=' + this.mode + ']');
268 if ($active.length > 1) {268 if ($active.length > 1) {
269 $active = $active.filter('[data-stacked=' + this.stacked + ']');269 $active = $active.filter('[data-stacked=' + this.stacked + ']');
270 }270 }
271 $active = $active.add(271 $active = $active.add(
272 this.$element.find('a:not([data-mode])[data-legend=' + this.legend + ']'));272 this.$el.find('a:not([data-mode])[data-legend=' + this.legend + ']'));
273273
274 $active.addClass('active');274 $active.addClass('active');
275275
276 if (this.spreadsheet) {276 if (this.spreadsheet) {
277 this.$element.find("#graph_show_data").addClass("active");277 this.$el.find("#graph_show_data").addClass("active");
278 }278 }
279 return this.graph;279 return this.graph;
280 },280 },
281281
=== modified file 'addons/web_graph/static/src/xml/web_graph.xml'
--- addons/web_graph/static/src/xml/web_graph.xml 2012-06-25 14:48:45 +0000
+++ addons/web_graph/static/src/xml/web_graph.xml 2012-08-27 06:09:20 +0000
@@ -1,5 +1,5 @@
1<template>1<template>
2 <div t-name="GraphView" id="element-chart" class="editor-render" style="position:relative; width: 300px;">2 <div t-name="GraphView" id="element-chart" class="oe_semantic_html_override editor-render" style="position:relative; width: 300px;">
3 <a href="#" class="oe_e dropdown-menu-icon" data-toggle="dropdown" title="Graph Options">&amp;iacute;</a>3 <a href="#" class="oe_e dropdown-menu-icon" data-toggle="dropdown" title="Graph Options">&amp;iacute;</a>
4 <div class="graph_header_legend">4 <div class="graph_header_legend">
5 </div>5 </div>
66
=== modified file 'addons/web_kanban/static/src/js/kanban.js'
--- addons/web_kanban/static/src/js/kanban.js 2012-08-21 16:15:17 +0000
+++ addons/web_kanban/static/src/js/kanban.js 2012-08-27 06:09:20 +0000
@@ -48,17 +48,17 @@
48 },48 },
49 on_loaded: function(data) {49 on_loaded: function(data) {
50 this.fields_view = data;50 this.fields_view = data;
51 this.$element.addClass(this.fields_view.arch.attrs['class']);51 this.$el.addClass(this.fields_view.arch.attrs['class']);
52 this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this}));52 this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this}));
53 if (this.options.$buttons) {53 if (this.options.$buttons) {
54 this.$buttons.appendTo(this.options.$buttons);54 this.$buttons.appendTo(this.options.$buttons);
55 } else {55 } else {
56 this.$element.find('.oe_kanban_buttons').replaceWith(this.$buttons);56 this.$el.find('.oe_kanban_buttons').replaceWith(this.$buttons);
57 }57 }
58 this.$buttons58 this.$buttons
59 .on('click', 'button.oe_kanban_button_new', this.do_add_record)59 .on('click', 'button.oe_kanban_button_new', this.do_add_record)
60 .on('click', '.oe_kanban_add_column', this.do_add_group);60 .on('click', '.oe_kanban_add_column', this.do_add_group);
61 this.$groups = this.$element.find('.oe_kanban_groups tr');61 this.$groups = this.$el.find('.oe_kanban_groups tr');
62 this.fields_keys = _.keys(this.fields_view.fields);62 this.fields_keys = _.keys(this.fields_view.fields);
63 this.add_qweb_template();63 this.add_qweb_template();
64 this.has_been_loaded.resolve();64 this.has_been_loaded.resolve();
@@ -188,14 +188,14 @@
188 };188 };
189 var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset);189 var new_group = new instance.web_kanban.KanbanGroup(self, [], datagroup, dataset);
190 self.do_add_groups([new_group]).then(function() {190 self.do_add_groups([new_group]).then(function() {
191 $(window).scrollTo(self.groups.slice(-1)[0].$element, { axis: 'x' });191 $(window).scrollTo(self.groups.slice(-1)[0].$el, { axis: 'x' });
192 });192 });
193 });193 });
194 });194 });
195 },195 },
196 do_search: function(domain, context, group_by) {196 do_search: function(domain, context, group_by) {
197 var self = this;197 var self = this;
198 this.$element.find('.oe_view_nocontent').remove();198 this.$el.find('.oe_view_nocontent').remove();
199 this.search_domain = domain;199 this.search_domain = domain;
200 this.search_context = context;200 this.search_context = context;
201 this.search_group_by = group_by;201 this.search_group_by = group_by;
@@ -204,14 +204,14 @@
204 self.group_by_field = self.fields_view.fields[self.group_by] || {};204 self.group_by_field = self.fields_view.fields[self.group_by] || {};
205 self.grouped_by_m2o = (self.group_by_field.type === 'many2one');205 self.grouped_by_m2o = (self.group_by_field.type === 'many2one');
206 self.$buttons.find('.oe_alternative').toggle(self.grouped_by_m2o);206 self.$buttons.find('.oe_alternative').toggle(self.grouped_by_m2o);
207 self.$element.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o);207 self.$el.toggleClass('oe_kanban_grouped_by_m2o', self.grouped_by_m2o);
208 self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []);208 self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []);
209 self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset);209 self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset);
210 });210 });
211 },211 },
212 do_process_groups: function(groups) {212 do_process_groups: function(groups) {
213 var self = this;213 var self = this;
214 this.$element.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped');214 this.$el.remove('oe_kanban_ungrouped').addClass('oe_kanban_grouped');
215 this.add_group_mutex.exec(function() {215 this.add_group_mutex.exec(function() {
216 self.do_clear_groups();216 self.do_clear_groups();
217 self.dataset.ids = [];217 self.dataset.ids = [];
@@ -234,7 +234,7 @@
234 },234 },
235 do_process_dataset: function(dataset) {235 do_process_dataset: function(dataset) {
236 var self = this;236 var self = this;
237 this.$element.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped');237 this.$el.remove('oe_kanban_grouped').addClass('oe_kanban_ungrouped');
238 this.add_group_mutex.exec(function() {238 this.add_group_mutex.exec(function() {
239 var def = $.Deferred();239 var def = $.Deferred();
240 self.do_clear_groups();240 self.do_clear_groups();
@@ -268,7 +268,7 @@
268 });268 });
269 var groups_started = _.map(this.groups, function(group) {269 var groups_started = _.map(this.groups, function(group) {
270 if (!group.is_started) {270 if (!group.is_started) {
271 return group.insertBefore(self.$element.find('.oe_kanban_groups_headers td:last'));271 return group.insertBefore(self.$el.find('.oe_kanban_groups_headers td:last'));
272 }272 }
273 });273 });
274 return $.when.apply(null, groups_started).then(function () {274 return $.when.apply(null, groups_started).then(function () {
@@ -280,7 +280,7 @@
280 this.compute_groups_width();280 this.compute_groups_width();
281 if (this.group_by) {281 if (this.group_by) {
282 // Kanban cards drag'n'drop282 // Kanban cards drag'n'drop
283 this.$element.find('.oe_kanban_column').sortable({283 this.$el.find('.oe_kanban_column').sortable({
284 connectWith: '.oe_kanban_column',284 connectWith: '.oe_kanban_column',
285 handle : '.oe_kanban_draghandle',285 handle : '.oe_kanban_draghandle',
286 start: function(event, ui) {286 start: function(event, ui) {
@@ -333,13 +333,13 @@
333 });333 });
334 }334 }
335 } else {335 } else {
336 this.$element.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle');336 this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle');
337 }337 }
338 },338 },
339 on_record_moved : function(record, old_group, old_index, new_group, new_index) {339 on_record_moved : function(record, old_group, old_index, new_group, new_index) {
340 var self = this;340 var self = this;
341 $.fn.tipsy.clear();341 $.fn.tipsy.clear();
342 $(old_group.$element).add(new_group.$element).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide();342 $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide();
343 if (old_group === new_group) {343 if (old_group === new_group) {
344 new_group.records.splice(old_index, 1);344 new_group.records.splice(old_index, 1);
345 new_group.records.splice(new_index, 0, record);345 new_group.records.splice(new_index, 0, record);
@@ -365,18 +365,18 @@
365 var self = this;365 var self = this;
366 _.each(this.groups, function(group) {366 _.each(this.groups, function(group) {
367 unfolded += group.state.folded ? 0 : 1;367 unfolded += group.state.folded ? 0 : 1;
368 group.$element.children(':first').css('width', '');368 group.$el.children(':first').css('width', '');
369 });369 });
370 _.each(this.groups, function(group) {370 _.each(this.groups, function(group) {
371 if (!group.state.folded) {371 if (!group.state.folded) {
372 if (182*unfolded>=self.$element.width()) {372 if (182*unfolded>=self.$el.width()) {
373 group.$element.children(':first').css('width', "170px");373 group.$el.children(':first').css('width', "170px");
374 } else if (262*unfolded<self.$element.width()) {374 } else if (262*unfolded<self.$el.width()) {
375 group.$element.children(':first').css('width', "250px");375 group.$el.children(':first').css('width', "250px");
376 } else {376 } else {
377 // -12 because of padding 6 between cards377 // -12 because of padding 6 between cards
378 // -1 because of the border of the latest dummy column378 // -1 because of the border of the latest dummy column
379 group.$element.children(':first').css('width', Math.floor((self.$element.width()-1)/unfolded)-12 + 'px');379 group.$el.children(':first').css('width', Math.floor((self.$el.width()-1)/unfolded)-12 + 'px');
380 }380 }
381 }381 }
382 });382 });
@@ -408,8 +408,8 @@
408 || !this.options.action.help) {408 || !this.options.action.help) {
409 return;409 return;
410 }410 }
411 this.$element.find('.oe_view_nocontent').remove();411 this.$el.find('.oe_view_nocontent').remove();
412 this.$element.prepend(412 this.$el.prepend(
413 $('<div class="oe_view_nocontent">').html(this.options.action.help)413 $('<div class="oe_view_nocontent">').html(this.options.action.help)
414 );414 );
415 }415 }
@@ -471,22 +471,22 @@
471 var self = this,471 var self = this,
472 def = this._super();472 def = this._super();
473 if (! self.view.group_by) {473 if (! self.view.group_by) {
474 self.$element.addClass("oe_kanban_no_group");474 self.$el.addClass("oe_kanban_no_group");
475 self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, {}, false)475 self.quick = new (get_class(self.view.quick_create_class))(this, self.dataset, {}, false)
476 .on('added', self, self.proxy('quick_created'));476 .on('added', self, self.proxy('quick_created'));
477 self.quick.replace($(".oe_kanban_no_group_qc_placeholder"));477 self.quick.replace($(".oe_kanban_no_group_qc_placeholder"));
478 }478 }
479 this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this}));479 this.$records = $(QWeb.render('KanbanView.group_records_container', { widget : this}));
480 this.$records.insertBefore(this.view.$element.find('.oe_kanban_groups_records td:last'));480 this.$records.insertBefore(this.view.$el.find('.oe_kanban_groups_records td:last'));
481481
482 this.$element.on('click', '.oe_kanban_group_dropdown li a', function(ev) {482 this.$el.on('click', '.oe_kanban_group_dropdown li a', function(ev) {
483 var fn = 'do_action_' + $(ev.target).data().action;483 var fn = 'do_action_' + $(ev.target).data().action;
484 if (typeof(self[fn]) === 'function') {484 if (typeof(self[fn]) === 'function') {
485 self[fn]($(ev.target));485 self[fn]($(ev.target));
486 }486 }
487 });487 });
488488
489 this.$element.find('.oe_kanban_add').click(function () {489 this.$el.find('.oe_kanban_add').click(function () {
490 if (self.quick) { return; }490 if (self.quick) { return; }
491 var ctx = {};491 var ctx = {};
492 ctx['default_' + self.view.group_by] = self.value;492 ctx['default_' + self.view.group_by] = self.value;
@@ -500,12 +500,12 @@
500 self.quick.focus();500 self.quick.focus();
501 });501 });
502 // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column.502 // Add bounce effect on image '+' of kanban header when click on empty space of kanban grouped column.
503 var add_btn = this.$element.find('.oe_kanban_add');503 var add_btn = this.$el.find('.oe_kanban_add');
504 this.$records.find('.oe_kanban_show_more').click(this.do_show_more);504 this.$records.find('.oe_kanban_show_more').click(this.do_show_more);
505 if (this.state.folded) {505 if (this.state.folded) {
506 this.do_toggle_fold();506 this.do_toggle_fold();
507 }507 }
508 this.$element.data('widget', this);508 this.$el.data('widget', this);
509 this.$records.data('widget', this);509 this.$records.data('widget', this);
510 this.$has_been_started.resolve();510 this.$has_been_started.resolve();
511 this.compute_cards_auto_height();511 this.compute_cards_auto_height();
@@ -525,7 +525,7 @@
525 var min_height = 0;525 var min_height = 0;
526 var els = [];526 var els = [];
527 _.each(this.records, function(r) {527 _.each(this.records, function(r) {
528 var $e = r.$element.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0);528 var $e = r.$el.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0);
529 if ($e.length) {529 if ($e.length) {
530 els.push($e[0]);530 els.push($e[0]);
531 min_height = Math.max(min_height, $e.outerHeight());531 min_height = Math.max(min_height, $e.outerHeight());
@@ -571,8 +571,8 @@
571 }571 }
572 },572 },
573 do_toggle_fold: function(compute_width) {573 do_toggle_fold: function(compute_width) {
574 this.$element.add(this.$records).toggleClass('oe_kanban_group_folded');574 this.$el.add(this.$records).toggleClass('oe_kanban_group_folded');
575 this.state.folded = this.$element.is('.oe_kanban_group_folded');575 this.state.folded = this.$el.is('.oe_kanban_group_folded');
576 this.$("ul.oe_kanban_group_dropdown li a[data-action=toggle_fold]").text((this.state.folded) ? _t("Unfold") : _t("Fold"));576 this.$("ul.oe_kanban_group_dropdown li a[data-action=toggle_fold]").text((this.state.folded) ? _t("Unfold") : _t("Fold"));
577 },577 },
578 do_action_toggle_fold: function() {578 do_action_toggle_fold: function() {
@@ -658,7 +658,7 @@
658 },658 },
659 start: function() {659 start: function() {
660 this._super();660 this._super();
661 this.$element.data('widget', this);661 this.$el.data('widget', this);
662 this.bind_events();662 this.bind_events();
663 },663 },
664 transform_record: function(record) {664 transform_record: function(record) {
@@ -696,14 +696,14 @@
696 bind_events: function() {696 bind_events: function() {
697 var self = this;697 var self = this;
698 this.setup_color_picker();698 this.setup_color_picker();
699 var $show_on_click = self.$element.find('.oe_kanban_box_show_onclick');699 var $show_on_click = self.$el.find('.oe_kanban_box_show_onclick');
700 $show_on_click.toggle(this.state.folded);700 $show_on_click.toggle(this.state.folded);
701 this.$element.find('.oe_kanban_box_show_onclick_trigger').click(function() {701 this.$el.find('.oe_kanban_box_show_onclick_trigger').click(function() {
702 $show_on_click.toggle();702 $show_on_click.toggle();
703 self.state.folded = !self.state.folded;703 self.state.folded = !self.state.folded;
704 });704 });
705705
706 this.$element.find('[tooltip]').tipsy({706 this.$el.find('[tooltip]').tipsy({
707 delayIn: 500,707 delayIn: 500,
708 delayOut: 0,708 delayOut: 0,
709 fade: true,709 fade: true,
@@ -721,11 +721,11 @@
721 });721 });
722722
723 // If no draghandle is found, make the whole card as draghandle723 // If no draghandle is found, make the whole card as draghandle
724 if (!this.$element.find('.oe_kanban_draghandle').length) {724 if (!this.$el.find('.oe_kanban_draghandle').length) {
725 this.$element.children(':first').addClass('oe_kanban_draghandle');725 this.$el.children(':first').addClass('oe_kanban_draghandle');
726 }726 }
727727
728 this.$element.find('.oe_kanban_action').click(function() {728 this.$el.find('.oe_kanban_action').click(function() {
729 var $action = $(this),729 var $action = $(this),
730 type = $action.data('type') || 'button',730 type = $action.data('type') || 'button',
731 method = 'do_action_' + (type === 'action' ? 'object' : type);731 method = 'do_action_' + (type === 'action' ? 'object' : type);
@@ -738,8 +738,8 @@
738 }738 }
739 });739 });
740740
741 if (this.$element.find('.oe_kanban_global_click').length) {741 if (this.$el.find('.oe_kanban_global_click').length) {
742 this.$element.on('click', function(ev) {742 this.$el.on('click', function(ev) {
743 if (!ev.isTrigger && !$(ev.target).data('events')) {743 if (!ev.isTrigger && !$(ev.target).data('events')) {
744 var trigger = true;744 var trigger = true;
745 var elem = ev.target;745 var elem = ev.target;
@@ -784,7 +784,7 @@
784 },784 },
785 setup_color_picker: function() {785 setup_color_picker: function() {
786 var self = this;786 var self = this;
787 var $el = this.$element.find('ul.oe_kanban_colorpicker');787 var $el = this.$el.find('ul.oe_kanban_colorpicker');
788 if ($el.length) {788 if ($el.length) {
789 $el.html(QWeb.render('KanbanColorPicker', {789 $el.html(QWeb.render('KanbanColorPicker', {
790 widget: this790 widget: this
@@ -829,7 +829,7 @@
829 if (records.length) {829 if (records.length) {
830 self.set_record(records[0]);830 self.set_record(records[0]);
831 self.renderElement();831 self.renderElement();
832 self.$element.data('widget', self);832 self.$el.data('widget', self);
833 self.bind_events();833 self.bind_events();
834 self.group.compute_cards_auto_height();834 self.group.compute_cards_auto_height();
835 } else {835 } else {
@@ -923,16 +923,16 @@
923 },923 },
924 start: function () {924 start: function () {
925 var self = this;925 var self = this;
926 self.$input = this.$element.find('input');926 self.$input = this.$el.find('input');
927 self.$input.keyup(function(event){927 self.$input.keyup(function(event){
928 if(event.keyCode == 13){928 if(event.keyCode == 13){
929 self.quick_add();929 self.quick_add();
930 }930 }
931 });931 });
932 $(".oe_kanban_quick_create_add", this.$element).click(function () {932 $(".oe_kanban_quick_create_add", this.$el).click(function () {
933 self.quick_add();933 self.quick_add();
934 });934 });
935 $(".oe_kanban_quick_create_close", this.$element).click(function () {935 $(".oe_kanban_quick_create_close", this.$el).click(function () {
936 self.trigger('close');936 self.trigger('close');
937 });937 });
938 self.$input.keyup(function(e) {938 self.$input.keyup(function(e) {
@@ -942,7 +942,7 @@
942 });942 });
943 },943 },
944 focus: function() {944 focus: function() {
945 this.$element.find('input').focus();945 this.$el.find('input').focus();
946 },946 },
947 /**947 /**
948 * Handles user event from nested quick creation view948 * Handles user event from nested quick creation view
949949
=== modified file 'addons/web_kanban/static/src/xml/web_kanban.xml'
--- addons/web_kanban/static/src/xml/web_kanban.xml 2012-08-16 13:50:23 +0000
+++ addons/web_kanban/static/src/xml/web_kanban.xml 2012-08-27 06:09:20 +0000
@@ -28,7 +28,7 @@
28<t t-name="KanbanView.group_header">28<t t-name="KanbanView.group_header">
29 <td class="oe_kanban_group_header">29 <td class="oe_kanban_group_header">
30 <t t-if="widget.view.group_by">30 <t t-if="widget.view.group_by">
31 <div class="oe_kanban_header">31 <div class="oe_kanban_header oe_semantic_html_override">
32 <t t-if="widget.view._is_quick_create_enabled()">32 <t t-if="widget.view._is_quick_create_enabled()">
33 <div class="oe_kanban_add oe_e">]</div>33 <div class="oe_kanban_add oe_e">]</div>
34 </t>34 </t>
3535
=== modified file 'addons/web_mobile/static/src/js/chrome_mobile.js'
--- addons/web_mobile/static/src/js/chrome_mobile.js 2012-08-14 13:53:24 +0000
+++ addons/web_mobile/static/src/js/chrome_mobile.js 2012-08-27 06:09:20 +0000
@@ -51,7 +51,7 @@
51 var self = this;51 var self = this;
52 this.session.bind_session().then(function() {52 this.session.bind_session().then(function() {
53 instance.web.qweb.add_template("xml/web_mobile.xml");53 instance.web.qweb.add_template("xml/web_mobile.xml");
54 self.$element.html(self.render());54 self.$el.html(self.render());
55 self.login.start();55 self.login.start();
56 });56 });
57 }57 }
@@ -76,18 +76,18 @@
76 self.db_list = result.db_list;76 self.db_list = result.db_list;
77 this.setElement($('#'+self.element_id).html(self.render(self)));77 this.setElement($('#'+self.element_id).html(self.render(self)));
78 if(self.session.db!=""){78 if(self.session.db!=""){
79 self.$element.find("#database").val(self.session.db);79 self.$el.find("#database").val(self.session.db);
80 }80 }
81 self.$element.find("#login_btn").click(self.on_login);81 self.$el.find("#login_btn").click(self.on_login);
82 $.mobile.initializePage();82 $.mobile.initializePage();
83 });83 });
84 this.$element84 this.$el
85 .removeClass("login_invalid");85 .removeClass("login_invalid");
86 },86 },
87 on_login: function(ev) {87 on_login: function(ev) {
88 ev.preventDefault();88 ev.preventDefault();
89 var self = this;89 var self = this;
90 var $e = this.$element;90 var $e = this.$el;
91 var db = $e.find("div select[name=database]").val();91 var db = $e.find("div select[name=database]").val();
92 var login = $e.find("div input[name=login]").val();92 var login = $e.find("div input[name=login]").val();
93 var password = $e.find("div input[name=password]").val();93 var password = $e.find("div input[name=password]").val();
@@ -117,13 +117,13 @@
117 });117 });
118 },118 },
119 on_login_invalid: function() {119 on_login_invalid: function() {
120 this.$element120 this.$el
121 .removeClass("login_valid")121 .removeClass("login_valid")
122 .addClass("login_invalid")122 .addClass("login_invalid")
123 .show();123 .show();
124 },124 },
125 on_login_valid: function() {125 on_login_valid: function() {
126 this.$element126 this.$el
127 .removeClass("login_invalid")127 .removeClass("login_invalid")
128 .addClass("login_valid");128 .addClass("login_valid");
129 //.hide();129 //.hide();
@@ -152,7 +152,7 @@
152 this._super(session, element_id);152 this._super(session, element_id);
153 },153 },
154 start: function() {154 start: function() {
155 this.$element.html(this.render(this));155 this.$el.html(this.render(this));
156 }156 }
157});157});
158158
@@ -164,7 +164,7 @@
164 this._super(session, element_id);164 this._super(session, element_id);
165 },165 },
166 start: function() {166 start: function() {
167 this.$element.html(this.render(this));167 this.$el.html(this.render(this));
168 }168 }
169});169});
170170
@@ -178,12 +178,12 @@
178 start: function() {178 start: function() {
179 var self = this;179 var self = this;
180 this.rpc('/web/session/sc_list',{} ,function(res){180 this.rpc('/web/session/sc_list',{} ,function(res){
181 self.$element.html(self.render({'sc': res}));181 self.$el.html(self.render({'sc': res}));
182 self.$element.find("[data-role=header]").find('h1').html('Favourite');182 self.$el.find("[data-role=header]").find('h1').html('Favourite');
183 self.$element.find("[data-role=header]").find('#home').click(function(){183 self.$el.find("[data-role=header]").find('#home').click(function(){
184 $.mobile.changePage("#oe_menu", "slide", false, true);184 $.mobile.changePage("#oe_menu", "slide", false, true);
185 });185 });
186 self.$element.find('#content').find("a").click(self.on_clicked);186 self.$el.find('#content').find("a").click(self.on_clicked);
187 $.mobile.changePage("#oe_shortcuts", "slide", false, true);187 $.mobile.changePage("#oe_shortcuts", "slide", false, true);
188 });188 });
189 },189 },
@@ -228,10 +228,10 @@
228 this.header.start();228 this.header.start();
229 this.footer = new instance.web_mobile.Footer(this, "oe_footer");229 this.footer = new instance.web_mobile.Footer(this, "oe_footer");
230 this.footer.start();230 this.footer.start();
231 this.$element.html(this.render(this.data));231 this.$el.html(this.render(this.data));
232 this.$element.find("[data-role=header]").find('h1').html('Applications');232 this.$el.find("[data-role=header]").find('h1').html('Applications');
233 this.$element.find("[data-role=header]").find('#home').hide();233 this.$el.find("[data-role=header]").find('#home').hide();
234 this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){234 this.$el.find("[data-role=footer]").find('#shrotcuts').click(function(){
235 if(!$('#oe_shortcuts').html().length){235 if(!$('#oe_shortcuts').html().length){
236 this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts");236 this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts");
237 this.shortcuts.start();237 this.shortcuts.start();
@@ -239,7 +239,7 @@
239 $.mobile.changePage($("#oe_shortcuts"), "slide", false, true);239 $.mobile.changePage($("#oe_shortcuts"), "slide", false, true);
240 }240 }
241 });241 });
242 this.$element.find("[data-role=footer]").find('#preference').click(function(){242 this.$el.find("[data-role=footer]").find('#preference').click(function(){
243 if(!$('#oe_options').html().length){243 if(!$('#oe_options').html().length){
244 this.options = new instance.web_mobile.Options(self, "oe_options");244 this.options = new instance.web_mobile.Options(self, "oe_options");
245 this.options.start();245 this.options.start();
@@ -247,7 +247,7 @@
247 $.mobile.changePage("#oe_options", "slide", false, true);247 $.mobile.changePage("#oe_options", "slide", false, true);
248 }248 }
249 });249 });
250 this.$element.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click);250 this.$el.add(this.$secondary_menu).find("#content").find('a').click(this.on_menu_click);
251 $.mobile.changePage("#oe_menu", "slide", false, true);251 $.mobile.changePage("#oe_menu", "slide", false, true);
252 },252 },
253 on_menu_click: function(ev, id) {253 on_menu_click: function(ev, id) {
@@ -260,7 +260,7 @@
260 this.children = this.data.data.children[i];260 this.children = this.data.data.children[i];
261 }261 }
262 }262 }
263 this.$element263 this.$el
264 .removeClass("login_valid")264 .removeClass("login_valid")
265 .addClass("secondary_menu");265 .addClass("secondary_menu");
266 if(!$('[id^="oe_sec_menu_'+id+'"]').html()){266 if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
@@ -284,10 +284,10 @@
284 start: function(ev, id) {284 start: function(ev, id) {
285 var self = this;285 var self = this;
286 var v = { menu : this.data };286 var v = { menu : this.data };
287 this.$element.html(this.render(v));287 this.$el.html(this.render(v));
288 this.$element.find("[data-role=header]").find("h1").html(this.data.name);288 this.$el.find("[data-role=header]").find("h1").html(this.data.name);
289 this.$element.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click);289 this.$el.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click);
290 this.$element.find("[data-role=header]").find('#home').click(function(){290 this.$el.find("[data-role=header]").find('#home').click(function(){
291 $.mobile.changePage("#oe_menu", "slide", false, true);291 $.mobile.changePage("#oe_menu", "slide", false, true);
292 });292 });
293 $.mobile.changePage("#"+this.element_id, "slide", false, true);293 $.mobile.changePage("#"+this.element_id, "slide", false, true);
@@ -308,7 +308,7 @@
308 }308 }
309 }309 }
310 if (child_len > 0) {310 if (child_len > 0) {
311 this.$element311 this.$el
312 .addClass("secondary_menu");312 .addClass("secondary_menu");
313 if(!$('[id^="oe_sec_menu_'+id+'"]').html()){313 if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
314 $('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');314 $('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
@@ -336,12 +336,12 @@
336336
337 start: function() {337 start: function() {
338 var self = this;338 var self = this;
339 this.$element.html(this.render(this));339 this.$el.html(this.render(this));
340 this.$element.find("[data-role=header]").find('h1').html('Preference');340 this.$el.find("[data-role=header]").find('h1').html('Preference');
341 this.$element.find("[data-role=header]").find('#home').click(function(){341 this.$el.find("[data-role=header]").find('#home').click(function(){
342 $.mobile.changePage("#oe_menu", "slide", false, true);342 $.mobile.changePage("#oe_menu", "slide", false, true);
343 });343 });
344 this.$element.find("[data-role=content]").find('a').click(function(){344 this.$el.find("[data-role=content]").find('a').click(function(){
345 $('#oe_login').empty();345 $('#oe_login').empty();
346 window.location.replace('/mobile');346 window.location.replace('/mobile');
347 });347 });
348348
=== modified file 'addons/web_mobile/static/src/js/form_mobile.js'
--- addons/web_mobile/static/src/js/form_mobile.js 2012-08-14 13:53:24 +0000
+++ addons/web_mobile/static/src/js/form_mobile.js 2012-08-27 06:09:20 +0000
@@ -48,12 +48,12 @@
48 }48 }
49 }49 }
50 self.hidden_fields(get_fields,fields);50 self.hidden_fields(get_fields,fields);
51 self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'}));51 self.$el.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'}));
52 self.$element.find("[data-role=header]").find('h1').html(self.head_title);52 self.$el.find("[data-role=header]").find('h1').html(self.head_title);
53 self.$element.find("[data-role=header]").find('#home').click(function(){53 self.$el.find("[data-role=header]").find('#home').click(function(){
54 $.mobile.changePage("#oe_menu", "slide", false, true);54 $.mobile.changePage("#oe_menu", "slide", false, true);
55 });55 });
56 self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){56 self.$el.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){
57 for (var k = 0; k < notebooks.children.length; k++) {57 for (var k = 0; k < notebooks.children.length; k++) {
58 if (notebooks.children[k].attrs.string == $(this).attr('id')) {58 if (notebooks.children[k].attrs.string == $(this).attr('id')) {
59 get_fields_notebook = self.get_fields(notebooks.children[k].children);59 get_fields_notebook = self.get_fields(notebooks.children[k].children);
@@ -62,7 +62,7 @@
62 }62 }
63 }63 }
64 });64 });
65 self.$element.find('#o2m_m2m').click(function(ev) {65 self.$el.find('#o2m_m2m').click(function(ev) {
66 ev.preventDefault();66 ev.preventDefault();
67 ev.stopPropagation();67 ev.stopPropagation();
68 var relational = $(this).attr('for');68 var relational = $(this).attr('for');
@@ -113,7 +113,7 @@
113 });113 });
114 }114 }
115 });115 });
116 self.$element.find('#m2o_btn').click(this.open_m2o_form);116 self.$el.find('#m2o_btn').click(this.open_m2o_form);
117 $.mobile.changePage("#"+self.element_id, "slide", false, true);117 $.mobile.changePage("#"+self.element_id, "slide", false, true);
118 self.formatdata('', '', '', '',self.element_id,'slider');118 self.formatdata('', '', '', '',self.element_id,'slider');
119 },119 },
120120
=== modified file 'addons/web_mobile/static/src/js/list_mobile.js'
--- addons/web_mobile/static/src/js/list_mobile.js 2012-08-14 13:53:24 +0000
+++ addons/web_mobile/static/src/js/list_mobile.js 2012-08-27 06:09:20 +0000
@@ -44,14 +44,14 @@
44 if(res['html_name_get']){44 if(res['html_name_get']){
45 additional = res['display'];45 additional = res['display'];
46 }46 }
47 self.$element.html(self.render({'records': res, 'data': additional }));47 self.$el.html(self.render({'records': res, 'data': additional }));
48 self.$element.find("[data-role=header]").find('h1').html(self.action.name);48 self.$el.find("[data-role=header]").find('h1').html(self.action.name);
49 self.$element.find("[data-role=header]").find('#home').click(function(){49 self.$el.find("[data-role=header]").find('#home').click(function(){
50 $.mobile.changePage("#oe_menu", "slide", false, true);50 $.mobile.changePage("#oe_menu", "slide", false, true);
51 });51 });
52 self.$element.find("a#list-id").click(self.on_list_click);52 self.$el.find("a#list-id").click(self.on_list_click);
53 $.mobile.changePage("#"+self.element_id, "slide", false, true);53 $.mobile.changePage("#"+self.element_id, "slide", false, true);
54 self.$element.find("a#list-id").find('span').addClass('desc');54 self.$el.find("a#list-id").find('span').addClass('desc');
55 });55 });
56 });56 });
57 },57 },
5858
=== modified file 'addons/web_process/__openerp__.py'
--- addons/web_process/__openerp__.py 2012-08-22 13:03:36 +0000
+++ addons/web_process/__openerp__.py 2012-08-27 06:09:20 +0000
@@ -1,4 +1,5 @@
1{1{
2
2 'name': 'Process',3 'name': 'Process',
3 'version': '2.0',4 'version': '2.0',
4 'description': """5 'description': """
@@ -8,7 +9,7 @@
8""",9""",
9 'depends': ['web_diagram'],10 'depends': ['web_diagram'],
10 'js': [11 'js': [
11 'static/lib/dracula/*.js',12 'static/lib/js/raphael.js',
12 'static/src/js/process.js'13 'static/src/js/process.js'
13 ],14 ],
14 'css': [15 'css': [
1516
=== removed directory 'addons/web_process/static/lib/dracula'
=== removed file 'addons/web_process/static/lib/dracula/dracula_algorithms.js'
--- addons/web_process/static/lib/dracula/dracula_algorithms.js 2012-03-05 11:08:13 +0000
+++ addons/web_process/static/lib/dracula/dracula_algorithms.js 1970-01-01 00:00:00 +0000
@@ -1,599 +0,0 @@
1/*
2 * Various algorithms and data structures, licensed under the MIT-license.
3 * (c) 2010 by Johann Philipp Strathausen <strathausen@gmail.com>
4 * http://strathausen.eu
5 *
6 */
7
8
9
10/*
11 Bellman-Ford
12
13 Path-finding algorithm, finds the shortest paths from one node to all nodes.
14
15
16 Complexity
17
18 O( |E| · |V| ), where E = edges and V = vertices (nodes)
19
20
21 Constraints
22
23 Can run on graphs with negative edge weights as long as they do not have
24 any negative weight cycles.
25
26 */
27function bellman_ford(g, source) {
28
29 /* STEP 1: initialisation */
30 for(var n in g.nodes)
31 g.nodes[n].distance = Infinity;
32 /* predecessors are implicitly null */
33 source.distance = 0;
34
35 step("Initially, all distances are infinite and all predecessors are null.");
36
37 /* STEP 2: relax each edge (this is at the heart of Bellman-Ford) */
38 /* repeat this for the number of nodes minus one */
39 for(var i = 1; i < g.nodes.length; i++)
40 /* for each edge */
41 for(var e in g.edges) {
42 var edge = g.edges[e];
43 if(edge.source.distance + edge.weight < edge.target.distance) {
44 step("Relax edge between " + edge.source.id + " and " + edge.target.id + ".");
45 edge.target.distance = edge.source.distance + edge.weight;
46 edge.target.predecessor = edge.source;
47 }
48 //Added by Jake Stothard (Needs to be tested)
49 if(!edge.style.directed) {
50 if(edge.target.distance + edge.weight < edge.source.distance) {
51 g.snapShot("Relax edge between "+edge.target.id+" and "+edge.source.id+".");
52 edge.source.distance = edge.target.distance + edge.weight;
53 edge.source.predecessor = edge.target;
54 }
55 }
56 }
57 step("Ready.");
58
59 /* STEP 3: TODO Check for negative cycles */
60 /* For now we assume here that the graph does not contain any negative
61 weights cycles. (this is left as an excercise to the reader[tm]) */
62}
63
64
65
66/*
67 Path-finding algorithm Dijkstra
68
69 - worst-case running time is O((|E| + |V|) · log |V| ) thus better than
70 Bellman-Ford for sparse graphs (with less edges), but cannot handle
71 negative edge weights
72 */
73function dijkstra(g, source) {
74
75 /* initially, all distances are infinite and all predecessors are null */
76 for(var n in g.nodes)
77 g.nodes[n].distance = Infinity;
78 /* predecessors are implicitly null */
79
80 g.snapShot("Initially, all distances are infinite and all predecessors are null.");
81
82 source.distance = 0;
83 /* set of unoptimized nodes, sorted by their distance (but a Fibonacci heap
84 would be better) */
85 var q = new BinaryMinHeap(g.nodes, "distance");
86
87 /* pointer to the node in focus */
88 var node;
89
90 /* get the node with the smallest distance
91 as long as we have unoptimized nodes. q.min() can have O(log n). */
92 while(q.min() != undefined) {
93 /* remove the latest */
94 node = q.extractMin();
95 node.optimized = true;
96
97 /* no nodes accessible from this one, should not happen */
98 if(node.distance == Infinity)
99 throw "Orphaned node!";
100
101 /* for each neighbour of node */
102 for(e in node.edges) {
103 var other = (node == node.edges[e].target) ? node.edges[e].source : node.edges[e].target;
104
105 if(other.optimized)
106 continue;
107
108 /* look for an alternative route */
109 var alt = node.distance + node.edges[e].weight;
110
111 /* update distance and route if a better one has been found */
112 if (alt < other.distance) {
113
114 /* update distance of neighbour */
115 other.distance = alt;
116
117 /* update priority queue */
118 q.heapify();
119
120 /* update path */
121 other.predecessor = node;
122 g.snapShot("Enhancing node.")
123 }
124 }
125 }
126}
127
128
129/* All-Pairs-Shortest-Paths */
130/* Runs at worst in O(|V|³) and at best in Omega(|V|³) :-)
131 complexity Sigma(|V|²) */
132/* This implementation is not yet ready for general use, but works with the
133 Dracula graph library. */
134function floyd_warshall(g, source) {
135
136 /* Step 1: initialising empty path matrix (second dimension is implicit) */
137 var path = [];
138 var next = [];
139 var n = g.nodes.length;
140
141 /* construct path matrix, initialize with Infinity */
142 for(j in g.nodes) {
143 path[j] = [];
144 next[j] = [];
145 for(i in g.nodes)
146 path[j][i] = j == i ? 0 : Infinity;
147 }
148
149 /* initialize path with edge weights */
150 for(e in g.edges)
151 path[g.edges[e].source.id][g.edges[e].target.id] = g.edges[e].weight;
152
153 /* Note: Usually, the initialisation is done by getting the edge weights
154 from a node matrix representation of the graph, not by iterating through
155 a list of edges as done here. */
156
157 /* Step 2: find best distances (the heart of Floyd-Warshall) */
158 for(k in g.nodes){
159 for(i in g.nodes) {
160 for(j in g.nodes)
161 if(path[i][j] > path[i][k] + path[k][j]) {
162 path[i][j] = path[i][k] + path[k][j];
163 /* Step 2.b: remember the path */
164 next[i][j] = k;
165 }
166 }
167 }
168
169 /* Step 3: Path reconstruction, get shortest path */
170 function getPath(i, j) {
171 if(path[i][j] == Infinity)
172 throw "There is no path.";
173 var intermediate = next[i][j];
174 if(intermediate == undefined)
175 return null;
176 else
177 return getPath(i, intermediate)
178 .concat([intermediate])
179 .concat(getPath(intermediate, j));
180 }
181
182 /* TODO use the knowledge, e.g. mark path in graph */
183}
184
185/*
186 Ford-Fulkerson
187
188 Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed
189 graph from source to sink.
190
191
192 Complexity
193
194 O(E * max(f)), max(f) being the maximum flow
195
196
197 Description
198
199 As long as there is an open path through the residual graph, send the
200 minimum of the residual capacities on the path.
201
202
203 Constraints
204
205 The algorithm works only if all weights are integers. Otherwise it is
206 possible that the Ford–Fulkerson algorithm will not converge to the maximum
207 value.
208
209
210 Input
211
212 g - Graph object
213 s - Source ID
214 t - Target (sink) ID
215
216
217 Output
218
219 Maximum flow from Source s to Target t
220
221 */
222/*
223 Edmonds-Karp
224
225 Max-Flow-Min-Cut Algorithm finding the maximum flow through a directed
226 graph from source to sink. An implementation of the Ford-Fulkerson
227 algorithm.
228
229
230 Complexity
231
232 O(|V|*|E|²)
233
234
235 Input
236
237 g - Graph object (with node and edge lists, capacity is a property of edge)
238 s - source ID
239 t - sink ID
240
241 */
242function edmonds_karp(g, s, t) {
243
244}
245
246/*
247 A simple binary min-heap serving as a priority queue
248 - takes an array as the input, with elements having a key property
249 - elements will look like this:
250 {
251 key: "... key property ...",
252 value: "... element content ..."
253 }
254 - provides insert(), min(), extractMin() and heapify()
255 - example usage (e.g. via the Firebug or Chromium console):
256 var x = {foo: 20, hui: "bla"};
257 var a = new BinaryMinHeap([x,{foo:3},{foo:10},{foo:20},{foo:30},{foo:6},{foo:1},{foo:3}],"foo");
258 console.log(a.extractMin());
259 console.log(a.extractMin());
260 x.foo = 0; // update key
261 a.heapify(); // call this always after having a key updated
262 console.log(a.extractMin());
263 console.log(a.extractMin());
264 - can also be used on a simple array, like [9,7,8,5]
265 */
266function BinaryMinHeap(array, key) {
267
268 /* Binary tree stored in an array, no need for a complicated data structure */
269 var tree = [];
270
271 var key = key || 'key';
272
273 /* Calculate the index of the parent or a child */
274 var parent = function(index) { return Math.floor((index - 1)/2); };
275 var right = function(index) { return 2 * index + 2; };
276 var left = function(index) { return 2 * index + 1; };
277
278 /* Helper function to swap elements with their parent
279 as long as the parent is bigger */
280 function bubble_up(i) {
281 var p = parent(i);
282 while((p >= 0) && (tree[i][key] < tree[p][key])) {
283 /* swap with parent */
284 tree[i] = tree.splice(p, 1, tree[i])[0];
285 /* go up one level */
286 i = p;
287 p = parent(i);
288 }
289 }
290
291 /* Helper function to swap elements with the smaller of their children
292 as long as there is one */
293 function bubble_down(i) {
294 var l = left(i);
295 var r = right(i);
296
297 /* as long as there are smaller children */
298 while(tree[l] && (tree[i][key] > tree[l][key]) || tree[r] && (tree[i][key] > tree[r][key])) {
299
300 /* find smaller child */
301 var child = tree[l] ? tree[r] ? tree[l][key] > tree[r][key] ? r : l : l : l;
302
303 /* swap with smaller child with current element */
304 tree[i] = tree.splice(child, 1, tree[i])[0];
305
306 /* go up one level */
307 i = child;
308 l = left(i);
309 r = right(i);
310 }
311 }
312
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: