I Attached some bug fixes, Still working on the remaining bugs. Regards, Gehad.
On Tue, Jul 15, 2014 at 11:22 PM, Tomaz Canabrava <[email protected]> wrote: > On Tue, Jul 15, 2014 at 4:31 PM, Anton Lundin <[email protected]> wrote: > > On 15 July, 2014 - Anton Lundin wrote: > > > >> On 15 July, 2014 - Miika Turkia wrote: > >> > >> > A few more bugs: > >> > - Trimix dives are missing He content (use e.g. test20.xml for testing > >> > purposes) - Reported by Roberto, but mailing list was not included > >> > >> Gaah. This is code that uses the event data straight off. In the case of > >> SAMPLE_EVENT_GASCHANGE especially we need to map the event to the > >> available cylinders and that way figure out which gas we are using. > >> > >> Almost every place where we use get_gasmix_from_event we should be using > >> get_cylinder_index instead and grab the "real" gasmix from the cylinder, > >> except the case where get_gasmix_from_event is called from > >> get_cylinder_index =) > >> > >> > >> This was more work than anticipated when i first gave it a stab. If no > >> one else untangles this I'll give it another stab later. > >> > >> > > > > Gaah 2. > > > > I of course miss-read the report and i was talking about what we write > > in the regular-non-html-ui. > > > > I found another bug. > > :P > > > //Anton > _______________________________________________ > subsurface mailing list > [email protected] > http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface >
From c3826df07a6a839c32af092ad2e936586d616f57 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 19 Jul 2014 05:26:07 +0200 Subject: [PATCH 7/7] HTML: fix SAC units Sac units is in l/min and not mm/min. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/theme/list_lib.js b/theme/list_lib.js index 63f3e89..57c4e2a 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -792,8 +792,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"> Otu: </td><td>' + dive.otu + + return '<h2 class="det_hed">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>'; }; @@ -850,6 +850,11 @@ function mm_to_meter(mm) return mm / (1000); } +function ml_to_litre(ml) +{ + return ml / (1000); +} + function format_two_digit(n) { return n > 9 ? "" + n : "0" + n; -- 1.9.1
From c568a27592ea309bd42abf1777522fd6915ce1cb Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 19 Jul 2014 05:09:48 +0200 Subject: [PATCH 6/7] HTML: add event type to the detailed view. Event type is important in case of gas change and heading events. The value information show: mix and direction. Signed-off-by: Gehad elrobey <[email protected]> --- save-html.c | 1 + theme/list_lib.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/save-html.c b/save-html.c index 710569d..c3a07e4 100644 --- a/save-html.c +++ b/save-html.c @@ -36,6 +36,7 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) put_string(b, "\"events\":["); while (ev) { put_format(b, "{\"name\":\"%s\",", ev->name); + 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 1d0cd90..63f3e89 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -747,7 +747,7 @@ 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></tr>'; + return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td><td class="Cyl">' + event.type + '</td></tr>'; } /** @@ -758,7 +758,7 @@ 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>'; + result += '<h2 class="det_hed">Events</h2><table><tr><td class="words">Name</td><td class="words">Time</td><td class="words">Type</td></tr>'; for (var i in dive.events) { result += get_bookmark_HTML(dive.events[i]); } -- 1.9.1
From 59b9641f7befa50c2215b854c80e7c131f880fdf Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 19 Jul 2014 01:49:30 +0200 Subject: [PATCH 5/7] HTML: Add notes variable to the JSON file even if notes don't exist if dive notes don't exist, notes variable must be added to the javascript containing empty value "--", this is more friendly than just showing 'undefined' Signed-off-by: Gehad elrobey <[email protected]> --- save-html.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/save-html.c b/save-html.c index f6b9a50..710569d 100644 --- a/save-html.c +++ b/save-html.c @@ -114,11 +114,13 @@ void put_HTML_quoted(struct membuffer *b, const char *text) void put_HTML_notes(struct membuffer *b, struct dive *dive, const char *pre, const char *post) { + put_string(b, pre); if (dive->notes) { - put_string(b, pre); put_HTML_quoted(b, dive->notes); - put_string(b, post); + } else { + put_string(b, "--"); } + put_string(b, post); } void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, const char *post) -- 1.9.1
From b70ef1a839fdd34b08b52e4c55c77901beac28da Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Fri, 18 Jul 2014 23:04:14 +0200 Subject: [PATCH 4/7] HTML: Fix the pressure axis if no pressure samples when no pressure samples are available the y-axis on right side gets a bogus legend, this must be fixed and the minimum value is set to zero, as there is no negative pressure value. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/list_lib.js b/theme/list_lib.js index f401518..1d0cd90 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -979,6 +979,7 @@ function canvas_draw() pad : 2.05 }, y2axis : { + min : 0, tickRenderer : $.jqplot.CanvasAxisTickRenderer, tickOptions : { formatString : '%ibar' -- 1.9.1
From cf4ae6e501cd51fc8fdbbd5dad7a6317a416985e Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Fri, 18 Jul 2014 16:55:16 +0200 Subject: [PATCH 3/7] HTML: fix searching tags from the detailed view. when clicking a tag in the detailed view a search must take place on the following tag, the search settings must be spesified to search for tags only and ignore the advanced search settings choosen by the user. Signed-off-by: Gehad elrobey <[email protected]> --- theme/dive_export.html | 2 +- theme/list_lib.js | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/theme/dive_export.html b/theme/dive_export.html index d9417e2..b28eaa0 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -137,7 +137,7 @@ function changeAdvSearch(e){ </center> <div id="diveListPanel"> <div id="controlbox"> - <input id="search_input" oninput="SearchModules(this.value)" placeholder="search"/><a id="adv_srch_sp" onClick="showdiv()" >Advanced Search</a> + <input id="search_input" oninput="SearchModules(this.value, null)" placeholder="search"/><a id="adv_srch_sp" onClick="showdiv()" >Advanced Search</a> <div id="advanced_search"> <input type="checkbox" onchange="changeAdvSearch(this)" value="location" checked>Location<br> <input type="checkbox" onchange="changeAdvSearch(this)" value="divemaster" checked>Divemaster<br> diff --git a/theme/list_lib.js b/theme/list_lib.js index dd7be94..f401518 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -206,8 +206,7 @@ function getExpanded(dive) { var res = '<table><tr><td class="words">Date: </td><td>' + dive.date + '</td><td class="words"> Time: </td><td>' + dive.time + - '</td><td class="words"> Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' + - dive.location + '</a>' + + '</td><td class="words"> Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' + '</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) + '</td><td class="words"> Visibilty:</td><td>' + putRating(dive.visibility) + '</td></tr></table>' + @@ -228,7 +227,7 @@ function putTags(tags) { var result = ""; for (var i in tags) { - result += '<a onclick=\"Search_list_Modules(\'' + tags[i] + '\')\">' + tags[i] + '</a>'; + result += '<a onclick=\"Search_list_Modules(\'' + tags[i] + '\', {location:false, divemaster:false, buddy:false, notes:false, tags:true,})\">' + tags[i] + '</a>'; if (i < tags.length - 1) result += ', '; } @@ -481,14 +480,15 @@ function Node(value) this.key = new Set(); } -function Search_list_Modules(searchfor) +function Search_list_Modules(searchfor, searchOptions) { document.getElementById("search_input").value = searchfor; - SearchModules(searchfor); + SearchModules(searchfor, searchOptions); } -function SearchModules(searchfor) +function SearchModules(searchfor, searchOptions) { + unshowDiveDetails(dive_id); var resultKeys = new Set(); //set if (searchfor.length <= 0) { @@ -502,22 +502,31 @@ function SearchModules(searchfor) var keywords = searchfor.split(" "); + if (searchOptions === null) { + searchOptions = {}; + searchOptions.location = searchingModules["location"].enabled; + searchOptions.divemaster = searchingModules["divemaster"].enabled; + searchOptions.buddy = searchingModules["buddy"].enabled; + searchOptions.notes = searchingModules["notes"].enabled; + searchOptions.tags = searchingModules["tags"].enabled; + } + for (var i = 0; i < keywords.length; i++) { var keywordResult = new Set(); - if (searchingModules["location"].enabled === true) + if (searchOptions.location === true) keywordResult.Union(searchingModules["location"].search(keywords[i])); - if (searchingModules["divemaster"].enabled === true) + if (searchOptions.divemaster === true) keywordResult.Union(searchingModules["divemaster"].search(keywords[i])); - if (searchingModules["buddy"].enabled === true) + if (searchOptions.buddy === true) keywordResult.Union(searchingModules["buddy"].search(keywords[i])); - if (searchingModules["notes"].enabled === true) + if (searchOptions.notes === true) keywordResult.Union(searchingModules["notes"].search(keywords[i])); - if (searchingModules["tags"].enabled === true) + if (searchOptions.tags === true) keywordResult.Union(searchingModules["tags"].search(keywords[i])); if (resultKeys.isEmpty()) { @@ -764,7 +773,7 @@ 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"> Time: </td><td>' + dive.time + - '</td><td class="words"> Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' + + '</td><td class="words"> Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' + '</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) + '</td><td class="words"> Visibilty:</td><td>' + putRating(dive.visibility) + -- 1.9.1
From e6fd28b6dde6d7ba1c45935aa5993903cef4f876 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Thu, 17 Jul 2014 05:15:28 +0200 Subject: [PATCH 2/7] HTML: list-lib Seach must support spaces in the search string The search result of a string consisting of separate words must be the intersection of the search results of each word. This way searching strings with spaces will be supported. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/theme/list_lib.js b/theme/list_lib.js index 6ba3660..dd7be94 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -460,6 +460,20 @@ Set.prototype.Union = function(another_set) }; }; +Set.prototype.intersect = function(another_set) +{ + if (another_set === null) { + return; + } + var result = new Array(); + for (var i = 0; i < another_set.keys.length; i++) { + if(this.contains(another_set.keys[i])) { + result.push(another_set.keys[i]); + } + }; + this.keys = result; +}; + function Node(value) { this.children = new Array(); @@ -486,24 +500,32 @@ function SearchModules(searchfor) return; } - searchingModules.forEach (function(x) { - resultKeys.Union(x.search(searchfor)); - }); + var keywords = searchfor.split(" "); + + for (var i = 0; i < keywords.length; i++) { + var keywordResult = new Set(); + + if (searchingModules["location"].enabled === true) + keywordResult.Union(searchingModules["location"].search(keywords[i])); - if (searchingModules["location"].enabled === true) - resultKeys.Union(searchingModules["location"].search(searchfor)); + if (searchingModules["divemaster"].enabled === true) + keywordResult.Union(searchingModules["divemaster"].search(keywords[i])); - if (searchingModules["divemaster"].enabled === true) - resultKeys.Union(searchingModules["divemaster"].search(searchfor)); + if (searchingModules["buddy"].enabled === true) + keywordResult.Union(searchingModules["buddy"].search(keywords[i])); - if (searchingModules["buddy"].enabled === true) - resultKeys.Union(searchingModules["buddy"].search(searchfor)); + if (searchingModules["notes"].enabled === true) + keywordResult.Union(searchingModules["notes"].search(keywords[i])); - if (searchingModules["notes"].enabled === true) - resultKeys.Union(searchingModules["notes"].search(searchfor)); + if (searchingModules["tags"].enabled === true) + keywordResult.Union(searchingModules["tags"].search(keywords[i])); - if (searchingModules["tags"].enabled === true) - resultKeys.Union(searchingModules["tags"].search(searchfor)); + if (resultKeys.isEmpty()) { + resultKeys.Union(keywordResult); + } else { + resultKeys.intersect(keywordResult); + } + } if (resultKeys.isEmpty()) { //didn't find keys -- 1.9.1
From c718449681dea46f41be4ac928619e322198f31a Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Wed, 16 Jul 2014 14:38:20 +0200 Subject: [PATCH 1/7] HTML: don't add photos or dive status if exporting list only If export list only option is choosen, photos and dive status must not be added to the export. Signed-off-by: Gehad elrobey <[email protected]> --- save-html.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/save-html.c b/save-html.c index 324d543..f6b9a50 100644 --- a/save-html.c +++ b/save-html.c @@ -191,14 +191,14 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d write_attribute(b, "buddy", dive->buddy); 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) { put_cylinder_HTML(b, dive); put_HTML_samples(b, dive); put_HTML_bookmarks(b, dive); + write_dive_status(b, dive); + save_photos(b, photos_dir, dive); } put_string(b, "},\n"); (*dive_no)++; -- 1.9.1
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
