update INSTALL and UPGRADE file
[phpfspot.git] / phpfspot.js
index b4e8421e045bd33147bd332ae2d2a46bd54c5da3..706d6423e417f778019edcaaaee74ace8a4c85b3 100644 (file)
@@ -265,15 +265,13 @@ function setCheckedValue(condition, value) {
  */
 function startSearch()
 {
-   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;
-
+   if(document.getElementById('date_from').value != undefined) {
+      date_from = document.getElementById('date_from').value;
+   }
+   if(document.getElementById('date_to').value != undefined) {
+      date_to = document.getElementById('date_to').value;
+   }
+      
    var objTemp = new Object();
    objTemp['action'] = 'search';
 
@@ -287,8 +285,8 @@ function startSearch()
    }
    if(document.getElementsByName('consider_date')[0] != undefined &&
       document.getElementsByName('consider_date')[0].checked == true) {
-      objTemp['from'] = from;
-      objTemp['to'] = to;
+      objTemp['date_from'] = date_from;
+      objTemp['date_to'] = date_to;
    }
    if(document.getElementsByName('consider_rate')[0] != undefined &&
       document.getElementsByName('consider_rate')[0].checked == true) {
@@ -322,12 +320,8 @@ function datesearch()
       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;
+   document.getElementById('date_from').disabled = mode;
+   document.getElementById('date_to').disabled = mode;
  
 } // datesearch()
 
@@ -337,8 +331,13 @@ function datesearch()
  * called for photo-index export. will return the
  * selected mode via AJAX from the server.
  */
-function setViewMode(mode)
+function setViewMode(srv_webpath, mode)
 {
+   if(srv_webpath != undefined)
+      web_path = srv_webpath;
+   else
+      web_path = '';
+
    var exprt = document.getElementById('output');
    exprt.innerHTML = "Loading...";
    exprt.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_export&mode=' + mode));
@@ -535,9 +534,24 @@ function hidePhotoDetails(mode)
  */
 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;
+   var calendar;
+   var userdate;
+
+   calendar = document.getElementById('calendar');
+   if(calendar == undefined) {
+      window.alert("Can not find element 'calendar'");
+      return;
+   }
+
+   userdate = document.getElementById('date_' + date_box);
+
+   if(userdate == undefined) {
+      window.alert("Can not find element 'date_'" + date_box);
+      return;
+   }
+
+   userdate = userdate.value;
+
    if(date_box == 'from') {
       var xpos = document.getElementById('frompic').offsetLeft;
       var ypos = document.getElementById('frompic').offsetTop;
@@ -549,12 +563,12 @@ function showCalendar(date_box, click_obj)
       calendar_mode = 'to';
    }
    calendar.style.left = xpos + 100 + 'px';
-   calendar.style.top = ypos + 80 + 'px';
+   calendar.style.top = ypos + 120 + 'px';
 
    if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
       calendar.style.visibility = 'visible';
       calendar.innerHTML = "Loading...";
-      calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path +'/rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month));
+      calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path +'/rpc.php?action=get_calendar_matrix&date=' + userdate));
       calendar_shown = 1;
    }
    else {
@@ -582,18 +596,16 @@ function setMonth(year, month, day)
 {
    var calendar = document.getElementById('calendar');
    calendar.innerHTML = "Loading...";
-   calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
+   calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_calendar_matrix&date='+ year +'-'+ month +'-'+ day));
 }
 
 /**
  * get the user-selected date from the calendar and
  * put it into the date-search boxes
  */
-function setCalendarDate(year, month, day)
+function setCalendarDate(userdate)
 {
-   document.getElementById(calendar_mode+'year').value = year;
-   document.getElementById(calendar_mode+'month').value = month;
-   document.getElementById(calendar_mode+'day').value = day;
+   document.getElementById('date_'+calendar_mode).value = userdate;
    hideCalendar();
 
 } // setCalendarDate()
@@ -655,17 +667,19 @@ function preloadPhotos(image_url) {
    var waiting = 100;
    var counting;
 
-   lbImg=WSR_getElementsByClassName(document,"img","thumb");
-   for(i=0;i<lbImg.length;i++){
-      lbImg[i].src=image_url[i];
-      // to not bomb the server with requests, give the page some time
-      // to load the images one by one. if a image exceeds the timeout,
-      // the next image will be loaded.
-      if(lbImg[i].complete != undefined && lbImg[i].complete != true) {
-         counting = 0;
-         while(lbImg[i].complete != true && counting < timeout) {
-            window.setTimeout("noop()", waiting);
-            counting+=waiting;
+   lbImg = WSR_getElementsByClassName(document,"img","thumb");
+   if(lbImg != undefined) {
+      for(i=0;i<lbImg.length;i++){
+         lbImg[i].src=image_url[i];
+         // to not bomb the server with requests, give the page some time
+         // to load the images one by one. if a image exceeds the timeout,
+         // the next image will be loaded.
+         if(lbImg[i].complete != undefined && lbImg[i].complete != true) {
+            counting = 0;
+            while(lbImg[i].complete != true && counting < timeout) {
+               window.setTimeout("noop()", waiting);
+               counting+=waiting;
+            }
          }
       }
    }
@@ -678,8 +692,13 @@ function noop() {}
 /**
  * start slideshow
  */
-function startSlideShow()
+function startSlideShow(srv_webpath)
 {
+   if(srv_webpath != undefined)
+      web_path = srv_webpath;
+   else
+      web_path = '';
+
    if(!sliding) {
       HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=reset_slideshow'));
       nextSlide();
@@ -744,7 +763,7 @@ function startAutoBrowse()
    else {
       clearInterval(autobrowse);
       autobrowse = 0;
-      document.getElementById('autobrowse_ico').src = web_path + "/resources/32_play.png";
+      document.getElementById('autobrowse_ico').src = web_path + "/resources/16_play.png";
    }
 
 } // startAutoBrowser()
@@ -814,6 +833,27 @@ function update_sort_order(obj)
 
 } // update_sort_order()
 
+/**
+ * if the photo-version Ń•elect-box has changed, set the newly
+ * choosen photo version as the to-be-displayed photo version
+ */
+function update_photo_version(obj, current_photo)
+{
+   var objTemp = new Object();
+   objTemp['photo_version'] = obj.options[obj.selectedIndex].value;
+   objTemp['photo_idx'] = current_photo;
+
+   var retr = HTML_AJAX.post(web_path + '/rpc.php?action=update_photo_version', objTemp);
+
+   if(retr == "ok") {
+      showPhoto(current_photo);
+   }
+   else {
+      window.alert("Server message: "+ retr);
+   }
+
+} // update_photo_version()
+
 /**
  * show rate stars
  *