Index: trunk/webapps/einotebook/roles/index.html
===================================================================
--- trunk/webapps/einotebook/roles/index.html	(revision 540)
+++ trunk/webapps/einotebook/roles/index.html	(revision 548)
@@ -22,7 +22,7 @@
       <option value="CHP RADIO">CHP RADIO</option>
     </select>
-      
     <iframe id='view' src='../script/scrollframe.html' frameborder='0' scrolling='yes'
             width='100%'></iframe>
+
   </body>
 </html>
Index: trunk/webapps/einotebook/scripts/Evaluation.js
===================================================================
--- trunk/webapps/einotebook/scripts/Evaluation.js	(revision 397)
+++ trunk/webapps/einotebook/scripts/Evaluation.js	(revision 548)
@@ -6,148 +6,136 @@
 function Evaluation(type, data)
 {
-	//========== private static members ==========//
-	Evaluation.id = (typeof Evaluation.id == 'undefined') ? 0 : ++Evaluation.id;
-	
-	//========== public constants ==========//
-	this.id = Evaluation.id;
-	this.ratingGroupName = "evaluationGroup" + this.id;	
-	this.textID = "evaluationText" + this.id;
-	this.type = type;
-	this.data = data;
-	
-	//========== public read-only members ==========//
-	this.text = "";
-	this.rating = -1;
-	
-	//========== public methods ==========//
-	this.html = html;
-	this.recordText = recordText; 
-	this.recordRating = recordRating;
-	
-	//========== private methods ==========//
-	this.smallScaleForm = smallScaleForm;
-	this.evaluationForm = evaluationForm;
-	
-	//========== function definitions ==========//
-	/**
-	 * @return The html representation of this evaluation.
-	 */
-	function html()
-	{
-		var text = "<table class='evaluation'>" +
-	   	   		   "<tr>" +
-	   	   		   "<th class='evaluationType' colspan='2'>" + type + " Evaluation</th>" +
-	   	   		   "</tr>" +
-	   	   		   "<tr>" +
-	   	   		   "<td><table class='evaluationInner2'>";
-		
-		for (i = 0; i < this.data.length; i += 2)
-		{
-			text += "<tr>" +
-				   "<td class='evaluationLabel'>" + this.data[i] + "</td>" +
-				   "<td class='evaluationCriteria'>" + this.data[i+1] + "</td>" +
-				   "</tr>";
-		}
-		/*  Displays the comment input field 
-		text += "<tr><td colspan='2' class='evaluationResponse'>" +
-			"<input onchange='events.getEvaluation(" + this.id + ").recordText();'" +
-			" id='" + this.textID + "' type='text' value='" + this.text + "'" +
-			" class='evaluationResponseText' />" 
-			+ "</td>";
+    //========== private static members ==========//
+    Evaluation.id = (typeof Evaluation.id == 'undefined') ? 0 : ++Evaluation.id;
+    
+    //========== public constants ==========//
+    this.id = Evaluation.id;
+    this.ratingGroupName = "evaluationGroup" + this.id;    
+    this.textID = "evaluationText" + this.id;
+    this.type = type;
+    this.data = data;
+    
+    //========== public read-only members ==========//
+    this.text = "";
+    this.rating = -1;
+    
+    //========== public methods ==========//
+    this.html = html;
+    this.recordText = recordText; 
+    this.recordRating = recordRating;
+    
+    //========== private methods ==========//
+    this.smallScaleForm = smallScaleForm;
+    this.evaluationForm = evaluationForm;
+    
+    //========== function definitions ==========//
+    /**
+     * @return The html representation of this evaluation.
+     */
+    function html()
+    {
+        var text = "<table class='evaluation'>" +
+                         "<tr>" +
+                         "<th class='evaluationType' colspan='2'>" + type + " Evaluation</th>" +
+                         "</tr>" +
+                         "<tr>" +
+                         "<td><table class='evaluationInner2'>";
+        
+        for (i = 0; i < this.data.length; i += 2)
+        {
+            text += "<tr>" +
+                   "<td class='evaluationLabel'>" + this.data[i] + "</td>" +
+                   "<td class='evaluationCriteria'>" + this.data[i+1] + "</td>" +
+                   "</tr>";
+        }
+        /*  Displays the comment input field 
+        text += "<tr><td colspan='2' class='evaluationResponse'>" +
+            "<input onchange='events.getEvaluation(" + this.id + ").recordText();'" +
+            " id='" + this.textID + "' type='text' value='" + this.text + "'" +
+            " class='evaluationResponseText' />" 
+            + "</td>";
         */
-        text +=	"</table>";
-		/*  Displays the ranking bubbles
-		text += "</td>" +
-   		   		"<td class='evaluationScale'>" + this.evaluationForm() + "</td>" +
-	   		    "</tr>";
-        */
-        text +=	"</table>";
+        text +=    "</table>";
+        /*  Displays the ranking bubbles  */
+        text += "</td>" +
+                      "<td class='evaluationScale'>" + this.evaluationForm() + "</td>" +
+                   "</tr>";
+        
+        text +=    "</table>";
 
-        		
-		return text;
-	}
-	
-	/**
-	 * Stores the rating given by the evaluation scale radio button form.
-	 */
-	function recordRating() 
-	{ 
-		// list of radio buttons
-		var radioButtons;
-		
-		// get list of radio buttons
-		radioButtons = events.doc.getElementsByName(this.ratingGroupName);
-		
-		// FOR each radio button
-		for (var i = 0; i < radioButtons.length; i++)
-		{
-			// IF the radio button is checked THEN
-			if (radioButtons[i].checked)
-			{
-				// save rating
-				this.rating = radioButtons[i].value;
-			}
-		}
-	}
+                
+        return text;
+    }
+    
+    /**
+     * Stores the rating given by the evaluation scale radio button form.
+     */
+    function recordRating(givenRating) 
+    { 
 
-	/**
-	 * Stores the text in the written response text box.
-	 */
-	function recordText() 
-	{ 
-		this.text = events.doc.getElementById(this.textID).value; 
-	}
-	
-	/**
-	 * @return The html for appropriate evaluation form for grading.
-	 */
-	function evaluationForm()
-	{
-		return this.smallScaleForm();
-	}
-	
-	/**
-	 * @return The html for a 1-5 grading scale.
-	 */
-	function smallScaleForm()
-	{
-		return "<form>" +
-			   "<table align='right' class='evaluationScale'>" +
-			   "<tr>" +
-			   "<td class='eventRadioButtonSmallScale'>Best</td>" +
-			   "<td class='eventRadioButtonSmallScale'>Good</td>" +
-			   "<td class='eventRadioButtonSmallScale'>Average</td>" +
-			   "<td class='eventRadioButtonSmallScale'>Poor</td>" +
-			   "<td class='eventRadioButtonSmallScale'>Worst</td>" +
-			   "</tr>" +
-			   "<tr>" +
-			   "<td align='center'><input type='radio' " + 
-			   		(this.rating == 1 ? "checked='true'" : "") + 
-			   		" onchange='events.getEvaluation(" + this.id + 
-			   		").recordRating()' name='" + this.ratingGroupName + 
-			   		"' value='1'></td>" +
-			   "<td align='center'><input type='radio' " + 
-			   		(this.rating == 2 ? "checked='true'" : "") + 
-			   		" onchange='events.getEvaluation(" + this.id + 
-			   		").recordRating()' name='" + this.ratingGroupName + 
-			   		"' value='2'></td>" +
-			   "<td align='center'><input type='radio' " + 
-			   		(this.rating == 3 ? "checked='true'" : "") + 
-			   		" onchange='events.getEvaluation(" + this.id + 
-			   		").recordRating()' name='" + this.ratingGroupName + 
-			   		"' value='3'></td>" +
-			   "<td align='center'><input type='radio' " + 
-			   		(this.rating == 4 ? "checked='true'" : "") + 
-			   		" onchange='events.getEvaluation(" + this.id + 
-			   		").recordRating()' name='" + this.ratingGroupName + 
-			   		"' value='4'></td>" +
-			   "<td align='center'><input type='radio' " + 
-			   		(this.rating == 5 ? "checked='true'" : "") + 
-			   		" onchange='events.getEvaluation(" + this.id + 
-			   		").recordRating()' name='" + this.ratingGroupName + 
-			   		"' value='5'></td>" +
-			   "</tr>" +
-			   "</table>"  +
-			   "</form>";
-	}
+        this.rating = givenRating;
+
+        console.log(this.ratingGroupName + " recordRating of " + this.rating )
+    }
+
+    /**
+     * Stores the text in the written response text box.
+     */
+    function recordText() 
+    { 
+        this.text = events.doc.getElementById(this.textID).value; 
+    }
+    
+    /**
+     * @return The html for appropriate evaluation form for grading.
+     */
+    function evaluationForm()
+    {
+        return this.smallScaleForm();
+    }
+    
+    /**
+     * @return The html for a 1-5 grading scale.
+     */
+    function smallScaleForm()
+    {
+        return "<form>" +
+               "<table align='right' class='evaluationScale'>" +
+               "<tr>" +
+               "<td class='eventRadioButtonSmallScale'>Best</td>" +
+               "<td class='eventRadioButtonSmallScale'>Good</td>" +
+               "<td class='eventRadioButtonSmallScale'>Average</td>" +
+               "<td class='eventRadioButtonSmallScale'>Poor</td>" +
+               "<td class='eventRadioButtonSmallScale'>Worst</td>" +
+               "</tr>" +
+               "<tr>" +
+               "<td align='center'><input type='radio' " + 
+                       (this.rating == 5 ? "checked='true'" : "") + 
+                       " onchange='events.getEvaluation(" + this.id + 
+                       ").recordRating(5)' name='" + this.ratingGroupName + 
+                       "' value='1'></td>" +
+               "<td align='center'><input type='radio' " + 
+                       (this.rating == 4 ? "checked='true'" : "") + 
+                       " onchange='events.getEvaluation(" + this.id + 
+                       ").recordRating(4)' name='" + this.ratingGroupName + 
+                       "' value='2'></td>" +
+               "<td align='center'><input type='radio' " + 
+                       (this.rating == 3 ? "checked='true'" : "") + 
+                       " onchange='events.getEvaluation(" + this.id + 
+                       ").recordRating(3)' name='" + this.ratingGroupName + 
+                       "' value='3'></td>" +
+               "<td align='center'><input type='radio' " + 
+                       (this.rating == 2 ? "checked='true'" : "") + 
+                       " onchange='events.getEvaluation(" + this.id + 
+                       ").recordRating(2)' name='" + this.ratingGroupName + 
+                       "' value='4'></td>" +
+               "<td align='center'><input type='radio' " + 
+                       (this.rating == 1 ? "checked='true'" : "") + 
+                       " onchange='events.getEvaluation(" + this.id + 
+                       ").recordRating(1)' name='" + this.ratingGroupName + 
+                       "' value='5'></td>" +
+               "</tr>" +
+               "</table>"  +
+               "</form>";
+    }
 }
