I attached fixes to some minor bugs that Dirk has mentioned before.

Regards,
Gehad

On Thu, Aug 14, 2014 at 8:10 AM, Gehad Elrobey <gehadelro...@gmail.com>
wrote:

> Hi miika,
>
> I attached patches for the mentioned bug and other random fixes.
> Now I think the exports are quite stable.
>
> There is one remaining known bug in the keyboard arrows navigation between
> dives I will fix it and submit a patch later.
> I ll also work on some style enhancement.
>
> thanks.
>
>
> On Sun, Aug 10, 2014 at 6:22 PM, Miika Turkia <miika.tur...@gmail.com>
> wrote:
>
>> Thanks. I just fixed a few typos and will send versions with my SOB...
>> I'd be interested in testing the multilingual support, but to test it
>> properly requires the translations to be available.
>>
>> The bug I mentioned earlier about the missing trips seems to occur when
>> exporting selected dives. Even if I try to export two trips, the trips are
>> not shown, but all the exported dives are assigned to the "trip" *other*.
>>
>> miika
>>
>>
>> On Sun, Aug 10, 2014 at 12:41 PM, Gehad Elrobey <gehadelro...@gmail.com>
>> wrote:
>>
>>> Hi miika,
>>>
>>> Here are another four patches on the top of the previously sent patches.
>>> This is a try to make the HTML exports Multilingual I also fixed some
>>> bugs.
>>> I still need to update the user-manual if you find that these patches
>>> are good.
>>>
>>> Thanks.
>>>
>>>
>>> On Fri, Aug 8, 2014 at 6:22 PM, Miika Turkia <miika.tur...@gmail.com>
>>> wrote:
>>>
>>>> On Fri, Aug 8, 2014 at 5:32 PM, Gehad Elrobey <gehadelro...@gmail.com>
>>>> wrote:
>>>>
>>>>> I have attached some patches that improves the statistics table view
>>>>> and fix the cells layout.
>>>>>
>>>>> Thanks, I'll take a look later.
>>>>
>>>>>
>>>>>
>>>>> On Mon, Aug 4, 2014 at 6:40 PM, Miika Turkia <miika.tur...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Looking good, but some more improvements needed after a brief test:
>>>>>>
>>>>>> - When I export dives from one trip only, the trip mode sorting shows
>>>>>> all the exported dives under other.
>>>>>>
>>>>>
>>>>> I don't understand this, could you clarify that please?
>>>>>
>>>>
>>>> when I export one trip, and open the HTML, the trip mode does not show
>>>> the trip info. The attached screenshot will hopefully clarify.
>>>>
>>>> miika
>>>>
>>>
>>>
>>
>
From 89c56eee30f5d215d3d516f0cfd82b27b6f43e16 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sun, 17 Aug 2014 00:37:21 +0300
Subject: [PATCH 7/7] HTML: Fix Fake precision value.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index addd2b5..23fbc80 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -999,7 +999,7 @@ function mkelvin_to_C(mkelvin)
 
 function mbar_to_bar(mbar)
 {
-	return mbar / 1000;
+	return Math.round(mbar / 1000).toFixed(1);
 }
 
 function mm_to_meter(mm)
@@ -1009,9 +1009,10 @@ function mm_to_meter(mm)
 
 function gram_to_km(gram)
 {
-	return gram / 1000;
+	return (gram / 1000).toFixed(1);
 }
 
+
 function ml_to_litre(ml)
 {
 	return ml / (1000);
-- 
1.9.1

From 8deb0f42997363837ca6912ab1acd2e56edda30b Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sat, 16 Aug 2014 17:23:34 +0300
Subject: [PATCH 6/7] HTML: change empty O2 Value to Air.

-Change column name to 'Gas' as changed in Subsurface.
-Replace '--' with 'Air' to empty tanks.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 save-html.c       | 3 ++-
 theme/list_lib.js | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/save-html.c b/save-html.c
index 8ab5b6e..5dbd371 100644
--- a/save-html.c
+++ b/save-html.c
@@ -99,7 +99,7 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
 		if (cylinder->gasmix.o2.permille) {
 			put_format(b, "\"O2\":\"%u.%u%%\",", FRACTION(cylinder->gasmix.o2.permille, 10));
 		} else {
-			write_attribute(b, "O2", "--");
+			write_attribute(b, "O2", "Air");
 		}
 		put_string(b, "},");
 	}
