X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=9e1a932431923d2d9303628d53fc0826da72aecc;hp=d54f8b5403519a997419d21f2fab0a236d9dbd30;hb=005562e4a4fb2b37fc6f1d4a8ca4a9c11ab42ed1;hpb=3d567f23a4e45ed8b082fbcd160bd0463b643529 diff --git a/phpfspot.js b/phpfspot.js index d54f8b5..9e1a932 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -45,13 +45,6 @@ function refreshSelectedTags() var selected_tags = document.getElementById("selected_tags"); selected_tags.innerHTML = "Loading..."; selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags')); - - // if no tags are currently selected, return false from here - if(selected_tags.innerHTML == "") - return false; - - return true; - } function showPhotoIndex(begin_with) @@ -97,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; @@ -116,13 +103,42 @@ 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'; + + if(searchfor != "") { + request = request + '&for=' + searchfor; + } - clearSearch(); + if(document.getElementsByName('consider_date')[0].checked == true) { + request = request + '&from='+ from +'&to='+ to; + } + + var sort_order = document.getElementsByName('sort_order')[0]; + request = request + '&sort_order='+ sort_order.options[sort_order.selectedIndex].value; + + HTML_AJAX.grab(encodeURI(request)); + refreshAvailableTags(); refreshSelectedTags(); - refreshPhotoIndex(); - refreshPhotoIndex(); + 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) @@ -148,15 +164,11 @@ function init_phpfspot() whattodo = AskServerWhatToDo(); - if(whattodo == 'showpi') { + if(whattodo == 'showpi' || whattodo == 'showpi_date') { showPhotoIndex(); } if(whattodo == 'showpi_tags') { - if(refreshSelectedTags()) { - showPhotoIndex(); - } - } - if(whattodo == 'showpi_date') { + refreshSelectedTags(); showPhotoIndex(); } if(whattodo == 'show_photo') { @@ -240,6 +252,68 @@ function resetAll() refreshPhotoIndex(); } +function WSR_getElementsByClassName(oElm, strTagName, oClassNames){ + var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); + var arrReturnElements = new Array(); + var arrRegExpClassNames = new Array(); + if(typeof oClassNames == "object"){ + for(var i=0; i