Here are the latest patches for HTML export.

0008-HTML-Make-export-statistics-optional.patch modifies the GUI (and
strings) so user manual will need a new screenshot when that is included
and one string to be translated. In any case, this patch set should work
properly with or without the 0008.

miika
From 0d133413f58e4c04c356b19102e6958cb2deba59 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 4 Aug 2014 18:22:05 +0300
Subject: [PATCH 10/10] HTML: prevent implicit type conversion

Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 theme/dive_export.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/theme/dive_export.html b/theme/dive_export.html
index 83240a5..065a8a4 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -53,7 +53,7 @@ function load_scripts()
 var advanced_shown=false;
 function showdiv(){
 	var search = document.getElementById("advanced_search");
-	if(advanced_shown==false){
+	if(advanced_shown===false){
 		search.style.display='block';
 		advanced_shown=true;
 	}
@@ -63,7 +63,7 @@ function showdiv(){
 	}
 }
 function hideAdvanced(){
-	if(advanced_shown==false) return;
+	if(advanced_shown===false) return;
 	var search = document.getElementById("advanced_search");
 	search.style.display='none';
 	advanced_shown=false;
-- 
1.9.1

From b7d998f6d4addd551a4701d52b38753306e14dfa Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Mon, 4 Aug 2014 16:26:08 +0300
Subject: [PATCH 09/10] HTML: don't replot the graph if not plotted before.

Prevent plotting the graph when screen is resized before the graph is
plotted for the first time.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 theme/list_lib.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index be2f969..684d92e 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1205,5 +1205,6 @@ function switchDives(e)
 }
 
 window.onresize = function(event) {
-      plot1.replot( { resetAxes: true } );
+      if (plot1)
+	      plot1.replot( { resetAxes: true } );
 };
-- 
1.9.1

From 32b803b309c62c12d1aafcfffa3b11deebca0ff9 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Mon, 4 Aug 2014 14:02:16 +0300
Subject: [PATCH 08/10] HTML: Make export statistics optional.

Make exporting statistics to the HTML page optional.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 qt-ui/divelogexportdialog.cpp | 41 ++++++++++++++++++++++-------------------
 qt-ui/divelogexportdialog.ui  |  4 ++--
 theme/dive_export.html        |  3 +++
 3 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 03bdaf9..0b6ab73 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -93,6 +93,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
 
 	exportHTMLsettings(json_settings);
 	exportHTMLstatistics(stat_file);
+
 	export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
 
 	QString searchPath = getSubsurfaceDataPath("theme");
@@ -140,25 +141,27 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
 	QTextStream out(&file);
 	int i = 0;
 	out << "divestat=[";
-	while (stats_yearly != NULL && stats_yearly[i].period) {
-		out << "{";
-		out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
-		out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
-		out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
-		out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
-		out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
-		out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
-		out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
-		out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
-		out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
-		out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
-		out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
-		out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
-		out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
-		out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
-		out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
-		out << "},";
-		i++;
+	if (ui->exportStatistics->isChecked()) {
+		while (stats_yearly != NULL && stats_yearly[i].period) {
+			out << "{";
+			out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
+			out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
+			out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
+			out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
+			out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
+			out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
+			out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
+			out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
+			out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
+			out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
+			out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
+			out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
+			out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
+			out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
+			out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
+			out << "},";
+			i++;
+		}
 	}
 	out << "]";
 	file.close();
diff --git a/qt-ui/divelogexportdialog.ui b/qt-ui/divelogexportdialog.ui
index aeed088..0e8ef4a 100644
--- a/qt-ui/divelogexportdialog.ui
+++ b/qt-ui/divelogexportdialog.ui
@@ -216,9 +216,9 @@
            </widget>
           </item>
           <item row="1" column="0">
-           <widget class="QCheckBox" name="checkBox_2">
+           <widget class="QCheckBox" name="exportStatistics">
             <property name="text">
-             <string>Minimum Javascript</string>
+             <string>Export Yearly Statistics</string>
             </property>
            </widget>
           </item>
diff --git a/theme/dive_export.html b/theme/dive_export.html
index 524f39a..83240a5 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -121,6 +121,9 @@ window.onload=function(){
 	showAllDives();
 	document.getElementById("divePanel").style.display='none';
 	document.getElementById("diveStat").style.display='none';
+	if (divestat.length <= 0)
+		document.getElementById("stats_button").style.display='none';
+
 	document.body.style.visibility='visible';
 
 	document.onkeydown = switchDives;
-- 
1.9.1

From 3aac0686c2bc93aa6da4724b5298baf72064abfb Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Mon, 4 Aug 2014 12:36:08 +0300
Subject: [PATCH 07/10] HTML: add Yearly Statistics view to the HTML export

View JSON data of yearly statistics in HTML exports.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 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 a326e3b..524f39a 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -35,6 +35,10 @@ function load_scripts()
 	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){
 		<button onClick="expandAll()"> Expand All </button>
 		<button onClick="collapseAll()"> Collapse All </button>
 		<button id="trip_button" onclick="toggleTrips();">trips</button>
+		<button id="stats_button" onclick="toggleStats();">Stats</button>
 		</div>
 	</div>
 		<div id="header">
@@ -213,5 +219,12 @@ function changeAdvSearch(e){
 		</div>
 		</div>
 	</div>
+	<div id="diveStat">
+	<center>
+	<button onClick="toggleStats()">Back to List</button>
+	</center>
+		<div id="diveStatsData">
+		</div>
+	</div>
 </body>
 </html>
diff --git a/theme/light.css b/theme/light.css
index 6f69880..a1acbfa 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 88a6210..be2f969 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 += '<table><tr id="stats_header">';
+	res += '<td class="statscell">Year</td><td class="statscell">#</td><td class="statscell">Total Time</td><td class="statscell">Avarage Time</td><td class="statscell">Shortest Time</td><td class="statscell">Longest Time</td><td class="statscell">Avarage Depth</td><td class="statscell">Min Depth</td><td class="statscell">Max Depth</td><td class="statscell">Average SAC</td><td class="statscell">Min SAC</td><td class="statscell">Max SAC</td><td class="statscell">Average Temp</td><td class="statscell">Min Temp</td><td class="statscell">Max Temp</td>';
+	res += '</tr>';
+	res += getStatsRows();
+	res += '</table>';
+	return res;
+}
+
+function getStatsRows(){
+	var res = "";
+	for(var i = 0; i < divestat.length ; i++) {
+	res += '<tr><td class="statscell">'+divestat[i].YEAR+'</td><td class="statscell">'+divestat[i].DIVES+'</td><td class="statscell">'+divestat[i].TOTAL_TIME+'</td><td class="statscell">'+divestat[i].AVERAGE_TIME+'</td><td class="statscell">'+divestat[i].SHORTEST_TIME+'</td><td class="statscell">'+divestat[i].LONGEST_TIME+'</td><td class="statscell">'+divestat[i].AVG_DEPTH+'</td><td class="statscell">'+divestat[i].MIN_DEPTH+'</td><td class="statscell">'+divestat[i].MAX_DEPTH+'</td><td class="statscell">'+divestat[i].AVG_SAC+'</td><td class="statscell">'+divestat[i].MIN_SAC+'</td><td class="statscell">'+divestat[i].MAX_SAC+'</td><td class="statscell">'+divestat[i].AVG_TEMP+'</td><td class="statscell">'+divestat[i].MIN_TEMP+'</td><td class="statscell">'+divestat[i].MAX_TEMP+'</td></tr>';
+	}
+	return res;
+}
+
 //trips
 
 var tripsShown;
diff --git a/theme/sand.css b/theme/sand.css
index d17824c..befa861 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;
-- 
1.9.1

From 845daea962506ac314bd07d105928e2dbead7ee4 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Mon, 4 Aug 2014 10:30:31 +0300
Subject: [PATCH 06/10] HTML: export yearly statistics to JSON files.

Save Yearly statistics as JSON data to the stats_files.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 qt-ui/divelogexportdialog.cpp | 34 ++++++++++++++++++++++++++++++++++
 qt-ui/divelogexportdialog.h   |  1 +
 2 files changed, 35 insertions(+)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 33b037d..03bdaf9 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -14,6 +14,7 @@
 #include "worldmap-save.h"
 #include "save-html.h"
 #include "helpers.h"
+#include "statistics.h"
 
 DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
 	ui(new Ui::DiveLogExportDialog)
@@ -85,11 +86,13 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
 
 	QString json_dive_data = exportFiles + QDir::separator() + "file.json";
 	QString json_settings = exportFiles + QDir::separator() + "settings.json";
+	QString stat_file = exportFiles + QDir::separator() + "stat.json";
 	QString photos_directory = exportFiles + QDir::separator() + "photos" + QDir::separator();
 	mainDir.mkdir(photos_directory);
 	exportFiles += "/";
 
 	exportHTMLsettings(json_settings);
+	exportHTMLstatistics(stat_file);
 	export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
 
 	QString searchPath = getSubsurfaceDataPath("theme");
@@ -130,6 +133,37 @@ void DiveLogExportDialog::exportHTMLsettings(const QString &filename)
 	file.close();
 }
 
+void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
+{
+	QFile file(filename);
+	file.open(QIODevice::WriteOnly | QIODevice::Text);
+	QTextStream out(&file);
+	int i = 0;
+	out << "divestat=[";
+	while (stats_yearly != NULL && stats_yearly[i].period) {
+		out << "{";
+		out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
+		out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
+		out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
+		out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
+		out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
+		out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
+		out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
+		out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
+		out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
+		out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
+		out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
+		out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
+		out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
+		out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
+		out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
+		out << "},";
+		i++;
+	}
+	out << "]";
+	file.close();
+}
+
 void DiveLogExportDialog::on_exportGroup_buttonClicked(QAbstractButton *button)
 {
 	showExplanation();
diff --git a/qt-ui/divelogexportdialog.h b/qt-ui/divelogexportdialog.h
index 1177505..e398a5a 100644
--- a/qt-ui/divelogexportdialog.h
+++ b/qt-ui/divelogexportdialog.h
@@ -25,6 +25,7 @@ private:
 	void showExplanation();
 	void exportHtmlInit(const QString &filename);
 	void exportHTMLsettings(const QString &filename);
+	void exportHTMLstatistics(const QString &filename);
 	void copy_and_overwrite(const QString &fileName, const QString &newName);
 };
 
-- 
1.9.1

From dafcc6202675fb7ce3f835ac7e677b44dfdafaca Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sun, 27 Jul 2014 21:38:50 +0200
Subject: [PATCH 05/10] HTML: add weight systems to the dive equipments
 section.

Add weights systems to the dive equipment list.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 save-html.c       | 22 ++++++++++++++++++++++
 theme/list_lib.js | 28 ++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/save-html.c b/save-html.c
index f777de0..652ffb4 100644
--- a/save-html.c
+++ b/save-html.c
@@ -44,6 +44,27 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
 	put_string(b, "],");
 }
 
+static void put_weightsystem_HTML(struct membuffer *b, struct dive *dive)
+{
+	int i, nr;
+
+	nr = nr_weightsystems(dive);
+
+	put_string(b, "\"Weights\":[");
+
+	for (i = 0; i < nr; i++) {
+		weightsystem_t *ws = dive->weightsystem + i;
+		int grams = ws->weight.grams;
+		const char *description = ws->description;
+
+		put_string(b, "{");
+		put_format(b, "\"weight\":\"%d\",", grams);
+		write_attribute(b, "description", description);
+		put_string(b, "},");
+	}
+	put_string(b, "],");
+}
+
 static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
 {
 	int i, nr;
@@ -199,6 +220,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d
 	put_HTML_notes(b, dive, "\"notes\":\"", "\",");
 	if (!list_only) {
 		put_cylinder_HTML(b, dive);
+		put_weightsystem_HTML(b, dive);
 		put_HTML_samples(b, dive);
 		put_HTML_bookmarks(b, dive);
 		write_dive_status(b, dive);
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 094cc26..88a6210 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -736,6 +736,28 @@ function lastNonZero()
 }
 
 /**
+*Return the HTML string for a dive weight entry in the table.
+*/
+function get_weight_HTML(weight)
+{
+	return '<tr><td class="Cyl">' + gram_to_km(weight.weight) + ' kg ' + '</td><td class="Cyl">' + weight.description + '</td></tr>';
+}
+
+/**
+*Return HTML table of weights of a dive.
+*/
+function get_weights_HTML(dive)
+{
+	var result = "";
+	result += '<table><tr><td class="words">Weight</td><td class="words">Type</td></tr>';
+	for (var i in dive.Weights) {
+		result += get_weight_HTML(dive.Weights[i]);
+	}
+	result += '</table>';
+	return result;
+}
+
+/**
 *Return the HTML string for a dive cylinder entry in the table.
 */
 function get_cylinder_HTML(cylinder)
@@ -890,6 +912,11 @@ function mm_to_meter(mm)
 	return mm / (1000);
 }
 
+function gram_to_km(gram)
+{
+	return gram / 1000;
+}
+
 function ml_to_litre(ml)
 {
 	return ml / (1000);
@@ -1067,6 +1094,7 @@ function showDiveDetails(dive)
 	//draw the canvas and initialize the view
 	document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]);
 	document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]);
