Changeset 250 for binary-improvements/webserver
- Timestamp:
- Aug 12, 2015, 6:10:28 PM (9 years ago)
- Location:
- binary-improvements/webserver
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/webserver/css/style.css
r249 r250 14 14 15 15 a { 16 color: #ff6000;16 color: orangered; 17 17 text-decoration: none; 18 18 } 19 19 20 20 a:visited { 21 color: #ff6000;21 color: orangered; 22 22 text-decoration: none; 23 23 } … … 30 30 31 31 .adminnavbar, 32 .admincontent {32 #admincontent { 33 33 position: absolute; 34 34 top: 0; … … 50 50 border-right: 1px solid rgba(0,0,0,0.3); 51 51 box-shadow: 3px 0px 14px rgba(0,0,0,0.9); 52 position: fixed; 52 53 } 53 54 … … 69 70 70 71 .adminnavbar #adminmenu .menu_button.allowed { 71 display: inline;72 display: list-item; 72 73 } 73 74 … … 80 81 font-weight: bold; 81 82 text-transform: uppercase; 83 } 84 85 #newlogcount { 86 font-size: 70%; 87 border-radius: 2px; 88 background-color: #f00; 89 color: #fff; 90 padding: 0px 2px 0px 2px; 91 display: none; 92 } 93 94 #newlogcount.visible { 95 display: inline; 82 96 } 83 97 … … 122 136 */ 123 137 124 .admincontent {138 #admincontent { 125 139 position: absolute; 126 140 right: 0; … … 129 143 } 130 144 131 .admincontent #nopermissionwarning {145 #admincontent #nopermissionwarning { 132 146 margin: 20px 50px; 133 147 } 134 148 135 .admincontent .contenttab {149 #admincontent .contenttab { 136 150 position: absolute; 137 151 top: 0; … … 141 155 } 142 156 143 .admincontent .current_tab {157 #admincontent .current_tab { 144 158 display: block; 145 159 } … … 199 213 border-collapse: collapse; 200 214 } 201 #equipmentTable .invFieldText { 202 display: none; 203 } 215 204 216 .playerInventoryDialog td.invField { 205 217 width: 58px; … … 222 234 } 223 235 236 #equipmentTable .invFieldText { 237 display: none; 238 } 239 .playerInventoryDialog .invFieldText { 240 display: none; 241 } 242 .playerInventoryDialog .invFieldText.visible { 243 display: inline; 244 } 245 .playerInventoryDialog .invFieldQuality { 246 bottom: 0px; 247 height: 5px; 248 left: 0px; 249 position: relative; 250 right: 0px; 251 display: none; 252 } 253 .playerInventoryDialog .invFieldQuality.visible { 254 display: block; 255 } 224 256 225 257 … … 246 278 .adminmap .leaflet-container a:hover { 247 279 text-decoration: none; 248 color: #ff6000;280 color: orangered; 249 281 } 250 282 … … 261 293 } 262 294 295 296 297 298 /*======================================== 299 - Log 300 */ 301 302 .adminlog { 303 padding: 10px; 304 } 305 306 .adminlog table { 307 width: 100%; 308 } 309 310 .adminlog table td { 311 vertical-align: top; 312 } 313 314 .adminlog table tr.readmark td { 315 border-bottom-width: 2px; 316 border-bottom-color: red; 317 border-bottom-style: dotted; 318 } 319 320 .adminlog table tr.Log td { 321 color: limegreen; 322 } 323 .adminlog table tr.Warning td { 324 color: orange; 325 } 326 .adminlog table tr.Error td { 327 color: red; 328 } 329 .adminlog table tr.Exception td { 330 color: red; 331 } 332 333 334 .adminlog .logcol_datetime, 335 .adminlog .logcol_uptime { 336 white-space: nowrap; 337 text-align: right; 338 } 339 .adminlog .logcol_type { 340 white-space: nowrap; 341 } 342 .adminlog .logcol_msg { 343 width: 100%; 344 } 345 346 .adminlog .logcol_missed { 347 text-align: center; 348 border-width: 1px 0px; 349 border-style: dashed; 350 border-color: orange; 351 } 352 353 .adminlog .tracebtn { 354 cursor: pointer; 355 } 356 .adminlog .tracebtn:after { 357 content: "Show trace..."; 358 } 359 .adminlog .tracebtn.visible:after { 360 content: "Hide trace..."; 361 } 362 363 .adminlog .trace { 364 display: none; 365 } 366 367 .adminlog .trace.visible { 368 display: block; 369 } 370 371 .adminlog .trace span { 372 display: block; 373 margin-left: 30px; 374 text-indent: -30px; 375 } 376 377 .adminlog #markasread { 378 cursor: pointer; 379 border-radius: 5px; 380 background-color: #444; 381 color: orangered; 382 display: inline-block; 383 margin-top: 10px; 384 padding: 3px 5px 3px 5px; 385 } 386 387 -
binary-improvements/webserver/index.html
r249 r250 46 46 <script type="text/javascript" src="js/permissions.js"></script> 47 47 <script type="text/javascript" src="js/map.js"></script> 48 <script type="text/javascript" src="js/log.js"></script> 48 49 49 50 <!-- Own stylesheet --> … … 65 66 <ul> 66 67 <li><a href="#tab_map" data-permission="web.map">Map</a></li> 67 <li><a href="#tab_log" data-permission="web .log">Log</a></li>68 <li><a href="#tab_log" data-permission="webapi.getlog">Log <span id="newlogcount"></span></a></li> 68 69 </ul> 69 70 </div> … … 85 86 </div> 86 87 </div> 87 <div class="admincontent">88 <div id="admincontent"> 88 89 <h1 id="nopermissionwarning" style="display:none">An error occured or you do not have any permissions on this WebPanel. Log in with the link on the lower left!</h1> 89 90 <div id="tab_map" class="adminmap"></div> 90 <div id="tab_log" class="adminlog"></div> 91 <div id="tab_log" class="adminlog"> 92 <table> 93 <tr> 94 <th>Date/Time</th> 95 <th>Uptime</th> 96 <th>Severity</th> 97 <th>Message</th> 98 </tr> 99 </table> 100 <a id="markasread">Mark as read</a> 101 </div> 91 102 </div> 92 103 </div> -
binary-improvements/webserver/js/index.js
r245 r250 1 InitializeTabs (); 1 //InitializeTabs (); 2 var tabs = $("#adminmenu").tabbedContent ({ 3 contentdiv: $("#admincontent"), 4 }); 2 5 SetupInventoryDialog (); 3 6 InitPermissions (); -
binary-improvements/webserver/js/inventory_dialog.js
r249 r250 11 11 var cell = $("#" + containerTypeName + "Field"+cellIdent); 12 12 var text = $("#" + containerTypeName + "FieldText"+cellIdent); 13 if (itemdata.count > 0) { 13 var qual = $("#" + containerTypeName + "FieldQuality"+cellIdent); 14 15 cell.attr("style", "background-image: none;"); 16 cell.removeAttr("title"); 17 text.removeClass ("visible"); 18 qual.removeClass ("visible"); 19 20 if (itemdata !== null) { 14 21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.name + ".png);"); 15 cell.attr("title", itemdata.name); 16 text.text(itemdata.count); 17 } else { 18 cell.attr("style", "background-image: none;"); 19 cell.removeAttr("title"); 20 text.text(""); 22 if (itemdata.quality >= 0) { 23 cell.attr("title", itemdata.name + " (quality: " + itemdata.quality + ")"); 24 qual.attr("style", "background-color: #"+ itemdata.qualitycolor); 25 qual.addClass ("visible"); 26 } else { 27 cell.attr("title", itemdata.name); 28 text.text(itemdata.count); 29 text.addClass ("visible"); 30 } 21 31 } 22 32 } … … 24 34 var SetEquipmentItem = function (data, name, cellIdent) { 25 35 if (data.equipment [name] == false) { 26 SetCellItem ("equipment", cellIdent, { count: 0, name: "" });36 SetCellItem ("equipment", cellIdent, null); 27 37 } else { 28 SetCellItem ("equipment", cellIdent, { count: 1, name: data.equipment [name] });38 SetCellItem ("equipment", cellIdent, data.equipment [name] ); 29 39 } 30 40 } … … 77 87 var CreateInvCell = function (containerTypeName, cellIdent) { 78 88 return "<td class=\"invField\" id=\"" + containerTypeName + "Field"+cellIdent+"\">" + 89 "<div class=\"invFieldQuality\" id=\"" + containerTypeName + "FieldQuality" + cellIdent + "\"></div>" + 79 90 "<span class=\"invFieldText\" id=\"" + containerTypeName + "FieldText"+cellIdent+"\"></span>" + 80 91 "</td>"; -
binary-improvements/webserver/js/map.js
r249 r250 131 131 }); 132 132 133 var openedPopup = null; 134 var updatingMarkers = false; 135 136 map.on ("popupopen", function (event) { 137 console.log ("open"); 138 console.log (event.popup._source); 139 openedPopup = event.popup._source; 140 }); 141 map.on ("popupclose", function (event) { 142 if (!updatingMarkers) { 143 console.log ("close"); 144 openedPopup = null; 145 } 146 }); 147 133 148 var setPlayerMarkers = function(data) { 134 149 var online = 0; 135 150 var offline = 0; 151 updatingMarkers = true; 136 152 $.each( data, function( key, val ) { 137 153 var marker; … … 147 163 playersMappingList[val.steamid] = { online: !val.online }; 148 164 } 149 if (playersMappingList[val.steamid].online) { 150 playersOnlineMarkerGroup.removeLayer(marker); 151 } else { 152 playersOfflineMarkerGroup.removeLayer(marker); 153 } 154 marker.setLatLng([val.position.x, val.position.z]); 155 if (val.online) { 156 marker.setOpacity(1.0); 157 playersOnlineMarkerGroup.addLayer(marker); 158 } else { 159 marker.setOpacity(0.5); 160 playersOfflineMarkerGroup.addLayer(marker); 165 166 oldpos = marker.getLatLng (); 167 if ( playersMappingList[val.steamid].online != val.online || oldpos.lat != val.position.x || oldpos.lng != val.position.z ) { 168 if (playersMappingList[val.steamid].online) { 169 playersOnlineMarkerGroup.removeLayer(marker); 170 } else { 171 playersOfflineMarkerGroup.removeLayer(marker); 172 } 173 marker.setLatLng([val.position.x, val.position.z]); 174 if (val.online) { 175 marker.setOpacity(1.0); 176 playersOnlineMarkerGroup.addLayer(marker); 177 } else { 178 marker.setOpacity(0.5); 179 playersOfflineMarkerGroup.addLayer(marker); 180 } 161 181 } 162 182 … … 169 189 offline++; 170 190 }); 191 updatingMarkers = false; 192 if (openedPopup != null) { 193 openedPopup.openPopup (); 194 } 171 195 $( "#mapControlOnlineCount" ).text( online ); 172 196 $( "#mapControlOfflineCount" ).text( offline ); 173 197 } 174 198 199 var updatePlayerTimeout; 175 200 var updatePlayerEvent = function() { 176 201 $.getJSON( "../api/getplayerslocation") … … 180 205 }) 181 206 .always(function() { 182 window.setTimeout(updatePlayerEvent, 2000);207 updatePlayerTimeout = window.setTimeout(updatePlayerEvent, 4000); 183 208 }); 184 209 } 185 210 186 if (HasPermission ("webapi.getplayerslocation")) { 187 window.setTimeout(updatePlayerEvent, 0); 211 tabs.on ("tabbedcontenttabopened", function (event, data) { 212 if (data.newTab === "#tab_map") { 213 if (HasPermission ("webapi.getplayerslocation")) { 214 updatePlayerEvent (); 215 } 216 } else { 217 window.clearTimeout (updatePlayerTimeout); 218 } 219 }); 220 221 if (tabs.tabbedContent ("isTabOpen", "tab_map")) { 222 if (HasPermission ("webapi.getplayerslocation")) { 223 updatePlayerEvent (); 224 } 188 225 } 189 226 -
binary-improvements/webserver/js/permissions.js
r249 r250 21 21 } 22 22 23 ApplyTabPermissions ();24 25 23 if (HasPermission ("web.map")) { 26 24 StartMapModule (); 27 25 } 26 if (HasPermission ("webapi.getlog")) { 27 StartLogModule (); 28 } 28 29 29 if (HasPermission ("webapi.getstats")) { 30 if (HasPermission ("webapi.getwebuiupdates")) { 31 StartUIUpdatesModule (); 32 } else if (HasPermission ("webapi.getstats")) { 30 33 StartStatsModule (); 31 34 } 35 36 tabs.tabbedContent ("applyPermissions"); 32 37 33 38 }) -
binary-improvements/webserver/js/stats.js
r245 r250 25 25 } 26 26 27 function StartUIUpdatesModule () { 28 var updateGameTimeEvent = function() { 29 $.getJSON( "../api/getwebuiupdates?latestLine=" + lastLogLine) 30 .done(function(data) { 31 var time = "Day " + data.gametime.days + ", "; 32 if (data.gametime.hours < 10) 33 time += "0"; 34 time += data.gametime.hours; 35 time += ":"; 36 if (data.gametime.minutes < 10) 37 time += "0"; 38 time += data.gametime.minutes; 39 40 $("#stats_time").html (time); 41 $("#stats_players").html (data.players); 42 $("#newlogcount").html (data.newlogs); 43 if (data.newlogs > 0) { 44 $("#newlogcount").addClass ("visible"); 45 } else { 46 $("#newlogcount").removeClass ("visible"); 47 } 48 }) 49 .fail(function(jqxhr, textStatus, error) { 50 console.log("Error fetching ui updates"); 51 }) 52 .always(function() { 53 }); 54 window.setTimeout(updateGameTimeEvent, 2000); 55 }; 56 updateGameTimeEvent(); 57 } 58 -
binary-improvements/webserver/js/tabs.js
r249 r250 1 var tabElements = {}; 2 var currentTabClass = "current_tab"; 1 $.widget( "7dtd.tabbedContent", { 2 options: { 3 contentdiv: null, 4 currentTabClass: "current_tab", 5 menuButtonClass: "menu_button", 6 allowedMenuButtonClass: "allowed", 7 contentDivClass: "contenttab", 8 }, 9 10 _create: function () { 11 var options = this.options; 12 var self = this; 13 14 if (options.contentdiv == null) { 15 console.log ("contentdiv has to be set!"); 16 } 17 18 this.element.find ("ul > li").addClass (options.menuButtonClass); 3 19 4 function OpenTab () { 5 var menuElement = $(this); 6 var linkElement = menuElement.children ("a"); 7 var linkName = linkElement.attr ("href"); 20 options.contentdiv.children ("div").addClass (options.contentDivClass); 21 this.element.on ('click.action', "ul > li", function (event) { 22 var menuElement = $(this); 23 var linkElement = menuElement.children ("a"); 24 var linkName = linkElement.attr ("href"); 25 self.openTab (linkName); 26 }); 8 27 9 $("*").removeClass (currentTabClass); 10 menuElement.addClass (currentTabClass); 11 $(linkName).addClass (currentTabClass); 12 } 28 self.tabs = {}; 29 this.element.find (".menu_button").each (function () { 30 self.tabs [$(this).children ("a").attr ("href")] = $(this); 31 }); 32 }, 33 34 applyPermissions: function () { 35 var self = this; 36 this.element.find (".menu_button").each (function () { 37 if ($(this).children ("a").data ("permission")) { 38 var perm = $(this).children ("a").data ("permission"); 39 if (HasPermission (perm)) { 40 $(this).addClass (self.options.allowedMenuButtonClass); 41 } 42 } else { 43 $(this).addClass (self.options.allowedMenuButtonClass); 44 } 45 }); 13 46 14 function InitializeTabs () { 15 $("#adminmenu > ul > li").addClass ("menu_button"); 16 $(".admincontent > div").addClass ("contenttab"); 17 $(".menu_button").on ('click.action', null, function (event) { 18 var menuElement = $(this); 19 var linkElement = menuElement.children ("a"); 20 var linkName = linkElement.attr ("href"); 47 this.element.find ("." + self.options.allowedMenuButtonClass).first ().click (); 48 }, 49 50 openTab: function (name) { 51 if (name.indexOf ("#") != 0) 52 name = "#" + name; 21 53 22 $("*").removeClass ("current_tab"); 23 menuElement.addClass ("current_tab"); 24 $(linkName).addClass ("current_tab"); 25 }); 26 } 54 if (!this.tabs.hasOwnProperty(name)) { 55 console.log ("no tab named " + name + " in " + this); 56 return; 57 } 27 58 28 function ApplyTabPermissions () { 29 $("#adminmenu .menu_button").each (function () { 30 if ($(this).children ("a").data ("permission")) { 31 var perm = $(this).children ("a").data ("permission"); 32 if (HasPermission (perm)) { 33 $(this).addClass ("allowed"); 34 } 59 var menuElement = $(".menu_button > a[href=" + name + "]").parent (); 60 61 $("*").removeClass (this.options.currentTabClass); 62 menuElement.addClass (this.options.currentTabClass); 63 $(name).addClass (this.options.currentTabClass); 64 var oldTab = this.currentTab; 65 this.currentTab = name; 66 67 if (oldTab != name) { 68 this._trigger ("tabopened", null, { oldTab: oldTab, newTab: name } ); 35 69 } 36 }); 70 }, 71 72 currentOpenTab: function () { 73 return this.currentTab; 74 }, 75 76 isTabOpen: function (name) { 77 if (name.indexOf ("#") != 0) 78 name = "#" + name; 37 79 38 $("#adminmenu .allowed").first ().click ();39 } 80 return this.currentTab == name; 81 }, 40 82 83 /* 84 value: function (value) { 85 if ( value === undefined ) { 86 return this.options.value; 87 } else { 88 this.options.value = this._constrain( value ); 89 var progress = this.options.value + "%"; 90 this.element.text( progress ); 91 } 92 }, 93 */ 94 });
Note:
See TracChangeset
for help on using the changeset viewer.