From 984b068b1369819a44bbfc4412476da0da49607f Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Tue, 17 Jul 2007 20:24:56 +0000 Subject: issue50, further code changes to be able to combine tag- and date-search git-svn-id: file:///var/lib/svn/phpfspot/trunk@219 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- phpfspot.js | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'phpfspot.js') diff --git a/phpfspot.js b/phpfspot.js index 58e48de..5aac788 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -90,16 +90,10 @@ function setCheckedValue(condition, value) { } } -function startTagSearch(searchfor) +function startSearch() { - HTML_AJAX.grab(encodeURI('rpc.php?action=tag_search&for=' + searchfor)); - refreshAvailableTags(); - refreshSelectedTags(); - showPhotoIndex(); -} + var searchfor = document.getElementsByName('searchfor')[0].value -function startDateSearch() -{ from_year = document.getElementById('fromyear').value; from_month = document.getElementById('frommonth').value; from_day = document.getElementById('fromday').value; @@ -109,10 +103,39 @@ function startDateSearch() to_day = document.getElementById('today').value; to = to_year +"-"+ to_month +"-"+ to_day; - HTML_AJAX.grab(encodeURI('rpc.php?action=date_search&from='+ from +'&to='+ to)); + var request = 'rpc.php?action=search'; - refreshPhotoIndex(); + if(searchfor != "") { + request = request + '&for=' + searchfor; + } + if(document.getElementsByName('consider_date')[0].checked == true) { + request = request + '&from='+ from +'&to='+ to; + } + + HTML_AJAX.grab(encodeURI(request)); + + refreshAvailableTags(); + refreshSelectedTags(); + showPhotoIndex(); + +} + +function datesearch() +{ + var mode = true; + + if(document.getElementsByName('consider_date')[0].checked == true) { + mode = false; + } + + document.getElementById('fromyear').disabled = mode; + document.getElementById('frommonth').disabled = mode; + document.getElementById('fromday').disabled = mode; + document.getElementById('toyear').disabled = mode; + document.getElementById('tomonth').disabled = mode; + document.getElementById('today').disabled = mode; + } function setViewMode(mode) -- cgit v1.2.3-18-g5258