| 1 | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 2 | | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | | |
| 4 | | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | | <head> |
| 6 | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 7 | | |
| 8 | | <title>Dojo Builder Prototype</title> |
| 9 | | <style type="text/css"> |
| 10 | | #builderFrame { |
| 11 | | visibility: hidden; |
| 12 | | } |
| | 1 | <html> |
| | 2 | <style type="text/css"> |
| | 3 | |
| | 4 | BODY { background-color: #e8dcc1; } |
| | 5 | |
| | 6 | |
| | 7 | LABEL { cursor:pointer; user-select:none; -moz-user-select:none; } |
| | 8 | |
| | 9 | |
| | 10 | INPUT, |
| | 11 | TEXTAREA, |
| | 12 | .insetBorder { |
| | 13 | border:1px solid; border-color:#746e61 #f8f5ec #f8f5ec#746e61; |
| | 14 | background:#fefdfc; |
| | 15 | } |
| | 16 | |
| | 17 | H2, |
| | 18 | SELECT, |
| | 19 | BUTTON, |
| | 20 | .outsetBorder { |
| | 21 | border:1px solid; border-color:#f8f5ec #746e61 #746e61 #f8f5ec; |
| | 22 | background:#fefdfc; |
| | 23 | } |
| | 24 | |
| | 25 | H2 { color:white; border-width:2px; background:#46423a; padding:10px;} |
| | 26 | |
| | 27 | |
| | 28 | BUTTON, |
| | 29 | SELECT { background:#d1c6ae; } |
| | 30 | |
| | 31 | |
| | 32 | #outerTable { width:700px; } |
| | 33 | |
| | 34 | .emphasize { font-weight:bold; } |
| | 35 | |
| | 36 | |
| | 37 | .labelRow { |
| | 38 | background-color:#aea591; padding:0px; |
| | 39 | cursor:pointer; user-select:none; -moz-user-select:none; |
| | 40 | } |
| | 41 | |
| | 42 | .labelRow_table { table-layout:fixed; } |
| | 43 | .labelRow_toggler { width:2em; text-align:center; } |
| | 44 | .labelRow_title { width:10em; color:#46423a; font-weight:bold; font-size:120%; vertical-align:top; padding-right:3px; } |
| | 45 | .labelRow_values { width:100%; color:white; } |
| | 46 | |
| | 47 | .toggler { |
| | 48 | border:1px outset #46423a; |
| | 49 | color:black; background-color:white; |
| | 50 | cursor:pointer; |
| | 51 | width:16px; line-height:16px; |
| | 52 | margin-left:5px; margin-right:5px; |
| | 53 | } |
| | 54 | |
| | 55 | .rowSpacer { height:5px; line-height:5px; } |
| | 56 | .colSpacer { width:3em; } |
| | 57 | |
| | 58 | .rowLabel { color:#46423a; vertical-align:top; } |
| | 59 | .overLabel { color:#46423a; font-size:75%; text-align:center; } |
| | 60 | .underLabel { color:#46423a; font-size:75%; text-align:center; } |
| | 61 | .note { color:#46423a; font-size:75%; } |
| | 62 | |
| | 63 | .radio {} |
| | 64 | .radioLabel { user-select:none; -moz-user-select:none; } |
| | 65 | |
| | 66 | .field {} |
| | 67 | .fieldLabel { color:#46423a; } |
| | 68 | |
| | 69 | .button {} |
| | 70 | |
| | 71 | .check { text-align:right; vertical-align:top;} |
| | 72 | .checkLabel { |
| | 73 | color:#46423a; vertical-align:top; padding-top:3px; |
| | 74 | } |
| | 75 | |
| | 76 | |
| | 77 | .customName { width:10em; } |
| | 78 | .customLocation { width:30em; } |
| | 79 | |
| | 80 | #version { font-size:50%; font-weight:normal; padding-left:5px;} |
| | 81 | |
| | 82 | #dependencyList { width:100%; height:200px; |
| | 83 | border:1px inset #46423a; |
| | 84 | } |
| | 85 | #treeContainer { width:100%; height:200px; |
| | 86 | font-family:monospace; |
| | 87 | border:1px outset #46423a; |
| | 88 | position:relative; |
| | 89 | background: #fefdfc; |
| | 90 | overflow:auto; |
| | 91 | } |
| | 92 | |
| | 93 | #buildit { font-size:150%; font-weight:bold;padding:5px 20px 5px 20px; } |
| | 94 | |
| | 95 | |
| | 96 | #xdDojoUrlDisplay {} |
| | 97 | #xdDojoUrl { font-weight:bold; } |
| | 98 | |
| | 99 | </style> |
| | 100 | <script type="text/javascript"> |
| | 101 | djConfig = { |
| | 102 | isDebug: true, |
| | 103 | baseRelativePath: "../../" |
| | 104 | }; |
| | 105 | </script> |
| | 106 | <script src="../../dojo.js" type="text/javascript"></script> |
| | 107 | <script type="text/javascript" src="treeData.js"></script> |
| | 108 | <script type="text/javascript"> |
| | 109 | dojo.require("dojo.widget.TreeV3"); |
| | 110 | dojo.require("dojo.widget.TreeNodeV3"); |
| | 111 | dojo.require("dojo.widget.TreeBasicControllerV3"); |
| | 112 | dojo.require("dojo.widget.TreeSelectorV3"); |
| | 113 | dojo.require("dojo.widget.TreeEmphasizeOnSelect"); |
| | 114 | dojo.require("dojo.html.iframe"); |
| | 115 | |
| | 116 | //assign output node on load. |
| | 117 | outputNode = null; |
| | 118 | function output(message){ |
| | 119 | outputNode.innerHTML += message + "<br />"; |
| | 120 | } |
| | 121 | |
| | 122 | function clearOutput(){ |
| | 123 | outputNode.innerHTML = ""; |
| | 124 | } |
| | 125 | |
| | 126 | function sendDependencyResultToServer(dependencyResult){ |
| | 127 | clearOutput(); |
| | 128 | |
| | 129 | var depListForm = document.depListForm; |
| | 130 | depListForm.action = "../webbuild.php"; |
| | 131 | depListForm.depList.value = dependencyResult.depList.join(","); |
| | 132 | depListForm.provideList.value = dependencyResult.provideList && dependencyResult.provideList.length > 0 ? dependencyResult.provideList.join(",") : "null"; |
| | 133 | depListForm.version.value = version; |
| | 134 | depListForm.xdDojoUrl.value = xdDojoUrl; |
| | 135 | |
| | 136 | //reset the hidden frame so we can do another build. |
| | 137 | setTimeout(function(){ |
| | 138 | dojo.html.iframeContentWindow(dojo.byId("builderFrame")).location = "../webbuild.html?random=" + (new Date()).getTime(); |
| | 139 | }, 1000); |
| | 140 | |
| | 141 | |
| | 142 | //Print out the list of modules included. |
| | 143 | output("<b>Files included in the build:<\/b>"); |
| | 144 | for(var i = 0; i < dependencyResult.depList.length; i++){ |
| | 145 | output(dependencyResult.depList[i]); |
| | 146 | } |
| | 147 | output("<br /><b>Modules included in the build:<\/b>"); |
| | 148 | if(!dependencyResult.provideList || dependencyResult.provideList.length == 0){ |
| | 149 | output("[no modules included in the build]"); |
| | 150 | }else{ |
| | 151 | var provideList = dependencyResult.provideList.sort(); |
| | 152 | for(var i = 0; i < provideList.length; i++){ |
| | 153 | output(provideList[i]); |
| | 154 | } |
| | 155 | } |
| | 156 | |
| | 157 | //Submit form to generate custom dojo.js file. |
| | 158 | depListForm.submit(); |
| | 159 | } |
| | 160 | |
| | 161 | dojo.addOnLoad(function(){ |
| | 162 | startup(); |
| 14 | | #treeContainer, #buildControls, #output { |
| 15 | | float: left; |
| 16 | | } |
| 17 | | |
| 18 | | #xdDojoUrlDisplay { |
| 19 | | display: none; |
| 20 | | } |
| 21 | | </style> |
| 22 | | <script type="text/javascript"> |
| 23 | | djConfig = { |
| 24 | | isDebug: true, |
| 25 | | baseRelativePath: "../../", |
| 26 | | debugContainerId: "output" |
| 27 | | }; |
| 28 | | </script> |
| 29 | | <script src="../../dojo.js" type="text/javascript"></script> |
| 30 | | <script type="text/javascript" src="treeData.js"></script> |
| 31 | | <script type="text/javascript"> |
| 32 | | dojo.require("dojo.widget.TreeV3"); |
| 33 | | dojo.require("dojo.widget.TreeNodeV3"); |
| 34 | | dojo.require("dojo.widget.TreeBasicControllerV3"); |
| 35 | | dojo.require("dojo.widget.TreeSelectorV3"); |
| 36 | | dojo.require("dojo.widget.TreeEmphasizeOnSelect"); |
| 37 | | dojo.require("dojo.html.iframe"); |
| 38 | | |
| 39 | | function output(message){ |
| 40 | | dojo.debug(message); |
| 41 | | } |
| 42 | | |
| 43 | | function sendDependencyResultToServer(dependencyResult){ |
| 44 | | var depListForm = document.depListForm; |
| 45 | | depListForm.action = "../webbuild.php"; |
| 46 | | depListForm.depList.value = dependencyResult.depList.join(","); |
| 47 | | depListForm.provideList.value = dependencyResult.provideList && dependencyResult.provideList.length > 0 ? dependencyResult.provideList.join(",") : "null"; |
| 48 | | depListForm.version.value = version; |
| 49 | | depListForm.xdDojoUrl.value = xdDojoUrl; |
| 50 | | |
| 51 | | //reset the hidden frame so we can do another build. |
| 52 | | setTimeout(function(){ |
| 53 | | dojo.html.iframeContentWindow(dojo.byId("builderFrame")).location = "../webbuild.html?random=" + (new Date()).getTime(); |
| 54 | | }, 1000); |
| 55 | | |
| 56 | | |
| 57 | | //Print out the list of modules included. |
| 58 | | dojo.debug("Files included in the build:"); |
| 59 | | for(var i = 0; i < dependencyResult.depList.length; i++){ |
| 60 | | output(dependencyResult.depList[i]); |
| 61 | | } |
| 62 | | dojo.debug("Modules included in the build:"); |
| 63 | | if(!dependencyResult.provideList || dependencyResult.provideList.length == 0){ |
| 64 | | dojo.debug("[no modules included in the build]"); |
| 65 | | }else{ |
| 66 | | var provideList = dependencyResult.provideList.sort(); |
| 67 | | for(var i = 0; i < provideList.length; i++){ |
| 68 | | output(provideList[i]); |
| | 164 | outputNode = dojo.byId("output"); |
| | 165 | clearOutput(); |
| | 166 | |
| | 167 | // create the tree and controller |
| | 168 | var controller = dojo.widget.createWidget("TreeBasicControllerV3"); |
| | 169 | var selector = dojo.widget.createWidget("TreeSelectorV3"); |
| | 170 | var hiliter = dojo.widget.createWidget("TreeEmphasizeOnSelect", {selector:selector.widgetId}); |
| | 171 | var treeWidget = dojo.widget.createWidget("TreeV3", {listeners: [selector.widgetId, controller.widgetId]}); |
| | 172 | |
| | 173 | dojo.event.topic.subscribe(selector.eventNames.select, this, "onTreeSelect") |
| | 174 | |
| | 175 | if(typeof treeData == "undefined"){ |
| | 176 | alert("Please run webbuild/makeWebBuildModuleList.js to generate list of modules:\n" |
| | 177 | + "cd to webbuild directory and run this command:\n\n" |
| | 178 | + "java -jar ../lib/custom_rhino.jar makeWebBuildModuleList.js ../../src treeData.js"); |
| | 179 | }else{ |
| | 180 | treeWidget.setChildren(treeData.children); |
| | 181 | // expand the tree to the first level |
| | 182 | controller.expandToLevel(treeWidget, 1); |
| | 183 | |
| | 184 | // after expanding, set things up so it'll wipe up and down when opened |
| | 185 | //BUG:TREE there is a bug in the tree with the wipe toggle where it doesn't reset the height properly on closing |
| | 186 | // treeWidget.toggleObj = dojo.lfx.toggle.wipe; |
| | 187 | var treeContainerNode = dojo.byId("treeContainer"); |
| | 188 | treeContainerNode.innerHTML = ""; |
| | 189 | treeContainerNode.appendChild(treeWidget.domNode); |
| | 190 | } |
| | 191 | |
| | 192 | //Set up XD Dojo URL if available. |
| | 193 | xdDojoUrl = "@XD_DOJO_URL@"; |
| | 194 | if(xdDojoUrl != ("@" + "XD_DOJO_URL" + "@")){ |
| | 195 | dojo.byId("xdDojoUrl").innerHTML = xdDojoUrl; |
| | 196 | dojo.byId("xdDojoUrlDisplay").style.display = "block"; |
| | 197 | }else{ |
| | 198 | xdDojoUrl = ""; |
| | 199 | } |
| | 200 | |
| | 201 | version = "@VERSION@"; |
| | 202 | if(xdDojoUrl == ("@" + "VERSION" + "@")){ |
| | 203 | version = ""; |
| | 204 | } |
| | 205 | |
| | 206 | loadProfile(); |
| | 207 | }); |
| | 208 | |
| | 209 | function startBuild(){ |
| | 210 | var deps = dojo.byId('dependencyList').value.replace(/^\s+/, "").replace(/\s+$/, ""); |
| | 211 | |
| | 212 | //Normalize dependencies. |
| | 213 | if(deps){ |
| | 214 | var parts = deps.split(/\n|\r\n|,/); |
| | 215 | |
| | 216 | var goodParts = []; |
| | 217 | for(var i = parts.length - 1; i >= 0; i--){ |
| | 218 | if(parts[i]){ |
| | 219 | var subParts = parts[i].match(/\s*("|')?([^"']*)("|')?\s*/); |
| | 220 | goodParts.push('"' + subParts[2] + '"'); |
| 71 | | |
| 72 | | //Submit form to generate custom dojo.js file. |
| 73 | | depListForm.submit(); |
| 74 | | } |
| 75 | | |
| 76 | | dojo.addOnLoad(function(){ |
| 77 | | // create the tree and controller |
| 78 | | var controller = dojo.widget.createWidget("TreeBasicControllerV3"); |
| 79 | | var selector = dojo.widget.createWidget("TreeSelectorV3"); |
| 80 | | var hiliter = dojo.widget.createWidget("TreeEmphasizeOnSelect", {selector:selector.widgetId}); |
| 81 | | var treeWidget = dojo.widget.createWidget("TreeV3", {listeners: [selector.widgetId, controller.widgetId]}); |
| 82 | | |
| 83 | | dojo.event.topic.subscribe(selector.eventNames.select, this, "onTreeSelect") |
| 84 | | |
| 85 | | if(typeof treeData == "undefined"){ |
| 86 | | alert("Please run webbuild/makeWebBuildModuleList.js to generate list of modules:\n" |
| 87 | | + "cd to webbuild directory and run this command:\n\n" |
| 88 | | + "java -jar ../lib/custom_rhino.jar makeWebBuildModuleList.js ../../src treeData.js"); |
| 89 | | }else{ |
| 90 | | treeWidget.setChildren(treeData.children); |
| 91 | | // expand the tree to the first level |
| 92 | | controller.expandToLevel(treeWidget, 1); |
| | 223 | |
| | 224 | deps = goodParts.join(","); |
| | 225 | } |
| 94 | | // after expanding, set things up so it'll wipe up and down when opened |
| 95 | | //BUG:TREE there is a bug in the tree with the wipe toggle where it doesn't reset the height properly on closing |
| 96 | | // treeWidget.toggleObj = dojo.lfx.toggle.wipe; |
| 97 | | var treeContainerNode = dojo.byId("treeContainer"); |
| 98 | | treeContainerNode.innerHTML = ""; |
| 99 | | treeContainerNode.appendChild(treeWidget.domNode); |
| | 227 | builderFrame.startBuild(deps, version, xdDojoUrl); |
| | 228 | } |
| | 229 | |
| | 230 | </script> |
| | 231 | |
| | 232 | <script language="javascript"> |
| | 233 | |
| | 234 | function byId(it) { |
| | 235 | return (typeof it == "string" ? document.getElementById(it) : it); |
| | 236 | } |
| | 237 | |
| | 238 | function cookie(name, value) { |
| | 239 | if (value == null) { |
| | 240 | var idx = document.cookie.lastIndexOf(name+'='); |
| | 241 | if(idx == -1) { return null; } |
| | 242 | var value = document.cookie.substring(idx+name.length+1); |
| | 243 | var end = value.indexOf(';'); |
| | 244 | if(end == -1) { end = value.length; } |
| | 245 | value = value.substring(0, end); |
| | 246 | return value; //String |
| | 247 | } else { |
| | 248 | value = escape(value); |
| | 249 | document.cookie = name + "=" + value + ";" |
| | 250 | } |
| | 251 | } |
| | 252 | |
| | 253 | |
| | 254 | function toggleRow(rowName, state) { |
| | 255 | if (state == null) { |
| | 256 | var row = byId(rowName); |
| | 257 | state = (row.style.display == "none"); |
| | 258 | } |
| | 259 | if (state) { |
| | 260 | showRow(rowName); |
| | 261 | } else { |
| | 262 | hideRow(rowName); |
| | 263 | } |
| | 264 | } |
| | 265 | |
| | 266 | function showRow(rowName) { |
| | 267 | var row = byId(rowName); |
| | 268 | row.style.display = (document.all ? "block" : "table-row"); |
| | 269 | var toggler = byId(row.id+"_toggler"); |
| | 270 | if (toggler) toggler.innerHTML = "–"; |
| | 271 | cookie(row.id, "true"); |
| | 272 | } |
| | 273 | |
| | 274 | function hideRow(rowName) { |
| | 275 | var row = byId(rowName); |
| | 276 | row.style.display = "none"; |
| | 277 | var toggler = byId(row.id+"_toggler"); |
| | 278 | if (toggler) toggler.innerHTML = "+"; |
| | 279 | cookie(row.id, "false"); |
| | 280 | } |
| | 281 | |
| | 282 | |
| | 283 | |
| | 284 | // this is pretty ghetto -- only handles up to 10 custom rows |
| | 285 | function addCustomRow(){ |
| | 286 | for (var i = 0; i < 100; i++) { |
| | 287 | var row = byId("customRow_"+i); |
| | 288 | if (row && row.style.display == "none") { |
| | 289 | showRow(row); |
| | 290 | break; |
| | 291 | } |
| | 292 | } |
| | 293 | } |
| | 294 | |
| | 295 | function showLoadButton(clicked) { |
| | 296 | byId("existingProfile_button_cell").style.display = (clicked == "existing" ? "block" : "none"); |
| | 297 | byId("fileProfile_button_cell").style.display = (clicked == "file" ? "block" : "none"); |
| | 298 | } |
| | 299 | |
| | 300 | function startup() { |
| | 301 | showLoadButton("none"); |
| | 302 | toggleRow("startRow", cookie("startRow") != "false"); |
| | 303 | //toggleRow("environmentRow", cookie("environmentRow") == "true"); |
| | 304 | toggleRow("moduleRow", cookie("moduleRow") == "true"); |
| | 305 | toggleRow("dependencyRow", cookie("dependencyRow") != "false"); |
| | 306 | //toggleRow("optionsRow", cookie("optionsRow") != "false"); |
| | 307 | } |
| | 308 | |
| | 309 | function clearProfile(){ |
| | 310 | dojo.byId("startRow_Choice").innerHTML = "(empty)"; |
| | 311 | dojo.byId("dependencyList").value = ""; |
| | 312 | } |
| | 313 | |
| | 314 | function loadProfile(){ |
| | 315 | //Get selected item name. |
| | 316 | var profileName = dojo.byId("profileSelection").options[dojo.byId("profileSelection").selectedIndex].text; |
| | 317 | |
| | 318 | //Show selected name |
| | 319 | dojo.byId("startRow_Choice").innerHTML = "empty"; |
| | 320 | |
| | 321 | //Load the selected profile. |
| | 322 | dojo.io.bind({ |
| | 323 | url: "../profiles/" + profileName + ".profile.js", |
| | 324 | mimetype: "text/plain", |
| | 325 | handle: function(type, data, kwArgs, transportImpl){ |
| | 326 | if(type != "load"){ |
| | 327 | alert("There was an error loading the " + profileName + " profile."); |
| | 328 | return; |
| 122 | | <h2>Dojo Builder (experimental, prototype)</h2> |
| 123 | | <p> |
| 124 | | For Dojo version: @VERSION@ |
| 125 | | </p> |
| 126 | | <div id="treeContainer"> |
| 127 | | |
| 128 | | </div> |
| 129 | | <div id="buildControls"> |
| 130 | | <p id="xdDojoUrlDisplay"> |
| 131 | | <b>XDomain Dojo path:</b><br /> |
| 132 | | <span id="xdDojoUrl"></span> |
| 133 | | </p> |
| 134 | | <p> |
| 135 | | <b>Modules to include in build (comma-separated list):</b><br /> |
| 136 | | <textarea id="dependencyList" cols="40" rows="20"> |
| 137 | | "dojo.io.*", |
| 138 | | "dojo.io.BrowserIO", |
| 139 | | "dojo.event.*", |
| 140 | | "dojo.lfx.*" |
| 141 | | </textarea> |
| 142 | | </p> |
| 143 | | <p> |
| 144 | | <button onclick="builderFrame.startBuild(dojo.byId('dependencyList').value, version, xdDojoUrl)">Go</button> |
| 145 | | </p> |
| 146 | | </div> |
| 147 | | |
| 148 | | <div id="output"> |
| 149 | | |
| 150 | | </div> |
| 151 | | |
| 152 | | <form name="depListForm" action="" method="POST"> |
| 153 | | <input type="hidden" name="depList" value="" /> |
| 154 | | <input type="hidden" name="provideList" value="" /> |
| 155 | | <input type="hidden" name="version" value="" /> |
| 156 | | <input type="hidden" name="compress" value="false" /> |
| 157 | | <input type="hidden" name="xdDojoUrl" value="" /> |
| 158 | | </form> |
| 159 | | |
| 160 | | <iframe id="builderFrame" name="builderFrame" src="../webbuild.html" style="visibility: hidden"></iframe> |
| | 352 | <form name="masterForm" onsubmit="return false"> |
| | 353 | |
| | 354 | <table id="outerTable"> |
| | 355 | <tr><td colspan=3><h2>Dojo Builder (highly experimental) |
| | 356 | <div id="version">for version @VERSION@</div> |
| | 357 | </h2></td></tr> |
| | 358 | <tr><td colspan=3 class="labelRow outsetBorder" id="startRow_label" onclick="toggleRow('startRow')"> |
| | 359 | <table class="labelRow_table" width=100% cellpadding=1><tr> |
| | 360 |