sort-order is now set via AJAX, not while submit a search-query
[phpfspot.git] / phpfspot.js
index 17cf1095e0b45f2f239918ae902e704013ccca9e..b196a68f846dbe3222b3309ac46f4066735daedb 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();
@@ -209,6 +206,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 +224,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 +399,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 = '';