X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=abf9c43fe6da3e5b94972b8206fa04aa0549d823;hp=068a96f76c0c5427789d538b8c5ff389a42259fa;hb=2283995d7df3de43454a11729a3296c5300d0f49;hpb=ba89e4f0f3526745c9332488d7e05038e33844c6 diff --git a/phpfspot.js b/phpfspot.js index 068a96f..abf9c43 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -58,7 +58,7 @@ function showPhotoIndex(begin_with) // if photo index is currently shown, refresh it function refreshPhotoIndex() { - if(document.getElementById("matrix") != undefined || startup == 1) { + if(document.getElementById("index") != undefined || startup == 1) { showPhotoIndex(); startup = 0; } @@ -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,12 +103,41 @@ 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) { var exprt = document.getElementById('output'); @@ -125,6 +148,11 @@ function setViewMode(mode) function clearSearch() { document.getElementsByName('searchfor')[0].value = ''; + + if(document.getElementsByName('consider_date')[0].checked == true) { + document.getElementsByName('consider_date')[0].checked = false; + datesearch(); + } } function AskServerWhatToDo() @@ -132,10 +160,12 @@ function AskServerWhatToDo() return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do')); } -function init_phpfspot() +function init_phpfspot(mode) { + /* always load list of available tags */ refreshAvailableTags(); + /* ask the server what we are currently displaying */ whattodo = AskServerWhatToDo(); if(whattodo == 'showpi' || whattodo == 'showpi_date') { @@ -151,7 +181,7 @@ function init_phpfspot() refreshSelectedTags(); } } -} +} // init_phpfspot() function setBackGrdColor(item, color) { @@ -178,6 +208,8 @@ function getPhotoToShow() function showCalendar(date_box, click_obj) { var calendar = document.getElementById('calendar'); + var year = document.getElementById(date_box+'year').value; + var month = document.getElementById(date_box+'month').value; if(date_box == 'from') { var xpos = document.getElementById('frompic').offsetLeft; var ypos = document.getElementById('frompic').offsetTop; @@ -188,16 +220,24 @@ function showCalendar(date_box, click_obj) var ypos = document.getElementById('topic').offsetTop; calendar_mode = 'to'; } - calendar.style.left = xpos + 60 + 'px'; + calendar.style.left = xpos + 100 + 'px'; calendar.style.top = ypos + 80 + 'px'; if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') { calendar.style.visibility = 'visible'; calendar.innerHTML = "Loading..."; - calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix')); + calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month)); calendar_shown = 1; } else { + hideCalendar(); + } +} + +function hideCalendar() +{ + var calendar = document.getElementById('calendar'); + if(calendar.style.visibility != 'hidden') { calendar.style.visibility = 'hidden'; calendar_shown = 0; } @@ -215,6 +255,7 @@ function setCalendarDate(year, month, day) document.getElementById(calendar_mode+'year').value = year; document.getElementById(calendar_mode+'month').value = month; document.getElementById(calendar_mode+'day').value = day; + hideCalendar(); } function resetAll() @@ -226,6 +267,201 @@ 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