issue59, remove HTML table from main skeleton
[phpfspot.git] / phpfspot.js
index 17cf1095e0b45f2f239918ae902e704013ccca9e..26e50903c63b38cb78532dfe25bc53280ced1ff9 100644 (file)
@@ -113,9 +113,6 @@ function startSearch()
       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();
@@ -163,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') {
@@ -182,7 +181,7 @@ function init_phpfspot()
          refreshSelectedTags();
       }
    }
-}
+} // init_phpfspot()
 
 function setBackGrdColor(item, color)
 {
@@ -209,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;
@@ -225,7 +226,7 @@ function showCalendar(date_box, click_obj)
    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 {
@@ -400,6 +401,23 @@ function initSlider()
 
 }
 
+function update_sort_order(obj)
+{  
+   var objTemp = new Object();
+   objTemp['value'] = obj.options[obj.selectedIndex].value;
+
+   var retr = HTML_AJAX.post('rpc.php?action=update_sort_order', objTemp);
+
+   if(retr == "ok") {
+      showPhotoIndex();
+   }
+   else {
+      window.alert(retr);
+   }
+
+} // update_sort_order()
+
+
 var startup = 1;
 var calendar_shown = 0;
 var calendar_mode = '';