X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=88af0b5ba07b51f7b124cb701c69f345c179e8bd;hp=bd2baf304a8f216aa56ad714319ec10916ad2cd0;hb=9b898a713707b6ff09f2550307a2d23ae248cd1b;hpb=81427447f075b3b90a46ce715a5ce4f841fe27a0 diff --git a/phpfspot.js b/phpfspot.js index bd2baf3..88af0b5 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) @@ -137,17 +153,28 @@ function clearSearch() document.getElementsByName('searchfor')[0].value = ''; } +function AskServerWhatToDo() +{ + return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do')); +} + function init_phpfspot() { refreshAvailableTags(); - if(photo = getPhotoToShow()) { - showImage(photo) + whattodo = AskServerWhatToDo(); + + if(whattodo == 'showpi' || whattodo == 'showpi_date') { + showPhotoIndex(); + } + if(whattodo == 'showpi_tags') { refreshSelectedTags(); + showPhotoIndex(); } - else { - if(refreshSelectedTags()) { - showPhotoIndex(); + if(whattodo == 'show_photo') { + if(photo = getPhotoToShow()) { + showImage(photo) + refreshSelectedTags(); } } } @@ -225,6 +252,144 @@ 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