From: Mike G. v. a. <we...@ma...> - 2008-05-12 01:06:05
|
Log Message: ----------- Uploading changes in the AppletObjects.pl and Applet.pm modules. Modified Files: -------------- pg/lib: Applet.pm pg/macros: AppletObjects.pl Revision Data ------------- Index: Applet.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Applet.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -Llib/Applet.pm -Llib/Applet.pm -u -r1.10 -r1.11 --- lib/Applet.pm +++ lib/Applet.pm @@ -417,12 +417,11 @@ ////////////////////////////////////////////////////////// applet_config_list["$appletName"] = function() { - debug_add("applet_config_list:\n configure $appletName . $config ( $base64_config )" - + typeof(getApplet("$appletName").$config) + debug_add("applet_config_list:\n attempt to configure $appletName . $config ( $base64_config ) if config function is defined: " ); try { if (( typeof(getApplet("$appletName").$config) == "function" ) ) { - debug_add("configure $appletName"); + debug_add("CONFIGURE $appletName"); getApplet("$appletName").$config(Base64.decode("$base64_config")); } } catch(e) { @@ -437,7 +436,8 @@ ////////////////////////////////////////////////////////// applet_setState_list["$appletName"] = function(state) { - debug_add("Begin setState"); + debug_add("Begin setState for applet $appletName"); + debug_add("Obtain state from $appletName"+"_state"); state = state || getQE("$appletName"+"_state").value; if ( base64Q(state) ) { state=Base64.decode(state); @@ -460,15 +460,16 @@ } }; applet_getState_list["$appletName"] = function () { - if (debug) { alert("getState for applet $appletName");} + debug_add("get current state for applet $appletName and store it in $appletName"+"_state"); var applet = getApplet("$appletName"); try { if (( typeof(applet.$getState) == "function" ) ) { // there may be no state function state = applet.$getState(); // get state in xml format } - if (debug) alert("state is " + state); + if (!debug) {state = Base64.encode(state) }; // replace state by encoded version unless in debug mode - getQE("$appletName"+"_state").value = state; //place in state htmlItem (debug: textarea, otherwise hidden) + debug_add("state is "+state); // this should still be in plain text + getQE("$appletName"+"_state").value = state; //place state in input item (debug: textarea, otherwise: hidden) } catch (e) { alert("Error in getting state for $appletName " + e ); } @@ -506,7 +507,7 @@ debug_add( "applet reports that it is loaded " + applet_reportsLoaded_list["$appletName"] ); ready =1; } - applet_isReady_list["$appletName"]=ready; + applet_isReady_list["$appletName"]= ready; return(ready); } @@ -515,8 +516,11 @@ }; applet_submitAction_list["$appletName"] = function () { + if (! applet_isReady_list["$appletName"] ) { + alert("$appletName is not ready"); + } applet_getState_list["$appletName"](); - getQE("$returnFieldName").value = getApplet("$appletName").sendData(); //FIXME -- not needed in general? + //getQE("$returnFieldName").value = getApplet("$appletName").sendData(); //FIXME -- not needed in general? }; </script> @@ -643,6 +647,10 @@ MAYSCRIPT > $javaParameters + + Sorry, the Applet could not be started. Please make sure that +Java 1.4.2 (or later) is installed and activated. +(<a href="http://java.sun.com/getjava">click here to install Java now</a>) </applet> END_OBJECT_TEXT Index: AppletObjects.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/AppletObjects.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -Lmacros/AppletObjects.pl -Lmacros/AppletObjects.pl -u -r1.9 -r1.10 --- macros/AppletObjects.pl +++ macros/AppletObjects.pl @@ -32,8 +32,14 @@ =cut +######################################################################### +# +# Add basic functionality to the header of the question +# +# don't reload this file +######################################################################### -sub _AppletObjects_init{}; # don't reload this file +sub _AppletObjects_init { main::HEADER_TEXT(<<'END_HEADER_TEXT'); @@ -79,12 +85,14 @@ ////////////////////////////////////////////////////////// function submitAction() { - //alert("submit Action" ); - for (var applet in applet_submitAction_list) { - //alert(applet); - applet_submitAction_list[applet](); - } - + alert("Begin submitAction!!!!!"); + if (debug) {debugText = "Begin looping through applet_submitAction_list\n";} + for (var applet in applet_submitAction_list) { + //alert(applet); + applet_submitAction_list[applet](); + } + if (debug) {alert(debugText); debugText="";}; + return(1); } function initializeAction() { var iMax = 10; @@ -118,7 +126,7 @@ // in-line handler -- configure and initialize try{ if (debug && typeof(getApplet(appletName).debug) == "function" ) { - getApplet(appletName).debug(1); + getApplet(appletName).debug(1); // turn the applet's debug functions on. } } catch(e) { alert("Unable to set debug mode for applet " + appletName); @@ -208,7 +216,7 @@ END_HEADER_TEXT - +}; =head3 FlashApplet @@ -286,8 +294,8 @@ ####### # insert a hidden variable to hold the applet's state (debug =>1 makes it visible for debugging and provides debugging buttons) ####### - my $base_64_encoded_answer_value = ($answer_value =~/<XML>/i)? encode_base64($answer_value) : $answer_value; - my $decoded_answer_value = ($answer_value =~/<XML>/i) ? $answer_value : decode_base64($answer_value); + my $base_64_encoded_answer_value = ($answer_value =~/<XML|<?xml/i)? encode_base64($answer_value) : $answer_value; + my $decoded_answer_value = ($answer_value =~/<XML|<?xml/i) ? $answer_value : decode_base64($answer_value); my $debug_input_element = qq!\n<textarea rows="4" cols="80" name = "$appletStateName">$decoded_answer_value</textarea><br/> <input type="button" value="$getState" |