@@ -406,6 +406,7 @@ void export_translation(const char *file_name)
 	write_attribute(b, "Work_Pressure", translate("gettextFromC", "Work Pressure"));
 	write_attribute(b, "Start_Pressure", translate("gettextFromC", "Start Pressure"));
 	write_attribute(b, "End_Pressure", translate("gettextFromC", "End Pressure"));
+	write_attribute(b, "Gas", translate("gettextFromC", "Gas"));
 	write_attribute(b, "Weight", translate("gettextFromC", "Weight"));
 	write_attribute(b, "Type", translate("gettextFromC", "Type"));
 	write_attribute(b, "Events", translate("gettextFromC", "Events"));
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 52e3ce2..addd2b5 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -863,7 +863,7 @@ function get_cylinders_HTML(dive)
 		return "";
 
 	var result = "";
-	result += '<h2 class="det_hed">' + translate.Dive_equipments + '</h2><table><tr><td class="words">' + translate.Type + '</td><td class="words">' + translate.Size + '</td><td class="words">' + translate.Work_Pressure + '</td><td class="words">' + translate.Start_Pressure + '</td><td class="words">' + translate.End_Pressure + '</td><td class="words">O2</td></tr>';
+	result += '<h2 class="det_hed">' + translate.Dive_equipments + '</h2><table><tr><td class="words">' + translate.Type + '</td><td class="words">' + translate.Size + '</td><td class="words">' + translate.Work_Pressure + '</td><td class="words">' + translate.Start_Pressure + '</td><td class="words">' + translate.End_Pressure + '</td><td class="words">'+translate.Gas+'</td></tr>';
 	for (var i in dive.Cylinders) {
 		result += get_cylinder_HTML(dive.Cylinders[i]);
 	}
-- 
1.9.1

From 69019156b71856156aed84ceb5decb7873da9488 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Sat, 16 Aug 2014 17:19:39 +0300
Subject: [PATCH 5/7] HTML: Make theme colors consistent.

Buttons and fields colors must be consistent in different themes.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 theme/dive_export.html |  1 +
 theme/list_lib.js      | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/theme/dive_export.html b/theme/dive_export.html
index fd98ba4..697c16c 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -134,6 +134,7 @@ window.onload=function(){
 
 	//translate Page
 	translate_page();
+	getDefaultColor();
 }
 
 function changeAdvSearch(e){
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 3f40c72..52e3ce2 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -666,13 +666,11 @@ 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();
 	}
@@ -717,7 +715,15 @@ function stats_row_unhighlight(row)
 //trips
 
 var tripsShown;
+var HEADER_COLOR;
+var BACKGROUND_COLOR;
 
+function getDefaultColor(){
+	var header = document.getElementById('header');
+	var button = document.getElementById('no_dives_selector');
+	HEADER_COLOR = document.defaultView.getComputedStyle(header).getPropertyValue('background-color');
+	BACKGROUND_COLOR = document.defaultView.getComputedStyle(button).getPropertyValue('background-color');
+}
 
 /**
 *This is the main function called to show/hide trips
@@ -727,11 +733,11 @@ function toggleTrips()
 	var trip_button = document.getElementById('trip_button');
 	if (tripsShown) {
 		tripsShown = false;
-		trip_button.style.backgroundColor = "#dfdfdf";
+		trip_button.style.backgroundColor = BACKGROUND_COLOR;
 		viewInPage();
 	} else {
 		showtrips();
-		trip_button.style.backgroundColor = "#5f7f8f";
+		trip_button.style.backgroundColor = HEADER_COLOR;
 		tripsShown = true;
 	}
 }
-- 
1.9.1

From 358722b02f6f833978a488173bba65de80963536 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 15 Aug 2014 11:55:44 +0300
Subject: [PATCH 4/7] HTML: Make SAC, OTU and CNS in uppercase letters.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 theme/list_lib.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 3a2e2ae..3f40c72 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -944,9 +944,9 @@ function get_dive_HTML(dive)
 */
 function get_status_HTML(dive)
 {
-	return '<h2 class="det_hed">' + translate.Dive_Status + '</h2><table><tr><td class="words">Sac: </td><td>' + ml_to_litre(dive.sac) +
-	       ' l/min' + '</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>';
+	return '<h2 class="det_hed">' + translate.Dive_Status + '</h2><table><tr><td class="words">SAC: </td><td>' + ml_to_litre(dive.sac) +
+	       ' l/min' + '</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>';
 };
 
 function get_dive_photos(dive)