Index: trunk/webapps/einotebook/script/scrollframe.js
===================================================================
--- trunk/webapps/einotebook/script/scrollframe.js	(revision 468)
+++ trunk/webapps/einotebook/script/scrollframe.js	(revision 548)
@@ -11,2 +11,56 @@
 	events = theEvents;
 }
+
+function collectRatings() 
+{
+    // Consider each event in the incident script
+    for (var evtidx = 0; evtidx < events.length; evtidx++)
+    {
+        // Does this event have any evaluations?
+        if (events[evtidx].evaluations.evaluations.length > 0)
+        {
+            // Examine each evaluation contained in this event
+            for (var rating=0; rating<events[evtidx].evaluations.evaluations.length; rating++ )
+            {
+                // Extract the rating assigned to this item
+                var item = events[evtidx].evaluations.evaluations[rating];
+                // If it not the default value we want to save it
+                if (item.rating > 0)
+                {
+                    console.log("collecting event"+evtidx + " at " + events[evtidx].time.format() +" "+item.type + " " + item.rating)
+                }
+            }
+        }
+    }
+}
+
+/* This is an alternative way to collect the ratings values by reading them directly from the radio buttons 
+function collectRadios()
+{
+    var radios = document.getElementsByTagName('input');
+    var count = 0;
+    for (var j=0; j<radios.length; j++)
+    {
+        if (radios[j].type == 'radio') 
+        {
+            count++;
+            if (radios[j].checked) 
+            {
+                console.log(radios[j].name + " checked " + radios[j].value)                        
+            }
+        }
+    }
+    alert("counted " + count + " radios");
+}
+*/
+
+// TODO
+function submitRatings()
+{
+        // Using POST to send the data 
+        var xhr = new XMLHttpRequest();
+        xhr.open("POST", "../../cgi-bin/saveRatings.py", true);
+        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
+        // send the collected data
+        xhr.send("msg="+outString);
+}
Index: trunk/webapps/einotebook/script/simscript.js
===================================================================
--- trunk/webapps/einotebook/script/simscript.js	(revision 468)
+++ trunk/webapps/einotebook/script/simscript.js	(revision 548)
@@ -70,4 +70,6 @@
 	}
 	
+    // Add a submit button to the very bottom 
+    html += "<button style=\"float: right\" onclick=\"collectRatings();\">Submit Ratings</button>"
 	// display events in iframe
 	getDocumentFromFrame('view').body.innerHTML = html;	
@@ -76,7 +78,7 @@
 	resizeIframe();
 	window.onresize = resizeIframe;
-    // This line is causing an error
-	//window.frames['view'].setEvents(Script.events);
-	
+    // Pass the events to the scroll frame window
+	document.getElementById("view").contentWindow.setEvents(Script.events);
+    
 	Script.events.win.scrollTo(0, readCookie('scriptScrollY'));
 	
Index: trunk/webapps/einotebook/script/index.html
===================================================================
--- trunk/webapps/einotebook/script/index.html	(revision 468)
+++ trunk/webapps/einotebook/script/index.html	(revision 548)
@@ -13,9 +13,13 @@
   <body>
    
+
     <button class="jumpToCurrentEvent" 
             onclick="jumpToLastExecutedEvent()">Jump to Current Event</button>
-     
+    
     <iframe id='view' src='scrollframe.html' frameborder='0' scrolling='yes'
             width='100%'></iframe>
+
+      </form>
+   
   </body>
 </html>
