Here is a set of patches missing from master (from Gehad).

miika
From 5a51290e8e210dd820f20df62a0687079a2166f0 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Wed, 23 Jul 2014 05:12:25 +0200
Subject: [PATCH 11/11] HTML: Save last ordering state of sorting

Saving sorting state and apply the last sorting to new search results.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[email protected]>
---
 theme/dive_export.html | 12 +++++------
 theme/list_lib.js      | 55 +++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/theme/dive_export.html b/theme/dive_export.html
index ebddf40..a326e3b 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -158,12 +158,12 @@ function changeAdvSearch(e){
 		</div>
 	</div>
 		<div id="header">
-		<div onClick="list_sort('1')" class="item">Number</div>
-		<div onClick="list_sort('2')" class="item">Date</div>
-		<div onClick="list_sort('3')" class="item">Time</div>
-		<div onClick="list_sort('6')" class="item_large">Location</div>
-		<div onClick="list_sort('4')" class="item">Air Temp</div>
-		<div onClick="list_sort('5')" class="item">Water Temp</div>
+		<div onClick="change_sort_col('1')" class="item">Number</div>
+		<div onClick="change_sort_col('2')" class="item">Date</div>
+		<div onClick="change_sort_col('3')" class="item">Time</div>
+		<div onClick="change_sort_col('6')" class="item_large">Location</div>
+		<div onClick="change_sort_col('4')" class="item">Air Temp</div>
+		<div onClick="change_sort_col('5')" class="item">Water Temp</div>
 	</div>
 	<div id="diveslist">
 	</div>
diff --git a/theme/list_lib.js b/theme/list_lib.js
index c11c349..904bde5 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -260,73 +260,98 @@ function putRating(rating)
 this variables keep the state of
 each col. sorted asc or des
 */
-var number = false;
+var number = true;
 var time = true;
 var date = true;
 var air = true;
 var water = true;
 var locat = true;
 
+/*
+This variable keep the state of the col.
+which is sorted upon it.
+*/
+var sort_based_on = 1; // sorting is based on number by default.
+
+function change_sort_col(sortOn)
+{
+	sort_based_on = sortOn;
+	toggle_sort_state(sortOn);
+	list_sort(sortOn);
+}
+
 function list_sort(sortOn)
 {
 	switch (sortOn) {
 	case '1': //number
 		if (number) {
 			sort_it(sortOn, cmpNumAsc);
-			number = 1 - number;
 		} else {
 			sort_it(sortOn, cmpNumDes);
-			number = 1 - number;
 		}
 		break;
 	case '2': //date
 		if (date) {
 			sort_it(sortOn, cmpDateAsc);
-			date = 1 - date;
 		} else {
 			sort_it(sortOn, cmpDateDes);
-			date = 1 - date;
 		}
 		break;
 	case '3': //time
 		if (time) {
 			sort_it(sortOn, cmpTimeDes);
-			time = 1 - time;
 		} else {
 			sort_it(sortOn, cmpTimeAsc);
-			time = 1 - time;
 		}
 		break;
 	case '4': //Air temp
 		if (air) {
 			sort_it(sortOn, cmpAtempDes);
-			air = 1 - air;
 		} else {
 			sort_it(sortOn, cmpAtempAsc);
-			air = 1 - air;
 		}
 		break;
 	case '5': //Water temp
 		if (water) {
 			sort_it(sortOn, cmpWtempDes);
-			water = 1 - water;
 		} else {
 			sort_it(sortOn, cmpWtempAsc);
-			water = 1 - water;
 		}
 		break;
-	case '6': //Water temp
+	case '6': //Location
 		if (locat) {
 			sort_it(sortOn, cmpLocationDes);
-			locat = 1 - locat;
 		} else {
 			sort_it(sortOn, cmpLocationAsc);
-			locat = 1 - locat;
 		}
 		break;
 	}
 }
 
+function toggle_sort_state(sortOn)
+{
+	switch (sortOn) {
+	case '1': //number
+		number = 1 - number;
+		break;
+	case '2': //date
+		date = 1 - date;
+		break;
+	case '3': //time
+		time = 1 - time;
+		break;
+	case '4': //Air temp
+		air = 1 - air;
+		break;
+	case '5': //Water temp
+		water = 1 - water;
+		break;
+	case '6': //Location
+		locat = 1 - locat;
+		break;
+	}
+}
+
 /*
 *sorting interface for different coloumns
 */
@@ -496,6 +521,7 @@ function SearchModules(searchfor, searchOptions)
 		document.getElementById("search_input").style.borderColor = "initial";
 		start = 0;
 		itemsToShow = olditemstoshow;
+		list_sort(sort_based_on);
 		viewInPage();
 		return;
 	}
@@ -548,6 +574,7 @@ function SearchModules(searchfor, searchOptions)
 	document.getElementById("search_input").style.borderColor = "initial";
 	itemsToShow = resultKeys.keys;
 	start = 0;
+	list_sort(sort_based_on);
 	viewInPage();
 }
 ///////////////////////////////////////
-- 
1.9.1

