Changeset 632 in tmcsimulator for trunk/webapps/einotebook/script/scrollframe.js
- Timestamp:
- 02/03/2021 06:34:04 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/webapps/einotebook/script/scrollframe.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/einotebook/script/scrollframe.js
r631 r632 12 12 } 13 13 14 // Collect all the ratings from the events - OBSOLETE15 function collectRatings()16 {17 var output = ""18 var ratingCount = 019 // Consider each event in the incident script20 for (var evtidx = 0; evtidx < events.length; evtidx++)21 {22 // Does this event have any evaluations?23 if (events[evtidx].evaluations.evaluations.length > 0)24 {25 // Examine each evaluation contained in this event26 for (var rating=0; rating<events[evtidx].evaluations.evaluations.length; rating++ )27 {28 // Extract the rating assigned to this item29 var item = events[evtidx].evaluations.evaluations[rating];30 // If it not the default value we want to save it31 if (item.rating > 0)32 { // Build a string for the log in this format:33 //03:01:00, Evaluation, CMS, Poor34 output += events[evtidx].time.format() +", Evaluation, "+item.type + ", " + item.ratingQualities[item.rating] + "\n"35 ratingCount += 1;36 }37 }38 }39 }40 submitRatings(output);41 alert(ratingCount + " rating were saved.")42 }43 14 44 /* This is an alternative way to collect the ratings values by reading them directly from the radio buttons45 function collectRadios()46 {47 var radios = document.getElementsByTagName('input');48 var count = 0;49 for (var j=0; j<radios.length; j++)50 {51 if (radios[j].type == 'radio')52 {53 count++;54 if (radios[j].checked)55 {56 console.log(radios[j].name + " checked " + radios[j].value)57 }58 }59 }60 alert("counted " + count + " radios");61 }62 */63 15 64 // Send the string of ratings to the server - OBSOLETE65 function submitRatings(logString)66 {67 // Using POST to send the data68 var xhr = new XMLHttpRequest();69 xhr.open("POST", "/cgi-bin/saveRatingsToLog.py", true);70 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');71 // send the collected data72 xhr.send("msg="+logString);73 }
Note: See TracChangeset
for help on using the changeset viewer.
