X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=40d676187f0c409f0a9d65940cf44dbea4a23fb8;hp=4849295d0b311699f46974e4dd69a9c8644d0153;hb=4a0b6f6114f19cebd796b3b1c6e5253edc3267c3;hpb=5477fa94d9278968eb3d7182c9c400512cab2b22 diff --git a/phpfspot.js b/phpfspot.js index 4849295..40d6761 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -20,9 +20,6 @@ function Tags(mode, id) // del the tag from users session HTML_AJAX.grab(encodeURI('rpc.php?action=deltag&id=' + id)); } - else if(mode == "reset") { - HTML_AJAX.grab(encodeURI('rpc.php?action=resettags')); - } else if(mode == "condition") { setCheckedValue(id, id.value); HTML_AJAX.grab(encodeURI('rpc.php?action=tagcondition&mode=' + id.value)); @@ -38,6 +35,7 @@ function refreshAvailableTags() { // update available tags var avail_tags = document.getElementById('available_tags'); + avail_tags.innerHTML = "Loading..."; avail_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_available_tags')); } @@ -45,24 +43,31 @@ function refreshSelectedTags() { // update selected tags var selected_tags = document.getElementById("selected_tags"); + selected_tags.innerHTML = "Loading..."; selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags')); -} -function showPhotoIndex() -{ - HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index')); + // if no tags are currently selected, return false from here + if(selected_tags.innerHTML == "") + return false; + + return true; + } -function showBubbleDetails(object, id, direction) +function showPhotoIndex(begin_with) { - HTML_AJAX.replace(object, encodeURI('rpc.php?action=showbubbledetails&id=' + id + '&direction=" + direction')); + if(begin_with == undefined) + HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index')); + else + HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index&begin_with=' + begin_with)); } // if photo index is currently shown, refresh it function refreshPhotoIndex() { - if(document.getElementById("matrix") != undefined) { + if(document.getElementById("matrix") != undefined || startup == 1) { showPhotoIndex(); + startup = 0; } } @@ -92,14 +97,130 @@ function setCheckedValue(condition, value) { } } -function startSearch(searchfor) +function startTagSearch(searchfor) { - HTML_AJAX.grab(encodeURI('rpc.php?action=search&for=' + searchfor)); + HTML_AJAX.grab(encodeURI('rpc.php?action=tag_search&for=' + searchfor)); + refreshAvailableTags(); + refreshSelectedTags(); showPhotoIndex(); +} + +function startDateSearch() +{ + from_year = document.getElementById('fromyear').value; + from_month = document.getElementById('frommonth').value; + from_day = document.getElementById('fromday').value; + from = from_year +"-"+ from_month +"-"+ from_day; + to_year = document.getElementById('toyear').value; + to_month = document.getElementById('tomonth').value; + 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)); + refreshAvailableTags(); + refreshSelectedTags(); + refreshPhotoIndex(); + refreshPhotoIndex(); +} + +function setViewMode(mode) +{ + var exprt = document.getElementById('output'); + exprt.innerHTML = "Loading..."; + exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode)); } function clearSearch() { document.getElementsByName('searchfor')[0].value = ''; } + +function init_phpfspot() +{ + refreshAvailableTags(); + + if(photo = getPhotoToShow()) { + showImage(photo) + refreshSelectedTags(); + } + else { + if(refreshSelectedTags()) { + showPhotoIndex(); + } + } +} + +function setBackGrdColor(item, color) +{ + if(color == 'mouseover') + item.style.backgroundColor='#c6e9ff'; + if(color == 'mouseout') + item.style.backgroundColor='#eeeeee'; + if(color == 'mouseclick') + item.style.backgroundColor='#93A8CA'; +} + +function getPhotoToShow() +{ + // update selected tags + var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show')); + + // if no image needs to be shown, return false from here + if(photo_to_show == "") + return false; + + return photo_to_show; +} + +function showCalendar(date_box, click_obj) +{ + var calendar = document.getElementById('calendar'); + if(date_box == 'from') { + var xpos = document.getElementById('frompic').offsetLeft; + var ypos = document.getElementById('frompic').offsetTop; + calendar_mode = 'from'; + } + if(date_box == 'to') { + var xpos = document.getElementById('topic').offsetLeft; + var ypos = document.getElementById('topic').offsetTop; + calendar_mode = 'to'; + } + calendar.style.left = xpos + 60 + '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_shown = 1; + } + else { + calendar.style.visibility = 'hidden'; + calendar_shown = 0; + } +} + +function setMonth(year, month, day) +{ + var calendar = document.getElementById('calendar'); + calendar.innerHTML = "Loading..."; + calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day)); +} + +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; +} + +function resetAll() +{ + HTML_AJAX.grab(encodeURI('rpc.php?action=reset')); + clearSearch(); +} + +var startup = 1; +var calendar_shown = 0; +var calendar_mode = '';