3 //CODE FOR HANDLING SENDING OF RESULTS
\r
6 var StartTime = (new Date()).toLocaleString();
\r
8 var ResultForm = '<html><body><form name="Results" action="[strFormMailURL]" method="post" enctype="x-www-form-encoded">';
\r
9 ResultForm += '<input type="hidden" name="recipient" value="[strEMail]"></input>';
\r
10 ResultForm += '<input type="hidden" name="subject" value="[strEscapedExerciseTitle]"></input>';
\r
11 ResultForm += '<input type="hidden" name="Exercise" value="[strEscapedExerciseTitle]"></input>';
\r
12 ResultForm += '<input type="hidden" name="realname" value=""></input>';
\r
13 ResultForm += '<input type="hidden" name="Score" value=""></input>';
\r
14 ResultForm += '<input type="hidden" name="Start_Time" value=""></input>';
\r
15 ResultForm += '<input type="hidden" name="End_Time" value=""></input>';
\r
16 ResultForm += '<input type="hidden" name="title" value="Thanks!"></input>';
\r
17 [inclPageBGColor]ResultForm += '<input type="hidden" name="bgcolor" value="[strPageBGColor]"></input>';[/inclPageBGColor]
\r
18 ResultForm += '<input type="hidden" name="text_color" value="[strTitleColor]"></input>';
\r
19 ResultForm += '<input type="hidden" name="sort" value="order:realname,Exercise,Score,Start_Time,End_Time"></input>';
\r
20 ResultForm += '</form></body></html>';
\r
22 function GetUserName(){
\r
23 UserName = prompt('[strNamePlease]','');
\r
25 if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){
\r
26 UserName = prompt('[strNamePlease]','');
\r
28 if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){
\r
34 function SendResults(Score){
\r
35 var today = new Date;
\r
36 var NewName = '' + today.getTime();
\r
37 var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300');
\r
39 //If user has prevented popups, no way to proceed -- exit
\r
40 if (NewWin == null){
\r
44 NewWin.document.clear();
\r
45 NewWin.document.open();
\r
46 NewWin.document.write(ResultForm);
\r
47 NewWin.document.close();
\r
48 NewWin.document.Results.Score.value = Score + '%';
\r
49 NewWin.document.Results.realname.value = UserName;
\r
50 NewWin.document.Results.End_Time.value = (new Date()).toLocaleString();
\r
51 NewWin.document.Results.Start_Time.value = StartTime;
\r
52 NewWin.document.Results.submit();
\r