| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <title>FileUploader TabContainer Test</title> |
| 5 | <link href="../../../dijit/themes/dijit.css" rel="stylesheet" /> |
| 6 | <link href="../../../dijit/themes/dijit.css" rel="stylesheet" /> |
| 7 | <link href="../../../dijit/themes/tundra/form/Button.css" rel="stylesheet" /> |
| 8 | <link href="../../../dijit/themes/tundra/Dialog.css" rel="stylesheet" /> |
| 9 | <link href="../../../dijit/themes/tundra/layout/TabContainer.css" rel="stylesheet" /> |
| 10 | <link href="../resources/FileUploader.css" rel="stylesheet" /> |
| 11 | <script> |
| 12 | djConfig = { |
| 13 | isDebug: true, |
| 14 | popup:true, |
| 15 | parseOnLoad: true |
| 16 | } |
| 17 | </script> |
| 18 | <script src="../../../dojo/dojo.js"></script> |
| 19 | <script> |
| 20 | dojo.require("dojo.parser"); |
| 21 | dojo.require("dojox.form.FileUploader"); |
| 22 | dojo.require("dijit.form.Button"); |
| 23 | dojo.require("dijit.Dialog"); |
| 24 | dojo.require("dijit.form.Form"); |
| 25 | dojo.require("dijit.layout.ContentPane"); |
| 26 | dojo.require("dijit.layout.TabContainer"); |
| 27 | |
| 28 | var fakeTab; |
| 29 | showFake = function(){ |
| 30 | dojo.style(fakeTab, "left", "0px"); |
| 31 | } |
| 32 | hideFake = function(){ |
| 33 | dojo.style(fakeTab, "left", "-2000px"); |
| 34 | } |
| 35 | dojo.addOnLoad(function(){ |
| 36 | var tab = dijit.byId("tab3"); |
| 37 | fakeTab = dojo.byId("fakeTab"); |
| 38 | hideFake(); |
| 39 | dojo.connect(tab, "onShow", showFake); |
| 40 | dojo.connect(tab, "onHide", hideFake); |
| 41 | }); |
| 42 | |
| 43 | |
| 44 | </script> |
| 45 | <style> |
| 46 | html{ |
| 47 | height:100%; |
| 48 | } |
| 49 | body{ |
| 50 | font-family:sans-serif; |
| 51 | font-size:12px; |
| 52 | height:100%; |
| 53 | } |
| 54 | #tabs{ |
| 55 | width:60%; |
| 56 | height:250px; |
| 57 | margin:0px 20%; |
| 58 | } |
| 59 | .dijitContentPane{ |
| 60 | padding:10px; |
| 61 | } |
| 62 | table td{ |
| 63 | width:33%; |
| 64 | vertical-align:top; |
| 65 | } |
| 66 | .scrolls{ |
| 67 | width:100%; |
| 68 | height:75px; |
| 69 | overflow-y:scroll; |
| 70 | position:relative; |
| 71 | } |
| 72 | .note{ |
| 73 | font-size:11px; |
| 74 | font-family:sans-serif; |
| 75 | color:#666; |
| 76 | width:400px; |
| 77 | margin-top:15px; |
| 78 | } |
| 79 | .note.nw{ |
| 80 | width:auto !important; |
| 81 | } |
| 82 | h3{ |
| 83 | width:600px; |
| 84 | font-weight:normal; |
| 85 | font-size:14px; |
| 86 | } |
| 87 | .formContent{ |
| 88 | width:300px; |
| 89 | height:150px; |
| 90 | } |
| 91 | |
| 92 | #myDialog #dialogContentPane{ |
| 93 | width:400px; |
| 94 | height:200px; |
| 95 | |
| 96 | } |
| 97 | #fakeTab{ |
| 98 | position:absolute; |
| 99 | left:0px; |
| 100 | top:125px; |
| 101 | width:60%; |
| 102 | height:250px; |
| 103 | margin:0px 20%; |
| 104 | padding:15px; |
| 105 | } |
| 106 | </style> |
| 107 | |
| 108 | |
| 109 | </head> |
| 110 | <body class="tundra"> |
| 111 | <h1>FileUploader TabContainer Test</h1> |
| 112 | <h3> |
| 113 | Testing that FileUploader works in Tabs initially shown and initially hidden. |
| 114 | <strong>See important node below</strong> |
| 115 | </h3> |
| 116 | |
| 117 | <div id="tabs" dojoType="dijit.layout.TabContainer" persist="false" tabStrip="true"> |
| 118 | <div id="tab1" dojoType="dijit.layout.ContentPane" title="Tab 1"> |
| 119 | <button isDebug="false" devMode="false" dojoType="dojox.form.FileUploader">Tab #1 Flash</button> |
| 120 | <button isDebug="false" devMode="false" force="html" dojoType="dojox.form.FileUploader">Tab #1 HTML</button> |
| 121 | </div> |
| 122 | <div id="tab2" dojoType="dijit.layout.ContentPane" title="Tab 2"> |
| 123 | <button isDebug="false" devMode="false" dojoType="dojox.form.FileUploader">Tab #2 Flash</button> |
| 124 | <button isDebug="false" devMode="false" force="html" dojoType="dojox.form.FileUploader">Tab #2 HTML</button> |
| 125 | </div> |
| 126 | <div id="tab3" dojoType="dijit.layout.ContentPane" title="Tab 3"> |
| 127 | </div> |
| 128 | </div> |
| 129 | |
| 130 | <div id="fakeTab"> |
| 131 | <button isDebug="false" devMode="false" dojoType="dojox.form.FileUploader">Tab #3 Flash</button> |
| 132 | <button isDebug="false" devMode="false" force="html" dojoType="dojox.form.FileUploader">Tab #3 HTML</button> |
| 133 | </div> |
| 134 | |
| 135 | <p style="font-size:12px; border:2px solid #ff0000; padding:3px;"> |
| 136 | <strong>NOTE:</strong> This test shows FileUploader successfully being created in TabContainers, <strong>BUT</strong> |
| 137 | there is a serious limitation in the Flash version for Firefox and Safari. When a node in those browsers is hidden |
| 138 | (or essentially repainted which can mean other style applications) the SWF is reloaded. This means that if you browse |
| 139 | for a file but don't upload upload it, change the tab and return, the files will no longer be in the FileUploader. |
| 140 | This problem can be seen when tabbing between Tab 1 and Tab 2 and observing the console logs and you will see the |
| 141 | SWF reinitializes. This problem does not exist in Internet Explorer. The HTML version of the Uploader should also |
| 142 | work fine. |
| 143 | <br/><br/> |
| 144 | This test also shows work around for the problem. View source of this test and see that in Tab 3, the FileUploader |
| 145 | is in a separate div floating over the TabContainer. When Tab #3 is shown and hidden, the div is moved off and on screen. |
| 146 | </p> |
| 147 | </body> |
| 148 | </html> |