Here are the patches with my SOB along with some additional fixes.

&nbsp should have a semi colon at the end ( ) - I fixed this along
with some other small errors that I noticed, some of them did sneak in in
earlier patches. Check out the attachments. Some other issues that I
spotted for you to fix:

- The pictures seem to be distorted. Compressed to rectangular format.
- Sac is displayed in milliliter, should be in liters.

Could the exportFiles include the QDir::separator() at the end when it is
introduced? Would simplify following code:
---8<---
-       QString exportFiles = file.fileName() + "_files/";
+       QString exportFiles = file.fileName() + "_files";

        QString json_dive_data = exportFiles + QDir::separator() +
"file.json";
        QString json_settings = exportFiles + QDir::separator() +
"settings.json";
+       QString photos_directory = exportFiles + QDir::separator() +
"photos" + QDir::separator();
+       mainDir.mkdir(photos_directory);
+       exportFiles += "/";
---8<---

If you have time and want to implement a worldmap integration to the
logbook export, it sure would be a nice to have feature. Of course it would
be nice to know if other people are interested in using such feature with
the HTML export.

Oh, and one more thing. The cylinder pressure scale on the dive profile
seems to vary quite a bit. You could fix it between 0 and 300 bars, and
leave some padding above and below. I guess that a 300 bar cylinder might
contain a few extra bars, but negative pressure is not going to happen.

miika

On Mon, Jul 14, 2014 at 6:13 PM, Gehad Elrobey <gehadelro...@gmail.com>
wrote:

> Hi,
>
> I did some progress in exporting photos, I attached two patches.
> I am still working on improving the photos slider style and adding
> additional dive data to the dive status.
>
> Also do you think adding a Google map or some kind of maps to show the
> dive location will be needed?
>
> waiting for your feedback.
>
> Regards,
> Gehad
>
>
> On Fri, Jul 11, 2014 at 6:28 AM, Miika Turkia <miika.tur...@gmail.com>
> wrote:
>
>> 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 <gehadelro...@gmail.com>
>> 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 033d73fdf0d209ebfae0354742374f6b00f01b36 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 14 Jul 2014 20:57:26 +0300
Subject: [PATCH 6/6] Terminate named character references properly

