Here are the latest patches with my SOB. This includes also the Rick's
patch that was missed.


On Fri, Jul 11, 2014 at 5:05 AM, Gehad Elrobey <[email protected]>
wrote:

> I attached two patches with some fixes to the dive profile view.
>
> additionally, I am still can't view the thumbnails when I add photos to
> dives, I think I am doing something wrong when adding photos.
> does any type of export save Images?
>

This was fixed a few days ago on master. Anyway, I'll send you a sample log
along with an image in a separate email so you can skip the image loading
part.

Currently the picture is ignored by other exports. Reinhart is just
implementing support for pictures on divelogs.de. I'll take a look in
adding this to UDDF export this weekend.

>
> Also there is a patch that Rick has sent 5 days ago which is not applied
> till now, should I forward it?
>

Included here...

miika
From 73f225b95c85f649dfeaa07fdd39a657ec7b43f5 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Tue, 8 Jul 2014 17:59:56 +0200
Subject: [PATCH 3/3] HTML: add empty values of pressure cylinders

When the dive cylinder (start pressure or end pressure) is not set,
enter the values of the pressure in the first and the last samples
instead. Use the first / last non-zero values.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[email protected]>
---
 theme/list_lib.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 628491a..7135369 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -669,13 +669,32 @@ var points;  //reference to the samples array of the shown dive.
 var ZERO_C_IN_MKELVIN = 273150;
 var plot1;
 
