Changeset 572
add iframeshom on modal window for IE
Apr 15 2008 * 15:23 (7 months ago)
Committed by seb
Affected files:
trunk/src/util/iframe_shim.js (Quick diff)
trunk/src/window/shadow.js (Quick diff)
trunk/src/window/window_manager.js (Quick diff)
trunk/test/functional/window/test_modal.html (Quick diff)
trunk/src/util/iframe_shim.js (Unified diff)
| r570 | r572 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | UI.IframeShim = Class.create(UI.Options, { |
| 28 | 28 | |
| 29 | options: { | |
| 30 | parent: document.body | |
| 31 | }, | |
| 32 | ||
| 29 | 33 | /* |
| 30 | 34 | Method: initialize |
| 31 | 35 | Constructor |
| --- | --- | |
| 37 | 41 | Returns: |
| 38 | 42 | this |
| 39 | 43 | */ |
| 40 | initialize: function() { | |
| 44 | initialize: function(options) { | |
| 45 | this.setOptions(options); | |
| 41 | 46 | this.element = new Element('iframe', { |
| 42 | 47 | style: 'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=1);', |
| 43 | 48 | src: 'javascript:false;', |
| 44 | 49 | frameborder: 0 |
| 45 | 50 | }); |
| 46 | $(document.body).insert(this.element); | |
| 51 | $(this.options.parent || document.body).insert(this.element); | |
| 47 | 52 | }, |
| 48 | 53 | |
| 49 | 54 | /* |
| --- | --- | |
| 104 | 109 | */ |
| 105 | 110 | setBounds: function(bounds) { |
| 106 | 111 | for (prop in bounds) { |
| 107 | bounds[prop] += 'px'; | |
| 112 | bounds[prop] = parseInt(bounds[prop]) + 'px'; | |
| 108 | 113 | } |
| 109 | 114 | this.element.setStyle(bounds); |
| 110 | 115 | return this; |
trunk/src/window/shadow.js (Unified diff)
| r570 | r572 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | if (this.options.shadow) |
| 50 | 50 | this.shadow = new UI.Shadow(this.element, {theme: this.getShadowTheme(), withIFrameShim: false}); |
| 51 | this.iframe = Prototype.Browser.IE ? new UI.IframeShim() : null; | |
| 51 | this.iframe = Prototype.Browser.IE || true ? new UI.IframeShim({parent: this.windowManager.container}) : null; | |
| 52 | 52 | }, |
| 53 | 53 | |
| 54 | 54 | addElementsWithShadow: function() { |
trunk/src/window/window_manager.js (Unified diff)
| r515 | r572 | |
|---|---|---|
| 149 | 149 | this.modalOverlay.setStyle("height: " + this.viewport.getHeight() + "px"); |
| 150 | 150 | |
| 151 | 151 | this.options.showOverlay(this.modalOverlay, {from: 0, to: this.modalOverlay.opacity}); |
| 152 | if (this.iframe) { | |
| 153 | this.iframe.setBounds({top: 0, left: 0, width: this.viewport.getWidth(), height: this.viewport.getHeight()}); | |
| 154 | this.iframe.show(); | |
| 155 | } | |
| 152 | 156 | } |
| 153 | 157 | this.modalOverlay.setStyle({ zIndex: win.zIndex - 1 }); |
| 154 | 158 | this.modalSessions++; |
| --- | --- | |
| 161 | 165 | } else { |
| 162 | 166 | this.resetOverflow(); |
| 163 | 167 | this.options.hideOverlay(this.modalOverlay, { from: this.modalOverlay.opacity, to: 0 }); |
| 168 | if (this.iframe) | |
| 169 | this.iframe.hide(); | |
| 164 | 170 | } |
| 165 | 171 | }, |
| 166 | 172 | |
| --- | --- | |
| 267 | 273 | createOverlays: function() { |
| 268 | 274 | this.modalOverlay = new Element("div", { style: this.overlayStyle }); |
| 269 | 275 | this.dragOverlay = new Element("div", { style: this.overlayStyle+"height: 100%" }); |
| 276 | this.iframe = Prototype.Browser.IE ? new UI.IframeShim() : null; | |
| 270 | 277 | }, |
| 271 | 278 | |
| 272 | 279 | focus: function(win) { |
trunk/test/functional/window/test_modal.html (Unified diff)
| r516 | r572 | |
|---|---|---|
| 24 | 24 | <div id="link2"><a href="#" onclick="openModalInDesktop(); return false;">Open modal window in desktop</a></div><br> |
| 25 | 25 | <div id="desktop" style="position: absolute; top: 10px; right: 10px; border: 1px solid black; width: 600px; height: 400px; overflow: auto"> |
| 26 | 26 | </div> |
| 27 | Add Select box for testing iFrameShim on IE<br/> | |
| 28 | <select> | |
| 29 | <option>option 1</option> | |
| 30 | <option>option 2</option> | |
| 31 | <option>option 3</option> | |
| 32 | </select> | |
| 33 | <br/> | |
| 34 | <select> | |
| 35 | <option>option 1</option> | |
| 36 | <option>option 2</option> | |
| 37 | <option>option 3</option> | |
| 38 | </select> | |
| 27 | 39 | <script type="text/javascript"> |
| 28 | 40 | //insertDebugControl(); |
| 29 | 41 | function runTest() { |
| --- | --- | |
| 34 | 46 | } |
| 35 | 47 | document.whenReady(runTest); |
| 36 | 48 | |
| 37 | var top = 10, left = 10; | |
| 49 | var pos = {top: 10, left: 10}; | |
| 38 | 50 | |
| 39 | 51 | function openModal() { |
| 40 | w = new UI.Window({shadow: true, top: top, left: left}); | |
| 41 | top += 20; | |
| 42 | left += 20; | |
| 52 | w = new UI.Window({shadow: true, top: pos.top, left: pos.left}); | |
| 53 | pos.top += 20; | |
| 54 | pos.left += 20; | |
| 43 | 55 | w.setContent($('link').innerHTML); |
| 44 | 56 | w.show(true).focus(); |
| 45 | w.observe("hidden", function() {top -= 20; left -= 20}) | |
| 57 | w.observe("hidden", function() {pos.top -= 20; pos.left -= 20}) | |
| 46 | 58 | } |
| 47 | 59 | |
| 48 | 60 | function openModalInDesktop() { |
| 49 | w = new UI.Window({shadow: true, top: top, left: left, windowManager: wm}); | |
| 50 | top += 20; | |
| 51 | left += 20; | |
| 61 | w = new UI.Window({shadow: true, top: pos.top, left: pos.left, windowManager: wm}); | |
| 62 | pos.top += 20; | |
| 63 | pos.left += 20; | |
| 52 | 64 | w.setContent($('link2').innerHTML); |
| 53 | 65 | w.show(true).focus(); |
| 54 | w.observe("hidden", function() {top -= 20; left -= 20}) | |
| 66 | w.observe("hidden", function() {pos.top -= 20; pos.left -= 20}) | |
| 55 | 67 | } |
| 56 | 68 | |
| 57 | 69 | </script> |


RSS feeds