+	document.getElementById("dive_equipments").innerHTML += get_weights_HTML(items[dive_id]);
 	document.getElementById("bookmarks").innerHTML = get_bookmarks_HTML(items[dive_id]);
 	document.getElementById("divestats").innerHTML = get_status_HTML(items[dive_id]);
 	document.getElementById("slider").innerHTML = get_dive_photos(items[dive_id]);
-- 
1.9.1

From df12be6b9e4066f9d94be4aab5b9d8d862720c9c Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sat, 26 Jul 2014 16:59:49 +0200
Subject: [PATCH 04/10] HTML: Fix constant value temperature curve.

When temperature is constant the temperature curve is stuck at the
top of the profile view.

Maximum temperature value is set to 50 degrees C. This will always put
the curve in the right place.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 theme/list_lib.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 135a0f9..094cc26 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1038,6 +1038,7 @@ function canvas_draw()
 					 },
 					 y3axis : {
 						padMax : 3.05,
+						max : 50,
 						tickOptions: {
 							showGridline: false,
 							showMark: false,
-- 
1.9.1

From 1a5add2aae0ae9aed4aeb3a4a7e5662f2de416d1 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sat, 26 Jul 2014 16:58:27 +0200
Subject: [PATCH 03/10] HTML: fix jqplot memory leaks when replot the profile.

When replot the profile, old plots must be deleted to avoid memory leaks.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 theme/list_lib.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 124cd78..135a0f9 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -949,6 +949,11 @@ function canvas_draw()
 			0
 		]);
 	}
