X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=be62cfbe8d4910e931443e2a0419fbc9be8af859;hp=2aee155ec5650e10e43997d687fc17b161743728;hb=f36faab3aed613fc0e1e10a34a88bf1065c80f79;hpb=b690db6fe75d323ff4f30e2be0a447a75e140cb5 diff --git a/phpfspot.js b/phpfspot.js index 2aee155..be62cfb 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -287,6 +287,10 @@ function startSearch() objTemp['from'] = from; objTemp['to'] = to; } + if(document.getElementsByName('consider_rate')[0].checked == true) { + objTemp['rate_from'] = rate_search['from']; + objTemp['rate_to'] = rate_search['to']; + } var retr = HTML_AJAX.post(web_path + '/rpc.php', objTemp); if(retr == "ok") { @@ -348,7 +352,11 @@ function clearSearch() if(document.getElementsByName('consider_date')[0].checked == true) { document.getElementsByName('consider_date')[0].checked = false; datesearch(); - } + } + if(document.getElementsByName('consider_rate')[0].checked == true) { + document.getElementsByName('consider_rate')[0].checked = false; + datesearch(); + } } // clearSearch() @@ -799,6 +807,64 @@ function update_sort_order(obj) } // update_sort_order() +/** + * show rate stars + * + * this function will show the requested amount of + * rate-stars. + * + * @param string mode + * @param int level + */ +function show_rate(mode, level) +{ + var i; + + for(i = 1; i <= 5; i++) { + if(i <= level) { + document.getElementById('rate_' + mode + '_' + i).src = web_path + '/resources/star.png'; + } + else { + document.getElementById('rate_' + mode + '_' + i).src = web_path + '/resources/empty_rate.png'; + } + } + +} // show_rate() + +/** + * set rate stars + * + * + * this function will set the requested rate-stars-amount into a global + * variable (which will then later be used on form-submit) and will also + * update the display. + * + * @param string mode + * @param int level + */ +function set_rate(mode, level) +{ + rate_search[mode] = level; + show_rate(mode, level); + +} // set_rate() + +/** + * reset rate stars + * + * this function will reset the rate-star to their initial value. + * + * @param string mode + */ +function reset_rate(mode) +{ + if(rate_search[mode] == undefined) + rate_search[mode] = 0; + + show_rate(mode, rate_search[mode]); + +} // reset_rate() + /** * handle key events */ @@ -858,3 +924,4 @@ var origWidth; // position of the last shown photo in photo-index var photo_details_pos; var web_path; +var rate_search = new Array();