Changeset 7285

Show
Ignore:
Timestamp:
02/11/07 22:56:11 (22 months ago)
Author:
jburke
Message:

(merge from 0.4 branch) References #2366. Get tree double-click to work, and add some protection to php script so it doesn't allow fetching any file from the server.

Location:
trunk/buildscripts
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/buildscripts/buildUtil.js

    r7281 r7285  
    292292        //Insert all the provide statements at the provide insertion marker. 
    293293        var provideString = ""; 
    294         for(var i = 0; i < provideList.length; i++){ 
    295                 provideString += 'dojo.provide("' + provideList[i] + '");' + lineSeparator; 
     294        if(provideList && provideList.length > 0){ 
     295                for(var i = 0; i < provideList.length; i++){ 
     296                        provideString += 'dojo.provide("' + provideList[i] + '");' + lineSeparator; 
     297                } 
    296298        } 
    297299        dojoContents = dojoContents.replace(/__DOJO_PROVIDE_INSERTION__/, provideString); 
  • trunk/buildscripts/makeDojoJsWeb.js

    r7275 r7285  
    1010 
    1111depList = depList.split(","); 
    12 provideList = provideList.split(","); 
     12 
     13//Check if there were no provideList (the caller can send string "null" 
     14//to indicate that the command line parameter is empty. We need some string 
     15//to make sure all the arguments are in the right spot. 
     16if(provideList == "null"){ 
     17        provideList = "[]"; 
     18}else{ 
     19        provideList = provideList.split(","); 
     20        provideList = '["' + provideList.join('","') + '"]'; 
     21} 
    1322 
    1423var dependencyResult; 
    15 eval('dependencyResult = {depList: ["' + depList.join('","') + '"], provideList: ["' + provideList.join('","') + '"]};'); 
     24eval('dependencyResult = {depList: ["' + depList.join('","') + '"], provideList: ' + provideList + '};'); 
    1625 
    17 //Load dojo (needed for string interning) 
    18 djConfig={ 
    19         baseRelativePath: "../" 
    20 }; 
    21 load('../dojo.js'); 
    22 dojo.require("dojo.string.extras"); 
    23  
    24 var contents = buildUtil.makeDojoJs(dependencyResult, version).dojoContents; 
    25  
    26 //Add copyright, and intern strings. 
    27 contents = new String(readFile("copyright.txt")) + buildUtil.interningRegexpMagic("xdomain", contents, djConfig.baseRelativePath, [["dojo", "src"]], [], true); 
    28  
    29 if(xdDojoUrl){ 
    30         contents = buildUtilXd.setXdDojoConfig(contents, xdDojoUrl); 
     26//Make sure we are dealing with JS files and that the paths are not outside 
     27//of the working area. Do this to discourage fetching arbitrary files from 
     28//the server. 
     29var deps = dependencyResult.depList; 
     30var isInputOk = true; 
     31for(var i = 0; i < deps.length; i++){ 
     32        var matches = deps[i].match(/\.\./g); 
     33        if((matches && matches.length > 1) || !deps[i].match(/\.js$/) || deps[i].indexOf(0) == '/'){ 
     34                print("Error: Invalid file set."); 
     35                isInputOk = false; 
     36                break; 
     37        } 
    3138} 
    3239 
    33 print(contents); 
     40if(isInputOk){ 
     41        //Load dojo (needed for string interning) 
     42        djConfig={ 
     43                baseRelativePath: "../" 
     44        }; 
     45        load('../dojo.js'); 
     46        dojo.require("dojo.string.extras"); 
     47         
     48        var contents = buildUtil.makeDojoJs(dependencyResult, version).dojoContents; 
     49         
     50        //Add copyright, and intern strings. 
     51        contents = new String(readFile("copyright.txt")) + buildUtil.interningRegexpMagic("xdomain", contents, djConfig.baseRelativePath, [["dojo", "src"]], [], true); 
     52         
     53        if(xdDojoUrl){ 
     54                contents = buildUtilXd.setXdDojoConfig(contents, xdDojoUrl); 
     55        } 
     56         
     57        print(contents); 
     58} 
  • trunk/buildscripts/webbuild/index.html

    r7281 r7285  
    159159        } 
    160160 
     161superMessage = null; 
     162        function onTreeSelect(message){ 
     163                //summary: event called when a tree node is selected. 
     164                //Adds item to module list for build. 
     165                superMessage = message; 
     166                var treeItem = message.node; 
     167                var moduleName = treeItem["dojoModuleName"]; 
     168                if(moduleName){ 
     169                        var existingDeps = getNormalizedDependencies(); 
     170                        var matchRegExp = new RegExp(moduleName.replace('"' + /\./g, "\\.").replace(/\*/g, "\\*") + '"(,|$)'); 
     171                        if(!existingDeps.match(matchRegExp)){ 
     172                                var depTextArea = dojo.byId("dependencyList"); 
     173                                var textValue = depTextArea.value; 
     174                                if(textValue && textValue.charAt(depTextArea.value.length - 1) != "\n"){ 
     175                                        textValue += "\n"; 
     176                                } 
     177                                depTextArea.value = textValue + moduleName + "\n"; 
     178                        } 
     179                } 
     180        } 
     181         
    161182        dojo.addOnLoad(function(){ 
    162183                startup(); 
     
    171192                var treeWidget = dojo.widget.createWidget("TreeV3", {listeners: [selector.widgetId, controller.widgetId]}); 
    172193 
    173                 dojo.event.topic.subscribe(selector.eventNames.select, this, "onTreeSelect") 
     194                dojo.event.topic.subscribe(selector.eventNames.dblselect, window, "onTreeSelect") 
    174195 
    175196                if(typeof treeData == "undefined"){ 
     
    207228        }); 
    208229         
    209         function startBuild(){ 
     230        function getNormalizedDependencies(){ 
    210231                var deps = dojo.byId('dependencyList').value.replace(/^\s+/, "").replace(/\s+$/, ""); 
    211232                 
     
    224245                        deps = goodParts.join(","); 
    225246                } 
    226                  
    227                 builderFrame.startBuild(deps, version, xdDojoUrl); 
     247                return deps;             
     248        } 
     249         
     250        function startBuild(){ 
     251                builderFrame.startBuild(getNormalizedDependencies(), version, xdDojoUrl); 
    228252        } 
    229253