source: Dev/trunk/src/client/dojox/widget/tests/test_Wizard.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 9.9 KB
Line 
1<!DOCTYPE html>
2<html>
3<head>
4
5        <title>Wizard Test</title>
6
7        <!-- required: a default theme file, and Wizard styles -->
8        <link rel="stylesheet" id="themeStyles" href="../../../dijit/themes/claro/claro.css">
9        <link rel="stylesheet" href="../Wizard/Wizard.css">
10       
11        <!-- required: dojo.js -->
12        <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true"></script>
13
14        <!-- do not use! only for testing dynamic themes -->
15        <script type="text/javascript" src="../../../dijit/tests/_testCommon.js"></script>
16
17        <script type="text/javascript">
18                dojo.require("dojox.widget.Wizard");
19                dojo.require("dojox.widget.WizardPane");
20       
21                dojo.require("dijit.Dialog");
22                dojo.require("dijit.layout.AccordionContainer");
23                dojo.require("dijit.layout.ContentPane");
24                dojo.require("dijit.layout.TabContainer");
25                dojo.require("dijit.layout.BorderContainer");
26               
27                function cancel() {
28                        alert("Wizard Cancelled!");
29                }
30               
31                function done() {
32                        alert("Wizard Done!");
33                }
34               
35                var programatic_Example = function(){
36                       
37                        var wizard = new dojox.widget.Wizard({
38                                style:"width:300px; height:300px"
39                        }).placeAt("programaticContainer");
40                       
41                        var contents = [
42                                "Pane 1 content", "Pane 2 content", "<h3>Done!</h3>"
43                        ];
44                       
45                        dojo.forEach(contents, function(term){
46                                new dojox.widget.WizardPane({
47                                        content: term
48                                }).placeAt(wizard);
49                        });
50                        wizard.startup();
51                       
52                }
53               
54                dojo.addOnLoad(programatic_Example)
55        </script>
56
57        <style type="text/css">
58                @import "../../../dijit/tests/css/dijitTests.css";
59                body {
60                        font-family : sans-serif;
61                }
62                .floater {
63                        float:left;
64                        margin-right:15px;
65                        margin-bottom:8px;
66                }
67        </style>
68</head>
69
70<body class="claro">
71
72        <h1 class="testTitle">dojox.widget.Wizard tests</h1>
73
74        <div class="floater">
75                <p>Test a wizard in a Dialog:</p>
76                <button data-dojo-type="dijit.form.Button" id="showDialog">
77                        Show Dialog
78                        <script type="dojo/connect" data-dojo-event="onClick">
79                                dijit.byId("wizardDialog").show();
80                        </script>
81                </button>
82               
83                <div id="wizardDialog" data-dojo-type="dijit.Dialog" data-dojo-props="title:'Wizard Dialog'">
84                        <div data-dojo-type="dojox.widget.Wizard" data-dojo-props="style:'height:300px; width:400px'">
85                                <div dojoType="dojox.widget.WizardPane">
86                                        <p>The next two (hidden) children container AccordionContainers. You'll have to be
87                                                more careful about the styling / sizing, as the child wants to take 100% of
88                                                it's height. You can size explicitly if you like, or add margin-bottom to
89                                                leave room for the buttons
90                                        </p>
91                                </div>
92                                <div dojoType="dojox.widget.WizardPane" style="padding:8px">
93                                        <div dojoType="dijit.layout.AccordionContainer">
94                                                <div title="foo" dojoType="dijit.layout.ContentPane">
95                                                        foo.
96                                                </div>
97                                                <div title="bar" dojoType="dijit.layout.ContentPane">
98                                                        foo.
99                                                </div>
100                                        </div>
101                                </div>
102                                <div dojoType="dojox.widget.WizardPane" style="padding:8px">
103                                        <div dojoType="dijit.layout.BorderContainer">
104                                                <div region="left" style="width:75px" dojoType="dijit.layout.ContentPane">
105                                                        left pane
106                                                </div>
107                                                <div region="center" dojoType="dijit.layout.ContentPane">
108                                                        main pane
109                                                </div>
110                                                <div dojoType="dijit.layout.ContentPane" region="right" style="width:75px">
111                                                        right pane
112                                                </div>
113                                        </div>
114                                </div>
115                                <div dojoType="dojox.widget.WizardPane" style="padding:8px">
116                                        <div dojoType="dijit.layout.TabContainer">
117                                                <div title="tab1" dojoType="dijit.layout.ContentPane">
118                                                        foo
119                                                </div>
120                                                <div title="tab2" dojoType="dijit.layout.ContentPane">
121                                                        foo
122                                                </div>
123                                                <div title="tab3" dojoType="dijit.layout.ContentPane">
124                                                        foo
125                                                </div>
126                                        </div>
127                                </div>
128                        </div>
129                </div>
130        </div>
131
132        <div class="floater">
133               
134                <p>This example shows a wizard with customized button labels.</p>
135               
136                <div id="wizard1" data-dojo-type="dojox.widget.Wizard" data-dojo-props="
137                        style:'width:400px; height:200px',
138                        nextButtonLabel:'Go on'
139                ">
140                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props='title:"Tab 1"'>
141                                <h1>Tab 1</h1>
142                                <p>Sized content, box one</p>
143                        </div>
144                        <div data-dojo-type="dojox.widget.WizardPane">
145                                <h1>Tab 2</h1>
146                        </div>
147                        <div data-dojo-type="dojox.widget.WizardPane">
148                                <h1>Tab 3</h1>
149       
150                                You won't be able to come back, but you can finish now...
151                                <script type='dojo/method' data-dojo-event="doneFunction">
152                                        done();
153                                        console.log('inline done function called');
154                                </script>
155                        </div>
156                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props="canGoBack:false">
157                                <h1>Tab 4</h1>
158       
159                                ... and now you can't go back.
160                        </div>
161                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props='doneFunction:done'>
162                                <h1>Tab 5</h1>
163                                ... and now you can finish up.
164                        </div>
165                        <script type="dojo/method" data-dojo-event="cancelFunction">
166                                alert("dojo/method cancel function on container! bye.")
167                                this.destroy();
168                        </script>
169                </div>
170        </div>
171       
172        <div class="floater">
173               
174                <p>The next shows the option to hide the inactive buttons, with a smaller width...</p>
175       
176                <div id="wizard2" dojoType="dojox.widget.Wizard" hideDisabled="true" style="width: 300px; height: 200px;">
177                        <div dojoType="dojox.widget.WizardPane">
178                                <h1>Step 1 of 3</h1>
179                                <p>Lorem ipsum dolor sit amet</p>
180                        </div>
181                        <div dojoType="dojox.widget.WizardPane">
182                                <h1>Step 2 of 3</h1>
183                                <p>consectetur adipisicing elit</p>
184                        </div>
185                        <div dojoType="dojox.widget.WizardPane">
186                                <h1>Step 3 of 3</h1>
187                                <p>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p>
188                        </div>
189                </div>
190
191        </div>
192        <div class="floater">
193               
194                <p>Layout Children</p>
195               
196                <div id="wizard2lay" dojoType="dojox.widget.Wizard" hideDisabled="true" style="width: 300px; height: 240px;">
197                        <div dojoType="dojox.widget.WizardPane">
198                                <p>The next two (hidden) children container AccordionContainers. You'll have to be
199                                        more careful about the styling / sizing, as the child wants to take 100% of
200                                        it's height. You can size explicitly if you like, or add margin-bottom to
201                                        leave room for the buttons
202                                </p>
203                        </div>
204                        <div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
205                                <div dojoType="dijit.layout.AccordionContainer">
206                                        <div title="foo" dojoType="dijit.layout.ContentPane">
207                                                foo.
208                                        </div>
209                                        <div title="bar" dojoType="dijit.layout.ContentPane">
210                                                foo.
211                                        </div>
212                                </div>                         
213                        </div>
214                        <div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
215                                <div dojoType="dijit.layout.BorderContainer">
216                                        <div region="left" style="width:75px" dojoType="dijit.layout.ContentPane">
217                                                left pane
218                                        </div>
219                                        <div region="center" dojoType="dijit.layout.ContentPane">
220                                                main pane
221                                        </div>
222                                        <div dojoType="dijit.layout.ContentPane" region="right" style="width:75px">
223                                                right pane
224                                        </div>
225                                </div>
226                        </div>
227                        <div dojoType="dojox.widget.WizardPane" style="padding:8px; margin-bottom:35px">
228                                <div dojoType="dijit.layout.TabContainer">
229                                        <div title="tab1" dojoType="dijit.layout.ContentPane">
230                                                foo
231                                        </div>
232                                        <div title="tab2" dojoType="dijit.layout.ContentPane">
233                                                foo
234                                        </div>
235                                        <div title="tab3" dojoType="dijit.layout.ContentPane">
236                                                foo
237                                        </div>
238                                </div>
239                        </div>
240                </div>
241        </div>
242       
243        <div class="floater">
244       
245                <p>The next shows blocking moving to the next step with a JS function...</p>
246       
247                <script>
248                        function checkAgreement(name) {
249                                var frm = document.forms[name || 'acceptAgreement'];
250                                var accept = frm.accept;
251                                if (!accept.checked) {
252                                        return "You must agree to the terms before continuing.";
253                                }
254                        }
255                </script>
256               
257                <div id="wizard3" data-dojo-type="dojox.widget.Wizard" style="width: 420px; height: 400px; margin:0 auto;">
258                        <div dojoType="dojox.widget.WizardPane" id="Agreement1" passFunction="checkAgreement">
259                                <h1>Agreement Terms</h1>
260       
261                                <div dojoType="dijit.layout.ContentPane" style="width:400px; border:1px solid #b7b7b7; background:#fff; padding:8px; margin:0 auto; height:200px; overflow:auto; "
262                                        href="../../../dojo/LICENSE"></div>
263       
264                                <form action="#" name="acceptAgreement">
265                                        <p>
266                                        <input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement.
267                                        </p>
268                                </form>
269                        </div>
270                        <div dojoType="dojox.widget.WizardPane" canGoBack="false">
271                                <h1>Complete</h1>
272                                <p>The license has been accepted.</p>
273                        </div>
274                </div>
275
276        </div>
277
278        <div class="floater">
279               
280                <p>Another like above, but with dojo/method passFunction</p>
281                <div id="wizard4" dojoType="dojox.widget.Wizard" style="width: 500px; height: 400px;">
282                        <div data-dojo-type="dojox.widget.WizardPane" id="Agreement12">
283                                <script type="dojo/method" data-dojo-event="passFunction">
284                                        return checkAgreement("acceptAgreementDos");
285                                </script>
286                                <h1>Agreement Terms</h1>
287
288                                <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props='
289                                        href:"../../../dojo/LICENSE",
290                                        style:"width:400px; border:1px solid #b7b7b7; background:#fff; padding:8px; margin:0 auto; height:200px; overflow:auto; "
291                                '></div>
292
293                                <form action="#" name="acceptAgreementDos">
294                                        <p>
295                                        <input type="checkbox" name="accept" value="true"/> I accept the terms of this agreement.
296                                        </p>
297                                </form>
298                        </div>
299                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props="canGoBack:false">
300                                <h1>Complete</h1>
301                                <p>The license has been accepted.</p>
302                        </div>
303                </div> 
304        </div>
305       
306        <div class="floater" id="programaticContainer">
307                <p>A Programatic Wizard should appear here</p>
308        </div>
309
310        <div class="floater">
311                <p>This should overflow, <em>badly</em>:</p>
312                <div id="weezard" data-dojo-type="dojox.widget.Wizard" data-dojo-props="
313                        style:'height:300px; width:300px'
314                ">
315                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props="
316                                href:'../../../dojo/LICENSE'
317                        "></div>
318                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props="
319                                href:'../../../dojo/LICENSE'
320                        "></div>
321                        <div data-dojo-type="dojox.widget.WizardPane" data-dojo-props="
322                                href:'../../../dojo/LICENSE'
323                        "></div>
324                </div>
325        </div>
326       
327        <div style="clear:both">That's all, folks.</div>
328       
329</body>
330</html>
331
332
Note: See TracBrowser for help on using the repository browser.