+function lastNonZero()
+{
+	for(var i = items[dive_id].samples.length-1; i >= 0; i--){
+		if(items[dive_id].samples[i][2] != 0)
+			return items[dive_id].samples[i][2];
+	}
+}
+
 /**
 *Return the HTML string for a dive cylinder entry in the table.
 */
 function get_cylinder_HTML(cylinder)
 {
-	return '<tr><td class="Cyl">' + cylinder.Type + '</td><td class="Cyl">' + cylinder.Size + '</td><td class="Cyl">' + cylinder.WPressure + '</td>' +
-	       '<td class="Cyl">' + cylinder.SPressure + '</td><td class="Cyl">' + cylinder.EPressure + '</td><td class="Cyl">' + cylinder.O2 + '</td></tr>';
+	var cSPressure = cylinder.SPressure;
+	var cEPressure = cylinder.EPressure;
+
+	if (cSPressure === "--") {
+		cSPressure = mbar_to_bar(items[dive_id].samples[0][2]) + " bar";
+	}
+
+	if (cEPressure === "--") {
+		var nonZeroCEPressure = lastNonZero();
+		cEPressure = mbar_to_bar(nonZeroCEPressure) + " bar";
+	}
+
+	return '<tr><td class="Cyl">' + cylinder.Type + '</td><td class="Cyl">' + cylinder.Size + '</td><td class="Cyl">' + cylinder.WPressure + '</td>' + '<td class="Cyl">' + cSPressure + '</td><td class="Cyl">' + cEPressure + '</td><td class="Cyl">' + cylinder.O2 + '</td></tr>';
 }
 
 /**
@@ -705,6 +724,7 @@ function get_bookmark_HTML(event)
 */
 function get_bookmarks_HTML(dive)
 {
+	if (dive.events <= 0) return "";
 	var result = "";
 	result += '<h2 class="det_hed">Events</h2><table><tr><td class="words">Name</td><td class="words">Time</td></tr>';
 	for (var i in dive.events) {
-- 
1.9.1

From 145f9622bafc78de95627ed24ef14710db1d044e Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Mon, 7 Jul 2014 14:01:36 +0200
Subject: [PATCH 2/3] HTML: fix profile labels

Fix labels view in dive profile.
Add Jqplot css file to the exports.
The css files fix the view and enahnce the plot.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[email protected]>
---
 qt-ui/divelogexportdialog.cpp |   1 +
 theme/dive_export.html        |   6 +
 theme/jquery.jqplot.css       | 259 ++++++++++++++++++++++++++++++++++++++++++
 theme/list_lib.js             |  32 +++---
 4 files changed, 282 insertions(+), 16 deletions(-)
 create mode 100644 theme/jquery.jqplot.css

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 1ff0786..f896235 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -103,6 +103,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
 	copy_and_overwrite(searchPath + "jqplot.canvasAxisTickRenderer.min.js", exportFiles + "jqplot.canvasAxisTickRenderer.min.js");
 	copy_and_overwrite(searchPath + "jqplot.canvasTextRenderer.min.js", exportFiles + "jqplot.canvasTextRenderer.min.js");
 	copy_and_overwrite(searchPath + "jquery.min.js", exportFiles + "jquery.min.js");
+	copy_and_overwrite(searchPath + "jquery.jqplot.css", exportFiles + "jquery.jqplot.css");
 	copy_and_overwrite(searchPath + (ui->themeSelection->currentText() == "Light" ? "light.css" : "sand.css"),
 			   exportFiles + "theme.css");
 }
diff --git a/theme/dive_export.html b/theme/dive_export.html
index e1d89f4..ec08e86 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -24,6 +24,12 @@ function load_scripts()
 	fileref.setAttribute("href", location.pathname + "_files/theme.css");
 	document.getElementsByTagName("head")[0].appendChild(fileref);
 
+	fileref=document.createElement("link");
+	fileref.setAttribute("rel", "stylesheet");
+	fileref.setAttribute("type", "text/css");
+	fileref.setAttribute("href", location.pathname + "_files/jquery.jqplot.css");
+	document.getElementsByTagName("head")[0].appendChild(fileref);
+
 	fileref=document.createElement('script');
 	fileref.setAttribute("src", location.pathname + "_files/file.json");
 	document.getElementsByTagName("head")[0].appendChild(fileref);
diff --git a/theme/jquery.jqplot.css b/theme/jquery.jqplot.css
new file mode 100644
index 0000000..d30bafb
--- /dev/null
+++ b/theme/jquery.jqplot.css
@@ -0,0 +1,259 @@
+/*rules for the plot target div.  These will be cascaded down to all plot elements according to css rules*/
+.jqplot-target {
+    position: relative;
+    color: #666666;
+    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+    font-size: 1em;
+/*    height: 300px;
+    width: 400px;*/
+}
+
+/*rules applied to all axes*/
+.jqplot-axis {
+    font-size: 0.75em;
+}
+
+.jqplot-xaxis {
+    margin-top: 10px;
+}
+
+.jqplot-x2axis {
+    margin-bottom: 10px;
+}
+
+.jqplot-yaxis {
+    margin-right: 10px;
+}
+
+.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis, .jqplot-yMidAxis {
+    margin-left: 10px;
+    margin-right: 10px;
+}
+
+/*rules applied to all axis tick divs*/
+.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick, .jqplot-yMidAxis-tick {
+    position: absolute;
+    white-space: pre;
+}
+
+
+.jqplot-xaxis-tick {
+    top: 0px;
+    /* initial position untill tick is drawn in proper place */
+    left: 15px;
+/*    padding-top: 10px;*/
+    vertical-align: top;
+}
+
+.jqplot-x2axis-tick {
+    bottom: 0px;
+    /* initial position untill tick is drawn in proper place */
+    left: 15px;
+/*    padding-bottom: 10px;*/
+    vertical-align: bottom;
+}
+
+.jqplot-yaxis-tick {
+    right: 0px;
+    /* initial position untill tick is drawn in proper place */
+    top: 15px;
+/*    padding-right: 10px;*/
+    text-align: right;
+}
+
+.jqplot-yaxis-tick.jqplot-breakTick {
+	right: -20px;
+	margin-right: 0px;
+	padding:1px 5px 1px 5px;
+/*	background-color: white;*/
+	z-index: 2;
+	font-size: 1.5em;
+}
+
+.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick {
+    left: 0px;
+    /* initial position untill tick is drawn in proper place */
+    top: 15px;
+/*    padding-left: 10px;*/
+/*    padding-right: 15px;*/
+    text-align: left;
+}
+
+.jqplot-yMidAxis-tick {
+    text-align: center;
+    white-space: nowrap;
+}
+
+.jqplot-xaxis-label {
+    margin-top: 10px;
+    font-size: 11pt;
+    position: absolute;
+}
+
+.jqplot-x2axis-label {
+    margin-bottom: 10px;
+    font-size: 11pt;
+    position: absolute;
+}
+
+.jqplot-yaxis-label {
+    margin-right: 10px;
+/*    text-align: center;*/
+    font-size: 11pt;
+    position: absolute;
+}
+
+.jqplot-yMidAxis-label {
+    font-size: 11pt;
+    position: absolute;
+}
+
+.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
+/*    text-align: center;*/
+    font-size: 11pt;
+    margin-left: 10px;
+    position: absolute;
+}
+
+.jqplot-meterGauge-tick {
+    font-size: 0.75em;
+    color: #999999;
+}
+
+.jqplot-meterGauge-label {
+    font-size: 1em;
+    color: #999999;
+}
+
+table.jqplot-table-legend {
+    margin-top: 12px;
+    margin-bottom: 12px;
+    margin-left: 12px;
+    margin-right: 12px;
+}
+
+table.jqplot-table-legend, table.jqplot-cursor-legend {
+    background-color: rgba(255,255,255,0.6);
+    border: 1px solid #cccccc;
+    position: absolute;
+    font-size: 0.75em;
+}
+
+td.jqplot-table-legend {
+    vertical-align:middle;
+}
+
+/*
+These rules could be used instead of assigning
+element styles and relying on js object properties.
+*/
+
+/*
+td.jqplot-table-legend-swatch {
+    padding-top: 0.5em;
+    text-align: center;
+}
+
+tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
+    padding-top: 0px;
+}
+*/
+
+td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
+    cursor: pointer;
+}
+
+.jqplot-table-legend .jqplot-series-hidden {
+    text-decoration: line-through;
+}
+
+div.jqplot-table-legend-swatch-outline {
+    border: 1px solid #cccccc;
+    padding:1px;
+}
+
+div.jqplot-table-legend-swatch {
+    width:0px;
+    height:0px;
+    border-top-width: 5px;
+    border-bottom-width: 5px;
+    border-left-width: 6px;
+    border-right-width: 6px;
+    border-top-style: solid;
+    border-bottom-style: solid;
+    border-left-style: solid;
+    border-right-style: solid;
+}
+
+.jqplot-title {
+    top: 0px;
+    left: 0px;
+    padding-bottom: 0.5em;
+    font-size: 1.2em;
+}
+
+table.jqplot-cursor-tooltip {
+    border: 1px solid #cccccc;
+    font-size: 0.75em;
+}
+
+
+.jqplot-cursor-tooltip {
+    border: 1px solid #cccccc;
+    font-size: 0.75em;
+    white-space: nowrap;
+    background: rgba(208,208,208,0.5);
+    padding: 1px;
+}
+
+.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
+    border: 1px solid #cccccc;
+    font-size: 0.75em;
+    white-space: nowrap;
+    background: rgba(208,208,208,0.5);
+    padding: 1px;
+}
+
+.jqplot-point-label {
+    font-size: 0.75em;
+    z-index: 2;
+}
+      
+td.jqplot-cursor-legend-swatch {
+    vertical-align: middle;
+    text-align: center;
+}
+
+div.jqplot-cursor-legend-swatch {
+    width: 1.2em;
+    height: 0.7em;
+}
+
+.jqplot-error {
+/*   Styles added to the plot target container when there is an error go here.*/
+    text-align: center;
+}
+
+.jqplot-error-message {
+/*    Styling of the custom error message div goes here.*/
+    position: relative;
+    top: 46%;
+    display: inline-block;
+}
+
+div.jqplot-bubble-label {
+    font-size: 0.8em;
+/*    background: rgba(90%, 90%, 90%, 0.15);*/
+    padding-left: 2px;
+    padding-right: 2px;
+    color: rgb(20%, 20%, 20%);
+}
+
+div.jqplot-bubble-label.jqplot-bubble-label-highlight {
+    background: rgba(90%, 90%, 90%, 0.7);
+}
+
+div.jqplot-noData-container {
+	text-align: center;
+	background-color: rgba(96%, 96%, 96%, 0.3);
+}
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 718ea4c..628491a 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -768,31 +768,31 @@ function int_to_time(n)
 function canvas_draw()
 {
 	document.getElementById("chart1").innerHTML = "";
-	var d1 = new Array(); //depth
-	var d2 = new Array(); //pressure
-	var d3 = new Array(); //events
-	var d4 = new Array(); //temperature
+	var depthData = new Array();
+	var pressureData = new Array();
+	var eventsData = new Array();
+	var temperatureData = new Array();
 	var last = 0;
 	for (var i = 0; i < items[dive_id].samples.length; i++) {
-		d1.push([
+		depthData.push([
 			items[dive_id].samples[i][0] / 60,
 			-1 * mm_to_meter(items[dive_id].samples[i][1])
 		]);
 		if (items[dive_id].samples[i][2] != 0) {
-			d2.push([
+			pressureData.push([
 				items[dive_id].samples[i][0] / 60,
 				mbar_to_bar(items[dive_id].samples[i][2])
 			]);
 		}
 		if (items[dive_id].samples[i][3] != 0) {
-			d4.push([
+			temperatureData.push([
 				items[dive_id].samples[i][0] / 60,
 				mkelvin_to_C(items[dive_id].samples[i][3]),
 			]);
 			last = items[dive_id].samples[i][3];
 		} else {
 			if (last != 0) {
-				d4.push([
+				temperatureData.push([
 					items[dive_id].samples[i][0] / 60,
 					mkelvin_to_C(last),
 				]);
@@ -800,16 +800,16 @@ function canvas_draw()
 		}
 	}
 	for (var i = 0; i < items[dive_id].events.length; i++) {
-		d3.push([
+		eventsData.push([
 			items[dive_id].events[i].time / 60,
 			0,
 		]);
 	}
 	plot1 = $.jqplot('chart1', [
-					   d1,
-					   d2,
-					   d3,
-					   d4,
+					depthData,
+					pressureData,
+					eventsData,
+					temperatureData,
 				   ],
 			 {
 				 grid : {
@@ -866,9 +866,9 @@ function canvas_draw()
 						 tickRenderer : $.jqplot.CanvasAxisTickRenderer,
 						 tickOptions : {
 							 showGridline : false,
-							 formatString : '%i min',
-							 angle : -30
-						 }
+							 formatString : '%i',
+						 },
+						 label:'Time (min)'
 					 },
 					 yaxis : {
 						 max : 0,
-- 
1.9.1

From f3cb8b58d14b767c8e5c593eb5c92685cefabb0b Mon Sep 17 00:00:00 2001
From: Rick Walsh <[email protected]>
Date: Sun, 6 Jul 2014 18:15:23 +1200
Subject: [PATCH 1/3] Corrects start and end pressure in HTML export

The start and end pressures were reported the wrong way.

Signed-off-by: Rick Walsh <[email protected]>
Signed-off-by: Miika Turkia <[email protected]>
---
 save-html.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/save-html.c b/save-html.c
index e1116aa..13bf70c 100644
--- a/save-html.c
+++ b/save-html.c
@@ -43,15 +43,15 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
 		put_pressure(b, cylinder->type.workingpressure, "\"WPressure\":\"", " bar\",");
 
 		if (cylinder->start.mbar) {
-			put_milli(b, "\"EPressure\":\"", cylinder->start.mbar, " bar\",");
+			put_milli(b, "\"SPressure\":\"", cylinder->start.mbar, " bar\",");
 		} else {
-			write_attribute(b, "EPressure", "--");
+			write_attribute(b, "SPressure", "--");
 		}
 
 		if (cylinder->end.mbar) {
-			put_milli(b, "\"SPressure\":\"", cylinder->end.mbar, " bar\",");
+			put_milli(b, "\"EPressure\":\"", cylinder->end.mbar, " bar\",");
 		} else {
-			write_attribute(b, "SPressure", "--");
+			write_attribute(b, "EPressure", "--");
 		}
 
 		if (cylinder->gasmix.o2.permille) {
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to