&nbsp; must be terminated with semicolon, just like any other named
character reference

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 899f059..6ba3660 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -205,14 +205,14 @@ function getlimited(dive)
 function getExpanded(dive)
 {
 	var res = '<table><tr><td class="words">Date: </td><td>' + dive.date +
-		  '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspTime: </td><td>' + dive.time +
-		  '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspLocation: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
+		  '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: </td><td>' + dive.time +
+		  '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
 		  dive.location + '</a>' +
 		  '</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) +
-		  '</td><td class="words">&nbsp&nbsp&nbspVisibilty:</td><td>' + putRating(dive.visibility) +
+		  '</td><td class="words">&nbsp;&nbsp;&nbsp;Visibilty:</td><td>' + putRating(dive.visibility) +
 		  '</td></tr></table>' +
 		  '<table><tr><td class="words">Air temp: </td><td>' + dive.temperature.air +
-		  '</td><td class="words">&nbsp&nbsp&nbsp&nbspWater temp: </td><td>' + dive.temperature.water +
+		  '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;Water temp: </td><td>' + dive.temperature.water +
 		  '</td></tr></table><table><tr><td class="words">DiveMaster: </td><td>' + dive.divemaster +
 		  '</td></tr><tr><td class="words"><p>Buddy: </p></td><td>' + dive.buddy +
 		  '</td></tr><tr><td class="words">Suit: </td><td>' + dive.suit +
@@ -741,14 +741,14 @@ function get_bookmarks_HTML(dive)
 function get_dive_HTML(dive)
 {
 	return '<h2 class="det_hed">Dive Information</h2><table><tr><td class="words">Date: </td><td>' + dive.date +
-	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspTime: </td><td>' + dive.time +
-	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspLocation: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: </td><td>' + dive.time +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
 	       dive.location + '</a>' +
 	       '</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) +
-	       '</td><td class="words">&nbsp&nbsp&nbspVisibilty:</td><td>' + putRating(dive.visibility) +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;Visibilty:</td><td>' + putRating(dive.visibility) +
 	       '</td></tr></table>' +
 	       '<table><tr><td class="words">Air temp: </td><td>' + dive.temperature.air +
-	       '</td><td class="words">&nbsp&nbsp&nbsp&nbspWater temp: </td><td>' + dive.temperature.water +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;Water temp: </td><td>' + dive.temperature.water +
 	       '</td></tr></table><table><tr><td class="words">DiveMaster: </td><td>' + dive.divemaster +
 	       '</td></tr><tr><td class="words"><p>Buddy: </p></td><td>' + dive.buddy +
 	       '</td></tr><tr><td class="words">Suit: </td><td>' + dive.suit +
@@ -762,8 +762,8 @@ function get_dive_HTML(dive)
 function get_status_HTML(dive)
 {
 	return '<h2 class="det_hed">Dive Status</h2><table><tr><td class="words">Sac: </td><td>' + dive.sac +
-	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspOtu: </td><td>' + dive.otu +
-	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspCns: </td><td>' + dive.cns +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Otu: </td><td>' + dive.otu +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cns: </td><td>' + dive.cns +
 	       '</td></tr></table>';
 };
 
-- 
1.9.1

From 375785d99db1f9a412df3cf861a321d2dc1e240c Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 14 Jul 2014 20:52:08 +0300
Subject: [PATCH 5/6] Removing extra commas from array initialization

Comma should be used on array initialization only between elements, not
at the end.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 89adba9..899f059 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -855,14 +855,14 @@ function canvas_draw()
 		if (items[dive_id].samples[i][3] !== 0) {
 			temperatureData.push([
 				items[dive_id].samples[i][0] / 60,
-				mkelvin_to_C(items[dive_id].samples[i][3]),
+				mkelvin_to_C(items[dive_id].samples[i][3])
 			]);
 			last = items[dive_id].samples[i][3];
 		} else {
 			if (last !== 0) {
 				temperatureData.push([
 					items[dive_id].samples[i][0] / 60,
-					mkelvin_to_C(last),
+					mkelvin_to_C(last)
 				]);
 			}
 		}
@@ -870,14 +870,14 @@ function canvas_draw()
 	for (var i = 0; i < items[dive_id].events.length; i++) {
 		eventsData.push([
 			items[dive_id].events[i].time / 60,
-			0,
+			0
 		]);
 	}
 	plot1 = $.jqplot('chart1', [
 					depthData,
 					pressureData,
 					eventsData,
-					temperatureData,
+					temperatureData
 				   ],
 			 {
 				 grid : {
@@ -906,27 +906,27 @@ function canvas_draw()
 						 showMarker : true,
 						 showLine : true,
 						 fill : true,
-						 yaxis : 'yaxis',
+						 yaxis : 'yaxis'
 					 },
 					 {
 						 color : 'rgba(44, 190, 160, 0.7)',
 						 showMarker : false,
 						 rendererOptions : {
-							 smooth : true,
+							 smooth : true
 						 },
-						 yaxis : 'y2axis',
+						 yaxis : 'y2axis'
 					 },
 					 {
 						  showLine:false,
 						  markerOptions: { size: 10, style:"o" },
-						  pointLabels: { show:false, } ,
+						  pointLabels: { show:false }
 					 },
 					 {
 						  showLine:true,
 						  showMarker : false,
-						  pointLabels: { show:false, } ,
-						  yaxis : 'y3axis',
-					 },
+						  pointLabels: { show:false },
+						  yaxis : 'y3axis'
+					 }
 				 ],
 				 axes : {
 					 xaxis : {
@@ -934,7 +934,7 @@ function canvas_draw()
 						 tickRenderer : $.jqplot.CanvasAxisTickRenderer,
 						 tickOptions : {
 							 showGridline : false,
-							 formatString : '%i',
+							 formatString : '%i'
 						 },
 						 label:'Time (min)'
 					 },
@@ -961,9 +961,9 @@ function canvas_draw()
 							showMark: false,
 							showLabel: false,
 							shadow: false,
-							formatString : '%i C',
-						},
-					 },
+							formatString : '%i C'
+						}
+					 }
 				 }
 			 });
 }
-- 
1.9.1

From 86d0a256cf9173d42e09eff1ee0f35ce772b80f0 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 14 Jul 2014 20:41:12 +0300
Subject: [PATCH 4/6] Fix string continuation

Concatenated string should have the plus sign at the end of the cut
line.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 0861dd2..89adba9 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -776,8 +776,8 @@ function get_dive_photos(dive)
 	var slider = "";
 	document.getElementById("divephotos").style.display = 'block';
 	for (var i = 0; i < dive.photos.length; i++) {
-		slider += '<img src="'+location.pathname
-		+'_files/photos/'+dive.photos[i].filename+'" alt="" height="240" width="240">';
+		slider += '<img src="'+location.pathname +
+			'_files/photos/'+dive.photos[i].filename+'" alt="" height="240" width="240">';
 	}
 	return slider;
 }
