### Eclipse Workspace Patch 1.0 #P Custom Builder2 Index: infusion-builder/js/customBuild.js =================================================================== --- infusion-builder/js/customBuild.js (revision 8597) +++ infusion-builder/js/customBuild.js (working copy) @@ -10,11 +10,9 @@ */ /*global jQuery*/ -/*global fluid_1_1*/ +/*global fluid*/ -fluid_1_1 = fluid_1_1 || {}; - -(function ($, fluid) { +(function ($) { var UNSELECTED = 0; //a 'constant' value representing an unselected module @@ -190,7 +188,7 @@ idMap: that.idMap }; - fluid.selfRender(that.locate("formControls"), generatedTree(that), renderOptions); + fluid.selfRender(that.locate("compressionControls"), generatedTree(that), renderOptions); }; /** @@ -393,6 +391,11 @@ typeSelections: that.options.model.typeInfo[0].typeValue || "", moduleSelections: [] }; + + that.applier = fluid.makeChangeApplier(that.model); + that.idMap = {}; + that.moduleValues = extractArray(that.options.model.moduleInfo, "moduleValue"); + moduleNames = createModuleNamesObject(that.options.model); }; /** @@ -473,6 +476,19 @@ that.locate("moduleSelections").html(modulesSelectedString); }; + var updateHiddenFormWithSelections = function (that) { + //sets the hidden form inputs to the user selection to be posted back to the server. + that.locate("moduleSelections").val(that.model.moduleSelections); + that.locate("typeSelections").val(that.model.typeSelections); + + // Enable or disable the download button depending on how many selections have been made. + if (that.model.moduleSelections.length > 0) { + that.locate("downloadButton").removeAttr("disabled"); + } else { + that.locate("downloadButton").attr("disabled", "disabled"); + } + }; + /** * Sets up the event handlers for listeners. * @@ -480,6 +496,14 @@ */ var bindEventHandlers = function (that) { that.events.afterModuleSelectionsChanged.addListener(updateSelectedModules); + that.events.afterModelChange.addListener(updateHiddenFormWithSelections); + + setupQuickSelect(that); + + that.locate("downloadButton").click(function () { + that.locate("controls").hide(); + that.locate("downloadMessage").show(); + }); }; /** @@ -489,14 +513,8 @@ */ var setupCustomBuilder = function (that) { setupModel(that); - setupQuickSelect(that); addAria(that); - that.applier = fluid.makeChangeApplier(that.model); - that.idMap = {}; - that.moduleValues = extractArray(that.options.model.moduleInfo, "moduleValue"); - moduleNames = createModuleNamesObject(that.options.model); bindEventHandlers(that); - initSelectionCounter(that); renderModules(that); renderDownloadTypeControls(that); @@ -576,13 +594,20 @@ moduleInputLabel: ".flc-customBuild-inputLabel", moduleDescription: ".flc-customBuild-moduleDescription", - formControls: ".flc-customBuild-formControls", + compressionControls: ".flc-customBuild-compressionControls", selectionModifier: ".flc-customBuild-selectionModifier", selectionModifierInput: "#flc-customBuild-selectionModifierInput", selectionModifierLabel: ".flc-customBuild-selectionModifierLabel", checkAll: ".flc-customBuild-checkAll", - unCheckAll: ".flc-customBuild-unCheckAll" + unCheckAll: ".flc-customBuild-unCheckAll", + + controls: ".flc-customBuild-downloadControls", + downloadMessage: ".flc-customBuild-downloadMsg", + downloadButton: ".flc-customBuild-downloadButton", + + moduleSelections: "#moduleSelections", + typeSelections: "#typeSelections" }, strings: {}, @@ -594,7 +619,7 @@ afterModelChange: null, afterModuleSelectionsChanged: null }, - + // TODO: Delete me! model: { groupInfo: [ { @@ -628,4 +653,4 @@ markSelection: fluid.customBuild.updateItemAndDependencies, unmarkSelection: fluid.customBuild.updateItemAndDependencies }); -})(jQuery, fluid_1_1); +})(jQuery); Index: infusion-builder/html/CustomBuild.html =================================================================== --- infusion-builder/html/CustomBuild.html (revision 8597) +++ infusion-builder/html/CustomBuild.html (working copy) @@ -22,81 +22,86 @@ - - +
-

