source: tmcsimulator/trunk/webapps/cmsmonitor/index.html @ 405

Revision 405, 4.0 KB checked in by jdalbey, 7 years ago (diff)

Remove HAR , Lane Closure columns from CMSmonitor. Change cctvLayer to user filename instead of folder for img categories.

Line 
1<!DOCTYPE html>
2<html>
3  <head>
4<!-- Launch with  python -m CGIHTTPServer 80  -->
5  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
6    <title>CMS Monitor v0.2</title> 
7<style>
8@font-face {
9  font-family: Scoreboard;
10  src: url('../cptms/js/scoreboard.ttf');
11}
12* {
13  box-sizing: border-box;
14}
15body {
16   background-color: #000033;
17}
18/* Create three unequal columns that float next to each other */
19.column {
20  float: left;
21  padding: 10px;
22  background-color:black; 
23  color:goldenrod
24}
25
26.left {
27  width: 100%;
28}
29
30.middle, .right {
31  width: 25%;
32}
33/* styling for cms monitor */
34#msgs{
35  padding: 15px 10% 15px 10%;
36}
37#cms_info{
38  font-size: 20px;
39  font-family: Arial;
40  font-weight:lighter;
41  color: white;
42  padding-left: 5%;
43  padding-right: 5%;
44}
45.cms_content{
46  font-size: 34px;
47  font-family: Scoreboard;
48  font-weight: 550;
49  padding: 0px 20% 20px 20%;
50}
51.divider {
52  font-family: Scoreboard;
53  font-weight: 550;
54  padding-left: 5%;
55  padding-right: 5%;
56}
57/* Clear floats after the columns */
58.row:after {
59  content: "";
60  display: table;
61  clear: both;
62}
63</style>
64</head>
65<body>
66<div class="row">
67  <div class="column left" >
68    <h2>Active CMS Messages</h2>
69    <p id="msgs"></p>
70  </div>
71</div>
72
73
74    <script  src="../common/js/fileutils.js"></script>
75    <script  src="../common/js/revision_number.dat"></script>
76    <script  src="../common/js/displayutils.js"></script> 
77   <script>
78    showRevision();
79    var cmsLocations = {};
80    // Load the CMS locations from the geojson file
81    function loadCMSlocations()
82    {
83        loadJSON("../cptms/data_layers/cms_locations_D12.gjson", function(response)
84        {
85            // Parse JSON string into object
86            var cmsjson = JSON.parse(response);
87            for (var i = 0; i < cmsjson.features.length; i++)
88            {
89                var item = cmsjson.features[i];
90                // Add each item to a lookup dictionary
91                cmsLocations[item.id] = item;
92            }
93        });
94    }
95    // Load the file of CMS messages
96    function loadAllcmsMessages()
97    {
98        var display = document.getElementById("msgs");
99        display.innerHTML = ""
100        loadJSON("../dynamicdata/cms_messages.json", function(response)
101        {
102            // Parse JSON string into object
103            messagejson = JSON.parse(response);
104            // Consider each message
105            for (var i = 0; i < messagejson.data.length; i++)
106            {
107                var item = messagejson.data[i];
108                // Find the location for this message
109                var cmsLoc = cmsLocations[item.cms.index];
110                // Build the message display
111                // divide the display message into 2 phases
112                var phase1 = item.cms.message.phase1.Line1.toUpperCase() + "<br>" +
113                    item.cms.message.phase1.Line2.toUpperCase() + "<br>" +
114                    item.cms.message.phase1.Line3.toUpperCase() + "<br>";
115                var phase2 = item.cms.message.phase2.Line1.toUpperCase() +  "<br>" +
116                    item.cms.message.phase2.Line2.toUpperCase() + "<br>" +
117                    item.cms.message.phase2.Line3.toUpperCase();
118     
119                // If the message isn't blank, append it to the list
120                // adding a seperate dotted line between phase1 and phase2
121                if (phase1 != "<br><br><br>" || phase2 != "<br><br>")
122                {
123                    display.innerHTML += "<div id=\"cms_info\">" + item.cms.index + ": " + 
124                        cmsLoc.properties.location + " " + cmsLoc.properties.street + "</div>";
125                    display.innerHTML += "<div class=\"cms_content\">" + phase1 + "</div>" +
126                      "<div class=\"divider\"> -----------------------------------------------</div>" +
127                      "<div class=\"cms_content\">" + phase2 + "</div>";
128                }
129            }
130        });
131    }
132
133// Start
134loadCMSlocations();
135loadAllcmsMessages();
136// start an interval timer to refresh the cms icons every 10 seconds
137var cmsTimer = setInterval(loadAllcmsMessages, 10000);
138
139   </script>
140  </body>
141</html>
Note: See TracBrowser for help on using the repository browser.