- Timestamp:
- 07/28/2019 05:27:26 AM (7 years ago)
- Location:
- trunk/webapps/einotebook
- Files:
-
- 12 added
- 9 deleted
- 7 edited
-
cad (deleted)
-
currentEvent (added)
-
currentEvent/cad.css (added)
-
currentEvent/cadpad.css (added)
-
currentEvent/currentEvent.js (added)
-
currentEvent/index.html (added)
-
index.html (modified) (3 diffs)
-
notebook.js (modified) (5 diffs)
-
notebook_standalone.js (deleted)
-
script/index.html (added)
-
script/script.css (deleted)
-
script/script.html (deleted)
-
script/script.js (deleted)
-
script/scripts.css (deleted)
-
script/scripts.html (deleted)
-
script/scripts.js (deleted)
-
script/scrollframe.css (added)
-
script/scrollframe.html (added)
-
script/scrollframe.js (added)
-
script/simscript.css (added)
-
script/simscript.js (added)
-
scripts/Events.js (modified) (1 diff)
-
scripts/Incident.js (modified) (4 diffs)
-
scripts/Incidents.js (modified) (2 diffs)
-
scripts/LoadEvents.js (modified) (6 diffs)
-
summary/index.html (added)
-
summary/summary.html (deleted)
-
summary/summary.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/einotebook/index.html
r401 r468 21 21 <script type="text/javascript" src="scripts/Incident.js"></script> 22 22 <script type="text/javascript" src="scripts/Incidents.js"></script> 23 <script type="text/javascript" src="scripts/LoadEvents.js"></script>24 <!--script type="text/javascript" src="scripts/PopulateIncidents.js"></script-->25 <!--script type="text/javascript" src="scripts/PopulateEvents.js"></script-->26 23 <script type="text/javascript" src="summary/summary.js"></script> 27 24 <script type="text/javascript" src="notebook.js"></script> 25 <!-- LoadEvents contains init() function, the main entry point --> 26 <script type="text/javascript" src="scripts/LoadEvents.js"></script> 28 27 </head> 29 <body onLoad="showRevision(); setupNotebook(); run();">28 <body onLoad="showRevision(); init()"> 30 29 31 30 <table class="notebook"> 32 <!-- The header which contains the number of evaluations, simulation status,33 and time34 <tr style="height: 20px">35 <td>36 <table class="header">37 <tr>38 39 <td class="updateStatusBox">40 <table>41 <tr>42 <td class="updateStatus" id="updateStatus">New Event</td>43 </tr>44 </table>45 </td>46 47 <td class="statusBox">48 <center><table>49 <tr>50 <td class="simulationStatus" id="simulationStatus">NOT STARTED</td>51 </tr>52 </table></center>53 </td>54 55 <td class="simulationTime" id="simulationTime">56 0:00:0057 </td>58 59 </tr>60 </table>61 </td>62 </tr>63 -->64 31 <tr style="height: 80px"> 65 32 <td colspan='3' class="tabMenu"> … … 77 44 Simulation Script 78 45 </li> 79 <li class="notActive" id=" CADTab"80 onClick="changeTab(this.id); showContent('c adPageContent')">46 <li class="notActive" id="currentTab" 47 onClick="changeTab(this.id); showContent('currentEventPageContent')"> 81 48 Current Event 82 49 </li> … … 94 61 <tr> 95 62 <td class='tabPageContent' id='summaryPageContent' style="display:inline"> 96 <iframe id='summaryTabPage' src='summary/summary.html' frameborder='0' scrolling='yes' 97 height='100%' width='100%' 98 onLoad='incidents.doc = getDocumentFromFrame("summaryTabPage"); 99 window.frames[0].loadSummary(incidents);'></iframe> 63 <iframe id='summaryTabPage' src='summary/index.html' frameborder='0' scrolling='yes' 64 height='100%' width='100%'> 65 </iframe> 100 66 </td> 101 67 <td class='tabPageContent' id='scriptPageContent' style="display:none;"> 102 <iframe id='tabPage' src='script/script.html' frameborder='0' 103 scrolling='yes' height='100%' width='100%' 104 onLoad='window.frames[1].loadScript(events, incidents);' 105 > 68 <iframe id='tabPage' src='script/index.html' frameborder='0' 69 scrolling='yes' height='100%' width='100%'> 106 70 </iframe> 107 71 </td> 108 <td class='tabPageContent' id='cadPageContent' style="display:none;"> 109 <iframe src='cad/index.html' frameborder='0' 110 scrolling='yes' height='100%' width='100%' 111 onLoad='window.frames[2].loadScript(events, incidents);'> 72 <td class='tabPageContent' id='currentEventPageContent' style="display:none;"> 73 <iframe id='currentEventPage' src='currentEvent/index.html' frameborder='0' 74 scrolling='yes' height='100%' width='100%'> 112 75 </iframe> 113 76 </td> 114 77 <td class='tabPageContent' id='mapsPageContent' style="display:none;"> 115 78 <iframe src='maps/index.html' frameborder='0' 116 scrolling='no' height='100%' width='100%' >79 scrolling='no' height='100%' width='100%' > 117 80 </iframe> 118 81 </td> -
trunk/webapps/einotebook/notebook.js
r415 r468 1 /*2 function loadXMLDoc()3 {4 if (window.XMLHttpRequest)5 {6 xmlhttp = new XMLHttpRequest();7 }8 else9 {10 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");11 }12 13 xmlhttp.onreadystatechange=function()14 {15 if (xmlhttp.readyState==4 && xmlhttp.status==200)16 {17 document.getElementById("myDiv").innerHTML = xmlhttp.responseText;18 }19 }20 21 xmlhttp.open("GET", "ajax_info.txt", true);22 xmlhttp.send("");23 }24 */25 26 1 /** 27 2 * Sets the selected tab to the summary tab and loads the summary page. … … 31 6 { 32 7 console.log("setupNotebook() starting"); 33 changeTab('summaryTab'); 8 changeTab('summaryTab'); // Initially show Summary tab 34 9 showContent('summaryPageContent') 35 loadSummary(); 10 loadSummaryPage(); 11 loadPages(); 36 12 setCookie("time", "0"); 37 13 setCookie("scriptScrollY", 0); 38 14 setCookie("summaryScrollY", 0); 15 run(); // start the script scrolling 39 16 } 40 17 41 18 /** 42 * Runs the script. 19 * Loads the summary tab page; 20 */ 21 function loadSummaryPage() 22 { 23 incidents.doc = getDocumentFromFrame('summaryTabPage'); 24 window.frames[0].loadSummary(incidents); 25 } 26 27 /** 28 * Loads content of the pages for Simulation Script and Current Event 29 */ 30 function loadPages() 31 { 32 window.frames[1].loadScript(events, incidents); 33 window.frames[2].loadScript(events, incidents); 34 } 35 36 /** 37 * Start scrolling the script in an infinite loop. 43 38 */ 44 39 function run() 45 40 { 46 41 run.initialDelay = 1000; 47 48 42 setTimeout("run.run()", run.initialDelay); 49 43 50 44 run.run = function() 51 45 { 52 // document.getElementById("simulationStatus").innerHTML = "RUNNING";53 46 setTime(); 54 updateStatus();55 47 }; 56 }57 58 /**59 * Displays fading text alerts in the status box (left-top corner).60 */61 function updateStatus()62 {63 // IF last event if it has not been set before THEN64 if (typeof updateStatus.lastEvent == 'undefined')65 {66 updateStatus.lastEvent = null;67 }68 69 var latestEvent = events.getLastExecutedEvent(readCookie("time"));70 71 72 // IF a new event executed THEN73 if (updateStatus.lastEvent != latestEvent)74 {75 var i;76 for (i=0; i<latestEvent.length; i++) {77 // IF the new event has evaluations THEN78 if (latestEvent[i].evaluations.evaluations.length == 0)79 {80 // document.getElementById('updateStatus').innerHTML = "New Event";81 }82 else83 {84 // document.getElementById('updateStatus').innerHTML = "New Evaluation";85 }86 }87 88 89 // fades the text90 updateStatus.fade = function fade()91 {92 // IF the fade color is not black yet THEN93 if (fade.hex < 255)94 {95 fade.hex += 5;96 // document.getElementById('updateStatus').style.color =97 "rgb(" + fade.hex + ", " + fade.hex + ", " + fade.hex + ")";98 setTimeout("updateStatus.fade()", 100);99 }100 else101 {102 // document.getElementById('updateStatus').style.color = "white";103 }104 105 };106 107 updateStatus.fade.hex = 0;108 updateStatus.fade();109 updateStatus.lastEvent = latestEvent;110 }111 112 setTimeout("updateStatus();", 1000);113 48 } 114 49 … … 129 64 setTime.time = seconds; 130 65 // increment time by one second (or initialize it if it has not been set before) 131 // setTime.time = (typeof setTime.time == 'undefined') ? 0 : ++setTime.time;66 // setTime.time = (typeof setTime.time == 'undefined') ? 0 : ++setTime.time; 132 67 133 68 setCookie("time", "" + setTime.time); … … 152 87 document.getElementById("summaryTab").className = "notActive"; 153 88 document.getElementById("scriptTab").className = "notActive"; 154 document.getElementById(" CADTab").className = "notActive";89 document.getElementById("currentTab").className = "notActive"; 155 90 document.getElementById("mapsTab").className = "notActive"; 156 91 157 92 /* Set the selected tab to being active */ 158 93 document.getElementById(id).className = "activeTab"; 159 }160 161 /**162 * Loads the script tab page;163 */164 function loadScript()165 {166 }167 168 /**169 * Loads the summary tab page;170 */171 function loadSummary()172 {173 94 } 174 95 … … 204 125 hideContent('summaryPageContent'); 205 126 hideContent('scriptPageContent'); 206 hideContent('c adPageContent');127 hideContent('currentEventPageContent'); 207 128 hideContent('mapsPageContent'); 208 129 document.getElementById(d).style.display = "block"; -
trunk/webapps/einotebook/scripts/Events.js
r418 r468 324 324 } 325 325 326 327 326 /** 328 327 * Finds the Event that was last executed by based on given time. -
trunk/webapps/einotebook/scripts/Incident.js
r359 r468 17 17 //========== public methods ==========// 18 18 this.html = html; 19 this.expandAction = expandAction;19 this.setSummary = setSummary; 20 20 21 21 //========== private methods ==========// 22 22 this.formatHeader = formatHeader; 23 this.expandOption = expandOption; 24 this.expandOptionSymbol = expandOptionSymbol; 25 23 24 /** Setter for summary field */ 25 function setSummary(description) 26 { 27 this.summary = description; 28 } 29 30 /** 26 31 /** 27 32 * @return The html representation of this incident; … … 35 40 "<tr>" + 36 41 "<td class='incidentSummary' id='summary" + this.number + "'>" + 37 (this.expanded ? this.summary : "")+ "</td>" +42 this.summary + "</td>" + 38 43 "</tr>" + 39 44 "</table>"; … … 50 55 return "<table class='incidentHeader'>" + 51 56 "<tr class='incidentHeader'>" + 52 "<td class='incidentExpandOption'> " + this.expandOption() + "</td>" +57 "<td class='incidentExpandOption'></td>" + 53 58 "<td class='incidentTime'>Time: " + this.time.format() + "</td>" + 54 59 "<td class='incidentNumber'>" + this.number + "</td>" + … … 58 63 } 59 64 60 /**61 * @return The html that for the + or - symbol that expands or collapses the incident.62 */63 function expandOption()64 {65 return "<button class='incidentExpandButton' " +66 "id='expandOption" + this.number + "' onclick='incidents.get(" +67 this.number + ").expandAction()'>" + this.expandOptionSymbol() +68 "</button>";69 }70 65 71 /**72 * Returns the symbol for the expand option.73 * @return Either "+" or "-" depending on whether this incidents is collapsed or74 * expanded.75 */76 function expandOptionSymbol()77 {78 return this.expanded == true ? "–" : "+";79 }80 81 /**82 * Performs the action of clicking on the + or - symbol that expands or collapses83 * the incident.84 */85 function expandAction()86 {87 if (this.expanded)88 {89 incidents.doc.getElementById("summary" + this.number).innerHTML = "";90 incidents.doc.getElementById("expandOption" + this.number).innerHTML = "+";91 }92 else93 {94 incidents.doc.getElementById("summary" + this.number).innerHTML =95 this.summary;96 incidents.doc.getElementById("expandOption" + this.number).innerHTML =97 "–";98 }99 100 this.expanded = !this.expanded;101 102 }103 66 } -
trunk/webapps/einotebook/scripts/Incidents.js
r359 r468 10 10 //========== public methods ==========// 11 11 incidents.get = incidents_get; 12 incidents.collapseAll = incidents_collapseAll;13 incidents.expandAll = incidents_expandAll;14 12 incidents.add = incidents_add; 15 13 … … 38 36 39 37 /** 40 * Collapses each Incident.41 */42 function incidents_collapseAll()43 {44 // FOR each incident45 for (var i = 0; i < this.length; i++)46 {47 // IF the incident is expanded THEN48 if (this[i].expanded)49 {50 // collapse incident51 this[i].expandAction();52 }53 }54 }55 56 /**57 * Expands each incident.58 */59 function incidents_expandAll()60 {61 // FOR each incident62 for (var i = 0; i < this.length; i++)63 {64 // IF incident is collapsed THEN65 if (!this[i].expanded)66 {67 // expand incident68 this[i].expandAction();69 }70 }71 }72 73 /**74 38 * Adds an Incident. 75 39 * @param incident {Incident} The Incident to be added. -
trunk/webapps/einotebook/scripts/LoadEvents.js
r434 r468 9 9 var xmlDoc = parser.parseFromString(response,"text/xml"); 10 10 var eventTags = xmlDoc.getElementsByTagName("SCRIPT_EVENT"); 11 console.log("parsing incident xml file ");11 console.log("parsing incident xml file containing "+eventTags.length+" event tags."); 12 12 // Process each SCRIPT_EVENT tag 13 13 for (var i = 0; i < eventTags.length; i++) … … 33 33 break; 34 34 case "INCIDENT": 35 incidentNum = Number(currEvt.childNodes[child].attributes["LogNum"].value);36 incidentTitle = currEvt.childNodes[child].textContent;37 break;38 case "GENERAL_INFO":39 35 /* This tag identifies a new incident. As long as it appears before any 40 36 other tags, we can use it to create a new incident. (The alternative is to … … 42 38 we load events.) Creating an event (below) requires that the incident has already 43 39 been created. */ 40 incidentNum = Number(currEvt.childNodes[child].attributes["LogNum"].value); 41 // If this incident number doesn't exist 42 if (incidents.get(incidentNum) == undefined) 43 { 44 incidentTitle = currEvt.childNodes[child].textContent; 45 // Construct the incident 46 var theIncident = new Incident(evtTime, incidentNum, incidentTitle, ""); 47 // Add the incident to the list of incidents 48 incidents.add(theIncident); 49 } 50 break; 51 case "GENERAL_INFO": 52 // Add the summary description to the incident 44 53 var desc = currEvt.childNodes[child].getElementsByTagName("TEXT")[0].textContent; 45 var theIncident = new Incident(evtTime, incidentNum, incidentTitle, desc);46 incident s.add(theIncident);47 // Create an entry showing the Incident start description. Fixes ticket #16454 incidentToUpdate = incidents.get(incidentNum); 55 incidentToUpdate.setSummary(desc); 56 // Create an entry showing the Incident start description. Fixes ticket #164 48 57 var result = new Array(); 49 58 result.push("Description:"); 50 result.push(desc);59 result.push(desc); 51 60 proparray.push(new Property("Incident Start",result)); 52 61 break; … … 101 110 } 102 111 } 103 } 104 // console.log(evtTime.format(), incidentNum, proparray.length, evalarray.length);112 }//end one event 113 // console.log(evtTime.format(), incidentNum, proparray.length, evalarray.length); 105 114 // Ignore Media Log incident and empty nodes 106 115 if (incidentNum != undefined && incidentNum != 100) … … 111 120 new Evaluations(evalarray)) ); 112 121 } 113 } 122 }// end all events 123 console.log("Done parsing xml, " + events.length + " events and " +incidents.length + " incidents saved."); 124 125 // NOW THAT WE HAVE THE EVENT LIST WE CAN PERFORM SETUP 126 setupNotebook(); 114 127 } 115 128 … … 208 221 return result; 209 222 } 210 // MAIN 211 //console.log("starting LoadEvents"); 212 try { 213 // the script must be located where accessible by the web server 214 var scriptFilename = "../dynamicdata/incident_script.xml"; 215 console.log("Attempting to load ", scriptFilename); 216 // Now load the Incident Script and go parse it 217 loadJSON(scriptFilename, parseXml) 218 219 } catch(e) { 220 console.log("Error attempt to parse incident script "+response) 221 } 222 223 223 // MAIN ENTRY POINT for this application 224 function init() 225 { 226 try { 227 // the script must be located where accessible by the web server 228 var scriptFilename = "../dynamicdata/incident_script.xml"; 229 console.log("LoadEvents.js main Attempting to load ", scriptFilename); 230 // Now load the Incident Script and go parse it 231 // NB: This is an async function, so all other notebook setup must be in the callback. 232 loadJSON(scriptFilename, parseXml) 233 234 } catch(e) { 235 console.log("Error attempting to parse incident script "+response) 236 } 237 } 238 -
trunk/webapps/einotebook/summary/summary.js
r359 r468 1 /** functions for Incident Summary page */ 1 2 var incidents; 2 3
Note: See TracChangeset
for help on using the changeset viewer.
