Hello, yet again a set of patches from Gehad. I did not include the fake precision one as it breaks gas consumption graph. (There is also one patch from me fixing a typo that causes the Location text to be undefined.)
miika
From ff393e368e615c79df01a99a8b119fd1074c0d9e Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Sat, 16 Aug 2014 17:23:34 +0300 Subject: [PATCH 7/8] 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> Signed-off-by: Miika Turkia <miika.tur...@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 0a79218..5d8538b 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 d77acfb2404f575fa03f01c4ee7d653e02c15935 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Sat, 16 Aug 2014 17:19:39 +0300 Subject: [PATCH 6/8] HTML: Make theme colors consistent. Buttons and fields colors must be consistent in different themes. Signed-off-by: Gehad elrobey <gehadelro...@gmail.com> Signed-off-by: Miika Turkia <miika.tur...@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 3b8dbc4..0a79218 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 4051e7a1b33509f7eba180f6db9deb397787bd72 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Fri, 15 Aug 2014 11:55:44 +0300 Subject: [PATCH 5/8] HTML: Make SAC, OTU and CNS in uppercase letters. Signed-off-by: Gehad elrobey <gehadelro...@gmail.com> Signed-off-by: Miika Turkia <miika.tur...@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 9327bbc..3b8dbc4 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"> Otu: </td><td>' + dive.otu + - '</td><td class="words"> 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"> OTU: </td><td>' + dive.otu + + '</td><td class="words"> CNS: </td><td>' + dive.cns + '</td></tr></table>'; }; function get_dive_photos(dive) -- 1.9.1
From 33c5d6677e47cc08782b826499fe62556e09040f Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Fri, 15 Aug 2014 11:13:35 +0300 Subject: [PATCH 4/8] 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> 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 9a79b23..9327bbc 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 2861e8abffa4c3e7e5d844ff9d4a726e9a73844d Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Fri, 15 Aug 2014 09:50:05 +0300 Subject: [PATCH 3/8] 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> Signed-off-by: Miika Turkia <miika.tur...@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 6e5dc87..9a79b23 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 2cf6c3bdb7956c10a5eeb08bd717a52ce46df59b Mon Sep 17 00:00:00 2001 From: Gehad elrobey <gehadelro...@gmail.com> Date: Fri, 15 Aug 2014 08:07:17 +0300 Subject: [PATCH 2/8] 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> Signed-off-by: Miika Turkia <miika.tur...@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
From 5209a68e85660ff3e2ad65b3430ea5c25a5b7b21 Mon Sep 17 00:00:00 2001 From: Miika Turkia <miika.tur...@gmail.com> Date: Thu, 14 Aug 2014 19:28:24 +0300 Subject: [PATCH 1/8] Fix typo 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 c5171ce..6e5dc87 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -208,7 +208,7 @@ function getExpanded(dive) { var res = '<table><tr><td class="words">' + translate.Date + ': </td><td>' + dive.date + '</td><td class="words"> ' + translate.Time + ': </td><td>' + dive.time + - '</td><td class="words"> ' + translate.Locaiton + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' + getDiveCoor(dive) + + '</td><td class="words"> ' + translate.Location + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' + getDiveCoor(dive) + '</td></tr></table><table><tr><td class="words">' + translate.Rating + ':</td><td>' + putRating(dive.rating) + '</td><td class="words"> ' + translate.Visibility + ':</td><td>' + putRating(dive.visibility) + '</td></tr></table>' + @@ -918,7 +918,7 @@ function get_dive_HTML(dive) { var res = '<h2 class="det_hed">' + translate.Dive_information + '</h2><table><tr><td class="words">' + translate.Date + ': </td><td>' + dive.date + '</td><td class="words"> ' + translate.Time + ': </td><td>' + dive.time + - '</td><td class="words"> ' + translate.Locaiton + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a></td>' + getDiveCoor(dive) + + '</td><td class="words"> ' + translate.Location + ': </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a></td>' + getDiveCoor(dive) + '</tr></table><table><tr><td class="words">' + translate.Rating + ':</td><td>' + putRating(dive.rating) + '</td><td class="words"> ' + translate.Visibility + ':</td><td>' + putRating(dive.visibility) + '</td></tr></table>' + -- 1.9.1
_______________________________________________ subsurface mailing list subsurface@hohndel.org http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface