3 var image_div = document.getElementById("content");
4 image_div.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showphoto&id=' + id));
9 var credits = document.getElementById("content");
10 credits.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showcredits'));
13 function Tags(mode, id)
16 // add the tag to users session
17 HTML_AJAX.grab(encodeURI('rpc.php?action=addtag&id=' + id));
19 else if(mode == "del") {
20 // del the tag from users session
21 HTML_AJAX.grab(encodeURI('rpc.php?action=deltag&id=' + id));
23 else if(mode == "condition") {
24 setCheckedValue(id, id.value);
25 HTML_AJAX.grab(encodeURI('rpc.php?action=tagcondition&mode=' + id.value));
28 refreshAvailableTags();
29 refreshSelectedTags();
34 function refreshAvailableTags()
36 // update available tags
37 var avail_tags = document.getElementById('available_tags');
38 avail_tags.innerHTML = "Loading...";
39 avail_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_available_tags'));
42 function refreshSelectedTags()
44 // update selected tags
45 var selected_tags = document.getElementById("selected_tags");
46 selected_tags.innerHTML = "Loading...";
47 selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags'));
49 // if no tags are currently selected, return false from here
50 if(selected_tags.innerHTML == "")
57 function showPhotoIndex(begin_with)
59 if(begin_with == undefined)
60 HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index'));
62 HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index&begin_with=' + begin_with));
65 // if photo index is currently shown, refresh it
66 function refreshPhotoIndex()
68 if(document.getElementById("matrix") != undefined || startup == 1) {
74 function click(object)
81 // set the radio button with the given value as being checked
82 // do nothing if there are no radio buttons
83 // if the given value does not exist, all the radio buttons
84 // are reset to unchecked
85 function setCheckedValue(condition, value) {
87 var count = condition.length;
88 if(count == undefined) {
89 condition.checked = (condition.value == value.toString());
92 for(var i = 0; i < count; i++) {
93 condition[i].checked = false;
94 if(condition[i].value == value.toString()) {
95 condition[i].checked = true;
100 function startTagSearch(searchfor)
102 HTML_AJAX.grab(encodeURI('rpc.php?action=tag_search&for=' + searchfor));
103 refreshAvailableTags();
104 refreshSelectedTags();
108 function startDateSearch()
110 from_year = document.getElementById('fromyear').value;
111 from_month = document.getElementById('frommonth').value;
112 from_day = document.getElementById('fromday').value;
113 from = from_year +"-"+ from_month +"-"+ from_day;
114 to_year = document.getElementById('toyear').value;
115 to_month = document.getElementById('tomonth').value;
116 to_day = document.getElementById('today').value;
117 to = to_year +"-"+ to_month +"-"+ to_day;
119 HTML_AJAX.grab(encodeURI('rpc.php?action=date_search&from='+ from +'&to='+ to));
122 refreshAvailableTags();
123 refreshSelectedTags();
128 function setViewMode(mode)
130 var exprt = document.getElementById('output');
131 exprt.innerHTML = "Loading...";
132 exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode));
135 function clearSearch()
137 document.getElementsByName('searchfor')[0].value = '';
140 function AskServerWhatToDo()
142 return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
145 function init_phpfspot()
147 refreshAvailableTags();
149 whattodo = AskServerWhatToDo();
151 if(whattodo == 'showpi') {
154 if(whattodo == 'showpi_tags') {
155 if(refreshSelectedTags()) {
159 if(whattodo == 'showpi_date') {
162 if(whattodo == 'show_photo') {
163 if(photo = getPhotoToShow()) {
165 refreshSelectedTags();
170 function setBackGrdColor(item, color)
172 if(color == 'mouseover')
173 item.style.backgroundColor='#c6e9ff';
174 if(color == 'mouseout')
175 item.style.backgroundColor='#eeeeee';
176 if(color == 'mouseclick')
177 item.style.backgroundColor='#93A8CA';
180 function getPhotoToShow()
182 // update selected tags
183 var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show'));
185 // if no image needs to be shown, return false from here
186 if(photo_to_show == "")
189 return photo_to_show;
192 function showCalendar(date_box, click_obj)
194 var calendar = document.getElementById('calendar');
195 if(date_box == 'from') {
196 var xpos = document.getElementById('frompic').offsetLeft;
197 var ypos = document.getElementById('frompic').offsetTop;
198 calendar_mode = 'from';
200 if(date_box == 'to') {
201 var xpos = document.getElementById('topic').offsetLeft;
202 var ypos = document.getElementById('topic').offsetTop;
203 calendar_mode = 'to';
205 calendar.style.left = xpos + 60 + 'px';
206 calendar.style.top = ypos + 80 + 'px';
208 if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
209 calendar.style.visibility = 'visible';
210 calendar.innerHTML = "Loading...";
211 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix'));
215 calendar.style.visibility = 'hidden';
220 function setMonth(year, month, day)
222 var calendar = document.getElementById('calendar');
223 calendar.innerHTML = "Loading...";
224 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
227 function setCalendarDate(year, month, day)
229 document.getElementById(calendar_mode+'year').value = year;
230 document.getElementById(calendar_mode+'month').value = month;
231 document.getElementById(calendar_mode+'day').value = day;
236 HTML_AJAX.grab(encodeURI('rpc.php?action=reset'));
238 refreshAvailableTags();
239 refreshSelectedTags();
244 var calendar_shown = 0;
245 var calendar_mode = '';