Build your own Infusion download

-

This page allows you to select which modules of the Fluid Infusion - software you would like to download. Your selections will be packaged - into a custom .zip file for downloading. Note: Some - of the modules require other modules to function, so any dependent - modules will also be automatically selected (even if you uncheck them). - If you need exact control over your build, see Creating a - Fluid Custom Build.

-
-
-
-

Group Name

- Group description -
    -
  1. - - -
    - This is the module's description -
    -
  2. -
+ +
+

Build your own Infusion download

+

This page allows you to select which modules of the Fluid Infusion + software you would like to download. Your selections will be packaged + into a custom .zip file for downloading. Note: Some + of the modules require other modules to function, so any dependent + modules will also be automatically selected (even if you uncheck them). + If you need exact control over your build, see Creating a + Fluid Custom Build.

+
+
+
+

Group Name

+ Group description +
    +
  1. + + +
    + This is the module's description +
    +
  2. +
+
-
-
-

Download Options

- - - - - -
- - - -
+
+

Download Options

+ + + + + + + + +
+ + + +
+
+ +
Modules Selected: none
+ + +
+

Download Fluid Infusion

+

Preparing your download...

-
Modules Selected: none
- +

Thank you for your interest in the Infusion Framework.

+

You might find the following links useful with your shiny new power-tools:

+
    +
  1. Report bugs
  2. +
  3. Documentation and API
  4. +
  5. Component status pages
  6. +
+ +
- -
-

Download Fluid Infusion

-

Preparing your download...

- -

Thank you for your interest in the Infusion Framework.

-

You might find the following links useful with your shiny new power-tools:

-
    -
  1. Report bugs
  2. -
  3. Documentation and API
  4. -
  5. Component status pages
  6. -
