]>
Commit | Line | Data |
---|---|---|
007bda35 AD |
1 | var xmlhttp = false; |
2 | ||
961513a3 | 3 | var active_feed = false; |
91ff844a | 4 | var active_feed_cat = false; |
a0d53889 | 5 | var active_filter = false; |
48f0adb0 | 6 | var active_label = false; |
e6cb77a0 | 7 | var active_user = false; |
961513a3 | 8 | |
f5a50b25 AD |
9 | var active_tab = false; |
10 | ||
007bda35 AD |
11 | /*@cc_on @*/ |
12 | /*@if (@_jscript_version >= 5) | |
13 | // JScript gives us Conditional compilation, we can cope with old IE versions. | |
14 | // and security blocked creation of the objects. | |
15 | try { | |
16 | xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); | |
17 | } catch (e) { | |
18 | try { | |
19 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
20 | } catch (E) { | |
21 | xmlhttp = false; | |
22 | } | |
23 | } | |
24 | @end @*/ | |
25 | ||
26 | if (!xmlhttp && typeof XMLHttpRequest!='undefined') { | |
27 | xmlhttp = new XMLHttpRequest(); | |
28 | } | |
29 | ||
007bda35 | 30 | function feedlist_callback() { |
007bda35 | 31 | if (xmlhttp.readyState == 4) { |
47c6c988 AD |
32 | try { |
33 | var container = document.getElementById('prefContent'); | |
34 | container.innerHTML=xmlhttp.responseText; | |
35 | if (active_feed) { | |
36 | var row = document.getElementById("FEEDR-" + active_feed); | |
37 | if (row) { | |
38 | if (!row.className.match("Selected")) { | |
39 | row.className = row.className + "Selected"; | |
40 | } | |
41 | } | |
42 | var checkbox = document.getElementById("FRCHK-" + active_feed); | |
43 | if (checkbox) { | |
44 | checkbox.checked = true; | |
45 | } | |
961513a3 | 46 | } |
47c6c988 AD |
47 | p_notify(""); |
48 | } catch (e) { | |
49 | exception_error("feedlist_callback", e); | |
961513a3 | 50 | } |
007bda35 AD |
51 | } |
52 | } | |
53 | ||
a0d53889 | 54 | function filterlist_callback() { |
f5a50b25 | 55 | var container = document.getElementById('prefContent'); |
a0d53889 | 56 | if (xmlhttp.readyState == 4) { |
f5a50b25 | 57 | |
a0d53889 AD |
58 | container.innerHTML=xmlhttp.responseText; |
59 | ||
60 | if (active_filter) { | |
61 | var row = document.getElementById("FILRR-" + active_filter); | |
62 | if (row) { | |
63 | if (!row.className.match("Selected")) { | |
64 | row.className = row.className + "Selected"; | |
65 | } | |
66 | } | |
67 | var checkbox = document.getElementById("FICHK-" + active_filter); | |
68 | ||
69 | if (checkbox) { | |
70 | checkbox.checked = true; | |
71 | } | |
72 | } | |
f5a50b25 | 73 | p_notify(""); |
a0d53889 AD |
74 | } |
75 | } | |
76 | ||
48f0adb0 | 77 | function labellist_callback() { |
f5a50b25 | 78 | var container = document.getElementById('prefContent'); |
48f0adb0 AD |
79 | if (xmlhttp.readyState == 4) { |
80 | container.innerHTML=xmlhttp.responseText; | |
81 | ||
967955b7 | 82 | if (active_label) { |
48f0adb0 AD |
83 | var row = document.getElementById("LILRR-" + active_label); |
84 | if (row) { | |
85 | if (!row.className.match("Selected")) { | |
86 | row.className = row.className + "Selected"; | |
87 | } | |
88 | } | |
89 | var checkbox = document.getElementById("LICHK-" + active_label); | |
90 | ||
91 | if (checkbox) { | |
92 | checkbox.checked = true; | |
93 | } | |
94 | } | |
f5a50b25 | 95 | p_notify(""); |
48f0adb0 AD |
96 | } |
97 | } | |
4255b24c | 98 | |
e6cb77a0 AD |
99 | function userlist_callback() { |
100 | var container = document.getElementById('prefContent'); | |
101 | if (xmlhttp.readyState == 4) { | |
102 | container.innerHTML=xmlhttp.responseText; | |
103 | ||
1a7572cb AD |
104 | if (active_user) { |
105 | var row = document.getElementById("UMRR-" + active_user); | |
e6cb77a0 AD |
106 | if (row) { |
107 | if (!row.className.match("Selected")) { | |
108 | row.className = row.className + "Selected"; | |
109 | } | |
110 | } | |
1a7572cb | 111 | var checkbox = document.getElementById("UMCHK-" + active_user); |
e6cb77a0 AD |
112 | |
113 | if (checkbox) { | |
114 | checkbox.checked = true; | |
115 | } | |
1a7572cb AD |
116 | } |
117 | ||
e6cb77a0 AD |
118 | p_notify(""); |
119 | } | |
120 | } | |
121 | ||
c6c3a07f | 122 | function infobox_callback() { |
1a7572cb | 123 | if (xmlhttp.readyState == 4) { |
2317ffaa AD |
124 | var box = document.getElementById('infoBox'); |
125 | var shadow = document.getElementById('infoBoxShadow'); | |
126 | ||
127 | if (box) { | |
128 | box.innerHTML=xmlhttp.responseText; | |
129 | if (shadow) { | |
130 | shadow.style.display = "block"; | |
131 | } else { | |
5e9188f2 | 132 | box.style.display = "block"; |
2317ffaa | 133 | } |
c6c3a07f | 134 | } |
1a7572cb AD |
135 | } |
136 | } | |
137 | ||
138 | ||
4255b24c AD |
139 | function prefslist_callback() { |
140 | var container = document.getElementById('prefContent'); | |
141 | if (xmlhttp.readyState == 4) { | |
142 | ||
143 | container.innerHTML=xmlhttp.responseText; | |
144 | ||
145 | p_notify(""); | |
146 | } | |
147 | } | |
148 | ||
b1895692 AD |
149 | function gethelp_callback() { |
150 | var container = document.getElementById('prefHelpBox'); | |
151 | if (xmlhttp.readyState == 4) { | |
152 | ||
153 | container.innerHTML = xmlhttp.responseText; | |
154 | container.style.display = "block"; | |
155 | ||
156 | } | |
157 | } | |
4255b24c AD |
158 | |
159 | ||
0e091d38 AD |
160 | function notify_callback() { |
161 | var container = document.getElementById('notify'); | |
162 | if (xmlhttp.readyState == 4) { | |
163 | container.innerHTML=xmlhttp.responseText; | |
164 | } | |
165 | } | |
166 | ||
b83c7545 | 167 | function updateFeedList(sort_key) { |
007bda35 | 168 | |
c0e5a40e | 169 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
170 | printLockingError(); |
171 | return | |
172 | } | |
173 | ||
f5a50b25 AD |
174 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; |
175 | ||
176 | p_notify("Loading, please wait..."); | |
007bda35 | 177 | |
f932bc9f AD |
178 | var feed_search = document.getElementById("feed_search"); |
179 | var search = ""; | |
180 | if (feed_search) { search = feed_search.value; } | |
181 | ||
b83c7545 | 182 | xmlhttp.open("GET", "backend.php?op=pref-feeds" + |
f932bc9f AD |
183 | "&sort=" + param_escape(sort_key) + |
184 | "&search=" + param_escape(search), true); | |
007bda35 AD |
185 | xmlhttp.onreadystatechange=feedlist_callback; |
186 | xmlhttp.send(null); | |
187 | ||
188 | } | |
189 | ||
e6cb77a0 AD |
190 | function updateUsersList() { |
191 | ||
192 | if (!xmlhttp_ready(xmlhttp)) { | |
193 | printLockingError(); | |
194 | return | |
195 | } | |
196 | ||
197 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; | |
198 | ||
199 | p_notify("Loading, please wait..."); | |
200 | ||
201 | xmlhttp.open("GET", "backend.php?op=pref-users", true); | |
202 | xmlhttp.onreadystatechange=userlist_callback; | |
203 | xmlhttp.send(null); | |
204 | ||
205 | } | |
206 | ||
48f0adb0 AD |
207 | function addLabel() { |
208 | ||
209 | if (!xmlhttp_ready(xmlhttp)) { | |
210 | printLockingError(); | |
211 | return | |
212 | } | |
213 | ||
214 | var sqlexp = document.getElementById("ladd_expr"); | |
215 | ||
216 | if (sqlexp.value.length == 0) { | |
217 | notify("Missing SQL expression."); | |
218 | } else { | |
219 | notify("Adding label..."); | |
220 | ||
221 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" + | |
222 | param_escape(sqlexp.value), true); | |
223 | ||
224 | xmlhttp.onreadystatechange=labellist_callback; | |
225 | xmlhttp.send(null); | |
226 | ||
227 | sqlexp.value = ""; | |
228 | } | |
229 | ||
230 | } | |
231 | ||
de435974 AD |
232 | function addFilter() { |
233 | ||
234 | if (!xmlhttp_ready(xmlhttp)) { | |
235 | printLockingError(); | |
236 | return | |
237 | } | |
238 | ||
239 | var regexp = document.getElementById("fadd_regexp"); | |
240 | var match = document.getElementById("fadd_match"); | |
ead60402 | 241 | var feed = document.getElementById("fadd_feed"); |
19c9cb11 | 242 | var action = document.getElementById("fadd_action"); |
de435974 AD |
243 | |
244 | if (regexp.value.length == 0) { | |
245 | notify("Missing filter expression."); | |
246 | } else { | |
247 | notify("Adding filter..."); | |
248 | ||
25cb5736 | 249 | var v_match = match[match.selectedIndex].text; |
ead60402 | 250 | var feed_id = feed[feed.selectedIndex].id; |
19c9cb11 | 251 | var action_id = action[action.selectedIndex].id; |
ead60402 | 252 | |
de435974 | 253 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add®exp=" + |
ead60402 | 254 | param_escape(regexp.value) + "&match=" + v_match + |
19c9cb11 | 255 | "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true); |
de435974 AD |
256 | |
257 | xmlhttp.onreadystatechange=filterlist_callback; | |
258 | xmlhttp.send(null); | |
259 | ||
260 | regexp.value = ""; | |
261 | } | |
262 | ||
263 | } | |
48f0adb0 | 264 | |
71ad3959 AD |
265 | function addFeed() { |
266 | ||
c0e5a40e | 267 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
268 | printLockingError(); |
269 | return | |
270 | } | |
271 | ||
331900c6 AD |
272 | var link = document.getElementById("fadd_link"); |
273 | ||
83fe4d6d | 274 | if (link.value.length == 0) { |
c753cd32 | 275 | notify("Missing feed URL."); |
331900c6 AD |
276 | } else { |
277 | notify("Adding feed..."); | |
278 | ||
279 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" + | |
280 | param_escape(link.value), true); | |
281 | xmlhttp.onreadystatechange=feedlist_callback; | |
282 | xmlhttp.send(null); | |
283 | ||
284 | link.value = ""; | |
285 | ||
286 | } | |
287 | ||
288 | } | |
289 | ||
91ff844a AD |
290 | function addFeedCat() { |
291 | ||
292 | if (!xmlhttp_ready(xmlhttp)) { | |
293 | printLockingError(); | |
294 | return | |
295 | } | |
296 | ||
297 | var cat = document.getElementById("fadd_cat"); | |
298 | ||
299 | if (cat.value.length == 0) { | |
300 | notify("Missing feed category."); | |
301 | } else { | |
302 | notify("Adding feed category..."); | |
303 | ||
304 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" + | |
305 | param_escape(cat.value), true); | |
306 | xmlhttp.onreadystatechange=feedlist_callback; | |
307 | xmlhttp.send(null); | |
308 | ||
309 | link.value = ""; | |
310 | ||
311 | } | |
312 | ||
313 | } | |
e6cb77a0 AD |
314 | function addUser() { |
315 | ||
316 | if (!xmlhttp_ready(xmlhttp)) { | |
317 | printLockingError(); | |
318 | return | |
319 | } | |
320 | ||
321 | var sqlexp = document.getElementById("uadd_box"); | |
322 | ||
323 | if (sqlexp.value.length == 0) { | |
324 | notify("Missing user login."); | |
325 | } else { | |
326 | notify("Adding user..."); | |
327 | ||
328 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" + | |
329 | param_escape(sqlexp.value), true); | |
330 | ||
331 | xmlhttp.onreadystatechange=userlist_callback; | |
332 | xmlhttp.send(null); | |
333 | ||
334 | sqlexp.value = ""; | |
335 | } | |
336 | ||
337 | } | |
338 | ||
48f0adb0 AD |
339 | function editLabel(id) { |
340 | ||
341 | if (!xmlhttp_ready(xmlhttp)) { | |
342 | printLockingError(); | |
343 | return | |
344 | } | |
345 | ||
346 | active_label = id; | |
347 | ||
348 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" + | |
349 | param_escape(id), true); | |
350 | xmlhttp.onreadystatechange=labellist_callback; | |
351 | xmlhttp.send(null); | |
352 | ||
353 | } | |
354 | ||
e6cb77a0 AD |
355 | function editUser(id) { |
356 | ||
357 | if (!xmlhttp_ready(xmlhttp)) { | |
358 | printLockingError(); | |
359 | return | |
360 | } | |
361 | ||
362 | active_user = id; | |
363 | ||
364 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" + | |
365 | param_escape(id), true); | |
366 | xmlhttp.onreadystatechange=userlist_callback; | |
367 | xmlhttp.send(null); | |
368 | ||
369 | } | |
370 | ||
a0d53889 AD |
371 | function editFilter(id) { |
372 | ||
373 | if (!xmlhttp_ready(xmlhttp)) { | |
374 | printLockingError(); | |
375 | return | |
376 | } | |
377 | ||
378 | active_filter = id; | |
379 | ||
380 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + | |
381 | param_escape(id), true); | |
382 | xmlhttp.onreadystatechange=filterlist_callback; | |
383 | xmlhttp.send(null); | |
384 | ||
385 | } | |
386 | ||
331900c6 AD |
387 | function editFeed(feed) { |
388 | ||
508a81e1 AD |
389 | // notify("Editing feed..."); |
390 | ||
c0e5a40e | 391 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
392 | printLockingError(); |
393 | return | |
394 | } | |
331900c6 | 395 | |
961513a3 AD |
396 | active_feed = feed; |
397 | ||
0ea4fb50 | 398 | /* xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" + |
331900c6 AD |
399 | param_escape(feed), true); |
400 | xmlhttp.onreadystatechange=feedlist_callback; | |
0ea4fb50 AD |
401 | xmlhttp.send(null); */ |
402 | ||
403 | selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false); | |
6c12c809 AD |
404 | // selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed, |
405 | // true, false); | |
406 | ||
407 | selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true); | |
0ea4fb50 AD |
408 | |
409 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" + | |
410 | param_escape(active_feed), true); | |
411 | ||
412 | xmlhttp.onreadystatechange=infobox_callback; | |
331900c6 AD |
413 | xmlhttp.send(null); |
414 | ||
415 | } | |
416 | ||
91ff844a | 417 | function editFeedCat(cat) { |
48f0adb0 | 418 | |
91ff844a AD |
419 | if (!xmlhttp_ready(xmlhttp)) { |
420 | printLockingError(); | |
421 | return | |
48f0adb0 AD |
422 | } |
423 | ||
91ff844a | 424 | active_feed_cat = cat; |
e6cb77a0 | 425 | |
91ff844a AD |
426 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" + |
427 | param_escape(cat), true); | |
428 | xmlhttp.onreadystatechange=feedlist_callback; | |
429 | xmlhttp.send(null); | |
e6cb77a0 | 430 | |
e6cb77a0 AD |
431 | } |
432 | ||
91ff844a AD |
433 | function getSelectedLabels() { |
434 | return getSelectedTableRowIds("prefLabelList", "LILRR"); | |
435 | } | |
48f0adb0 | 436 | |
91ff844a AD |
437 | function getSelectedUsers() { |
438 | return getSelectedTableRowIds("prefUserList", "UMRR"); | |
a0d53889 AD |
439 | } |
440 | ||
83fe4d6d | 441 | function getSelectedFeeds() { |
91ff844a AD |
442 | return getSelectedTableRowIds("prefFeedList", "FEEDR"); |
443 | } | |
331900c6 | 444 | |
91ff844a AD |
445 | function getSelectedFilters() { |
446 | return getSelectedTableRowIds("prefFilterList", "FILRR"); | |
447 | } | |
331900c6 | 448 | |
91ff844a AD |
449 | function getSelectedFeedCats() { |
450 | return getSelectedTableRowIds("prefFeedCatList", "FCATR"); | |
83fe4d6d AD |
451 | } |
452 | ||
91ff844a | 453 | |
4f3a84f4 | 454 | function readSelectedFeeds(read) { |
83fe4d6d | 455 | |
c0e5a40e | 456 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
457 | printLockingError(); |
458 | return | |
459 | } | |
460 | ||
83fe4d6d AD |
461 | var sel_rows = getSelectedFeeds(); |
462 | ||
463 | if (sel_rows.length > 0) { | |
464 | ||
4f3a84f4 AD |
465 | if (!read) { |
466 | op = "unread"; | |
467 | } else { | |
468 | op = "read"; | |
469 | } | |
83fe4d6d | 470 | |
4f3a84f4 | 471 | notify("Marking selected feeds as " + op + "..."); |
83fe4d6d | 472 | |
4f3a84f4 | 473 | xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+ |
83fe4d6d | 474 | param_escape(sel_rows.toString()), true); |
0e091d38 | 475 | xmlhttp.onreadystatechange=notify_callback; |
83fe4d6d AD |
476 | xmlhttp.send(null); |
477 | ||
478 | } else { | |
479 | ||
c753cd32 | 480 | notify("Please select some feeds first."); |
83fe4d6d AD |
481 | |
482 | } | |
483 | } | |
484 | ||
48f0adb0 AD |
485 | function removeSelectedLabels() { |
486 | ||
487 | if (!xmlhttp_ready(xmlhttp)) { | |
488 | printLockingError(); | |
489 | return | |
490 | } | |
491 | ||
492 | var sel_rows = getSelectedLabels(); | |
493 | ||
494 | if (sel_rows.length > 0) { | |
495 | ||
69668465 | 496 | var ok = confirm("Remove selected labels?"); |
48f0adb0 | 497 | |
69668465 AD |
498 | if (ok) { |
499 | notify("Removing selected labels..."); | |
500 | ||
501 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ | |
502 | param_escape(sel_rows.toString()), true); | |
503 | xmlhttp.onreadystatechange=labellist_callback; | |
504 | xmlhttp.send(null); | |
505 | } | |
48f0adb0 AD |
506 | } else { |
507 | notify("Please select some labels first."); | |
508 | } | |
509 | } | |
510 | ||
e6cb77a0 AD |
511 | function removeSelectedUsers() { |
512 | ||
513 | if (!xmlhttp_ready(xmlhttp)) { | |
514 | printLockingError(); | |
515 | return | |
516 | } | |
517 | ||
518 | var sel_rows = getSelectedUsers(); | |
519 | ||
520 | if (sel_rows.length > 0) { | |
521 | ||
69668465 | 522 | var ok = confirm("Remove selected users?"); |
e6cb77a0 | 523 | |
69668465 AD |
524 | if (ok) { |
525 | notify("Removing selected users..."); | |
526 | ||
527 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+ | |
528 | param_escape(sel_rows.toString()), true); | |
529 | xmlhttp.onreadystatechange=userlist_callback; | |
530 | xmlhttp.send(null); | |
531 | } | |
e6cb77a0 AD |
532 | |
533 | } else { | |
534 | notify("Please select some labels first."); | |
535 | } | |
536 | } | |
537 | ||
48f0adb0 AD |
538 | function removeSelectedFilters() { |
539 | ||
540 | if (!xmlhttp_ready(xmlhttp)) { | |
541 | printLockingError(); | |
542 | return | |
543 | } | |
544 | ||
545 | var sel_rows = getSelectedFilters(); | |
546 | ||
547 | if (sel_rows.length > 0) { | |
548 | ||
69668465 | 549 | var ok = confirm("Remove selected filters?"); |
48f0adb0 | 550 | |
69668465 AD |
551 | if (ok) { |
552 | notify("Removing selected filters..."); | |
553 | ||
554 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ | |
555 | param_escape(sel_rows.toString()), true); | |
556 | xmlhttp.onreadystatechange=filterlist_callback; | |
557 | xmlhttp.send(null); | |
558 | } | |
48f0adb0 AD |
559 | } else { |
560 | notify("Please select some filters first."); | |
561 | } | |
562 | } | |
563 | ||
564 | ||
83fe4d6d AD |
565 | function removeSelectedFeeds() { |
566 | ||
c0e5a40e | 567 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
568 | printLockingError(); |
569 | return | |
570 | } | |
571 | ||
83fe4d6d AD |
572 | var sel_rows = getSelectedFeeds(); |
573 | ||
331900c6 AD |
574 | if (sel_rows.length > 0) { |
575 | ||
69668465 | 576 | var ok = confirm("Remove selected feeds?"); |
331900c6 | 577 | |
69668465 AD |
578 | if (ok) { |
579 | ||
580 | notify("Removing selected feeds..."); | |
581 | ||
582 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ | |
583 | param_escape(sel_rows.toString()), true); | |
584 | xmlhttp.onreadystatechange=feedlist_callback; | |
585 | xmlhttp.send(null); | |
586 | } | |
71ad3959 | 587 | |
71ad3959 | 588 | } else { |
331900c6 | 589 | |
c753cd32 | 590 | notify("Please select some feeds first."); |
331900c6 | 591 | |
71ad3959 AD |
592 | } |
593 | ||
594 | } | |
007bda35 | 595 | |
91ff844a AD |
596 | function removeSelectedFeedCats() { |
597 | ||
598 | if (!xmlhttp_ready(xmlhttp)) { | |
599 | printLockingError(); | |
600 | return | |
601 | } | |
602 | ||
603 | var sel_rows = getSelectedFeedCats(); | |
604 | ||
605 | if (sel_rows.length > 0) { | |
606 | ||
69668465 | 607 | var ok = confirm("Remove selected categories?"); |
91ff844a | 608 | |
69668465 AD |
609 | if (ok) { |
610 | notify("Removing selected categories..."); | |
611 | ||
612 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+ | |
613 | param_escape(sel_rows.toString()), true); | |
614 | xmlhttp.onreadystatechange=feedlist_callback; | |
615 | xmlhttp.send(null); | |
616 | } | |
91ff844a AD |
617 | |
618 | } else { | |
619 | ||
620 | notify("Please select some feeds first."); | |
621 | ||
622 | } | |
623 | ||
624 | } | |
625 | ||
508a81e1 AD |
626 | function feedEditCancel() { |
627 | ||
c0e5a40e | 628 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
629 | printLockingError(); |
630 | return | |
631 | } | |
632 | ||
327a3bbe AD |
633 | closeInfoBox(); |
634 | ||
961513a3 AD |
635 | active_feed = false; |
636 | ||
508a81e1 AD |
637 | notify("Operation cancelled."); |
638 | ||
327a3bbe | 639 | /* xmlhttp.open("GET", "backend.php?op=pref-feeds", true); |
508a81e1 | 640 | xmlhttp.onreadystatechange=feedlist_callback; |
327a3bbe | 641 | xmlhttp.send(null); */ |
508a81e1 AD |
642 | |
643 | } | |
644 | ||
91ff844a AD |
645 | function feedCatEditCancel() { |
646 | ||
647 | if (!xmlhttp_ready(xmlhttp)) { | |
648 | printLockingError(); | |
649 | return | |
650 | } | |
651 | ||
652 | active_feed_cat = false; | |
653 | ||
654 | notify("Operation cancelled."); | |
655 | ||
656 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
657 | xmlhttp.onreadystatechange=feedlist_callback; | |
658 | xmlhttp.send(null); | |
659 | ||
660 | } | |
661 | ||
603c27f8 AD |
662 | function feedEditSave() { |
663 | ||
47c6c988 | 664 | try { |
d148926e | 665 | |
47c6c988 AD |
666 | var feed = active_feed; |
667 | ||
668 | if (!xmlhttp_ready(xmlhttp)) { | |
669 | printLockingError(); | |
670 | return | |
671 | } | |
672 | ||
673 | var link = document.getElementById("iedit_link").value; | |
674 | var title = document.getElementById("iedit_title").value; | |
675 | var upd_intl = document.getElementById("iedit_updintl").value; | |
676 | var purge_intl = document.getElementById("iedit_purgintl").value; | |
677 | var fcat = document.getElementById("iedit_fcat"); | |
e3c99f3b AD |
678 | |
679 | var private = document.getElementById("iedit_private").checked; | |
47c6c988 | 680 | |
48fa05ad AD |
681 | var fcat_id = 0; |
682 | ||
683 | if (fcat) { | |
684 | fcat_id = fcat[fcat.selectedIndex].id; | |
685 | } | |
1da7e457 AD |
686 | |
687 | var pfeed = document.getElementById("iedit_parent_feed"); | |
688 | var parent_feed_id = pfeed[pfeed.selectedIndex].id; | |
47c6c988 AD |
689 | |
690 | if (link.length == 0) { | |
691 | notify("Feed link cannot be blank."); | |
692 | return; | |
693 | } | |
694 | ||
695 | if (title.length == 0) { | |
696 | notify("Feed title cannot be blank."); | |
697 | return; | |
698 | } | |
699 | ||
700 | var auth_login = document.getElementById("iedit_login").value; | |
701 | var auth_pass = document.getElementById("iedit_pass").value; | |
702 | ||
703 | active_feed = false; | |
704 | ||
705 | notify("Saving feed..."); | |
d148926e | 706 | |
47c6c988 AD |
707 | var query = "op=pref-feeds&subop=editSave&id=" + |
708 | feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) + | |
709 | "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) + | |
e3c99f3b AD |
710 | "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) + |
711 | "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) + | |
712 | "&private=" + param_escape(private); | |
508a81e1 | 713 | |
47c6c988 AD |
714 | xmlhttp.open("POST", "backend.php", true); |
715 | xmlhttp.onreadystatechange=feedlist_callback; | |
716 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
717 | xmlhttp.send(query); | |
718 | ||
719 | } catch (e) { | |
720 | exception_error("feedEditSave", e); | |
508a81e1 | 721 | } |
508a81e1 AD |
722 | } |
723 | ||
5ddadb4c AD |
724 | function feedCatEditSave() { |
725 | ||
726 | if (!xmlhttp_ready(xmlhttp)) { | |
727 | printLockingError(); | |
728 | return | |
729 | } | |
730 | ||
f0e81ffe | 731 | notify("Saving category..."); |
5ddadb4c AD |
732 | |
733 | var cat_title = document.getElementById("iedit_title").value; | |
734 | ||
735 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" + | |
736 | param_escape(active_feed_cat) + "&title=" + param_escape(cat_title), | |
737 | true); | |
738 | xmlhttp.onreadystatechange=feedlist_callback; | |
739 | xmlhttp.send(null); | |
740 | ||
741 | active_feed_cat = false; | |
742 | ||
743 | } | |
744 | ||
745 | ||
d9dde1d6 AD |
746 | function labelTest() { |
747 | ||
748 | var sqlexp = document.getElementById("iedit_expr").value; | |
749 | var descr = document.getElementById("iedit_descr").value; | |
750 | ||
751 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" + | |
752 | param_escape(sqlexp) + "&descr=" + param_escape(descr), true); | |
753 | ||
754 | xmlhttp.onreadystatechange=infobox_callback; | |
755 | xmlhttp.send(null); | |
756 | ||
757 | } | |
758 | ||
01c9c74a AD |
759 | function displayHelpInfobox(topic_id) { |
760 | ||
761 | xmlhttp.open("GET", "backend.php?op=help&tid=" + | |
762 | param_escape(topic_id) + "&noheaders=1", true); | |
763 | ||
764 | xmlhttp.onreadystatechange=infobox_callback; | |
765 | xmlhttp.send(null); | |
766 | ||
767 | } | |
768 | ||
48f0adb0 AD |
769 | function labelEditCancel() { |
770 | ||
771 | if (!xmlhttp_ready(xmlhttp)) { | |
772 | printLockingError(); | |
773 | return | |
774 | } | |
775 | ||
776 | active_label = false; | |
777 | ||
778 | notify("Operation cancelled."); | |
779 | ||
780 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
781 | xmlhttp.onreadystatechange=labellist_callback; | |
782 | xmlhttp.send(null); | |
783 | ||
784 | } | |
785 | ||
e6cb77a0 AD |
786 | function userEditCancel() { |
787 | ||
788 | if (!xmlhttp_ready(xmlhttp)) { | |
789 | printLockingError(); | |
790 | return | |
791 | } | |
792 | ||
793 | active_user = false; | |
794 | ||
795 | notify("Operation cancelled."); | |
796 | ||
797 | xmlhttp.open("GET", "backend.php?op=pref-users", true); | |
798 | xmlhttp.onreadystatechange=userlist_callback; | |
799 | xmlhttp.send(null); | |
800 | ||
801 | } | |
48f0adb0 | 802 | |
a0d53889 AD |
803 | function filterEditCancel() { |
804 | ||
805 | if (!xmlhttp_ready(xmlhttp)) { | |
806 | printLockingError(); | |
807 | return | |
808 | } | |
809 | ||
810 | active_filter = false; | |
811 | ||
812 | notify("Operation cancelled."); | |
813 | ||
814 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
815 | xmlhttp.onreadystatechange=filterlist_callback; | |
816 | xmlhttp.send(null); | |
817 | ||
818 | } | |
819 | ||
48f0adb0 AD |
820 | function labelEditSave() { |
821 | ||
822 | var label = active_label; | |
823 | ||
824 | if (!xmlhttp_ready(xmlhttp)) { | |
825 | printLockingError(); | |
826 | return | |
827 | } | |
828 | ||
829 | var sqlexp = document.getElementById("iedit_expr").value; | |
830 | var descr = document.getElementById("iedit_descr").value; | |
831 | ||
832 | // notify("Saving label " + sqlexp + ": " + descr); | |
833 | ||
834 | if (sqlexp.length == 0) { | |
835 | notify("SQL expression cannot be blank."); | |
836 | return; | |
837 | } | |
838 | ||
839 | if (descr.length == 0) { | |
840 | notify("Caption cannot be blank."); | |
841 | return; | |
842 | } | |
843 | ||
f0e81ffe | 844 | notify("Saving label..."); |
dbd9e2f1 | 845 | |
48f0adb0 AD |
846 | active_label = false; |
847 | ||
848 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" + | |
849 | label + "&s=" + param_escape(sqlexp) + "&d=" + param_escape(descr), | |
850 | true); | |
851 | ||
852 | xmlhttp.onreadystatechange=labellist_callback; | |
853 | xmlhttp.send(null); | |
854 | ||
855 | } | |
856 | ||
e6cb77a0 AD |
857 | function userEditSave() { |
858 | ||
859 | var user = active_user; | |
860 | ||
861 | if (!xmlhttp_ready(xmlhttp)) { | |
862 | printLockingError(); | |
863 | return | |
864 | } | |
865 | ||
866 | var login = document.getElementById("iedit_ulogin").value; | |
867 | var level = document.getElementById("iedit_ulevel").value; | |
72932a75 | 868 | var email = document.getElementById("iedit_email").value; |
e6cb77a0 AD |
869 | |
870 | if (login.length == 0) { | |
871 | notify("Login cannot be blank."); | |
872 | return; | |
873 | } | |
874 | ||
875 | if (level.length == 0) { | |
876 | notify("User level cannot be blank."); | |
877 | return; | |
878 | } | |
879 | ||
880 | active_user = false; | |
881 | ||
f0e81ffe | 882 | notify("Saving user..."); |
dbd9e2f1 | 883 | |
e6cb77a0 | 884 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=editSave&id=" + |
72932a75 AD |
885 | user + "&l=" + param_escape(login) + "&al=" + param_escape(level) + |
886 | "&e=" + param_escape(email), true); | |
e6cb77a0 | 887 | |
dbd9e2f1 | 888 | xmlhttp.onreadystatechange=userlist_callback; |
e6cb77a0 AD |
889 | xmlhttp.send(null); |
890 | ||
891 | } | |
892 | ||
893 | ||
a0d53889 AD |
894 | function filterEditSave() { |
895 | ||
896 | var filter = active_filter; | |
897 | ||
898 | if (!xmlhttp_ready(xmlhttp)) { | |
899 | printLockingError(); | |
900 | return | |
901 | } | |
902 | ||
903 | var regexp = document.getElementById("iedit_regexp").value; | |
904 | var descr = document.getElementById("iedit_descr").value; | |
25cb5736 | 905 | var match = document.getElementById("iedit_match"); |
19c9cb11 | 906 | |
25cb5736 | 907 | var v_match = match[match.selectedIndex].text; |
a0d53889 | 908 | |
ead60402 AD |
909 | var feed = document.getElementById("iedit_feed"); |
910 | var feed_id = feed[feed.selectedIndex].id; | |
911 | ||
19c9cb11 AD |
912 | var action = document.getElementById("iedit_filter_action"); |
913 | var action_id = action[action.selectedIndex].id; | |
914 | ||
a0d53889 AD |
915 | // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match); |
916 | ||
917 | if (regexp.length == 0) { | |
918 | notify("Filter expression cannot be blank."); | |
919 | return; | |
920 | } | |
921 | ||
922 | active_filter = false; | |
923 | ||
924 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" + | |
925 | filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) + | |
19c9cb11 AD |
926 | "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id) + |
927 | "&aid=" + param_escape(action_id), true); | |
dbd9e2f1 | 928 | |
f0e81ffe | 929 | notify("Saving filter..."); |
dbd9e2f1 | 930 | |
a0d53889 AD |
931 | xmlhttp.onreadystatechange=filterlist_callback; |
932 | xmlhttp.send(null); | |
933 | ||
934 | } | |
935 | ||
48f0adb0 AD |
936 | function editSelectedLabel() { |
937 | var rows = getSelectedLabels(); | |
a0d53889 | 938 | |
48f0adb0 AD |
939 | if (rows.length == 0) { |
940 | notify("No labels are selected."); | |
941 | return; | |
a0d53889 AD |
942 | } |
943 | ||
48f0adb0 AD |
944 | if (rows.length > 1) { |
945 | notify("Please select one label."); | |
946 | return; | |
947 | } | |
a0d53889 | 948 | |
dbd9e2f1 AD |
949 | notify(""); |
950 | ||
48f0adb0 | 951 | editLabel(rows[0]); |
a0d53889 | 952 | |
a0d53889 AD |
953 | } |
954 | ||
e6cb77a0 AD |
955 | function editSelectedUser() { |
956 | var rows = getSelectedUsers(); | |
957 | ||
958 | if (rows.length == 0) { | |
959 | notify("No users are selected."); | |
960 | return; | |
961 | } | |
962 | ||
963 | if (rows.length > 1) { | |
964 | notify("Please select one user."); | |
965 | return; | |
966 | } | |
967 | ||
dbd9e2f1 AD |
968 | notify(""); |
969 | ||
e6cb77a0 AD |
970 | editUser(rows[0]); |
971 | } | |
972 | ||
973 | function resetSelectedUserPass() { | |
974 | var rows = getSelectedUsers(); | |
975 | ||
976 | if (rows.length == 0) { | |
977 | notify("No users are selected."); | |
978 | return; | |
979 | } | |
980 | ||
981 | if (rows.length > 1) { | |
982 | notify("Please select one user."); | |
983 | return; | |
984 | } | |
985 | ||
69668465 | 986 | var ok = confirm("Reset password of selected user?"); |
e6cb77a0 | 987 | |
69668465 AD |
988 | if (ok) { |
989 | notify("Resetting password for selected user..."); | |
990 | ||
991 | var id = rows[0]; | |
992 | ||
993 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" + | |
994 | param_escape(id), true); | |
995 | xmlhttp.onreadystatechange=userlist_callback; | |
996 | xmlhttp.send(null); | |
997 | } | |
e6cb77a0 AD |
998 | } |
999 | ||
717f5e64 | 1000 | function selectedUserDetails() { |
e6cb77a0 | 1001 | |
1a7572cb AD |
1002 | if (!xmlhttp_ready(xmlhttp)) { |
1003 | printLockingError(); | |
1004 | return | |
1005 | } | |
1006 | ||
717f5e64 AD |
1007 | var rows = getSelectedUsers(); |
1008 | ||
1009 | if (rows.length == 0) { | |
1010 | notify("No users are selected."); | |
1011 | return; | |
1012 | } | |
1013 | ||
1014 | if (rows.length > 1) { | |
1015 | notify("Please select one user."); | |
1016 | return; | |
1017 | } | |
1018 | ||
1019 | var id = rows[0]; | |
1020 | ||
dbd9e2f1 AD |
1021 | notify(""); |
1022 | ||
1a7572cb | 1023 | xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true); |
c6c3a07f AD |
1024 | xmlhttp.onreadystatechange=infobox_callback; |
1025 | xmlhttp.send(null); | |
1026 | ||
1027 | } | |
1028 | ||
1029 | function selectedFeedDetails() { | |
1030 | ||
1031 | if (!xmlhttp_ready(xmlhttp)) { | |
1032 | printLockingError(); | |
1033 | return | |
1034 | } | |
1035 | ||
1036 | var rows = getSelectedFeeds(); | |
1037 | ||
1038 | if (rows.length == 0) { | |
1039 | notify("No feeds are selected."); | |
1040 | return; | |
1041 | } | |
1042 | ||
df268d47 AD |
1043 | // if (rows.length > 1) { |
1044 | // notify("Please select one feed."); | |
1045 | // return; | |
1046 | // } | |
c6c3a07f | 1047 | |
df268d47 | 1048 | // var id = rows[0]; |
c6c3a07f | 1049 | |
dbd9e2f1 AD |
1050 | notify(""); |
1051 | ||
df268d47 AD |
1052 | xmlhttp.open("GET", "backend.php?op=feed-details&id=" + |
1053 | param_escape(rows.toString()), true); | |
c6c3a07f | 1054 | xmlhttp.onreadystatechange=infobox_callback; |
1a7572cb | 1055 | xmlhttp.send(null); |
717f5e64 AD |
1056 | |
1057 | } | |
a0d53889 AD |
1058 | |
1059 | function editSelectedFilter() { | |
1060 | var rows = getSelectedFilters(); | |
1061 | ||
1062 | if (rows.length == 0) { | |
1063 | notify("No filters are selected."); | |
1064 | return; | |
1065 | } | |
1066 | ||
1067 | if (rows.length > 1) { | |
1068 | notify("Please select one filter."); | |
1069 | return; | |
1070 | } | |
1071 | ||
dbd9e2f1 AD |
1072 | notify(""); |
1073 | ||
a0d53889 AD |
1074 | editFilter(rows[0]); |
1075 | ||
1076 | } | |
1077 | ||
1078 | ||
508a81e1 AD |
1079 | function editSelectedFeed() { |
1080 | var rows = getSelectedFeeds(); | |
1081 | ||
1082 | if (rows.length == 0) { | |
1083 | notify("No feeds are selected."); | |
1084 | return; | |
1085 | } | |
1086 | ||
1087 | if (rows.length > 1) { | |
1088 | notify("Please select one feed."); | |
1089 | return; | |
1090 | } | |
1091 | ||
dbd9e2f1 AD |
1092 | notify(""); |
1093 | ||
508a81e1 | 1094 | editFeed(rows[0]); |
91ff844a AD |
1095 | |
1096 | } | |
1097 | ||
1098 | function editSelectedFeedCat() { | |
1099 | var rows = getSelectedFeedCats(); | |
1100 | ||
1101 | if (rows.length == 0) { | |
1102 | notify("No categories are selected."); | |
1103 | return; | |
1104 | } | |
1105 | ||
1106 | if (rows.length > 1) { | |
1107 | notify("Please select one category."); | |
1108 | return; | |
1109 | } | |
1110 | ||
1111 | notify(""); | |
1112 | ||
1113 | editFeedCat(rows[0]); | |
508a81e1 AD |
1114 | |
1115 | } | |
1116 | ||
13ad9102 AD |
1117 | function localPiggieFunction(enable) { |
1118 | if (enable) { | |
508a81e1 AD |
1119 | piggie.style.display = "block"; |
1120 | seq = ""; | |
1121 | notify("I loveded it!!!"); | |
1122 | } else { | |
1123 | piggie.style.display = "none"; | |
1124 | notify(""); | |
1125 | } | |
508a81e1 AD |
1126 | } |
1127 | ||
9f311df6 AD |
1128 | function validateOpmlImport() { |
1129 | ||
1130 | var opml_file = document.getElementById("opml_file"); | |
1131 | ||
1132 | if (opml_file.value.length == 0) { | |
1133 | notify("Please select OPML file to upload."); | |
1134 | return false; | |
1135 | } else { | |
1136 | return true; | |
1137 | } | |
1138 | } | |
1139 | ||
a0d53889 AD |
1140 | function updateFilterList() { |
1141 | ||
1142 | if (!xmlhttp_ready(xmlhttp)) { | |
1143 | printLockingError(); | |
1144 | return | |
1145 | } | |
1146 | ||
f5a50b25 AD |
1147 | // document.getElementById("prefContent").innerHTML = "Loading filters, please wait..."; |
1148 | ||
1149 | p_notify("Loading, please wait..."); | |
a0d53889 AD |
1150 | |
1151 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
1152 | xmlhttp.onreadystatechange=filterlist_callback; | |
1153 | xmlhttp.send(null); | |
1154 | ||
1155 | } | |
1156 | ||
48f0adb0 AD |
1157 | function updateLabelList() { |
1158 | ||
1159 | if (!xmlhttp_ready(xmlhttp)) { | |
1160 | printLockingError(); | |
1161 | return | |
1162 | } | |
1163 | ||
f5a50b25 AD |
1164 | p_notify("Loading, please wait..."); |
1165 | ||
1166 | // document.getElementById("prefContent").innerHTML = "Loading labels, please wait..."; | |
48f0adb0 AD |
1167 | |
1168 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
1169 | xmlhttp.onreadystatechange=labellist_callback; | |
1170 | xmlhttp.send(null); | |
48f0adb0 AD |
1171 | } |
1172 | ||
4255b24c AD |
1173 | function updatePrefsList() { |
1174 | ||
1175 | if (!xmlhttp_ready(xmlhttp)) { | |
1176 | printLockingError(); | |
1177 | return | |
1178 | } | |
1179 | ||
1180 | p_notify("Loading, please wait..."); | |
1181 | ||
1182 | xmlhttp.open("GET", "backend.php?op=pref-prefs", true); | |
1183 | xmlhttp.onreadystatechange=prefslist_callback; | |
1184 | xmlhttp.send(null); | |
1185 | ||
1186 | } | |
1187 | ||
f5a50b25 | 1188 | function selectTab(id) { |
48f0adb0 | 1189 | |
c6c3a07f AD |
1190 | if (!xmlhttp_ready(xmlhttp)) { |
1191 | printLockingError(); | |
1192 | return | |
1193 | } | |
1194 | ||
f5a50b25 | 1195 | if (id == "feedConfig") { |
a0d53889 | 1196 | updateFeedList(); |
f5a50b25 | 1197 | } else if (id == "filterConfig") { |
a0d53889 | 1198 | updateFilterList(); |
f5a50b25 | 1199 | } else if (id == "labelConfig") { |
48f0adb0 | 1200 | updateLabelList(); |
4255b24c AD |
1201 | } else if (id == "genConfig") { |
1202 | updatePrefsList(); | |
e6cb77a0 AD |
1203 | } else if (id == "userConfig") { |
1204 | updateUsersList(); | |
a0d53889 | 1205 | } |
f5a50b25 AD |
1206 | |
1207 | var tab = document.getElementById(active_tab + "Tab"); | |
1208 | ||
1209 | if (tab) { | |
1210 | if (tab.className.match("Selected")) { | |
1211 | tab.className = "prefsTab"; | |
1212 | } | |
1213 | } | |
1214 | ||
1215 | tab = document.getElementById(id + "Tab"); | |
1216 | ||
1217 | if (tab) { | |
1218 | if (!tab.className.match("Selected")) { | |
1219 | tab.className = tab.className + "Selected"; | |
1220 | } | |
1221 | } | |
1222 | ||
1223 | active_tab = id; | |
1224 | ||
4da47970 AD |
1225 | setCookie('ttrss_pref_acttab', active_tab); |
1226 | ||
a0d53889 AD |
1227 | } |
1228 | ||
007bda35 | 1229 | function init() { |
e2ec66a8 | 1230 | |
7719618b AD |
1231 | try { |
1232 | ||
1233 | // IE kludge | |
1234 | if (!xmlhttp) { | |
1235 | document.getElementById("prefContent").innerHTML = | |
1236 | "<b>Fatal error:</b> This program needs XmlHttpRequest " + | |
1237 | "to function properly. Your browser doesn't seem to support it."; | |
1238 | return; | |
1239 | } | |
4da47970 AD |
1240 | |
1241 | active_tab = getCookie("ttrss_pref_acttab"); | |
1242 | if (!active_tab) active_tab = "genConfig"; | |
1243 | selectTab(active_tab); | |
7719618b AD |
1244 | |
1245 | document.onkeydown = hotkey_handler; | |
1246 | notify(""); | |
1247 | } catch (e) { | |
1248 | exception_error("init", e); | |
e2ec66a8 | 1249 | } |
007bda35 | 1250 | } |
b1895692 | 1251 | |
c6c3a07f | 1252 | function closeInfoBox() { |
2317ffaa AD |
1253 | var box = document.getElementById('infoBox'); |
1254 | var shadow = document.getElementById('infoBoxShadow'); | |
1255 | ||
1256 | if (shadow) { | |
1257 | shadow.style.display = "none"; | |
1258 | } else if (box) { | |
1259 | box.style.display = "none"; | |
1260 | } | |
1a7572cb | 1261 | } |
f932bc9f AD |
1262 | |
1263 | function categorizeSelectedFeeds() { | |
1264 | ||
1265 | if (!xmlhttp_ready(xmlhttp)) { | |
1266 | printLockingError(); | |
1267 | return | |
1268 | } | |
1269 | ||
1270 | var sel_rows = getSelectedFeeds(); | |
1271 | ||
1272 | var cat_sel = document.getElementById("sfeed_set_fcat"); | |
1273 | var cat_id = cat_sel[cat_sel.selectedIndex].id; | |
1274 | ||
1275 | if (sel_rows.length > 0) { | |
1276 | ||
1277 | notify("Changing category of selected feeds..."); | |
1278 | ||
1279 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+ | |
1280 | param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true); | |
1281 | xmlhttp.onreadystatechange=feedlist_callback; | |
1282 | xmlhttp.send(null); | |
1283 | ||
1284 | } else { | |
1285 | ||
1286 | notify("Please select some feeds first."); | |
1287 | ||
1288 | } | |
1289 | ||
1290 | } | |
69668465 AD |
1291 | |
1292 | function validatePrefsReset() { | |
1293 | return confirm("Reset to defaults?"); | |
1294 | } | |
f9cb39ac AD |
1295 | |
1296 | function browseFeeds() { | |
1297 | ||
1298 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true); | |
1299 | xmlhttp.onreadystatechange=infobox_callback; | |
1300 | xmlhttp.send(null); | |
1301 | ||
1302 | } | |
a0476535 AD |
1303 | |
1304 | function feedBrowserSubscribe() { | |
1305 | try { | |
1306 | var list = document.getElementById("browseFeedList"); | |
1307 | ||
1308 | var selected = new Array(); | |
1309 | ||
1310 | for (i = 0; i < list.childNodes.length; i++) { | |
1311 | var child = list.childNodes[i]; | |
1312 | if (child.id && child.id.match("FBROW-")) { | |
1313 | var id = child.id.replace("FBROW-", ""); | |
1314 | ||
1315 | var cb = document.getElementById("FBCHK-" + id); | |
1316 | ||
1317 | if (cb.checked) { | |
1318 | selected.push(id); | |
1319 | } | |
1320 | } | |
1321 | } | |
1322 | ||
1323 | if (selected.length > 0) { | |
1324 | closeInfoBox(); | |
1325 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+ | |
1326 | param_escape(selected.toString()), true); | |
1327 | xmlhttp.onreadystatechange=feedlist_callback; | |
1328 | xmlhttp.send(null); | |
1329 | } else { | |
1330 | alert("No feeds are selected."); | |
1331 | } | |
1332 | ||
1333 | } catch (e) { | |
1334 | exception_error("feedBrowserSubscribe", e); | |
1335 | } | |
1336 | } |