[system] / trunk / pg / macros / AppletObjects.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/AppletObjects.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5662 Revision 5667
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.7 2008/04/26 21:19:14 gage Exp $ 4# $CVSHeader: pg/macros/AppletObjects.pl,v 1.9 2008/05/05 17:24:46 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.
30 30
31L<Applets.pm>. 31L<Applets.pm>.
32 32
33=cut 33=cut
34 34
35#########################################################################
36#
37# Add basic functionality to the header of the question
38#
39# don't reload this file
40#########################################################################
35 41
36sub _AppletObjects_init{}; # don't reload this file 42sub _AppletObjects_init {
37 43
38 44
39main::HEADER_TEXT(<<'END_HEADER_TEXT'); 45main::HEADER_TEXT(<<'END_HEADER_TEXT');
40 <script language="javascript">AC_FL_RunContent = 0;</script> 46 <script language="javascript">AC_FL_RunContent = 0;</script>
41 <script src="/webwork2_files/applets/AC_RunActiveContent.js" language="javascript"> 47 <script src="/webwork2_files/applets/AC_RunActiveContent.js" language="javascript">
77////////////////////////////////////////////////////////// 83//////////////////////////////////////////////////////////
78// INITIALIZE and SUBMIT actions 84// INITIALIZE and SUBMIT actions
79////////////////////////////////////////////////////////// 85//////////////////////////////////////////////////////////
80 86
81 function submitAction() { 87 function submitAction() {
82 //alert("submit Action" ); 88 alert("Begin submitAction!!!!!");
89 if (debug) {debugText = "Begin looping through applet_submitAction_list\n";}
83 for (var applet in applet_submitAction_list) { 90 for (var applet in applet_submitAction_list) {
84 //alert(applet); 91 //alert(applet);
85 applet_submitAction_list[applet](); 92 applet_submitAction_list[applet]();
86 } 93 }
87 94 if (debug) {alert(debugText); debugText="";};
95 return(1);
88 } 96 }
89 function initializeAction() { 97 function initializeAction() {
90 var iMax = 10; 98 var iMax = 10;
91 debugText="start intializeAction() with up to " +iMax + " attempts\n"; 99 debugText="start intializeAction() with up to " +iMax + " attempts\n";
92 for (var appletName in applet_initializeAction_list) { 100 for (var appletName in applet_initializeAction_list) {
116 debug_add(" Ready to initialize applet " + appletName + " with " + i + " iterations left. "); 124 debug_add(" Ready to initialize applet " + appletName + " with " + i + " iterations left. ");
117 125
118 // in-line handler -- configure and initialize 126 // in-line handler -- configure and initialize
119 try{ 127 try{
120 if (debug && typeof(getApplet(appletName).debug) == "function" ) { 128 if (debug && typeof(getApplet(appletName).debug) == "function" ) {
121 getApplet(appletName).debug(1); 129 getApplet(appletName).debug(1); // turn the applet's debug functions on.
122 } 130 }
123 } catch(e) { 131 } catch(e) {
124 alert("Unable to set debug mode for applet " + appletName); 132 alert("Unable to set debug mode for applet " + appletName);
125 } 133 }
126 try{ 134 try{
206 214
207 </script> 215 </script>
208 216
209END_HEADER_TEXT 217END_HEADER_TEXT
210 218
211 219};
212 220
213=head3 221=head3
214 FlashApplet 222 FlashApplet
215 223
216 Useage: $applet = FlashApplet(); 224 Useage: $applet = FlashApplet();
284 $answer_value =~ s/\s+/ /g; ## remove excessive whitespace from student answer 292 $answer_value =~ s/\s+/ /g; ## remove excessive whitespace from student answer
285 293
286 ####### 294 #######
287 # insert a hidden variable to hold the applet's state (debug =>1 makes it visible for debugging and provides debugging buttons) 295 # insert a hidden variable to hold the applet's state (debug =>1 makes it visible for debugging and provides debugging buttons)
288 ####### 296 #######
289 my $base_64_encoded_answer_value = ($answer_value =~/<XML>/i)? encode_base64($answer_value) : $answer_value; 297 my $base_64_encoded_answer_value = ($answer_value =~/<XML|<?xml/i)? encode_base64($answer_value) : $answer_value;
290 my $decoded_answer_value = ($answer_value =~/<XML>/i) ? $answer_value : decode_base64($answer_value); 298 my $decoded_answer_value = ($answer_value =~/<XML|<?xml/i) ? $answer_value : decode_base64($answer_value);
291 my $debug_input_element = qq!\n<textarea rows="4" cols="80" 299 my $debug_input_element = qq!\n<textarea rows="4" cols="80"
292 name = "$appletStateName">$decoded_answer_value</textarea><br/> 300 name = "$appletStateName">$decoded_answer_value</textarea><br/>
293 <input type="button" value="$getState" 301 <input type="button" value="$getState"
294 onClick="applet_getState_list['$appletName']()" 302 onClick="applet_getState_list['$appletName']()"
295 > 303 >

Legend:
Removed from v.5662  
changed lines
  Added in v.5667

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9