-- 
1.9.1

From 2bf7fed5a8227c626d383557c4ab17fc9432eff9 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 15 Aug 2014 11:13:35 +0300
Subject: [PATCH 3/7] HTML: add units to time in dive profile.

Also change the separator to a colon which is more readable.

Signed-off-by: Gehad elrobey <gehadelro...@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 b832931..3a2e2ae 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1095,7 +1095,7 @@ function canvas_draw()
 						if(seriesIndex===2)
 						return items[dive_id].events[pointIndex].name;
 						else
-						return str;
+						return str.replace(",", " : ");
 					 }
 				 },
 				 seriesDefaults : {
@@ -1138,7 +1138,7 @@ function canvas_draw()
 						 tickRenderer : $.jqplot.CanvasAxisTickRenderer,
 						 tickOptions : {
 							 showGridline : false,
-							 formatString : '%i'
+							 formatString : '%is'
 						 },
 						 label:'Time (min)'
 					 },
-- 
1.9.1

From f0a296c41cc9a66100e94daac2fc5d1ed8206ba1 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 15 Aug 2014 09:50:05 +0300
Subject: [PATCH 2/7] HTML: don't show cylinders or weights table if they don't
 exist

Don't show the table header of cylinders or weights if they are not
available.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index c5171ce..b832931 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -816,6 +816,9 @@ function get_weight_HTML(weight)
 */
 function get_weights_HTML(dive)
 {
+	if (!dive.Weights.length)
+		return "";
+
 	var result = "";
 	result += '<table><tr><td class="words">' + translate.Weight + '</td><td class="words">' + translate.Type + '</td></tr>';
 	for (var i in dive.Weights) {
@@ -850,6 +853,9 @@ function get_cylinder_HTML(cylinder)
 */
 function get_cylinders_HTML(dive)
 {
+	if (!dive.Cylinders.length)
+		return "";
+
 	var result = "";
 	result += '<h2 class="det_hed">' + translate.Dive_equipments + '</h2><table><tr><td class="words">' + translate.Type + '</td><td class="words">' + translate.Size + '</td><td class="words">' + translate.Work_Pressure + '</td><td class="words">' + translate.Start_Pressure + '</td><td class="words">' + translate.End_Pressure + '</td><td class="words">O2</td></tr>';
 	for (var i in dive.Cylinders) {
-- 
1.9.1

From 2522e4e159c335fe3f0b4594d710e8c105709825 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 15 Aug 2014 08:07:17 +0300
Subject: [PATCH 1/7] HTML: Don't export others trip if no dives are selected.

Don't export 'others' trip unless there is really at least one dive to
be inserted into the 'others' group.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 save-html.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/save-html.c b/save-html.c
index 0288d44..8ab5b6e 100644
--- a/save-html.c
+++ b/save-html.c
@@ -252,18 +252,23 @@ void write_no_trip(struct membuffer *b, int *dive_no, bool selected_only, const
 {
 	int i;
 	struct dive *dive;
-
-	put_format(b, "{");
-	put_format(b, "\"name\":\"Other\",");
-	put_format(b, "\"dives\":[");
+	bool found_sel_dive = 0;
 
 	for_each_dive (i, dive) {
 		// write dive if it doesn't belong to any trip and the dive is selected
 		// or we are in exporting all dives mode.
-		if (!dive->divetrip && (dive->selected || !selected_only))
+		if (!dive->divetrip && (dive->selected || !selected_only)) {
+			if (!found_sel_dive) {
+				put_format(b, "{");
+				put_format(b, "\"name\":\"Other\",");
+				put_format(b, "\"dives\":[");
+				found_sel_dive = 1;
+			}
 			write_one_dive(b, dive, photos_dir, dive_no, list_only);
+		}
 	}
-	put_format(b, "]},\n\n");
+	if (found_sel_dive)
+		put_format(b, "]},\n\n");
 }
 
 void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, bool selected_only, const char *photos_dir, const bool list_only)
-- 
1.9.1

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

Reply via email to