-- 
1.9.1

From 6a8ab1cbbe3f563c6de2d9ef8529a3a96c786411 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Mon, 14 Jul 2014 20:39:42 +0300
Subject: [PATCH 3/6] HTML: prevent implicit type conversion on testing

== and != comparison of true, false, null, allows implicit type
conversion, thus using === and !== instead

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 74cfce0..0861dd2 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -528,7 +528,7 @@ function SearchModule(enabled)
 
 SearchModule.prototype.Enter_search_string = function(str, diveno)
 {
-	if (str == "" || !str)
+	if (str === "" || !str)
 		return;
 	var res = str.toLowerCase().split(" ");
 	for (var i = 0; i < res.length; i++) {
@@ -672,7 +672,7 @@ var plot1;
 function lastNonZero()
 {
 	for(var i = items[dive_id].samples.length-1; i >= 0; i--){
-		if(items[dive_id].samples[i][2] != 0)
+		if(items[dive_id].samples[i][2] !== 0)
 			return items[dive_id].samples[i][2];
 	}
 }
@@ -846,20 +846,20 @@ function canvas_draw()
 			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) {
+		if (items[dive_id].samples[i][2] !== 0) {
 			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) {
+		if (items[dive_id].samples[i][3] !== 0) {
 			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) {
+			if (last !== 0) {
 				temperatureData.push([
 					items[dive_id].samples[i][0] / 60,
 					mkelvin_to_C(last),
-- 
1.9.1

From 7b6b9006facedc86e74c8f821f315288e5c9df3f Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sun, 13 Jul 2014 23:36:35 +0200
Subject: [PATCH 2/6] HTML: Add dive photos to the detailed view

Dive photos are copied to the photos directory on export. The photos
section appears only if photos exist.

C++ helper functions are added to copy images to the photos directory,
Additionally the photos directory must be passed as a parameter to the
write_one_dive function to save photos to it. Some options structure may
be needed instead of passing many arguments.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 qt-ui/divelogexportdialog.cpp |  7 +++++--
 qthelper.cpp                  | 20 ++++++++++++++++++++
 qthelper.h                    |  1 +
 save-html.c                   | 39 ++++++++++++++++++++++++++-------------
 save-html.h                   |  4 +++-
 theme/dive_export.html        |  9 +++++++++
 theme/light.css               | 14 ++++++++++++++
 theme/list_lib.js             | 41 ++++++++++++++++++++++++++++++++++++++++-
 theme/sand.css                | 14 ++++++++++++++
 9 files changed, 132 insertions(+), 17 deletions(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index f896235..2221802 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -81,13 +81,16 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
 	QFileInfo info(file);
 	QDir mainDir = info.absoluteDir();
 	mainDir.mkdir(file.fileName() + "_files");
-	QString exportFiles = file.fileName() + "_files/";
+	QString exportFiles = file.fileName() + "_files";
 
 	QString json_dive_data = exportFiles + QDir::separator() + "file.json";
 	QString json_settings = exportFiles + QDir::separator() + "settings.json";
+	QString photos_directory = exportFiles + QDir::separator() + "photos" + QDir::separator();
+	mainDir.mkdir(photos_directory);
+	exportFiles += "/";
 
 	exportHTMLsettings(json_settings);
-	export_HTML(json_dive_data.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
+	export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
 
 	QString searchPath = getSubsurfaceDataPath("theme");
 	if (searchPath.isEmpty())
diff --git a/qthelper.cpp b/qthelper.cpp
index c8738b2..a961d64 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -4,6 +4,7 @@
 #include "statistics.h"
 #include <exif.h>
 #include "file.h"
+#include <QFile>
 #include <QRegExp>
 #include <QDir>
 #include <QMap>
@@ -283,6 +284,25 @@ picture_load_exit:
 	return;
 }
 
+extern "C" const char* get_file_name(const char *fileName)
+{
+	QFile file(fileName);
+	QFileInfo fileInfo(file.fileName());
+	QString filename(fileInfo.fileName());
+	return filename.toStdString().c_str();
+}
+
+extern "C" void copy_image_and_overwrite(const char *cfileName, const char *cnewName)
+{
+	QString fileName = QString::fromUtf8(cfileName);
+	QString newName = QString::fromUtf8(cnewName);
+	newName += get_file_name(cfileName);
+	QFile file(newName);
+	if (file.exists())
+		file.remove();
+	QFile::copy(fileName, newName);
+}
+
 static bool lessThan(const QPair<QString, int> &a, const QPair<QString, int> &b)
 {
 	return a.second < b.second;
diff --git a/qthelper.h b/qthelper.h
index 528c636..ccc57bc 100644
--- a/qthelper.h
+++ b/qthelper.h
@@ -16,4 +16,5 @@ bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_te
 QString printGPSCoords(int lat, int lon);
 QList<int> getDivesInTrip(dive_trip_t *trip);
 QString gasToStr(struct gasmix gas);
+
 #endif // QTHELPER_H
diff --git a/save-html.c b/save-html.c
index 2d03bca..324d543 100644
--- a/save-html.c
+++ b/save-html.c
@@ -11,6 +11,18 @@ void write_attribute(struct membuffer *b, const char *att_name, const char *valu
 	put_string(b, "\",");
 }
 
+void save_photos(struct membuffer *b, const char *photos_dir, struct dive *dive)
+{
+	struct picture *pic = dive->picture_list;
+	put_string(b, "\"photos\":[");
+	while (pic) {
+		put_format(b, "{\"filename\":\"%s\"},", get_file_name(pic->filename));
+		copy_image_and_overwrite(pic->filename, photos_dir);
+		pic = pic->next;
+	}
+	put_string(b, "],");
+}
+
 void write_dive_status(struct membuffer *b, struct dive *dive)
 {
 	put_format(b, "\"sac\":\"%d\",", dive->sac);
@@ -162,7 +174,7 @@ void put_HTML_tags(struct membuffer *b, struct dive *dive, const char *pre, cons
 }
 
 /* if exporting list_only mode, we neglect exporting the samples, bookmarks and cylinders */
-void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const bool list_only)
+void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_dir, int *dive_no, const bool list_only)
 {
 	put_string(b, "{");
 	put_format(b, "\"number\":%d,", *dive_no);
@@ -180,6 +192,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const
 	write_attribute(b, "divemaster", dive->divemaster);
 	write_attribute(b, "suit", dive->suit);
 	write_dive_status(b, dive);
+	save_photos(b, photos_dir, dive);
 	put_HTML_tags(b, dive, "\"tags\":", ",");
 	put_HTML_notes(b, dive, "\"notes\":\"", "\",");
 	if (!list_only) {
@@ -191,7 +204,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const
 	(*dive_no)++;
 }
 
-void write_no_trip(struct membuffer *b, int *dive_no, const bool list_only)
+void write_no_trip(struct membuffer *b, int *dive_no, const char *photos_dir, const bool list_only)
 {
 	int i;
 	struct dive *dive;
@@ -202,12 +215,12 @@ void write_no_trip(struct membuffer *b, int *dive_no, const bool list_only)
 
 	for_each_dive (i, dive) {
 		if (!dive->divetrip)
-			write_one_dive(b, dive, dive_no, list_only);
+			write_one_dive(b, dive, photos_dir, dive_no, list_only);
 	}
 	put_format(b, "]},\n\n");
 }
 
-void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, const bool list_only)
+void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, const char *photos_dir, const bool list_only)
 {
 	struct dive *dive;
 
@@ -216,13 +229,13 @@ void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, const bool
 	put_format(b, "\"dives\":[");
 
 	for (dive = trip->dives; dive != NULL; dive = dive->next) {
-		write_one_dive(b, dive, dive_no, list_only);
+		write_one_dive(b, dive, photos_dir, dive_no, list_only);
 	}
 
 	put_format(b, "]},\n\n");
 }
 
-void write_trips(struct membuffer *b, bool selected_only, const bool list_only)
+void write_trips(struct membuffer *b, const char *photos_dir, bool selected_only, const bool list_only)
 {
 	int i, dive_no = 0;
 	struct dive *dive;
@@ -239,7 +252,7 @@ void write_trips(struct membuffer *b, bool selected_only, const bool list_only)
 		for_each_dive (i, dive) {
 			if (!dive->selected)
 				continue;
-			write_one_dive(b, dive, &dive_no, list_only);
+			write_one_dive(b, dive, photos_dir, &dive_no, list_only);
 		}
 		put_format(b, "]},\n\n");
 	} else {
@@ -253,27 +266,27 @@ void write_trips(struct membuffer *b, bool selected_only, const bool list_only)
 
 			/* We haven't seen this trip before - save it and all dives */
 			trip->index = 1;
-			write_trip(b, trip, &dive_no, list_only);
+			write_trip(b, trip, &dive_no, photos_dir, list_only);
 		}
 
 		/*Save all remaining trips into Others*/
-		write_no_trip(b, &dive_no, list_only);
+		write_no_trip(b, &dive_no, photos_dir, list_only);
 	}
 }
 
-void export_list(struct membuffer *b, bool selected_only, const bool list_only)
+void export_list(struct membuffer *b, const char *photos_dir, bool selected_only, const bool list_only)
 {
 	put_string(b, "trips=[");
-	write_trips(b, selected_only, list_only);
+	write_trips(b, photos_dir, selected_only, list_only);
 	put_string(b, "]");
 }
 
-void export_HTML(const char *file_name, const bool selected_only, const bool list_only)
+void export_HTML(const char *file_name, const char *photos_dir, const bool selected_only, const bool list_only)
 {
 	FILE *f;
 
 	struct membuffer buf = { 0 };
-	export_list(&buf, selected_only, list_only);
+	export_list(&buf, photos_dir, selected_only, list_only);
 
 	f = subsurface_fopen(file_name, "w+");
 	if (!f)
diff --git a/save-html.h b/save-html.h
index 432231d..2981961 100644
--- a/save-html.h
+++ b/save-html.h
@@ -15,8 +15,10 @@ void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, cons
 void put_HTML_notes(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
 void put_HTML_quoted(struct membuffer *b, const char *text);
 
-void export_HTML(const char *file_name, const bool selected_only, const bool list_only);
+void export_HTML(const char *file_name, const char *photos_dir, const bool selected_only, const bool list_only);
 
+extern void copy_image_and_overwrite(const char *cfileName, const char *cnewName);
+extern const char* get_file_name(const char *fileName);
 #ifdef __cplusplus
 }
 #endif
diff --git a/theme/dive_export.html b/theme/dive_export.html
index ec08e86..d9417e2 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -203,6 +203,15 @@ function changeAdvSearch(e){
 		<div id="divestats">
 		<h2 class="det_hed">Dive stats</h2>
 		</div>
+		<div id="divephotos">
+		<h2 class="det_hed">Dive Photos</h2>
+		<div id="slider_container">
+			<button onclick="prev_photo()" style="width:7%;margin:1%;float:left;">&lt;-</button>
+			<div id="slider">
+			</div>
+			<button onclick="next_photo()" style="width:7%;margin:1%;float:left">-&gt;</button>
+		</div>
+		</div>
 	</div>
 </body>
 </html>
diff --git a/theme/light.css b/theme/light.css
index 1dc5f6d..6f69880 100644
--- a/theme/light.css
+++ b/theme/light.css
@@ -210,6 +210,20 @@ ul:hover{
 	box-shadow: 10px 10px 5px #888888;
 }
 
+#slider_container{
+	height:240px;
+	margin-bottom:20px;
+}
+
+#slider{
+	float:left;
+	width:80%;
+	min-width:350px;
+	height:240px;
+	border-style:solid;
+	overflow:hidden;
+}
+
 .Cyl{
 	padding-right:25px;
 }
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 0a61ed7..74cfce0 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -724,7 +724,8 @@ function get_bookmark_HTML(event)
 */
 function get_bookmarks_HTML(dive)
 {
-	if (dive.events <= 0) return "";
+	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) {
@@ -766,6 +767,43 @@ function get_status_HTML(dive)
 	       '</td></tr></table>';
 };
 
+function get_dive_photos(dive)
+{
+	if (dive.photos.length <= 0) {
+		document.getElementById("divephotos").style.display = 'none';
+		return "";
+	}
+	var slider = "";
+	document.getElementById("divephotos").style.display = 'block';
+	for (var i = 0; i < dive.photos.length; i++) {
+		slider += '<img src="'+location.pathname
+		+'_files/photos/'+dive.photos[i].filename+'" alt="" height="240" width="240">';
+	}
+	return slider;
+}
+
+function prev_photo()
+{
+	var temp = items[dive_id].photos[0];
+	var i;
+	for (i = 0; i < items[dive_id].photos.length - 1; i++) {
+		items[dive_id].photos[i] = items[dive_id].photos[i + 1]
+	}
+	items[dive_id].photos[i] = temp;
+	document.getElementById("slider").innerHTML = get_dive_photos(items[dive_id]);
+}
+
+function next_photo()
+{
+	var temp = items[dive_id].photos[items[dive_id].photos.length - 1];
+	var i;
+	for (i = items[dive_id].photos.length - 1; i > 0; i--) {
+		items[dive_id].photos[i] = items[dive_id].photos[i - 1]
+	}
+	items[dive_id].photos[0] = temp;
+	document.getElementById("slider").innerHTML = get_dive_photos(items[dive_id]);
+}
+
 function mkelvin_to_C(mkelvin)
 {
 	return (mkelvin - ZERO_C_IN_MKELVIN) / 1000.0;
@@ -948,6 +986,7 @@ function showDiveDetails(dive)
 	document.getElementById("dive_equipments").innerHTML = get_cylinders_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]);
 	setDiveTitle(items[dive_id]);
 
 	//hide the list of dives and show the canvas.
diff --git a/theme/sand.css b/theme/sand.css
index 1ccde77..d17824c 100644
--- a/theme/sand.css
+++ b/theme/sand.css
@@ -212,6 +212,20 @@ ul:hover{
 	box-shadow: 7px 7px 5px rgba(215, 107, 27, 0.43);
 }
 
+#slider_container{
+	height:240px;
+	margin-bottom:20px;
+}
+
+#slider{
+	float:left;
+	width:80%;
+	min-width:350px;
+	height:240px;
+	border-style:solid;
+	overflow:hidden;
+}
+
 .det_hed{
 	background-color:#EFC15F;
 	padding:3px;
-- 
1.9.1

From 62ab29379bcd69c82798e200d48734a957262c65 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 11 Jul 2014 03:26:21 +0200
Subject: [PATCH 1/6] HTML: display dive status in detailed view

Add dive status in the detailed dive view.

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

diff --git a/save-html.c b/save-html.c
index 13bf70c..2d03bca 100644
--- a/save-html.c
+++ b/save-html.c
@@ -11,6 +11,13 @@ void write_attribute(struct membuffer *b, const char *att_name, const char *valu
 	put_string(b, "\",");
 }
 
+void write_dive_status(struct membuffer *b, struct dive *dive)
+{
+	put_format(b, "\"sac\":\"%d\",", dive->sac);
+	put_format(b, "\"otu\":\"%d\",", dive->otu);
+	put_format(b, "\"cns\":\"%d\",", dive->cns);
+}
+
 void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
 {
 	struct event *ev = dive->dc.events;
@@ -172,6 +179,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const
 	write_attribute(b, "buddy", dive->buddy);
 	write_attribute(b, "divemaster", dive->divemaster);
 	write_attribute(b, "suit", dive->suit);
+	write_dive_status(b, dive);
 	put_HTML_tags(b, dive, "\"tags\":", ",");
 	put_HTML_notes(b, dive, "\"notes\":\"", "\",");
 	if (!list_only) {
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 7135369..0a61ed7 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -734,7 +734,6 @@ function get_bookmarks_HTML(dive)
 	return result;
 }
 
-
 /**
 *Return HTML main data of a dive
 */
@@ -756,6 +755,17 @@ function get_dive_HTML(dive)
 	       '</td></tr></table><div style="margin:10px;"><p class="words">Notes: </p>' + dive.notes + '</div>';
 };
 
+/**
+*Return HTML dive status data
+*/
+function get_status_HTML(dive)
+{
+	return '<h2 class="det_hed">Dive Status</h2><table><tr><td class="words">Sac: </td><td>' + dive.sac +
+	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspOtu: </td><td>' + dive.otu +
+	       '</td><td class="words">&nbsp&nbsp&nbsp&nbsp&nbspCns: </td><td>' + dive.cns +
+	       '</td></tr></table>';
+};
+
 function mkelvin_to_C(mkelvin)
 {
 	return (mkelvin - ZERO_C_IN_MKELVIN) / 1000.0;
@@ -937,6 +947,7 @@ function showDiveDetails(dive)
 	document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]);
 	document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]);
 	document.getElementById("bookmarks").innerHTML = get_bookmarks_HTML(items[dive_id]);
+	document.getElementById("divestats").innerHTML = get_status_HTML(items[dive_id]);
 	setDiveTitle(items[dive_id]);
 
 	//hide the list of dives and show the canvas.
-- 
1.9.1

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

Reply via email to