From e3be473a7fc82bd99d2a76e9294e564b0f5eea82 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 31 Oct 2014 02:50:17 +0200 Subject: Fix inconsistent search result in HTML export The advanced search drop down menu always showed the user selected settings, even if this is a customized search (tag, location) that took place by clicking on the search quick hyperlink. This is fixed by saving the user default search preferences and changing them temporarily when quick hyperlinks searching is used. Fixes #723 Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- theme/dive_export.html | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'theme/dive_export.html') diff --git a/theme/dive_export.html b/theme/dive_export.html index 6f3708c49..e171b070f 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -139,8 +139,40 @@ window.onload=function(){ getDefaultColor(); } +var user_search_preference = { + location : true, + divemaster : true, + buddy : true, + notes : true, + tags : true +}; + +function set_search_dropdown(search_preference) +{ + console.log(search_preference); + searchingModules["location"].enabled = search_preference.location; + document.getElementById("search_item_location").checked = search_preference.location; + + searchingModules["divemaster"].enabled = search_preference.divemaster; + document.getElementById("search_item_divemaster").checked = search_preference.divemaster; + + searchingModules["buddy"].enabled = search_preference.buddy; + document.getElementById("search_item_Buddy").checked = search_preference.buddy; + + searchingModules["notes"].enabled = search_preference.notes; + document.getElementById("search_item_Notes").checked = search_preference.notes; + + searchingModules["tags"].enabled = search_preference.tags; + document.getElementById("search_item_Tags").checked = search_preference.tags; +} + function changeAdvSearch(e){ - searchingModules[e.value].enabled=e.checked; + // change user searching preference + user_search_preference[e.value] = e.checked; + + //set search preference dropdown + set_search_dropdown(user_search_preference); + SearchModules(document.getElementById("search_input").value, null); } @@ -158,11 +190,11 @@ function changeAdvSearch(e){ Advanced search