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