From 0b2563baacbf3fb27fbd75e6c144657e2ce3ca6a Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Mon, 21 Jul 2014 07:02:31 +0200
Subject: [PATCH 10/11] HTML: Fix the viewed search results when change the
 number of viewed dives.

When a search results are shown and the number of showed dives is
changed, all the dives are shown. We Just need to preview the first
number to show dives from the search results instead of all the dives.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 0789714..c11c349 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -160,7 +160,7 @@ function setNumberOfDives(e)
 	var value = e.options[e.selectedIndex].value;
 	sizeofpage = parseInt(value, 10);
 	var end = start + sizeofpage - 1;
-	view_in_range(start, end);
+	viewInPage();
 }
 
 function toggleExpantion(ul)
-- 
1.9.1

From 9bd0e4ca6898f4fcbd29991e8ccc67cf91ae7059 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Sun, 20 Jul 2014 22:42:18 +0200
Subject: [PATCH 09/11] HTML: rescale dive profile with page zoom in/out

Rescale the dive profile view with page zooming in and out.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 7204746..0789714 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1081,3 +1081,7 @@ function switchDives(e)
 		}
 	}
 }
+
+window.onresize = function(event) {
+      plot1.replot( { resetAxes: true } );
+};
-- 
1.9.1

From b8a8b9243be0b3225fb74d0e888d3054aff0722a Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Sun, 20 Jul 2014 16:48:10 +0200
Subject: [PATCH 08/11] HTML: fix moving to previous dive by keyboard arrows.

If I go to next dive on detailed view, and hit one extra right arrows
after reaching the last dive, first click on left does not change the
selection, only re-clicking on left does.

Fix the number of dives to prevent throwing exceptions and fix moving
between dives smoothly.

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

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 2b5931d..7204746 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -1054,7 +1054,7 @@ function unshowDiveDetails(dive)
 
 function nextDetailedDive()
 {
-	if (dive_id < items.length) {
+	if (dive_id < items.length - 1) {
 		showDiveDetails(++dive_id);
 	}
 }
-- 
1.9.1

From 2b7a6a6b6370dd5264a039eea88321d6b2988107 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Sat, 19 Jul 2014 05:26:07 +0200
Subject: [PATCH 07/11] HTML: fix SAC units

Sac units is in l/min and not mm/min.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[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 0da1108..2b5931d 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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">&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>';
 };
@@ -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 87ab76ce30a56a580ac9745b6f8d99ea41664cd0 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Sat, 19 Jul 2014 05:09:48 +0200
Subject: [PATCH 06/11] HTML: add event value to the detailed view.

Event value is important in case of gas change and heading events.
The value information show: mix and direction.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[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..75f7542 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, "\"value\":\"%d\",", ev->value);
 		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..0da1108 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.value + '</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">Value</td></tr>';
 	for (var i in dive.events) {
 		result += get_bookmark_HTML(dive.events[i]);
 	}
-- 
1.9.1

From 2e1527f9ab773a8005989c97f1bd945b8da745c5 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Sat, 19 Jul 2014 01:49:30 +0200
Subject: [PATCH 05/11] 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]>
Signed-off-by: Miika Turkia <[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 87564155ea9669a04065f589d37e3fde4138f9d3 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 18 Jul 2014 23:04:14 +0200
Subject: [PATCH 04/11] 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]>
Signed-off-by: Miika Turkia <[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 3121bd2be789b24d52accdda98bb650cd73222d0 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 18 Jul 2014 16:55:16 +0200
Subject: [PATCH 03/11] 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 specified to search for tags
only and ignore the advanced search settings chosen by the user.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[email protected]>
---
 theme/dive_export.html |  4 ++--
 theme/list_lib.js      | 33 +++++++++++++++++++++------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/theme/dive_export.html b/theme/dive_export.html
index d9417e2..ebddf40 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -123,7 +123,7 @@ window.onload=function(){
 
 function changeAdvSearch(e){
 	searchingModules[e.value].enabled=e.checked;
-	SearchModules(document.getElementById("search_input").value);
+	SearchModules(document.getElementById("search_input").value, null);
 }
 
 </script>
@@ -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">&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><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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">&nbsp;&nbsp;&nbsp;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">&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 + '\')\">' +
+	       '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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">&nbsp;&nbsp;&nbsp;Visibilty:</td><td>' + putRating(dive.visibility) +
-- 
1.9.1

From 6666a0e12b8735a7e5404d18b1564cfb81f00560 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Thu, 17 Jul 2014 05:15:28 +0200
Subject: [PATCH 02/11] HTML: list-lib Search 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]>
Signed-off-by: Miika Turkia <[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 f81c60e24751f442b3aa50006da0125f6f0b4d9e Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Wed, 16 Jul 2014 14:38:20 +0200
Subject: [PATCH 01/11] HTML: don't add photos or dive status if exporting list
 only

If export list only option is chosen, photos and dive status must not
be added to the export.

Signed-off-by: Gehad elrobey <[email protected]>
Signed-off-by: Miika Turkia <[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

Reply via email to