| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: pg/macros/AppletObjects.pl,v 1.9 2008/05/05 17:24:46 gage Exp $ |
4 | # $CVSHeader: pg/macros/AppletObjects.pl,v 1.10 2008/05/12 00:50:24 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 83 | ////////////////////////////////////////////////////////// |
83 | ////////////////////////////////////////////////////////// |
| 84 | // INITIALIZE and SUBMIT actions |
84 | // INITIALIZE and SUBMIT actions |
| 85 | ////////////////////////////////////////////////////////// |
85 | ////////////////////////////////////////////////////////// |
| 86 | |
86 | |
| 87 | function submitAction() { |
87 | function submitAction() { |
| 88 | alert("Begin submitAction!!!!!"); |
88 | |
|
|
89 | if (debug) { |
| 89 | if (debug) {debugText = "Begin looping through applet_submitAction_list\n";} |
90 | debugText = " Begin looping through applet_submitAction_list\n"; |
|
|
91 | } |
| 90 | for (var applet in applet_submitAction_list) { |
92 | for (var applet in applet_submitAction_list) { |
| 91 | //alert(applet); |
93 | |
| 92 | applet_submitAction_list[applet](); |
94 | applet_submitAction_list[applet](); |
| 93 | } |
95 | } |
|
|
96 | if (debug) { |
| 94 | if (debug) {alert(debugText); debugText="";}; |
97 | alert(debugText); debugText=""; |
| 95 | return(1); |
98 | }; |
| 96 | } |
99 | } |
| 97 | function initializeAction() { |
100 | function initializeAction() { |
| 98 | var iMax = 10; |
101 | var iMax = 10; |
| 99 | debugText="start intializeAction() with up to " +iMax + " attempts\n"; |
102 | debugText="start intializeAction() with up to " +iMax + " attempts\n"; |
| 100 | for (var appletName in applet_initializeAction_list) { |
103 | for (var appletName in applet_initializeAction_list) { |
| … | |
… | |
| 293 | |
296 | |
| 294 | ####### |
297 | ####### |
| 295 | # insert a hidden variable to hold the applet's state (debug =>1 makes it visible for debugging and provides debugging buttons) |
298 | # insert a hidden variable to hold the applet's state (debug =>1 makes it visible for debugging and provides debugging buttons) |
| 296 | ####### |
299 | ####### |
| 297 | my $base_64_encoded_answer_value = ($answer_value =~/<XML|<?xml/i)? encode_base64($answer_value) : $answer_value; |
300 | my $base_64_encoded_answer_value = ($answer_value =~/<XML|<?xml/i)? encode_base64($answer_value) : $answer_value; |
|
|
301 | $base_64_encoded_answer_value =~ s/\r|\n//g; # get rid of line returns |
| 298 | my $decoded_answer_value = ($answer_value =~/<XML|<?xml/i) ? $answer_value : decode_base64($answer_value); |
302 | my $decoded_answer_value = ($answer_value =~/<XML|<?xml/i) ? $answer_value : decode_base64($answer_value); |
| 299 | my $debug_input_element = qq!\n<textarea rows="4" cols="80" |
303 | my $debug_input_element = qq!\n<textarea rows="4" cols="80" |
| 300 | name = "$appletStateName">$decoded_answer_value</textarea><br/> |
304 | name = "$appletStateName">$decoded_answer_value</textarea><br/> |
| 301 | <input type="button" value="$getState" |
305 | <input type="button" value="$getState" |
| 302 | onClick="applet_getState_list['$appletName']()" |
306 | onClick="applet_getState_list['$appletName']()" |