diff -urN dojo-0.4.1-kitchen_sink-old/src/widget/Wizard.js dojo-0.4.1-kitchen_sink/src/widget/Wizard.js
|
old
|
new
|
|
| 48 | 48 | // Label for the "Done" button. |
| 49 | 49 | doneButtonLabel: "done", |
| 50 | 50 | |
| 51 | | // cancelButtonLabel: FunctionName |
| | 51 | // checkBoth: Boolean |
| | 52 | // If true, we call the passFunction when the next button is |
| | 53 | // clicked, or when the previous button is clicked |
| | 54 | checkBoth: false, |
| | 55 | |
| | 56 | // cancelFunction: FunctionName |
| 52 | 57 | // Name of function to call if user presses cancel button. |
| 53 | 58 | // Cancel button is not displayed if function is not specified. |
| 54 | 59 | cancelFunction: "", |
| … |
… |
|
| 112 | 117 | |
| 113 | 118 | onSelected: function(/*WizardPanel*/ panel){ |
| 114 | 119 | // summary: Callback when new panel is selected.. Deselect old panel and select new one |
| 115 | | if(this.selected ){ |
| 116 | | if (this.selected._checkPass()) { |
| 117 | | this.selected.hide(); |
| 118 | | } else { |
| 119 | | return; |
| 120 | | } |
| 121 | | } |
| 122 | | panel.show(); |
| 123 | | this.selected = panel; |
| | 120 | if(this.selected){ |
| | 121 | if(this.checkBoth){ // Seems a bit dumb to check here and in _onNextButtonClick? |
| | 122 | if(this.selected._checkPass()){ |
| | 123 | this.selected.hide(); |
| | 124 | }else{ |
| | 125 | return; |
| | 126 | } |
| | 127 | }else{ |
| | 128 | this.selected.hide(); |
| | 129 | } |
| | 130 | } |
| | 131 | panel.show(); |
| | 132 | this.selected = panel; |
| 124 | 133 | }, |
| 125 | 134 | |
| 126 | 135 | getPanels: function() { |
| … |
… |
|
| 141 | 150 | var selectedIndex = this.selectedIndex(); |
| 142 | 151 | if ( selectedIndex > -1 ) { |
| 143 | 152 | var childPanels = this.getPanels(); |
| 144 | | if (childPanels[selectedIndex + 1]) { |
| 145 | | this.onSelected(childPanels[selectedIndex + 1]); |
| 146 | | } |
| 147 | | } |
| 148 | | this._checkButtons(); |
| 149 | | }, |
| | 153 | if (childPanels[selectedIndex + 1]){ |
| | 154 | if( this.checkBoth ){ |
| | 155 | this.onSelected(childPanels[selectedIndex + 1]); |
| | 156 | }else{ |
| | 157 | if (this.selected._checkPass()){ |
| | 158 | this.onSelected(childPanels[selectedIndex + 1]); |
| | 159 | } |
| | 160 | } |
| | 161 | } |
| | 162 | } |
| | 163 | this._checkButtons(); |
| | 164 | }, |
| 150 | 165 | |
| 151 | 166 | _onPreviousButtonClick: function() { |
| 152 | 167 | // summary: callback when previous button is clicked |
diff -urN dojo-0.4.1-kitchen_sink-old/tests/widget/test_Wizard.html dojo-0.4.1-kitchen_sink/tests/widget/test_Wizard.html
|
old
|
new
|
|
| 66 | 66 | </div> |
| 67 | 67 | </div> |
| 68 | 68 | |
| 69 | | <p>The next shows the option to hide the inactive buttons, with a smaller width (smaller width current fails, bug #607)...</p> |
| | 69 | <p>The next example shows the option to hide the inactive buttons, with a smaller width (smaller width current fails, bug #607)...</p> |
| 70 | 70 | |
| 71 | 71 | <div id="wizard2" dojoType="WizardContainer" hideDisabledButtons="true" style="width: 50%; height: 200px;"> |
| 72 | 72 | <div dojoType="WizardPane"> |
| … |
… |
|
| 83 | 83 | </div> |
| 84 | 84 | </div> |
| 85 | 85 | |
| 86 | | <p>The next shows blocking moving to the next step with a JS function...</p> |
| | 86 | <p>The next example shows blocking moving to the next step with a JS function...</p> |
| 87 | 87 | |
| 88 | 88 | <script> |
| 89 | 89 | function checkAgreement() { |
| … |
… |
|
| 109 | 109 | </div> |
| 110 | 110 | </div> |
| 111 | 111 | |
| | 112 | <p>The next example shows that the passFunction can be used in each direction of the wizard, not just when you click "next"</p> |
| | 113 | |
| | 114 | <script> |
| | 115 | function checkAgreement1() { |
| | 116 | var frm = document.forms['acceptAgreement1']; |
| | 117 | var accept = frm.accept; |
| | 118 | if (!accept.checked) { |
| | 119 | return "You must agree to the terms before continuing."; |
| | 120 | } |
| | 121 | } |
| | 122 | |
| | 123 | function checkAgreement2() { |
| | 124 | var frm = document.forms['acceptAgreement2']; |
| | 125 | var accept = frm.accept; |
| | 126 | if (!accept.checked) { |
| | 127 | return "You must agree to the terms before continuing."; |
| | 128 | } |
| | 129 | } |
| | 130 | </script> |
| | 131 | <div id="wizard4" dojoType="WizardContainer" checkBoth="true" style="width: 100%; height: 200px;"> |
| | 132 | <div dojoType="WizardPane" id="Agreement11" passFunction="checkAgreement1"> |
| | 133 | <h1>Agreement Terms 1</h1> |
| | 134 | <form action="#" name="acceptAgreement1"> |
| | 135 | <p> |
| | 136 | <input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement. |
| | 137 | </p> |
| | 138 | </form> |
| | 139 | </div> |
| | 140 | <div dojoType="WizardPane" id="Agreement2" passFunction="checkAgreement2"> |
| | 141 | <h1>Agreement Terms 2</h1> |
| | 142 | <form action="#" name="acceptAgreement2"> |
| | 143 | <p> |
| | 144 | <input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement. |
| | 145 | </p> |
| | 146 | </form> |
| | 147 | </div> |
| | 148 | <div dojoType="WizardPane" canGoBack="false"> |
| | 149 | <h1>Complete</h1> |
| | 150 | <p>The license has been accepted.</p> |
| | 151 | </div> |
| | 152 | </div> |
| | 153 | |
| 112 | 154 | </body> |
| 113 | 155 | </html> |
| 114 | 156 | |