- -
Property changes on: . ___________________________________________________________________ Modified: svn:externals - infusion-builder/infusion https://source.fluidproject.org/svn/fluid/infusion/tags/fluid-1.1.2/ + infusion-builder/infusion https://source.fluidproject.org/svn/fluid/infusion/trunk Index: infusion-builder/js/builder.js =================================================================== --- infusion-builder/js/builder.js (revision 8597) +++ infusion-builder/js/builder.js (working copy) @@ -1,86 +0,0 @@ -/* - Copyright 2008-2009 University of Toronto - - Licensed under the Educational Community License (ECL), Version 2.0 or the New - BSD license. You may not use this file except in compliance with one these - Licenses. - - You may obtain a copy of the ECL 2.0 License and BSD License at - https://source.fluidproject.org/svn/LICENSE.txt - - */ -/*global jQuery, fluid*/ - -fluid = fluid || {}; -fluid.customBuild = fluid.customBuild || {}; -fluid.customBuild.demo = fluid.customBuild.demo || {}; - -/** - * A demo function to illustrate how one might add the customBuild component to a website. - * How to use this function can be seen in action in /html/CustomBuild.html - * - * Some key concepts: - * A form with hidden inputs is being used as the mechanism to maintain the data structures representing - * selected modules and the desired download file type. A submit button with id=testButton within the form - * is used to submit these hidden values to server side code which runs the build and returns the custom build - * infusion zip file. - * - * There are other techniques which could have been used to keep track of the model data and - * submit it to the server side code to start the build and download process. We decided to - * leave the techniques up to the user instead of hard coding this code into the component. - * - * @param {Object} container - the container used to instantiate customBuild - * (a selector representing the components container) - * @param {Object} options - the options data structure used to instantiate customBuild - * (the options to be passed in to the component) - * - */ - -var builderInit = function (container) { - - //instantiate instance of customBuild component - var options = fluid.customBuild.dependencies || fluid.customBuild.demo.completeFluidInfusionData; - var builder = fluid.customBuild(container, options); - - //add click handler to 'download' button - var testButton = jQuery(".testButton"); - testButton.click(function () { - jQuery("#customBuild").hide(); - jQuery(".fl-customBuild-download").show(); - }); - - /** - * a function which changes the input value attribute for - * the two hidden form elements which are storing the model data - */ - var updateFormValues = function () { - //sets the value attribute on the input element with id - //#moduleSelections to the json data structure representing the selected modules - jQuery("#moduleSelections").attr({value: builder.model.moduleSelections}); - - //sets the value attribute on the input element with id - //#typeSelections to the json data structure representing the desired download type - jQuery("#typeSelections").attr({value: builder.model.typeSelections}); - }; - - //Add a listener which fires after the model changes. Recall that the model is the data - // structure containing the selected modules and desired download file format). - // Also disable the download button if there are no selected modules. - // - // The model changes when - // a) the component is first instantiated - // b) a checkbox is selected - // c) checkall or uncheckall buttons are clicked. - builder.events.afterModelChange.addListener(function (that) { - var model = that.model; - updateFormValues(); - if (model.moduleSelections.length > 0) { - testButton.removeAttr("disabled"); - } - else { - testButton.attr({ - disabled: "disabled" - }); - } - }); -}; \ No newline at end of file Index: infusion-builder/tests/js/customBuild-tests.js =================================================================== --- infusion-builder/tests/js/customBuild-tests.js (revision 8597) +++ infusion-builder/tests/js/customBuild-tests.js (working copy) @@ -501,11 +501,12 @@ * @param {Object} data - the data on which the tests will be performed */ var testSetup = function (dataId, data) { + var testCase = jqUnit.testCase("Custom Build Tests - " + dataId + " - ", function () { + testCase.fetchTemplate("../../html/CustomBuild.html", CUSTOM_BUILD_SELECTOR, $("#main"), afterTemplateFetch); + }); + testComponent = fluid.customBuild(CUSTOM_BUILD_SELECTOR, data); testingFunctions = defineTestingFunctions(data); - var setUp = function () { - testComponent = fluid.customBuild(CUSTOM_BUILD_SELECTOR, data); - }; - return new jqUnit.TestCase("Custom Build Tests - " + dataId + " - ", setUp); + return testCase; }; /** @@ -529,7 +530,7 @@ */ var fullDataTests = function () { - var data = fluid.customBuild.demo.completeFluidInfusionData; + var data = fluid.customBuild.dependencies; var INLINE_EDIT_INDEX = getModuleIndex("inlineEdit", data); var PAGER_INDEX = getModuleIndex("pager", data);; @@ -540,14 +541,15 @@ //TODO: do we need to test the model initialization or does the rendering test do it sufficiently? //TODO: are we testing customBuild external API? If so, how? var tests = testSetup("full data", data); + tests.test("Rendering of Elements", testingFunctions.renderingTests); - tests.test("Select all Modules", testingFunctions.selectAllTests); - tests.test("Deselect all Modules", testingFunctions.deselectAllTests); - tests.test("Autochecking single Module", testingFunctions.generateAutoCheckingTestFunc(PAGER_INDEX)); - tests.test("Autochecking multiple Modules", testingFunctions.generateAutoCheckingTwoModulesTestFunc(INLINE_EDIT_INDEX, REORDERER_INDEX)); - tests.test("Auto-unchecking", testingFunctions.generateAutoUncheckingFunc(PROGRESS_INDEX, UIOPTIONS_INDEX)); - tests.test("Select Minified", testingFunctions.selectMinified); - tests.test("Select Source", testingFunctions.selectSource); +// tests.test("Select all Modules", testingFunctions.selectAllTests); +// tests.test("Deselect all Modules", testingFunctions.deselectAllTests); +// tests.test("Autochecking single Module", testingFunctions.generateAutoCheckingTestFunc(PAGER_INDEX)); +// tests.test("Autochecking multiple Modules", testingFunctions.generateAutoCheckingTwoModulesTestFunc(INLINE_EDIT_INDEX, REORDERER_INDEX)); +// tests.test("Auto-unchecking", testingFunctions.generateAutoUncheckingFunc(PROGRESS_INDEX, UIOPTIONS_INDEX)); +// tests.test("Select Minified", testingFunctions.selectMinified); +// tests.test("Select Source", testingFunctions.selectSource); //TODO: test event that signals when the model is changed. }; @@ -747,11 +749,11 @@ $(document).ready(function () { fullDataTests(); - smallDataTests(); - emptyDataTests(); - noModulesDataTests(); - noGroupsDataTests(); - noGroupNameDataTests(); +// smallDataTests(); +// emptyDataTests(); +// noModulesDataTests(); +// noGroupsDataTests(); +// noGroupNameDataTests(); }); })(jQuery); Index: infusion-builder/tests/html/customBuild-tests.html =================================================================== --- infusion-builder/tests/html/customBuild-tests.html (revision 8597) +++ infusion-builder/tests/html/customBuild-tests.html (working copy) @@ -39,6 +39,7 @@
+
Index: infusion-builder/js/customBuild-data.js =================================================================== --- infusion-builder/js/customBuild-data.js (revision 8597) +++ infusion-builder/js/customBuild-data.js (working copy) @@ -13,14 +13,13 @@ fluid = fluid || {}; fluid.customBuild = fluid.customBuild || {}; -fluid.customBuild.demo = fluid.customBuild.demo || {}; /* * Note that this data is used both by the demo and by the tests, so changes * to this data must be checked in both places. * */ -fluid.customBuild.demo.completeFluidInfusionData = { +fluid.customBuild.dependencies = { model: { groupInfo: [{ @@ -34,7 +33,7 @@ }, { groupName: "Third Party Modules", groupDescription: "Third Party Modules Descriptoin", - groupModules: ["fastXmlPull", "json", "jQuery", "jQueryUICore", "jQueryUIWidgets", "jQueryDelegatePlugin", "jQueryTooltipPlugin", "jQuerybgiframePlugin", "swfupload", "swfobject"] + groupModules: ["fastXmlPull", "json", "jQuery", "jQueryUICore", "jQueryUIWidgets", "jQueryDelegatePlugin", "jQueryTooltipPlugin", "jQuerybgiframePlugin", "swfupload", "Cats!"] }], moduleInfo: [ //index 0 @@ -122,7 +121,7 @@ moduleValue: "uploader", moduleName: "Uploader", moduleDescription: "Allows users to upload files.", - moduleDependencies: ["jQuery", "jQueryUICore", "framework", "swfobject", "swfupload", "progress"] + moduleDependencies: ["jQuery", "jQueryUICore", "framework", "Cats!", "swfupload", "progress"] }, //index 15 { moduleValue: "fastXmlPull", @@ -175,9 +174,9 @@ moduleDescription: "SWFUpload is a small JavaScript/Flash library featuring the great upload capabilities of Flash and the accessibility and ease of HTML/CSS." }, //index 24 { - moduleValue: "swfobject", - moduleName: "swfobject", - moduleDescription: "Embed Flash content into html." + moduleValue: "Cats!", + moduleName: "Cats!", + moduleDescription: "Slash slash, bite bite." }] } }; Index: .externals =================================================================== --- .externals (revision 8597) +++ .externals (working copy) @@ -1 +1 @@ -infusion-builder/infusion https://source.fluidproject.org/svn/fluid/infusion/tags/fluid-1.1.2/ \ No newline at end of file +infusion-builder/infusion https://source.fluidproject.org/svn/fluid/infusion/trunk \ No newline at end of file