Merge lp:~unifield-team/unifield-web/web_bigger_popup into lp:unifield-web
- web_bigger_popup
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4631 |
Proposed branch: | lp:~unifield-team/unifield-web/web_bigger_popup |
Merge into: | lp:unifield-web |
Diff against target: |
726 lines (+627/-12) 8 files modified
addons/openerp/static/javascript/m2m.js (+2/-4) addons/openerp/static/javascript/m2o.js (+2/-2) addons/openerp/static/javascript/o2m.js (+2/-3) addons/openerp/static/javascript/openerp/openerp.base.js (+2/-1) openobject/controllers/templates/base.mako (+1/-0) openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css (+2/-2) openobject/static/javascript/jQuery/jquery.dialogextend.js (+611/-0) openobject/static/javascript/openobject/openobject.dom.js (+5/-0) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-web/web_bigger_popup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email: mp+99016@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'addons/openerp/static/javascript/m2m.js' | |||
2 | --- addons/openerp/static/javascript/m2m.js 2011-01-17 11:57:11 +0000 | |||
3 | +++ addons/openerp/static/javascript/m2m.js 2012-03-23 13:05:29 +0000 | |||
4 | @@ -183,10 +183,8 @@ | |||
5 | 183 | 'source-window': $this[0], | 183 | 'source-window': $this[0], |
6 | 184 | source_id: options.source || null | 184 | source_id: options.source || null |
7 | 185 | }, { | 185 | }, { |
12 | 186 | width: '70%', | 186 | width: '90%', |
13 | 187 | max_width: 1000, | 187 | height: '95%' |
10 | 188 | height: '90%', | ||
11 | 189 | max_height: 700 | ||
14 | 190 | }); | 188 | }); |
15 | 191 | } | 189 | } |
16 | 192 | 190 | ||
17 | 193 | 191 | ||
18 | === modified file 'addons/openerp/static/javascript/m2o.js' | |||
19 | --- addons/openerp/static/javascript/m2o.js 2011-08-16 11:46:19 +0000 | |||
20 | +++ addons/openerp/static/javascript/m2o.js 2012-03-23 13:05:29 +0000 | |||
21 | @@ -601,9 +601,9 @@ | |||
22 | 601 | 'source-window': $this[0], | 601 | 'source-window': $this[0], |
23 | 602 | source_id: options.source || null | 602 | source_id: options.source || null |
24 | 603 | }, { | 603 | }, { |
26 | 604 | width: '80%', | 604 | width: '90%', |
27 | 605 | max_width: 1200, | 605 | max_width: 1200, |
29 | 606 | height: '90%' | 606 | height: '95%' |
30 | 607 | }); | 607 | }); |
31 | 608 | } | 608 | } |
32 | 609 | 609 | ||
33 | 610 | 610 | ||
34 | === modified file 'addons/openerp/static/javascript/o2m.js' | |||
35 | --- addons/openerp/static/javascript/o2m.js 2011-08-23 16:21:49 +0000 | |||
36 | +++ addons/openerp/static/javascript/o2m.js 2012-03-23 13:05:29 +0000 | |||
37 | @@ -243,9 +243,8 @@ | |||
38 | 243 | }, {'source-window': $this[0], | 243 | }, {'source-window': $this[0], |
39 | 244 | 'list': options['_terp_o2m'] | 244 | 'list': options['_terp_o2m'] |
40 | 245 | }, { | 245 | }, { |
44 | 246 | width: '70%', | 246 | width: '90%', |
45 | 247 | height: '90%', | 247 | height: '95%', |
43 | 248 | max_height: 700 | ||
46 | 249 | }); | 248 | }); |
47 | 250 | var $form = jQuery('<form>', { | 249 | var $form = jQuery('<form>', { |
48 | 251 | method: 'POST', | 250 | method: 'POST', |
49 | 252 | 251 | ||
50 | === modified file 'addons/openerp/static/javascript/openerp/openerp.base.js' | |||
51 | --- addons/openerp/static/javascript/openerp/openerp.base.js 2012-03-16 15:01:42 +0000 | |||
52 | +++ addons/openerp/static/javascript/openerp/openerp.base.js 2012-03-23 13:05:29 +0000 | |||
53 | @@ -176,7 +176,8 @@ | |||
54 | 176 | src: action_url, | 176 | src: action_url, |
55 | 177 | 'class': 'action-dialog' | 177 | 'class': 'action-dialog' |
56 | 178 | }, null, { | 178 | }, null, { |
58 | 179 | width: 800 | 179 | width: '90%', |
59 | 180 | height: '95%' | ||
60 | 180 | }); | 181 | }); |
61 | 181 | break; | 182 | break; |
62 | 182 | case 'download': | 183 | case 'download': |
63 | 183 | 184 | ||
64 | === modified file 'openobject/controllers/templates/base.mako' | |||
65 | --- openobject/controllers/templates/base.mako 2010-12-14 17:34:23 +0000 | |||
66 | +++ openobject/controllers/templates/base.mako 2012-03-23 13:05:29 +0000 | |||
67 | @@ -20,6 +20,7 @@ | |||
68 | 20 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.form.js"></script> | 20 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.form.js"></script> |
69 | 21 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.ba-hashchange.js"></script> | 21 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.ba-hashchange.js"></script> |
70 | 22 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js"></script> | 22 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js"></script> |
71 | 23 | <script type="text/javascript" src="/openobject/static/javascript/jQuery/jquery.dialogextend.js"></script> | ||
72 | 23 | 24 | ||
73 | 24 | <script type="text/javascript"> | 25 | <script type="text/javascript"> |
74 | 25 | jQuery.noConflict(); | 26 | jQuery.noConflict(); |
75 | 26 | 27 | ||
76 | === modified file 'openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css' | |||
77 | --- openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css 2010-11-10 11:45:00 +0000 | |||
78 | +++ openobject/static/css/jquery-ui/smoothness/jquery-ui-1.8.6.custom.css 2012-03-23 13:05:29 +0000 | |||
79 | @@ -56,7 +56,7 @@ | |||
80 | 56 | 56 | ||
81 | 57 | /* Component containers | 57 | /* Component containers |
82 | 58 | ----------------------------------*/ | 58 | ----------------------------------*/ |
84 | 59 | .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } | 59 | .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 0.7em; } |
85 | 60 | .ui-widget .ui-widget { font-size: 1em; } | 60 | .ui-widget .ui-widget { font-size: 1em; } |
86 | 61 | .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } | 61 | .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } |
87 | 62 | .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } | 62 | .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } |
88 | @@ -569,4 +569,4 @@ | |||
89 | 569 | * http://docs.jquery.com/UI/Progressbar#theming | 569 | * http://docs.jquery.com/UI/Progressbar#theming |
90 | 570 | */ | 570 | */ |
91 | 571 | .ui-progressbar { height:2em; text-align: left; } | 571 | .ui-progressbar { height:2em; text-align: left; } |
92 | 572 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } | ||
93 | 573 | \ No newline at end of file | 572 | \ No newline at end of file |
94 | 573 | .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } | ||
95 | 574 | 574 | ||
96 | === added file 'openobject/static/javascript/jQuery/jquery.dialogextend.js' | |||
97 | --- openobject/static/javascript/jQuery/jquery.dialogextend.js 1970-01-01 00:00:00 +0000 | |||
98 | +++ openobject/static/javascript/jQuery/jquery.dialogextend.js 2012-03-23 13:05:29 +0000 | |||
99 | @@ -0,0 +1,611 @@ | |||
100 | 1 | /*! | ||
101 | 2 | * jQuery DialogExtend 1.0 | ||
102 | 3 | * | ||
103 | 4 | * Copyright (c) 2010 Shum Ting Hin | ||
104 | 5 | * | ||
105 | 6 | * Licensed under MIT | ||
106 | 7 | * http://www.opensource.org/licenses/mit-license.php | ||
107 | 8 | * | ||
108 | 9 | * Project Home: | ||
109 | 10 | * http://code.google.com/p/jquery-dialogextend/ | ||
110 | 11 | * | ||
111 | 12 | * Depends: | ||
112 | 13 | * jQuery 1.4 | ||
113 | 14 | * jQuery UI Dialog 1.8.0 | ||
114 | 15 | * | ||
115 | 16 | * History: | ||
116 | 17 | * 0.9 / 2010-11-04 / hin / creation of plugin | ||
117 | 18 | * 0.9.1 / 2010-11-16 / hin / fix bug of zero-config | ||
118 | 19 | * 0.9.2 / 2010-12-16 / hin / fix bug of not firing <load.dialogExtend> event | ||
119 | 20 | * apply <events> as init option for defining event-callback | ||
120 | 21 | * 1.0 / 2010-01-05 / hin / fix bug of button-pane in 'minimized' state | ||
121 | 22 | * fix bug of title-bar word-wrap in 'minimized' state | ||
122 | 23 | * apply <titlebar=none|transparent> as init option for enhancing title-bar feature | ||
123 | 24 | * apply <dblclick=collapse> as init option for enhancing double-click feature | ||
124 | 25 | * | ||
125 | 26 | */ | ||
126 | 27 | (function($){ | ||
127 | 28 | |||
128 | 29 | //default settings | ||
129 | 30 | var defaults = { | ||
130 | 31 | "maximize" : false, | ||
131 | 32 | "minimize" : false, | ||
132 | 33 | "collapse" : false, | ||
133 | 34 | "dblclick" : false, | ||
134 | 35 | "titlebar" : false, | ||
135 | 36 | "icons" : { | ||
136 | 37 | "maximize" : "ui-icon-extlink", | ||
137 | 38 | "minimize" : "ui-icon-minus", | ||
138 | 39 | "restore" : "ui-icon-newwin", | ||
139 | 40 | "collapse": "ui-icon-carat-1-n", | ||
140 | 41 | "uncollapse": "ui-icon-carat-1-s", | ||
141 | 42 | }, | ||
142 | 43 | "events" : { | ||
143 | 44 | "load" : null, | ||
144 | 45 | "beforeCollapse" : null, | ||
145 | 46 | "beforeMaximize" : null, | ||
146 | 47 | "beforeMinimize" : null, | ||
147 | 48 | "beforeRestore" : null, | ||
148 | 49 | "collapse" : null, | ||
149 | 50 | "maximize" : null, | ||
150 | 51 | "minimize" : null, | ||
151 | 52 | "restore" : null | ||
152 | 53 | } | ||
153 | 54 | }; | ||
154 | 55 | |||
155 | 56 | //plugin settings (will be modified during init) | ||
156 | 57 | var settings; | ||
157 | 58 | |||
158 | 59 | //plubic methods | ||
159 | 60 | var methods = { | ||
160 | 61 | |||
161 | 62 | "init" : function( options ){ | ||
162 | 63 | var self = this; | ||
163 | 64 | //validation | ||
164 | 65 | if ( !$(self).dialog ) { | ||
165 | 66 | $.error( "jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted" ); | ||
166 | 67 | } | ||
167 | 68 | //merge defaults & options, without modifying the defaults | ||
168 | 69 | options = options || {}; | ||
169 | 70 | options.icons = options.icons || {}; | ||
170 | 71 | options.events = options.events || {}; | ||
171 | 72 | settings = $.extend({}, defaults, options); | ||
172 | 73 | settings.icons = $.extend({}, defaults.icons, options.icons); | ||
173 | 74 | settings.events = $.extend({}, defaults.events, options.events); | ||
174 | 75 | //initiate plugin... | ||
175 | 76 | $(self).each(function(){ | ||
176 | 77 | $(this) | ||
177 | 78 | //set default dialog state | ||
178 | 79 | .data("dialog-state", "normal") | ||
179 | 80 | //do bunch of things... | ||
180 | 81 | .dialogExtend("_verifySettings") | ||
181 | 82 | .dialogExtend("_initEvents") | ||
182 | 83 | .dialogExtend("_initStyles") | ||
183 | 84 | .dialogExtend("_initButtons") | ||
184 | 85 | .dialogExtend("_initTitleBar") | ||
185 | 86 | //trigger custom event when done | ||
186 | 87 | .dialogExtend("_trigger", "load"); | ||
187 | 88 | }); | ||
188 | 89 | //maintain chainability | ||
189 | 90 | return self; | ||
190 | 91 | }, | ||
191 | 92 | |||
192 | 93 | "collapse" : function(){ | ||
193 | 94 | var self = this; | ||
194 | 95 | //calculate new dimension | ||
195 | 96 | var newHeight = $(this).dialog("widget").find(".ui-dialog-titlebar").height()+15; | ||
196 | 97 | //start! | ||
197 | 98 | $(self) | ||
198 | 99 | //trigger custom event | ||
199 | 100 | .dialogExtend("_trigger", "beforeCollapse") | ||
200 | 101 | //remember original state | ||
201 | 102 | .dialogExtend("_saveSnapshot") | ||
202 | 103 | //mark new state | ||
203 | 104 | .data("dialog-state", "collapsed") | ||
204 | 105 | //modify dialog size (after hiding content) | ||
205 | 106 | .dialog("option", { | ||
206 | 107 | "height" : newHeight, | ||
207 | 108 | "maxHeight" : newHeight | ||
208 | 109 | }) | ||
209 | 110 | //hide content | ||
210 | 111 | //hide button-pane | ||
211 | 112 | //make title-bar no-wrap | ||
212 | 113 | .hide() | ||
213 | 114 | .dialog("widget") | ||
214 | 115 | .find(".ui-dialog-buttonpane:visible").hide().end() | ||
215 | 116 | .find(".ui-dialog-titlebar").css("white-space", "nowrap").end() | ||
216 | 117 | .find("#ui-dialog-collapse-button").addClass(settings.icons.uncollapse).removeClass(settings.icons.collapse).end() | ||
217 | 118 | .find(".ui-dialog-content") | ||
218 | 119 | //trigger custom event | ||
219 | 120 | .dialogExtend("_trigger", "collapse"); | ||
220 | 121 | //maintain chainability | ||
221 | 122 | return self; | ||
222 | 123 | }, | ||
223 | 124 | |||
224 | 125 | "maximize" : function(){ | ||
225 | 126 | var self = this; | ||
226 | 127 | //caculate new dimension | ||
227 | 128 | var newHeight = $(window).height()-11; | ||
228 | 129 | var newWidth = $(window).width()-11; | ||
229 | 130 | //start! | ||
230 | 131 | $(self) | ||
231 | 132 | //trigger custom event | ||
232 | 133 | .dialogExtend("_trigger", "beforeMaximize") | ||
233 | 134 | //remember original state | ||
234 | 135 | .dialogExtend("_saveSnapshot") | ||
235 | 136 | //mark new state | ||
236 | 137 | .data("dialog-state", "maximized") | ||
237 | 138 | //modify dialog button | ||
238 | 139 | .dialogExtend("_toggleButtons") | ||
239 | 140 | //fix dialog from scrolling | ||
240 | 141 | .dialog("widget") | ||
241 | 142 | .css("position", "fixed") | ||
242 | 143 | .find(".ui-dialog-content") | ||
243 | 144 | //show content | ||
244 | 145 | //show button-pane (when minimized/collapsed) | ||
245 | 146 | .show() | ||
246 | 147 | .dialog("widget") | ||
247 | 148 | .find(".ui-dialog-buttonpane").show().end() | ||
248 | 149 | .find(".ui-dialog-content") | ||
249 | 150 | //modify dialog with new config | ||
250 | 151 | .dialog("option", { | ||
251 | 152 | "resizable" : false, | ||
252 | 153 | "draggable" : false, | ||
253 | 154 | "height" : newHeight, | ||
254 | 155 | "width" : newWidth, | ||
255 | 156 | "position" : [1, 1] | ||
256 | 157 | }) | ||
257 | 158 | //disable draggable-handle (for <titlebar=none> only) | ||
258 | 159 | .dialog("widget") | ||
259 | 160 | .draggable("option", "handle", null) | ||
260 | 161 | .find(".ui-dialog-draggable-handle").css("cursor", "text").end() | ||
261 | 162 | .find(".ui-dialog-content") | ||
262 | 163 | //trigger custom event | ||
263 | 164 | .dialogExtend("_trigger", "maximize"); | ||
264 | 165 | //maintain chainability | ||
265 | 166 | return self; | ||
266 | 167 | }, | ||
267 | 168 | |||
268 | 169 | "minimize" : function(){ | ||
269 | 170 | var self = this; | ||
270 | 171 | var container = "#minimized-dialog-container"; | ||
271 | 172 | //caculate new dimension | ||
272 | 173 | var newHeight = $(this).dialog("widget").find(".ui-dialog-titlebar").height()+15; | ||
273 | 174 | var newWidth = 200; | ||
274 | 175 | //create container for (multiple) minimized dialogs (when necessary) | ||
275 | 176 | if ( !$(container).length ) { | ||
276 | 177 | $("<div />") | ||
277 | 178 | .attr("id", container.replace("#", "")) | ||
278 | 179 | .css({ "left" : 1, "bottom" : 1, "position" : "fixed" }) | ||
279 | 180 | .appendTo("body"); | ||
280 | 181 | } | ||
281 | 182 | //start! | ||
282 | 183 | $(self) | ||
283 | 184 | //trigger custom event | ||
284 | 185 | .dialogExtend("_trigger", "beforeMinimize") | ||
285 | 186 | //remember original state | ||
286 | 187 | .dialogExtend("_saveSnapshot") | ||
287 | 188 | //mark new state | ||
288 | 189 | .data("dialog-state", "minimized") | ||
289 | 190 | //modify dialog button | ||
290 | 191 | .dialogExtend("_toggleButtons") | ||
291 | 192 | //move dialog from body to container | ||
292 | 193 | .dialog("widget") | ||
293 | 194 | .css({ | ||
294 | 195 | "float" : "left", //float is essential for stacking | ||
295 | 196 | "margin" : 1, | ||
296 | 197 | "position" : "static" | ||
297 | 198 | }) | ||
298 | 199 | .appendTo(container) | ||
299 | 200 | .find(".ui-dialog-content") | ||
300 | 201 | //modify dialog with new config | ||
301 | 202 | .dialog("option", { | ||
302 | 203 | "resizable" : false, | ||
303 | 204 | "draggable" : false, | ||
304 | 205 | "height" : newHeight, | ||
305 | 206 | "width" : newWidth | ||
306 | 207 | }) | ||
307 | 208 | //hide content | ||
308 | 209 | //hide button-pane | ||
309 | 210 | //make title-bar no-wrap | ||
310 | 211 | .hide() | ||
311 | 212 | .dialog("widget") | ||
312 | 213 | .find(".ui-dialog-buttonpane:visible").hide().end() | ||
313 | 214 | .find(".ui-dialog-titlebar").css("white-space", "nowrap").end() | ||
314 | 215 | .find(".ui-dialog-content") | ||
315 | 216 | //disable draggable-handle (for <titlebar=none> only) | ||
316 | 217 | .dialog("widget") | ||
317 | 218 | .draggable("option", "handle", null) | ||
318 | 219 | .find(".ui-dialog-draggable-handle").css("cursor", "text").end() | ||
319 | 220 | .find(".ui-dialog-content") | ||
320 | 221 | //trigger custom event | ||
321 | 222 | .dialogExtend("_trigger", "minimize"); | ||
322 | 223 | //maintain chainability | ||
323 | 224 | return self; | ||
324 | 225 | }, | ||
325 | 226 | |||
326 | 227 | "restore" : function(){ | ||
327 | 228 | var self = this; | ||
328 | 229 | var beforeState = $(self).data("dialog-state"); | ||
329 | 230 | //start! | ||
330 | 231 | $(self) | ||
331 | 232 | //trigger custom event | ||
332 | 233 | .dialogExtend("_trigger", "beforeRestore") | ||
333 | 234 | //mark new state | ||
334 | 235 | .data("dialog-state", "normal") | ||
335 | 236 | //restore dialog button | ||
336 | 237 | .dialogExtend("_toggleButtons") | ||
337 | 238 | //restore dialog according to previous state | ||
338 | 239 | .dialogExtend( | ||
339 | 240 | beforeState == "maximized" ? "_restoreFromMaximized" : | ||
340 | 241 | beforeState == "minimized" ? "_restoreFromMinimized" : | ||
341 | 242 | beforeState == "collapsed" ? "_restoreFromCollapsed" : | ||
342 | 243 | $.error( "jQuery.dialogExtend Error : Cannot restore dialog from unknown state '" + beforeState +"'" ) | ||
343 | 244 | ) | ||
344 | 245 | //trigger custom event | ||
345 | 246 | .dialogExtend("_trigger", "restore"); | ||
346 | 247 | //maintain chainability | ||
347 | 248 | return self; | ||
348 | 249 | }, | ||
349 | 250 | |||
350 | 251 | "_initButtons" : function(){ | ||
351 | 252 | var self = this; | ||
352 | 253 | //start operation on titlebar | ||
353 | 254 | var titlebar = $(self).dialog("widget").find(".ui-dialog-titlebar"); | ||
354 | 255 | $(titlebar) | ||
355 | 256 | .append('<a class="ui-dialog-titlebar-maximize ui-corner-all" href="#"><span class="ui-icon '+settings.icons.maximize+'">maximize</span></a>') | ||
356 | 257 | .append('<a class="ui-dialog-titlebar-minimize ui-corner-all" href="#"><span class="ui-icon '+settings.icons.minimize+'">minimize</span></a>') | ||
357 | 258 | .append('<a class="ui-dialog-titlebar-collapse ui-corner-all" href="#"><span id="ui-dialog-collapse-button" class="ui-icon '+settings.icons.collapse+'">collapse</span></a>') | ||
358 | 259 | .append('<a class="ui-dialog-titlebar-restore ui-corner-all" href="#"><span class="ui-icon '+settings.icons.restore+'">restore</span></a>') | ||
359 | 260 | //add effect to buttons | ||
360 | 261 | .find(".ui-dialog-titlebar-maximize,.ui-dialog-titlebar-minimize,.ui-dialog-titlebar-collapse,.ui-dialog-titlebar-restore") | ||
361 | 262 | .attr("role", "button") | ||
362 | 263 | .mouseover(function(){ $(this).addClass("ui-state-hover"); }) | ||
363 | 264 | .mouseout(function(){ $(this).removeClass("ui-state-hover"); }) | ||
364 | 265 | .focus(function(){ $(this).addClass("ui-state-focus"); }) | ||
365 | 266 | .blur(function(){ $(this).removeClass("ui-state-focus"); }) | ||
366 | 267 | .end() | ||
367 | 268 | //default show buttons | ||
368 | 269 | //set button positions | ||
369 | 270 | //on-click-button | ||
370 | 271 | .find(".ui-dialog-titlebar-maximize") | ||
371 | 272 | .toggle(settings.maximize) | ||
372 | 273 | .css({ "right" : settings.maximize ? "2.4em" : "-9999em" }) | ||
373 | 274 | .click(function(e){ | ||
374 | 275 | e.preventDefault(); | ||
375 | 276 | $(self).dialogExtend("maximize"); | ||
376 | 277 | }) | ||
377 | 278 | .end() | ||
378 | 279 | .find(".ui-dialog-titlebar-minimize") | ||
379 | 280 | .toggle(settings.minimize) | ||
380 | 281 | .css({ "right" : settings.maximize ? "4.6em" : settings.minimize ? "2.3em" : "-9999em" }) | ||
381 | 282 | .click(function(e){ | ||
382 | 283 | e.preventDefault(); | ||
383 | 284 | $(self).dialogExtend("minimize"); | ||
384 | 285 | }) | ||
385 | 286 | .end() | ||
386 | 287 | .find(".ui-dialog-titlebar-collapse") | ||
387 | 288 | .toggle(settings.collapse) | ||
388 | 289 | .css({ "right" : settings.collapse ? (2.3*(1+ (settings.maximize?1:0) + (settings.minimize?1:0)))+"em" : "-9999em" }) | ||
389 | 290 | .click(function(e){ | ||
390 | 291 | e.preventDefault(); | ||
391 | 292 | if ($(self).data("dialog-state") == "collapsed") { | ||
392 | 293 | $(self).dialogExtend("restore"); | ||
393 | 294 | } else { | ||
394 | 295 | $(self).dialogExtend("collapse"); | ||
395 | 296 | } | ||
396 | 297 | }) | ||
397 | 298 | .end() | ||
398 | 299 | .find(".ui-dialog-titlebar-restore") | ||
399 | 300 | .hide() | ||
400 | 301 | .css({ "right" : "-9999em" }) | ||
401 | 302 | .click(function(e){ | ||
402 | 303 | e.preventDefault(); | ||
403 | 304 | $(self).dialogExtend("restore"); | ||
404 | 305 | }) | ||
405 | 306 | .end() | ||
406 | 307 | //on-dblclick-titlebar : maximize/minimize/collapse/restore | ||
407 | 308 | .dblclick(function(evt){ | ||
408 | 309 | if ( settings.dblclick && settings.dblclick.length ) { | ||
409 | 310 | $(self).dialogExtend( $(self).data("dialog-state") != "normal" ? "restore" : settings.dblclick ); | ||
410 | 311 | } | ||
411 | 312 | }) | ||
412 | 313 | //avoid text-highlight when double-click | ||
413 | 314 | .each(function(){ | ||
414 | 315 | $(this) | ||
415 | 316 | //.attr("unselectable", "on") | ||
416 | 317 | //.css({ "-moz-user-select" : "none", "-khtml-user-select" : "none" }) | ||
417 | 318 | .select(function(){ return false; }); | ||
418 | 319 | }); | ||
419 | 320 | //maintain chainability | ||
420 | 321 | return self; | ||
421 | 322 | }, | ||
422 | 323 | |||
423 | 324 | "_initEvents" : function(){ | ||
424 | 325 | var self = this; | ||
425 | 326 | //bind event callbacks which specified at init | ||
426 | 327 | $.each(settings.events, function(type){ | ||
427 | 328 | if ( $.isFunction( settings.events[type] ) ) { | ||
428 | 329 | $(self).bind(type+".dialogExtend", settings.events[type]); | ||
429 | 330 | } | ||
430 | 331 | }); | ||
431 | 332 | //maintain chainability | ||
432 | 333 | return self; | ||
433 | 334 | }, | ||
434 | 335 | |||
435 | 336 | "_initStyles" : function(){ | ||
436 | 337 | var self = this; | ||
437 | 338 | //append styles for this plugin to body | ||
438 | 339 | var style = ''; | ||
439 | 340 | style += '<style type="text/css">'; | ||
440 | 341 | style += '.ui-dialog .ui-dialog-titlebar-maximize,'; | ||
441 | 342 | style += '.ui-dialog .ui-dialog-titlebar-minimize,'; | ||
442 | 343 | style += '.ui-dialog .ui-dialog-titlebar-collapse,'; | ||
443 | 344 | style += '.ui-dialog .ui-dialog-titlebar-restore { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }'; | ||
444 | 345 | style += '.ui-dialog .ui-dialog-titlebar-maximize span,'; | ||
445 | 346 | style += '.ui-dialog .ui-dialog-titlebar-minimize span,'; | ||
446 | 347 | style += '.ui-dialog .ui-dialog-titlebar-restore span { display: block; margin: 1px; }'; | ||
447 | 348 | style += '.ui-dialog .ui-dialog-titlebar-maximize:hover,'; | ||
448 | 349 | style += '.ui-dialog .ui-dialog-titlebar-maximize:focus,'; | ||
449 | 350 | style += '.ui-dialog .ui-dialog-titlebar-minimize:hover,'; | ||
450 | 351 | style += '.ui-dialog .ui-dialog-titlebar-minimize:focus,'; | ||
451 | 352 | style += '.ui-dialog .ui-dialog-titlebar-restore:hover,'; | ||
452 | 353 | style += '.ui-dialog .ui-dialog-titlebar-restore:focus { padding: 0; }'; | ||
453 | 354 | style += '.ui-dialog .ui-dialog-titlebar ::selection { background-color: transparent; }'; | ||
454 | 355 | style += '</style>'; | ||
455 | 356 | $(style).appendTo("body"); | ||
456 | 357 | //maintain chainability | ||
457 | 358 | return self; | ||
458 | 359 | }, | ||
459 | 360 | |||
460 | 361 | "_initTitleBar" : function(){ | ||
461 | 362 | var self = this; | ||
462 | 363 | //modify title bar | ||
463 | 364 | switch ( settings.titlebar ) { | ||
464 | 365 | case false: | ||
465 | 366 | //do nothing | ||
466 | 367 | break; | ||
467 | 368 | case "none": | ||
468 | 369 | //create new draggable-handle as substitute of title bar | ||
469 | 370 | if ( $(self).dialog("option", "draggable") ) { | ||
470 | 371 | var handle = $("<div />").addClass("ui-dialog-draggable-handle").css("cursor", "move").height(5); | ||
471 | 372 | $(self).dialog("widget").prepend(handle).draggable("option", "handle", handle); | ||
472 | 373 | } | ||
473 | 374 | //remove title bar and keep it draggable | ||
474 | 375 | $(self) | ||
475 | 376 | .dialog("widget") | ||
476 | 377 | .find(".ui-dialog-titlebar") | ||
477 | 378 | //clear title text | ||
478 | 379 | .find(".ui-dialog-title").html(" ").end() | ||
479 | 380 | //keep buttons at upper-right-hand corner | ||
480 | 381 | .css({ | ||
481 | 382 | "background-color" : "transparent", | ||
482 | 383 | "background-image" : "none", | ||
483 | 384 | "border" : 0, | ||
484 | 385 | "position" : "absolute", | ||
485 | 386 | "right" : 0, | ||
486 | 387 | "top" : 0, | ||
487 | 388 | "z-index" : 9999 | ||
488 | 389 | }) | ||
489 | 390 | .end(); | ||
490 | 391 | break; | ||
491 | 392 | case "transparent": | ||
492 | 393 | //remove title style | ||
493 | 394 | $(self) | ||
494 | 395 | .dialog("widget") | ||
495 | 396 | .find(".ui-dialog-titlebar") | ||
496 | 397 | .css({ | ||
497 | 398 | "background-color" : "transparent", | ||
498 | 399 | "background-image" : "none", | ||
499 | 400 | "border" : 0 | ||
500 | 401 | }); | ||
501 | 402 | break; | ||
502 | 403 | default: | ||
503 | 404 | $.error( "jQuery.dialogExtend Error : Invalid <titlebar> value '" + settings.titlebar + "'" ); | ||
504 | 405 | } | ||
505 | 406 | //maintain chainability | ||
506 | 407 | return self; | ||
507 | 408 | }, | ||
508 | 409 | |||
509 | 410 | "_loadSnapshot" : function(){ | ||
510 | 411 | var self = this; | ||
511 | 412 | return { | ||
512 | 413 | "config" : { | ||
513 | 414 | "resizable" : $(self).data("original-config-resizable"), | ||
514 | 415 | "draggable" : $(self).data("original-config-draggable") | ||
515 | 416 | }, | ||
516 | 417 | "size" : { | ||
517 | 418 | "height" : $(self).data("original-size-height"), | ||
518 | 419 | "width" : $(self).data("original-size-width"), | ||
519 | 420 | "maxHeight" : $(self).data("original-size-maxHeight") | ||
520 | 421 | }, | ||
521 | 422 | "position" : { | ||
522 | 423 | "mode" : $(self).data("original-position-mode"), | ||
523 | 424 | "left" : $(self).data("original-position-left"), | ||
524 | 425 | "top" : $(self).data("original-position-top") | ||
525 | 426 | }, | ||
526 | 427 | "titlebar" : { | ||
527 | 428 | "wrap" : $(self).data("original-titlebar-wrap") | ||
528 | 429 | } | ||
529 | 430 | }; | ||
530 | 431 | }, | ||
531 | 432 | |||
532 | 433 | "_restoreFromCollapsed" : function(){ | ||
533 | 434 | var self = this; | ||
534 | 435 | var original = $(this).dialogExtend("_loadSnapshot"); | ||
535 | 436 | //restore dialog | ||
536 | 437 | $(self) | ||
537 | 438 | //show content | ||
538 | 439 | //show button-pane | ||
539 | 440 | //fix title-bar wrap | ||
540 | 441 | .show() | ||
541 | 442 | .dialog("widget") | ||
542 | 443 | .find(".ui-dialog-buttonpane:hidden").show().end() | ||
543 | 444 | .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end() | ||
544 | 445 | .find(".ui-dialog-content") | ||
545 | 446 | //restore config & size | ||
546 | 447 | .dialog("option", { | ||
547 | 448 | "height" : original.size.height, | ||
548 | 449 | "maxHeight" : original.size.maxHeight | ||
549 | 450 | }); | ||
550 | 451 | //maintain chainability | ||
551 | 452 | return self; | ||
552 | 453 | }, | ||
553 | 454 | |||
554 | 455 | "_restoreFromMaximized" : function(){ | ||
555 | 456 | var self = this; | ||
556 | 457 | var original = $(this).dialogExtend("_loadSnapshot"); | ||
557 | 458 | //restore dialog | ||
558 | 459 | $(self) | ||
559 | 460 | //free dialog from scrolling | ||
560 | 461 | //fix title-bar wrap (if dialog was minimized/collapsed) | ||
561 | 462 | .dialog("widget") | ||
562 | 463 | .css("position", original.position.mode) | ||
563 | 464 | .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end() | ||
564 | 465 | .find(".ui-dialog-content") | ||
565 | 466 | //restore config & size & position | ||
566 | 467 | .dialog("option", { | ||
567 | 468 | "resizable" : original.config.resizable, | ||
568 | 469 | "draggable" : original.config.draggable, | ||
569 | 470 | "height" : original.size.height, | ||
570 | 471 | "width" : original.size.width, | ||
571 | 472 | "maxHeight" : original.size.maxHeight, | ||
572 | 473 | "position" : [ original.position.left, original.position.top ] | ||
573 | 474 | }) | ||
574 | 475 | //restore draggable-handle (for <titlebar=none> only) | ||
575 | 476 | .dialog("widget") | ||
576 | 477 | .draggable("option", "handle", $(this).find(".ui-dialog-draggable-handle")) | ||
577 | 478 | .find(".ui-dialog-draggable-handle") | ||
578 | 479 | .css("cursor", "move"); | ||
579 | 480 | //maintain chainability | ||
580 | 481 | return self; | ||
581 | 482 | }, | ||
582 | 483 | |||
583 | 484 | "_restoreFromMinimized" : function(){ | ||
584 | 485 | var self = this; | ||
585 | 486 | var original = $(this).dialogExtend("_loadSnapshot"); | ||
586 | 487 | var container = "#minimized-dialog-container"; | ||
587 | 488 | //restore dialog | ||
588 | 489 | $(self) | ||
589 | 490 | //move dialog back from container to body | ||
590 | 491 | .dialog("widget") | ||
591 | 492 | .appendTo("body") | ||
592 | 493 | .css({ | ||
593 | 494 | "float" : "none", | ||
594 | 495 | "margin" : 0, | ||
595 | 496 | "position" : original.position.mode | ||
596 | 497 | }) | ||
597 | 498 | .find(".ui-dialog-content") | ||
598 | 499 | //show content | ||
599 | 500 | //show button-pane | ||
600 | 501 | //fix title-bar wrap | ||
601 | 502 | .show() | ||
602 | 503 | .dialog("widget") | ||
603 | 504 | .find(".ui-dialog-buttonpane:hidden").show().end() | ||
604 | 505 | .find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end() | ||
605 | 506 | .find(".ui-dialog-content") | ||
606 | 507 | //restore config & size & position | ||
607 | 508 | .dialog("option", { | ||
608 | 509 | "resizable" : original.config.resizable, | ||
609 | 510 | "draggable" : original.config.draggable, | ||
610 | 511 | "height" : original.size.height, | ||
611 | 512 | "width" : original.size.width, | ||
612 | 513 | "maxHeight" : original.size.maxHeight, | ||
613 | 514 | "position" : [ original.position.left, original.position.top ] | ||
614 | 515 | }) | ||
615 | 516 | //restore draggable-handle (for <titlebar=none> only) | ||
616 | 517 | .dialog("widget") | ||
617 | 518 | .draggable("option", "handle", $(this).find(".ui-dialog-draggable-handle")) | ||
618 | 519 | .find(".ui-dialog-draggable-handle") | ||
619 | 520 | .css("cursor", "move"); | ||
620 | 521 | //maintain chainability | ||
621 | 522 | return self; | ||
622 | 523 | }, | ||
623 | 524 | |||
624 | 525 | "_saveSnapshot" : function(){ | ||
625 | 526 | var self = this; | ||
626 | 527 | //remember all configs under normal state | ||
627 | 528 | if ( $(self).data("dialog-state") == "normal" ) { | ||
628 | 529 | $(self) | ||
629 | 530 | .data("original-config-resizable", $(self).dialog("option", "resizable")) | ||
630 | 531 | .data("original-config-draggable", $(self).dialog("option", "draggable")) | ||
631 | 532 | .data("original-size-height", $(self).dialog("widget").height()) | ||
632 | 533 | .data("original-size-width", $(self).dialog("option", "width")) | ||
633 | 534 | .data("original-size-maxHeight", $(self).dialog("option", "maxHeight")) | ||
634 | 535 | .data("original-position-mode", $(self).dialog("widget").css("position")) | ||
635 | 536 | .data("original-position-left", $(self).dialog("widget").offset().left) | ||
636 | 537 | .data("original-position-top", $(self).dialog("widget").offset().top) | ||
637 | 538 | .data("original-titlebar-wrap", $(self).dialog("widget").find(".ui-dialog-titlebar").css("white-space")); | ||
638 | 539 | } | ||
639 | 540 | //maintain chainability | ||
640 | 541 | return self; | ||
641 | 542 | }, | ||
642 | 543 | |||
643 | 544 | "_toggleButtons" : function(){ | ||
644 | 545 | var self = this; | ||
645 | 546 | //show or hide buttons & decide position | ||
646 | 547 | $(self).dialog("widget") | ||
647 | 548 | .find(".ui-dialog-titlebar-maximize") | ||
648 | 549 | .toggle( $(self).data("dialog-state") != "maximized" && settings.maximize ) | ||
649 | 550 | .end() | ||
650 | 551 | .find(".ui-dialog-titlebar-minimize") | ||
651 | 552 | .toggle( $(self).data("dialog-state") != "minimized" && settings.minimize ) | ||
652 | 553 | .end() | ||
653 | 554 | .find(".ui-dialog-titlebar-restore") | ||
654 | 555 | .toggle( $(self).data("dialog-state") != "normal" && ( settings.maximize || settings.minimize ) ) | ||
655 | 556 | .css({ "right" : $(self).data("dialog-state") == "maximized" ? "2.4em" : $(self).data("dialog-state") == "minimized" ? !settings.maximize ? "2.4em" : "4.6em" : "-9999em" }) | ||
656 | 557 | .end() | ||
657 | 558 | .find("#ui-dialog-collapse-button") | ||
658 | 559 | .addClass(settings.icons.collapse) | ||
659 | 560 | .removeClass(settings.icons.uncollapse) | ||
660 | 561 | .end(); | ||
661 | 562 | //maintain chainability | ||
662 | 563 | return self; | ||
663 | 564 | }, | ||
664 | 565 | |||
665 | 566 | "_trigger" : function( type ){ | ||
666 | 567 | var self = this; | ||
667 | 568 | //trigger event with namespace when user bind to it | ||
668 | 569 | $(self).triggerHandler(type+".dialogExtend", this); | ||
669 | 570 | //maintain chainability | ||
670 | 571 | return self; | ||
671 | 572 | }, | ||
672 | 573 | |||
673 | 574 | "_verifySettings" : function(){ | ||
674 | 575 | var self = this; | ||
675 | 576 | //check <dblclick> option | ||
676 | 577 | if ( !settings.dblclick ) { | ||
677 | 578 | } else if ( settings.dblclick == "maximize" ) { | ||
678 | 579 | } else if ( settings.dblclick == "minimize" ) { | ||
679 | 580 | } else if ( settings.dblclick == "collapse" ) { | ||
680 | 581 | } else { | ||
681 | 582 | $.error( "jQuery.dialogExtend Error : Invalid <dblclick> value '" + settings.dblclick + "'" ); | ||
682 | 583 | settings.dblclick = false; | ||
683 | 584 | } | ||
684 | 585 | //check <titlebar> option | ||
685 | 586 | if ( !settings.titlebar ) { | ||
686 | 587 | } else if ( settings.titlebar == "none" ) { | ||
687 | 588 | } else if ( settings.titlebar == "transparent" ) { | ||
688 | 589 | } else { | ||
689 | 590 | $.error( "jQuery.dialogExtend Error : Invalid <titlebar> value '" + settings.titlebar + "'" ); | ||
690 | 591 | settings.titlebar = false; | ||
691 | 592 | } | ||
692 | 593 | //maintain chainability | ||
693 | 594 | return self; | ||
694 | 595 | } | ||
695 | 596 | |||
696 | 597 | }; | ||
697 | 598 | |||
698 | 599 | //core method | ||
699 | 600 | $.fn.dialogExtend = function( method ){ | ||
700 | 601 | //method calling logic | ||
701 | 602 | if ( methods[ method ] ) { | ||
702 | 603 | return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) ); | ||
703 | 604 | } else if ( typeof method === "object" || ! method ) { | ||
704 | 605 | return methods.init.apply( this, arguments ); | ||
705 | 606 | } else { | ||
706 | 607 | $.error( "jQuery.dialogExtend Error : Method <" + method + "> does not exist" ); | ||
707 | 608 | } | ||
708 | 609 | }; | ||
709 | 610 | |||
710 | 611 | }(jQuery)); | ||
711 | 0 | 612 | ||
712 | === modified file 'openobject/static/javascript/openobject/openobject.dom.js' | |||
713 | --- openobject/static/javascript/openobject/openobject.dom.js 2011-04-08 09:24:41 +0000 | |||
714 | +++ openobject/static/javascript/openobject/openobject.dom.js 2012-03-23 13:05:29 +0000 | |||
715 | @@ -97,6 +97,11 @@ | |||
716 | 97 | width: options.width, | 97 | width: options.width, |
717 | 98 | height: options.height, | 98 | height: options.height, |
718 | 99 | close: options.close | 99 | close: options.close |
719 | 100 | }) | ||
720 | 101 | .dialogExtend({ | ||
721 | 102 | "dblclick" : "collapse", | ||
722 | 103 | "collapse": true, | ||
723 | 104 | "maximize": true, | ||
724 | 100 | }); | 105 | }); |
725 | 101 | $frame[0].set_title = function (title) { | 106 | $frame[0].set_title = function (title) { |
726 | 102 | $frame.prev().find('.ui-dialog-title').text(title); | 107 | $frame.prev().find('.ui-dialog-title').text(title); |