From e968d91943bbcaf25cd3a1df84fc4d09bc889c94 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Mon, 4 Aug 2014 12:36:08 +0300 Subject: [PATCH] HTML: add Yearly Statistics view to the HTML export View JSON data of yearly statistics in HTML exports. Signed-off-by: Gehad elrobey Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- theme/dive_export.html | 13 ++++++++++++ theme/light.css | 24 +++++++++++++++++++++ theme/list_lib.js | 48 ++++++++++++++++++++++++++++++++++++++++++ theme/sand.css | 20 +++++++++++++++++- 4 files changed, 104 insertions(+), 1 deletion(-) diff --git a/theme/dive_export.html b/theme/dive_export.html index a326e3bf6..524f39a69 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -34,6 +34,10 @@ function load_scripts() fileref.setAttribute("src", location.pathname + "_files/file.json"); document.getElementsByTagName("head")[0].appendChild(fileref); + fileref=document.createElement('script'); + fileref.setAttribute("src", location.pathname + "_files/stat.json"); + document.getElementsByTagName("head")[0].appendChild(fileref); + fileref=document.createElement('script'); fileref.setAttribute("src", location.pathname + "_files/settings.json"); document.getElementsByTagName("head")[0].appendChild(fileref); @@ -116,6 +120,7 @@ window.onload=function(){ sizeofpage=10; showAllDives(); document.getElementById("divePanel").style.display='none'; + document.getElementById("diveStat").style.display='none'; document.body.style.visibility='visible'; document.onkeydown = switchDives; @@ -155,6 +160,7 @@ function changeAdvSearch(e){ + +
+
+ +
+
+
+
diff --git a/theme/light.css b/theme/light.css index 6f6988097..a1acbfa65 100644 --- a/theme/light.css +++ b/theme/light.css @@ -144,6 +144,30 @@ input[type=checkbox]{ box-shadow: 10px 10px 5px #888888; } +#diveStat{ + padding:5px; + width:90%; + margin:0% 5% 0% 5%; + margin-bottom:50px; + background-color: rgba(88,121,139,0.3); + box-shadow: 10px 10px 5px #888888; +} + +#diveStatsData{ + overflow:scroll; + overflow-y:hidden; +} + +.statscell{ + min-width:100px; + margin:0px; +} + +#stats_header{ + background-color:#5f7f8f; +} + + button,#no_dives_selector{ font-size:13px; min-width:55px; diff --git a/theme/list_lib.js b/theme/list_lib.js index 88a621028..be2f969d5 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -646,6 +646,54 @@ function searchin(value, node) return null; } +//stats + +var statsShows; + +/** +*This is the main function called to show/hide trips +*/ +function toggleStats() +{ + var stats_button = document.getElementById('stats_button'); + if (statsShows) { + statsShows = false; + stats_button.style.backgroundColor = "#dfdfdf"; + document.getElementById('diveListPanel').style.display='block'; + document.getElementById('diveStat').style.display='none'; + } else { + document.getElementById('diveListPanel').style.display='none'; + document.getElementById('diveStat').style.display='block'; + stats_button.style.backgroundColor = "#5f7f8f"; + statsShows = true; + showStats(); + } +} + +function showStats() +{ + document.getElementById('diveStatsData').innerHTML = ''; + document.getElementById('diveStatsData').innerHTML += getDiveStats(); +} + +function getDiveStats(){ + var res = ""; + res += ''; + res += ''; + res += ''; + res += getStatsRows(); + res += '
Year#Total TimeAvarage TimeShortest TimeLongest TimeAvarage DepthMin DepthMax DepthAverage SACMin SACMax SACAverage TempMin TempMax Temp
'; + return res; +} + +function getStatsRows(){ + var res = ""; + for(var i = 0; i < divestat.length ; i++) { + res += ''+divestat[i].YEAR+''+divestat[i].DIVES+''+divestat[i].TOTAL_TIME+''+divestat[i].AVERAGE_TIME+''+divestat[i].SHORTEST_TIME+''+divestat[i].LONGEST_TIME+''+divestat[i].AVG_DEPTH+''+divestat[i].MIN_DEPTH+''+divestat[i].MAX_DEPTH+''+divestat[i].AVG_SAC+''+divestat[i].MIN_SAC+''+divestat[i].MAX_SAC+''+divestat[i].AVG_TEMP+''+divestat[i].MIN_TEMP+''+divestat[i].MAX_TEMP+''; + } + return res; +} + //trips var tripsShown; diff --git a/theme/sand.css b/theme/sand.css index d17824cf5..befa861b7 100644 --- a/theme/sand.css +++ b/theme/sand.css @@ -128,7 +128,6 @@ input[type=checkbox]{ font-weight:bold; } - #controller{ min-width:200px; padding:10px; @@ -143,6 +142,25 @@ input[type=checkbox]{ box-shadow: 7px 7px 5px rgba(215, 107, 27, 0.43); } +#diveStat{ + padding:5px; + width:90%; + margin:0% 5% 0% 5%; + margin-bottom:50px; + background-color: rgba(88,121,139,0.3); + box-shadow: 10px 10px 5px #888888; +} + +#diveStatsData{ + overflow:scroll; + overflow-y:hidden; +} +.statscell{ + border-style:solid; + padding-right:100px; + margin:0px; +} + button,#no_dives_selector{ font-size:13px; min-width:55px;