+	if (plot1)
+	{
+		$('chart1').unbind();
+		plot1.destroy();
+	}
 	plot1 = $.jqplot('chart1', [
 					depthData,
 					pressureData,
-- 
1.9.1

From c9f7cd7156ab8c2f7261a061929e34f79829b4c8 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 28 Jul 2014 16:55:37 +0300
Subject: [PATCH 02/10] Return the heading value on HTML export

HTML export was erroneously not returning the heading value.

Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 theme/list_lib.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index e4b9837..124cd78 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -777,7 +777,7 @@ function get_event_value(event)
 		return 'He: ' + he + ' - O2: ' + o2;
 	}
 	if (event.type == 23) { // heading
-		event.value;
+		return event.value;
 	}
 	return '-';
 }
-- 
1.9.1

From 5e0fc4336ec5e6fe7ab3c4bda0c91948d1b50060 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sat, 26 Jul 2014 16:29:16 +0200
Subject: [PATCH 01/10] HTML: Fix event value fields.

- The gas event values can contain o2 and he mix in gas change events.
- Give a '-' value for events that don't have any sensible values.
- Show event value if event type is heading or gaschange.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 save-html.c       |  1 +
 theme/list_lib.js | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/save-html.c b/save-html.c
index 75f7542..f777de0 100644
--- a/save-html.c
+++ b/save-html.c
@@ -37,6 +37,7 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
 	while (ev) {
 		put_format(b, "{\"name\":\"%s\",", ev->name);
 		put_format(b, "\"value\":\"%d\",", ev->value);
+		put_format(b, "\"type\":\"%d\",", ev->type);
 		put_format(b, "\"time\":\"%d\",},", ev->time.seconds);
 		ev = ev->next;
 	}
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 904bde5..e4b9837 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -769,12 +769,25 @@ function get_cylinders_HTML(dive)
 	return result;
 }
 
+function get_event_value(event)
+{
+	if (event.type == 11 || event.type == 25) { // gas change
+		var he = event.value >> 16;
+		var o2 = event.value & 0xffff;
+		return 'He: ' + he + ' - O2: ' + o2;
+	}
+	if (event.type == 23) { // heading
+		event.value;
+	}
+	return '-';
+}
+
 /**
 Return the HTML string for a bookmark entry in the table.
 */
 function get_bookmark_HTML(event)
 {
-	return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td><td class="Cyl">' + event.value + '</td></tr>';
+	return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td><td class="Cyl">' + get_event_value(event) + '</td></tr>';
 }
 
 /**
-- 
1.9.1

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to