File: we_test_ajax.html

package info (click to toggle)
libaws 20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 16,656 kB
  • sloc: ada: 95,505; python: 2,270; ansic: 1,017; makefile: 829; xml: 235; javascript: 202; java: 112; sh: 106
file content (446 lines) | stat: -rw-r--r-- 17,182 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446

@@INCLUDE@@ ../../web_elements/javascripts/aws.tjs

<html>
   <head>
@@INCLUDE@@ ../../web_elements/notebook/notebook.thtml Tabs currentPage TabContents page1
<style>
h1             { font-size: large; text-align: center; }
.TabContents   { background: white; height: 20em }
.TabContents2  { background: #aaa; }

/* trick IE which won't understand html>div */
html>div, #page1         { height: 15em; }
html>div, #page2         { height: 33em; }
html>div, #page3         { height: 20em; }
html>div, #page4         { height: 36em; }
html>div, #page5         { height: 30em; }
html>div, #page6         { height: 23em; }
html>div, #page7         { height: 27em; }

.Demo          { position: relative; top: 1em; width: 40%;
                 float: left;
                 background-color: #a7aedb; padding: 10px;
               }
.Result        { position: relative; top: 2em; width: 50%;
                 float: left; left: 10px; height: 2em;
                 background-color: #dddddd; padding: 10px;
                 font-size: small; font-family: courier;
               }
.XML_Result    { position: relative; top: 2em; width: 50%;
                 float: left; left: 10px; height: 20em;
                 background-color: #dddddd; padding: 10px;
                 font-size: small; font-family: courier;
               }
.CResult       { position: relative; top: 1em; width: 50%;
                 float: left; left: 10px; height: 10em;
                 background-color: #dddddd; padding: 10px;
               }
.List          { position: relative; width: 70%;
                 float: left; left: 10px;
                 padding: 10px;
               }
.HList         { position: relative; top: 2em; width: 40%;
                 float: left; left: 10px;
                 padding: 10px;
               }
.BList         { position: relative; top: 3em; width: 40%;
                 float: left; left: 10px; height: 10em;
                 background-color: #8dc387; padding: 10px;
               }
.Code          { position: relative; top: 2em; width: 90%;
                 float: left;
                 background-color: #f5f691; padding: 10px;
                 font-size: small; font-family: courier;
               }
.Status        { position: relative; top: 2em; width: 90%;
                 float: left;
                 background-color: #f5f691; padding: 10px;
                 font-size: large; font-weight: bold;
               }
.Dialog        { position: absolute; top: 4em; left: 4em;
                 width: 30em; height: 5em; z-index: 10;
                 background-color: #ffffff; padding: 10px;
                 display: none; border-style: double;
                 border-style: solid;
                 border-color: #ff0000;
               }
.Button        { position: relative; top: 2em; width: 70%;
                 float: left; left: 10px; height: 2em;
                 background-color: #ffffff; padding: 10px;
                 font-size: small; font-family: courier;
               }
.green         {
                 color: #00FF00;
               }
.blue          {
                 color: #0000FF;
               }
.red           {
                 color: #FF0000;
               }
.small         {
                 font-size: small;
               }
.medium        {
                 font-size: medium;
               }
.large         {
                 font-size: large;
               }

.ulist         {
                 height: 8em;
               }

</style>
   </head>

   <body>
      <h1>Ajax - <i>Asynchronous JavaScript language and XML</i> demos</h1>

      <table width="90%" align="center">
      <td>
      <ul id="Tabs">
        <li id="page1" class="currentPage">
            <a href="#" onclick="switchTabPage_Tabs('page1')">
            Button</a></li>
        <li id="page2">
            <a href="#" onclick="switchTabPage_Tabs('page2')">
            Button/Clear</a></li>
        <li id="page3">
            <a href="#" onclick="switchTabPage_Tabs('page3')">Select</a></li>
        <li id="page4">
            <a href="#" onclick="switchTabPage_Tabs('page4')">
            Select/Form</a></li>
        <li id="page5">
            <a href="#" onclick="switchTabPage_Tabs('page5')">
            Complex Form</a></li>
        <li id="page6">
            <a href="#" onclick="switchTabPage_Tabs('page6')">
            XML 1</a></li>
        <li id="page7">
            <a href="#" onclick="switchTabPage_Tabs('page7')">
            XML 2</a></li>
        <li id="page8">
            <a href="#" onclick="switchTabPage_Tabs('page8')">
            XML 3</a></li>
      </ul>

      <!-- Button -->

      <div class="TabContents" id="page1">

      <div class="Demo">
      <p>Click on the button...</p>
      <p><input id="clickme" type="button" value="Click Me"></p>
      </div>

      <div Class="Result" id="placeholder">... result here ...
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs onclick clickme placeholder
      </div>

      <div class="Code">
      Click on the button...
      <br>&lt;input id="<strong>clickme</strong>" type="button" value="Click Me"&gt;
      <br>&lt;div id="<strong>placeholder</strong>"&gt;... result here ...&lt;/div&gt;
      <br>@@INCLUDE@@ aws_action_replace.tjs onclick <strong>clickme</strong> <strong>placeholder</strong>
      </div>
      </div>

      <!-- Button/Clear -->

      <div class="TabContents" id="page2">

      <div class="Demo">
      <p>Enter some text in the following entry:
      <p><input id="field" type="text" value="enter some text here">
      <p>Click on the button...</p>
      <p><input id="data" type="button" value="Click Me"></p>
      <p>Clear actions:
      <p><input id="cdata" type="button" value="Clear Field">
      <p><input id="cplaceh" type="button" value="Clear Result">
      </div>

      <div Class="Result" id="placeholder2">... result here ...
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs (onclick, data, placeholder2, 5=>field)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_clear.tjs (onclick, cdata, field)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_clear.tjs (onclick, cplaceh, placeholder2)
      </div>

      <div class="Code">
      <br>Enter some text in the following entry:
      <br>&lt;input id="<strong>field</strong>" type="text" value="enter some text here"&gt;
      <br>Click on the button...
      <br>&lt;input id="<strong>data</strong>" type="button" value="Click Me"&gt;
      <br>Clear the entry:
      <br>&lt;input id="<strong>cdata</strong>" type="button" value="Clear"&gt;
      <br>&lt;div id="<strong>placeholder</strong>"&gt;... result here ...&lt;/div&gt;
      <br>@@INCLUDE@@ aws_action_replace.tjs (onclick, <strong>data</strong>, <strong>placeholder</strong>, 5=&gt;<strong>field</strong>)
      <br>@@INCLUDE@@ aws_action_clear.tjs (onclick, </strong>cdata</strong>, <strong>field</strong>)
      </div>
      </div>

      <!-- Select -->

      <div class="TabContents" id="page3">

      <div class="Demo">
      <p>Select a value from the select:</p>
      <select id="select_color" name="select_color">
         <option value="red">Red</option>
         <option value="green">Green</option>
         <option value="blue">Blue</option>
      </select>
      </div>

      <div Class="Result" id="placeholder3">... result here ...
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs (onchange, select_color, placeholder3, 5=>select_color)
      </div>

      <div class="Code">
      <br>Select a value from the select:
      <br>&lt;select id="<strong>select_color</strong>" name="select_color"&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="red"&gt;Red&lt;/option&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="green"&gt;Green&lt;/option&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="blue"&gt;Blue&lt;/option&gt;
      <br>&lt;/select&gt;
      <br>&lt;div Class="Result" id="<strong>placeholder</strong>"&gt;... result here ...&lt;/div&gt;
      <br>@@INCLUDE@@ aws_action_replace.tjs (onchange, <strong>select_color</strong>, <strong>placeholder</strong>, 5=&gt;<strong>select_color</strong>)
      </div>
      </div>

      <!-- Select/Form -->

      <div class="TabContents" id="page4">

      <div class="Demo">
      <p>Select a value from a form</p>
      <form id="small_form" name="small_form">
      <select id="form_color" name="form_color">
         <option value="red">Red</option>
         <option value="green">Green</option>
         <option value="blue">Blue</option>
      </select>
      <br><br>
      <fieldset>
         <legend>Select one size</legend>
         <input type=radio name=size value=large>Large
         <input type=radio name=size value=medium>Medium
         <input type=radio name=size value=small>Small
      </fieldset>
      <br>
      <input type="submit" value="Send"/>
      </form>
      </div>

      <div Class="Result" id="form_result">... result here ...
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs (onsubmit, small_form, form_result, 5=>small_form)
      </div>

      <div class="Code">
      <br>Select a color:
      <br>&lt;form id="<strong>small_form</strong>" name="small_form"&gt;
      <br>&lt;select id="form_color" name="form_color"&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="red"&gt;Red&lt;/option&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="green"&gt;Green&lt;/option&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;option value="blue"&gt;Blue&lt;/option&gt;
      <br>&lt;/select&gt;
      <br>&lt;fieldset&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;legend&gt;Select one size&lt;/legend&gt;
      <br>&nbsp;&nbsp;&nbsp;&lt;input type=radio name=size value=large&gt;Large
      <br>&nbsp;&nbsp;&nbsp;&lt;input type=radio name=size value=medium&gt;Medium
      <br>&nbsp;&nbsp;&nbsp;&lt;input type=radio name=size value=small&gt;Small
      <br>&lt;/fieldset&gt;
      <br>&lt;input type="submit" value="Send"/&gt;
      <br>&lt;/form&gt;
      <br>&lt;div Class="Result" id="<strong>form_result</strong>"&gt;...result here...&lt;/div&gt;
      <br>@@INCLUDE@@ aws_action_replace.tjs (onsubmit, <strong>small_form</strong>, <strong>form_result</strong>, 5=&gt;<strong>small_form</strong>)
      </div>
      </div>

      <!-- Complex -->

      <div class="TabContents" id="page5">
      <div class="Demo">
      <fieldset>
         <legend>Actions</legend>
         <input id="db_sel1" type="button" name="action1" value="Create Group">
         <br><br>
         <input id="db_sel2" type="button" name="action2" value="Create User">
         <br>
      </fieldset>
      <br>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs onclick db_sel1 action
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs onclick db_sel2 action
      </form>
      </div>

<script>
   function list_group()
   {
      @@INCLUDE@@ ../../web_elements/javascripts/aws_func_replace.tjs (null, g_list, group_list)
   }
   function list_user()
   {
      @@INCLUDE@@ ../../web_elements/javascripts/aws_func_replace.tjs (null, u_list, user_list)
   }
</script>
      <div id="action" class="CResult"></div>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs (onclick, g_action, action, 5=>db_group, 20=>list_group)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_replace.tjs (onclick, u_action, action, 5=>db_user, 20=>list_user)
      <div class="List">
      <div class="HList">Groups</div>
      <div class="HList">Users</div>
      <div id="group_list" class="BList"></div>
      <div id="user_list" class="BList">
      </div>
      </div>
      </div>

      <!-- XML Based Requests (1) -->

      <div class="TabContents" id="page6">
      <div class="Demo">
      <fieldset>
         <legend>Actions</legend>
         <input id="xml1" type="button" name="action1" value="Fill Widgets">
         <br><br>
         <input id="xml_clear" type="button" name="action2" value="Clear Widgets">
         <br><br>
         <input id="xml3" type="button" name="action3" value="Mixed Fill/Clear"
         <br><br>
         <input id="xml4" type="button" name="action4" value="Action + Call URL"
         <br>
      </fieldset>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml1)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml_clear)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml3)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml4)
      </div>

      <div Class="XML_Result">
        <div id="text1">text1</div>
        <div id="text2">text2</div>
        <br>
        <input id="input1" type="text" value="enter here 1">
        <input id="input2" type="text" value="enter here 2">
        <br><br>
        <select id="xmlsel"></select>
        <br><br>
        <fieldset>
           <legend>Options</legend>
           <input id="radio1" type="radio" name="rsel">option1</input>
           <input id="radio2" type="radio" name="rsel">option2</input>
           <input id="radio3" type="radio" name="rsel">option3</input>
        </fieldset>
        <br><br>
        <fieldset>
           <legend>Multiple Options</legend>
           <input id="check1" type="checkbox" name="csel">optiona</input>
           <input id="check2" type="checkbox" name="csel">optionb</input>
           <input id="check3" type="checkbox" name="csel">optionc</input>
        </fieldset>
      </div>

      <div Class="Dialog" id="dialog_yes_no">
      Are you sure you want to clear everything ?
      <p><input id="xml2" type="button" name="action1" value="Yes">
      <input id="xml_clear_no" type="button" name="action1" value="No">
      </div>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml2)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml_clear_no)

      <br><br>
      <div Class="Status" id="xml_status_bar">Click on the buttons</div>
      </div>

      <!-- XML Based Requests (2) -->

      <div class="TabContents" id="page7">
      <div class="Demo">

      <p> Select some colors you like...</p>

        <fieldset>
           <legend>Colors</legend>
           <ul id="fromlist" class="ulist">
              <li id="fromlist_red">Red</li>
              <li id="fromlist_green">Green</li>
              <li id="fromlist_blue">Blue</li>
              <li id="fromlist_yellow">Yellow</li>
              <li id="fromlist_magenta">Magenta</li>
           </ul>
        </fieldset>
      </div>

      <div class="Demo">
      <p>... and place them below.</p>
        <fieldset>
           <legend>Colors you like</legend>
           <ul id="tolist" class="ulist"></ul>
        </fieldset>

      @@INCLUDE@@ ../../web_elements/javascripts/aws_sortable.tjs fromlist tolist
      </div>

      <br>
      <div class="Button">
      <p>
      <input id="xml5" type="button" name="action1" value="Make sortable">
      <input id="xml6" type="button" name="action2" value="Remove sortable">
      <input id="xml_get_list" type="button" name="action3" value="Check result">

      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml5)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml6)
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml_get_list, 4=>tolist)
      </div>

      <div class="Result" id="list_result">... result here ...</div>

      <br><br>
      <div Class="Status" id="xml2_status_bar">Click on the buttons</div>

      </div>

      <!-- XML Based Requests (3) -->

      <div class="TabContents" id="page8">

      <div class="Demo">
      <p>Enter some text in the following entry:
      <form id="XML3_form">
         <p><input id="xfield" type="text" value="enter some text here">
         <p>Click on the button...</p>
         <p><input id="showdata" type="button" value="Click Me"></p>
      </form>

      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, showdata, 4=>xfield)

      <br><br>
      <input id="xml7" type="button" name="adisable" value="Disable Entry"/>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml7)
      <input id="xml8" type="button" name="adisable" value="Enable Entry"/>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml8)
      <br><br>
      <input id="xml9" type="button" name="aro" value="Set Read-Only"/>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml9)
      <input id="xml10" type="button" name="aro" value="Set Read-Write"/>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml10)
      <br><br>
      <input id="xml11" type="button" name="reset_form" value="Reset"/>
      @@INCLUDE@@ ../../web_elements/javascripts/aws_action_xml.tjs (onclick, xml11)
      </div>

      <div Class="Result" id="xml3_result">... result here ...</div>

      <div class="Status" id="xml3_status_bar"></div>
      </div>

      <!-- End -->

      </td>

      </table>
   </body>
</html>