]>
Commit | Line | Data |
---|---|---|
007bda35 AD |
1 | /* |
2 | This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com> | |
3 | Licensed under GPL v.2 or (at your preference) any later version. | |
4 | */ | |
5 | ||
6 | var xmlhttp = false; | |
7 | ||
961513a3 | 8 | var active_feed = false; |
a0d53889 | 9 | var active_filter = false; |
48f0adb0 | 10 | var active_label = false; |
961513a3 | 11 | |
f5a50b25 AD |
12 | var active_tab = false; |
13 | ||
007bda35 AD |
14 | /*@cc_on @*/ |
15 | /*@if (@_jscript_version >= 5) | |
16 | // JScript gives us Conditional compilation, we can cope with old IE versions. | |
17 | // and security blocked creation of the objects. | |
18 | try { | |
19 | xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); | |
20 | } catch (e) { | |
21 | try { | |
22 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
23 | } catch (E) { | |
24 | xmlhttp = false; | |
25 | } | |
26 | } | |
27 | @end @*/ | |
28 | ||
29 | if (!xmlhttp && typeof XMLHttpRequest!='undefined') { | |
30 | xmlhttp = new XMLHttpRequest(); | |
31 | } | |
32 | ||
007bda35 | 33 | function feedlist_callback() { |
f5a50b25 | 34 | var container = document.getElementById('prefContent'); |
007bda35 AD |
35 | if (xmlhttp.readyState == 4) { |
36 | container.innerHTML=xmlhttp.responseText; | |
961513a3 AD |
37 | if (active_feed) { |
38 | var row = document.getElementById("FEEDR-" + active_feed); | |
39 | if (row) { | |
40 | if (!row.className.match("Selected")) { | |
41 | row.className = row.className + "Selected"; | |
42 | } | |
43 | } | |
44 | var checkbox = document.getElementById("FRCHK-" + active_feed); | |
45 | if (checkbox) { | |
46 | checkbox.checked = true; | |
47 | } | |
48 | } | |
f5a50b25 | 49 | p_notify(""); |
007bda35 AD |
50 | } |
51 | } | |
52 | ||
a0d53889 | 53 | function filterlist_callback() { |
f5a50b25 | 54 | var container = document.getElementById('prefContent'); |
a0d53889 | 55 | if (xmlhttp.readyState == 4) { |
f5a50b25 | 56 | |
a0d53889 AD |
57 | container.innerHTML=xmlhttp.responseText; |
58 | ||
59 | if (active_filter) { | |
60 | var row = document.getElementById("FILRR-" + active_filter); | |
61 | if (row) { | |
62 | if (!row.className.match("Selected")) { | |
63 | row.className = row.className + "Selected"; | |
64 | } | |
65 | } | |
66 | var checkbox = document.getElementById("FICHK-" + active_filter); | |
67 | ||
68 | if (checkbox) { | |
69 | checkbox.checked = true; | |
70 | } | |
71 | } | |
f5a50b25 | 72 | p_notify(""); |
a0d53889 AD |
73 | } |
74 | } | |
75 | ||
48f0adb0 | 76 | function labellist_callback() { |
f5a50b25 | 77 | var container = document.getElementById('prefContent'); |
48f0adb0 AD |
78 | if (xmlhttp.readyState == 4) { |
79 | container.innerHTML=xmlhttp.responseText; | |
80 | ||
81 | if (active_filter) { | |
82 | var row = document.getElementById("LILRR-" + active_label); | |
83 | if (row) { | |
84 | if (!row.className.match("Selected")) { | |
85 | row.className = row.className + "Selected"; | |
86 | } | |
87 | } | |
88 | var checkbox = document.getElementById("LICHK-" + active_label); | |
89 | ||
90 | if (checkbox) { | |
91 | checkbox.checked = true; | |
92 | } | |
93 | } | |
f5a50b25 | 94 | p_notify(""); |
48f0adb0 AD |
95 | } |
96 | } | |
4255b24c AD |
97 | |
98 | function prefslist_callback() { | |
99 | var container = document.getElementById('prefContent'); | |
100 | if (xmlhttp.readyState == 4) { | |
101 | ||
102 | container.innerHTML=xmlhttp.responseText; | |
103 | ||
104 | p_notify(""); | |
105 | } | |
106 | } | |
107 | ||
b1895692 AD |
108 | function gethelp_callback() { |
109 | var container = document.getElementById('prefHelpBox'); | |
110 | if (xmlhttp.readyState == 4) { | |
111 | ||
112 | container.innerHTML = xmlhttp.responseText; | |
113 | container.style.display = "block"; | |
114 | ||
115 | } | |
116 | } | |
4255b24c AD |
117 | |
118 | ||
0e091d38 AD |
119 | function notify_callback() { |
120 | var container = document.getElementById('notify'); | |
121 | if (xmlhttp.readyState == 4) { | |
122 | container.innerHTML=xmlhttp.responseText; | |
123 | } | |
124 | } | |
125 | ||
175847de | 126 | |
0e091d38 | 127 | function updateFeedList() { |
007bda35 | 128 | |
c0e5a40e | 129 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
130 | printLockingError(); |
131 | return | |
132 | } | |
133 | ||
f5a50b25 AD |
134 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; |
135 | ||
136 | p_notify("Loading, please wait..."); | |
007bda35 AD |
137 | |
138 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
139 | xmlhttp.onreadystatechange=feedlist_callback; | |
140 | xmlhttp.send(null); | |
141 | ||
142 | } | |
143 | ||
144 | function toggleSelectRow(sender) { | |
145 | var parent_row = sender.parentNode.parentNode; | |
146 | ||
147 | if (sender.checked) { | |
148 | if (!parent_row.className.match("Selected")) { | |
149 | parent_row.className = parent_row.className + "Selected"; | |
150 | } | |
151 | } else { | |
152 | if (parent_row.className.match("Selected")) { | |
153 | parent_row.className = parent_row.className.replace("Selected", ""); | |
154 | } | |
155 | } | |
156 | } | |
157 | ||
48f0adb0 AD |
158 | function addLabel() { |
159 | ||
160 | if (!xmlhttp_ready(xmlhttp)) { | |
161 | printLockingError(); | |
162 | return | |
163 | } | |
164 | ||
165 | var sqlexp = document.getElementById("ladd_expr"); | |
166 | ||
167 | if (sqlexp.value.length == 0) { | |
168 | notify("Missing SQL expression."); | |
169 | } else { | |
170 | notify("Adding label..."); | |
171 | ||
172 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" + | |
173 | param_escape(sqlexp.value), true); | |
174 | ||
175 | xmlhttp.onreadystatechange=labellist_callback; | |
176 | xmlhttp.send(null); | |
177 | ||
178 | sqlexp.value = ""; | |
179 | } | |
180 | ||
181 | } | |
182 | ||
de435974 AD |
183 | function addFilter() { |
184 | ||
185 | if (!xmlhttp_ready(xmlhttp)) { | |
186 | printLockingError(); | |
187 | return | |
188 | } | |
189 | ||
190 | var regexp = document.getElementById("fadd_regexp"); | |
191 | var match = document.getElementById("fadd_match"); | |
192 | ||
193 | if (regexp.value.length == 0) { | |
194 | notify("Missing filter expression."); | |
195 | } else { | |
196 | notify("Adding filter..."); | |
197 | ||
25cb5736 AD |
198 | var v_match = match[match.selectedIndex].text; |
199 | ||
de435974 | 200 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add®exp=" + |
25cb5736 | 201 | param_escape(regexp.value) + "&match=" + v_match, true); |
de435974 AD |
202 | |
203 | xmlhttp.onreadystatechange=filterlist_callback; | |
204 | xmlhttp.send(null); | |
205 | ||
206 | regexp.value = ""; | |
207 | } | |
208 | ||
209 | } | |
48f0adb0 | 210 | |
71ad3959 AD |
211 | function addFeed() { |
212 | ||
c0e5a40e | 213 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
214 | printLockingError(); |
215 | return | |
216 | } | |
217 | ||
331900c6 AD |
218 | var link = document.getElementById("fadd_link"); |
219 | ||
83fe4d6d | 220 | if (link.value.length == 0) { |
c753cd32 | 221 | notify("Missing feed URL."); |
331900c6 AD |
222 | } else { |
223 | notify("Adding feed..."); | |
224 | ||
225 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" + | |
226 | param_escape(link.value), true); | |
227 | xmlhttp.onreadystatechange=feedlist_callback; | |
228 | xmlhttp.send(null); | |
229 | ||
230 | link.value = ""; | |
231 | ||
232 | } | |
233 | ||
234 | } | |
235 | ||
48f0adb0 AD |
236 | function editLabel(id) { |
237 | ||
238 | if (!xmlhttp_ready(xmlhttp)) { | |
239 | printLockingError(); | |
240 | return | |
241 | } | |
242 | ||
243 | active_label = id; | |
244 | ||
245 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" + | |
246 | param_escape(id), true); | |
247 | xmlhttp.onreadystatechange=labellist_callback; | |
248 | xmlhttp.send(null); | |
249 | ||
250 | } | |
251 | ||
a0d53889 AD |
252 | function editFilter(id) { |
253 | ||
254 | if (!xmlhttp_ready(xmlhttp)) { | |
255 | printLockingError(); | |
256 | return | |
257 | } | |
258 | ||
259 | active_filter = id; | |
260 | ||
261 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + | |
262 | param_escape(id), true); | |
263 | xmlhttp.onreadystatechange=filterlist_callback; | |
264 | xmlhttp.send(null); | |
265 | ||
266 | } | |
267 | ||
331900c6 AD |
268 | function editFeed(feed) { |
269 | ||
508a81e1 AD |
270 | // notify("Editing feed..."); |
271 | ||
c0e5a40e | 272 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
273 | printLockingError(); |
274 | return | |
275 | } | |
331900c6 | 276 | |
961513a3 AD |
277 | active_feed = feed; |
278 | ||
331900c6 AD |
279 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" + |
280 | param_escape(feed), true); | |
281 | xmlhttp.onreadystatechange=feedlist_callback; | |
282 | xmlhttp.send(null); | |
283 | ||
284 | } | |
285 | ||
48f0adb0 AD |
286 | function getSelectedLabels() { |
287 | ||
288 | var content = document.getElementById("prefLabelList"); | |
289 | ||
290 | var sel_rows = new Array(); | |
291 | ||
292 | for (i = 0; i < content.rows.length; i++) { | |
293 | if (content.rows[i].className.match("Selected")) { | |
294 | var row_id = content.rows[i].id.replace("LILRR-", ""); | |
295 | sel_rows.push(row_id); | |
296 | } | |
297 | } | |
298 | ||
299 | return sel_rows; | |
300 | } | |
301 | ||
302 | ||
a0d53889 AD |
303 | function getSelectedFilters() { |
304 | ||
305 | var content = document.getElementById("prefFilterList"); | |
306 | ||
307 | var sel_rows = new Array(); | |
308 | ||
309 | for (i = 0; i < content.rows.length; i++) { | |
310 | if (content.rows[i].className.match("Selected")) { | |
311 | var row_id = content.rows[i].id.replace("FILRR-", ""); | |
312 | sel_rows.push(row_id); | |
313 | } | |
314 | } | |
315 | ||
316 | return sel_rows; | |
317 | } | |
318 | ||
83fe4d6d | 319 | function getSelectedFeeds() { |
331900c6 AD |
320 | |
321 | var content = document.getElementById("prefFeedList"); | |
322 | ||
323 | var sel_rows = new Array(); | |
324 | ||
325 | for (i = 0; i < content.rows.length; i++) { | |
326 | if (content.rows[i].className.match("Selected")) { | |
327 | var row_id = content.rows[i].id.replace("FEEDR-", ""); | |
328 | sel_rows.push(row_id); | |
329 | } | |
330 | } | |
331 | ||
83fe4d6d AD |
332 | return sel_rows; |
333 | } | |
334 | ||
335 | function readSelectedFeeds() { | |
336 | ||
c0e5a40e | 337 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
338 | printLockingError(); |
339 | return | |
340 | } | |
341 | ||
83fe4d6d AD |
342 | var sel_rows = getSelectedFeeds(); |
343 | ||
344 | if (sel_rows.length > 0) { | |
345 | ||
346 | notify("Marking selected feeds as read..."); | |
347 | ||
0e091d38 | 348 | xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ |
83fe4d6d | 349 | param_escape(sel_rows.toString()), true); |
0e091d38 | 350 | xmlhttp.onreadystatechange=notify_callback; |
83fe4d6d AD |
351 | xmlhttp.send(null); |
352 | ||
353 | } else { | |
354 | ||
c753cd32 | 355 | notify("Please select some feeds first."); |
83fe4d6d AD |
356 | |
357 | } | |
358 | } | |
359 | ||
360 | function unreadSelectedFeeds() { | |
361 | ||
c0e5a40e | 362 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
363 | printLockingError(); |
364 | return | |
365 | } | |
366 | ||
83fe4d6d AD |
367 | var sel_rows = getSelectedFeeds(); |
368 | ||
369 | if (sel_rows.length > 0) { | |
370 | ||
371 | notify("Marking selected feeds as unread..."); | |
372 | ||
0e091d38 | 373 | xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=unread&ids="+ |
83fe4d6d | 374 | param_escape(sel_rows.toString()), true); |
0e091d38 | 375 | xmlhttp.onreadystatechange=notify_callback; |
83fe4d6d AD |
376 | xmlhttp.send(null); |
377 | ||
378 | } else { | |
379 | ||
c753cd32 | 380 | notify("Please select some feeds first."); |
83fe4d6d AD |
381 | |
382 | } | |
383 | } | |
384 | ||
48f0adb0 AD |
385 | function removeSelectedLabels() { |
386 | ||
387 | if (!xmlhttp_ready(xmlhttp)) { | |
388 | printLockingError(); | |
389 | return | |
390 | } | |
391 | ||
392 | var sel_rows = getSelectedLabels(); | |
393 | ||
394 | if (sel_rows.length > 0) { | |
395 | ||
396 | notify("Removing selected labels..."); | |
397 | ||
398 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ | |
399 | param_escape(sel_rows.toString()), true); | |
400 | xmlhttp.onreadystatechange=labellist_callback; | |
401 | xmlhttp.send(null); | |
402 | ||
403 | } else { | |
404 | notify("Please select some labels first."); | |
405 | } | |
406 | } | |
407 | ||
408 | function removeSelectedFilters() { | |
409 | ||
410 | if (!xmlhttp_ready(xmlhttp)) { | |
411 | printLockingError(); | |
412 | return | |
413 | } | |
414 | ||
415 | var sel_rows = getSelectedFilters(); | |
416 | ||
417 | if (sel_rows.length > 0) { | |
418 | ||
419 | notify("Removing selected filters..."); | |
420 | ||
421 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ | |
422 | param_escape(sel_rows.toString()), true); | |
423 | xmlhttp.onreadystatechange=filterlist_callback; | |
424 | xmlhttp.send(null); | |
425 | ||
426 | } else { | |
427 | notify("Please select some filters first."); | |
428 | } | |
429 | } | |
430 | ||
431 | ||
83fe4d6d AD |
432 | function removeSelectedFeeds() { |
433 | ||
c0e5a40e | 434 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
435 | printLockingError(); |
436 | return | |
437 | } | |
438 | ||
83fe4d6d AD |
439 | var sel_rows = getSelectedFeeds(); |
440 | ||
331900c6 AD |
441 | if (sel_rows.length > 0) { |
442 | ||
443 | notify("Removing selected feeds..."); | |
444 | ||
445 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ | |
446 | param_escape(sel_rows.toString()), true); | |
447 | xmlhttp.onreadystatechange=feedlist_callback; | |
448 | xmlhttp.send(null); | |
71ad3959 | 449 | |
71ad3959 | 450 | } else { |
331900c6 | 451 | |
c753cd32 | 452 | notify("Please select some feeds first."); |
331900c6 | 453 | |
71ad3959 AD |
454 | } |
455 | ||
456 | } | |
007bda35 | 457 | |
508a81e1 AD |
458 | function feedEditCancel() { |
459 | ||
c0e5a40e | 460 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
461 | printLockingError(); |
462 | return | |
463 | } | |
464 | ||
961513a3 AD |
465 | active_feed = false; |
466 | ||
508a81e1 AD |
467 | notify("Operation cancelled."); |
468 | ||
469 | xmlhttp.open("GET", "backend.php?op=pref-feeds", true); | |
470 | xmlhttp.onreadystatechange=feedlist_callback; | |
471 | xmlhttp.send(null); | |
472 | ||
473 | } | |
474 | ||
603c27f8 AD |
475 | function feedEditSave() { |
476 | ||
477 | var feed = active_feed; | |
508a81e1 | 478 | |
c0e5a40e | 479 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
480 | printLockingError(); |
481 | return | |
482 | } | |
483 | ||
603c27f8 AD |
484 | var link = document.getElementById("iedit_link").value; |
485 | var title = document.getElementById("iedit_title").value; | |
d148926e | 486 | var upd_intl = document.getElementById("iedit_updintl").value; |
5d73494a | 487 | var purge_intl = document.getElementById("iedit_purgintl").value; |
508a81e1 | 488 | |
603c27f8 | 489 | // notify("Saving feed."); |
508a81e1 | 490 | |
140aae81 | 491 | /* if (upd_intl < 0) { |
d148926e AD |
492 | notify("Update interval must be >= 0 (0 = default)"); |
493 | return; | |
494 | } | |
495 | ||
5d73494a AD |
496 | if (purge_intl < 0) { |
497 | notify("Purge days must be >= 0 (0 = default)"); | |
498 | return; | |
140aae81 | 499 | } */ |
d148926e | 500 | |
508a81e1 AD |
501 | if (link.length == 0) { |
502 | notify("Feed link cannot be blank."); | |
503 | return; | |
504 | } | |
505 | ||
506 | if (title.length == 0) { | |
507 | notify("Feed title cannot be blank."); | |
508 | return; | |
509 | } | |
510 | ||
603c27f8 AD |
511 | active_feed = false; |
512 | ||
508a81e1 | 513 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" + |
d148926e | 514 | feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) + |
5d73494a | 515 | "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl), true); |
508a81e1 AD |
516 | xmlhttp.onreadystatechange=feedlist_callback; |
517 | xmlhttp.send(null); | |
518 | ||
519 | } | |
520 | ||
48f0adb0 AD |
521 | function labelEditCancel() { |
522 | ||
523 | if (!xmlhttp_ready(xmlhttp)) { | |
524 | printLockingError(); | |
525 | return | |
526 | } | |
527 | ||
528 | active_label = false; | |
529 | ||
530 | notify("Operation cancelled."); | |
531 | ||
532 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
533 | xmlhttp.onreadystatechange=labellist_callback; | |
534 | xmlhttp.send(null); | |
535 | ||
536 | } | |
537 | ||
538 | ||
a0d53889 AD |
539 | function filterEditCancel() { |
540 | ||
541 | if (!xmlhttp_ready(xmlhttp)) { | |
542 | printLockingError(); | |
543 | return | |
544 | } | |
545 | ||
546 | active_filter = false; | |
547 | ||
548 | notify("Operation cancelled."); | |
549 | ||
550 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
551 | xmlhttp.onreadystatechange=filterlist_callback; | |
552 | xmlhttp.send(null); | |
553 | ||
554 | } | |
555 | ||
48f0adb0 AD |
556 | function labelEditSave() { |
557 | ||
558 | var label = active_label; | |
559 | ||
560 | if (!xmlhttp_ready(xmlhttp)) { | |
561 | printLockingError(); | |
562 | return | |
563 | } | |
564 | ||
565 | var sqlexp = document.getElementById("iedit_expr").value; | |
566 | var descr = document.getElementById("iedit_descr").value; | |
567 | ||
568 | // notify("Saving label " + sqlexp + ": " + descr); | |
569 | ||
570 | if (sqlexp.length == 0) { | |
571 | notify("SQL expression cannot be blank."); | |
572 | return; | |
573 | } | |
574 | ||
575 | if (descr.length == 0) { | |
576 | notify("Caption cannot be blank."); | |
577 | return; | |
578 | } | |
579 | ||
580 | active_label = false; | |
581 | ||
582 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" + | |
583 | label + "&s=" + param_escape(sqlexp) + "&d=" + param_escape(descr), | |
584 | true); | |
585 | ||
586 | xmlhttp.onreadystatechange=labellist_callback; | |
587 | xmlhttp.send(null); | |
588 | ||
589 | } | |
590 | ||
a0d53889 AD |
591 | function filterEditSave() { |
592 | ||
593 | var filter = active_filter; | |
594 | ||
595 | if (!xmlhttp_ready(xmlhttp)) { | |
596 | printLockingError(); | |
597 | return | |
598 | } | |
599 | ||
600 | var regexp = document.getElementById("iedit_regexp").value; | |
601 | var descr = document.getElementById("iedit_descr").value; | |
25cb5736 AD |
602 | var match = document.getElementById("iedit_match"); |
603 | ||
604 | var v_match = match[match.selectedIndex].text; | |
a0d53889 AD |
605 | |
606 | // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match); | |
607 | ||
608 | if (regexp.length == 0) { | |
609 | notify("Filter expression cannot be blank."); | |
610 | return; | |
611 | } | |
612 | ||
613 | active_filter = false; | |
614 | ||
615 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" + | |
616 | filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) + | |
25cb5736 | 617 | "&m=" + param_escape(v_match), true); |
a0d53889 AD |
618 | |
619 | xmlhttp.onreadystatechange=filterlist_callback; | |
620 | xmlhttp.send(null); | |
621 | ||
622 | } | |
623 | ||
48f0adb0 AD |
624 | function editSelectedLabel() { |
625 | var rows = getSelectedLabels(); | |
a0d53889 | 626 | |
48f0adb0 AD |
627 | if (rows.length == 0) { |
628 | notify("No labels are selected."); | |
629 | return; | |
a0d53889 AD |
630 | } |
631 | ||
48f0adb0 AD |
632 | if (rows.length > 1) { |
633 | notify("Please select one label."); | |
634 | return; | |
635 | } | |
a0d53889 | 636 | |
48f0adb0 | 637 | editLabel(rows[0]); |
a0d53889 | 638 | |
a0d53889 AD |
639 | } |
640 | ||
641 | ||
642 | function editSelectedFilter() { | |
643 | var rows = getSelectedFilters(); | |
644 | ||
645 | if (rows.length == 0) { | |
646 | notify("No filters are selected."); | |
647 | return; | |
648 | } | |
649 | ||
650 | if (rows.length > 1) { | |
651 | notify("Please select one filter."); | |
652 | return; | |
653 | } | |
654 | ||
655 | editFilter(rows[0]); | |
656 | ||
657 | } | |
658 | ||
659 | ||
508a81e1 AD |
660 | function editSelectedFeed() { |
661 | var rows = getSelectedFeeds(); | |
662 | ||
663 | if (rows.length == 0) { | |
664 | notify("No feeds are selected."); | |
665 | return; | |
666 | } | |
667 | ||
668 | if (rows.length > 1) { | |
669 | notify("Please select one feed."); | |
670 | return; | |
671 | } | |
672 | ||
673 | editFeed(rows[0]); | |
674 | ||
675 | } | |
676 | ||
13ad9102 AD |
677 | function localPiggieFunction(enable) { |
678 | if (enable) { | |
508a81e1 AD |
679 | piggie.style.display = "block"; |
680 | seq = ""; | |
681 | notify("I loveded it!!!"); | |
682 | } else { | |
683 | piggie.style.display = "none"; | |
684 | notify(""); | |
685 | } | |
508a81e1 AD |
686 | } |
687 | ||
9f311df6 AD |
688 | function validateOpmlImport() { |
689 | ||
690 | var opml_file = document.getElementById("opml_file"); | |
691 | ||
692 | if (opml_file.value.length == 0) { | |
693 | notify("Please select OPML file to upload."); | |
694 | return false; | |
695 | } else { | |
696 | return true; | |
697 | } | |
698 | } | |
699 | ||
a0d53889 AD |
700 | function updateFilterList() { |
701 | ||
702 | if (!xmlhttp_ready(xmlhttp)) { | |
703 | printLockingError(); | |
704 | return | |
705 | } | |
706 | ||
f5a50b25 AD |
707 | // document.getElementById("prefContent").innerHTML = "Loading filters, please wait..."; |
708 | ||
709 | p_notify("Loading, please wait..."); | |
a0d53889 AD |
710 | |
711 | xmlhttp.open("GET", "backend.php?op=pref-filters", true); | |
712 | xmlhttp.onreadystatechange=filterlist_callback; | |
713 | xmlhttp.send(null); | |
714 | ||
715 | } | |
716 | ||
48f0adb0 AD |
717 | function updateLabelList() { |
718 | ||
719 | if (!xmlhttp_ready(xmlhttp)) { | |
720 | printLockingError(); | |
721 | return | |
722 | } | |
723 | ||
f5a50b25 AD |
724 | p_notify("Loading, please wait..."); |
725 | ||
726 | // document.getElementById("prefContent").innerHTML = "Loading labels, please wait..."; | |
48f0adb0 AD |
727 | |
728 | xmlhttp.open("GET", "backend.php?op=pref-labels", true); | |
729 | xmlhttp.onreadystatechange=labellist_callback; | |
730 | xmlhttp.send(null); | |
48f0adb0 AD |
731 | } |
732 | ||
4255b24c AD |
733 | function updatePrefsList() { |
734 | ||
735 | if (!xmlhttp_ready(xmlhttp)) { | |
736 | printLockingError(); | |
737 | return | |
738 | } | |
739 | ||
740 | p_notify("Loading, please wait..."); | |
741 | ||
742 | xmlhttp.open("GET", "backend.php?op=pref-prefs", true); | |
743 | xmlhttp.onreadystatechange=prefslist_callback; | |
744 | xmlhttp.send(null); | |
745 | ||
746 | } | |
747 | ||
f5a50b25 | 748 | function selectTab(id) { |
48f0adb0 | 749 | |
f5a50b25 | 750 | if (id == "feedConfig") { |
a0d53889 | 751 | updateFeedList(); |
f5a50b25 | 752 | } else if (id == "filterConfig") { |
a0d53889 | 753 | updateFilterList(); |
f5a50b25 | 754 | } else if (id == "labelConfig") { |
48f0adb0 | 755 | updateLabelList(); |
4255b24c AD |
756 | } else if (id == "genConfig") { |
757 | updatePrefsList(); | |
a0d53889 | 758 | } |
f5a50b25 AD |
759 | |
760 | var tab = document.getElementById(active_tab + "Tab"); | |
761 | ||
762 | if (tab) { | |
763 | if (tab.className.match("Selected")) { | |
764 | tab.className = "prefsTab"; | |
765 | } | |
766 | } | |
767 | ||
768 | tab = document.getElementById(id + "Tab"); | |
769 | ||
770 | if (tab) { | |
771 | if (!tab.className.match("Selected")) { | |
772 | tab.className = tab.className + "Selected"; | |
773 | } | |
774 | } | |
775 | ||
776 | active_tab = id; | |
777 | ||
a0d53889 AD |
778 | } |
779 | ||
007bda35 | 780 | function init() { |
e2ec66a8 AD |
781 | |
782 | // IE kludge | |
783 | ||
ad095c16 | 784 | if (!xmlhttp) { |
e2ec66a8 AD |
785 | document.getElementById("prefContent").innerHTML = |
786 | "<b>Fatal error:</b> This program needs XmlHttpRequest " + | |
787 | "to function properly. Your browser doesn't seem to support it."; | |
788 | return; | |
789 | } | |
790 | ||
77e96719 | 791 | selectTab("genConfig"); |
f5a50b25 | 792 | |
508a81e1 | 793 | document.onkeydown = hotkey_handler; |
857a9270 AD |
794 | notify(""); |
795 | ||
007bda35 | 796 | } |
b1895692 AD |
797 | |
798 | /* | |
799 | var help_topic_id = false; | |
800 | ||
801 | function do_dispOptionHelp() { | |
802 | ||
803 | if (!xmlhttp_ready(xmlhttp)) | |
804 | return; | |
805 | ||
806 | xmlhttp.open("GET", "backend.php?op=pref-prefs&subop=getHelp&pn=" + | |
807 | param_escape(help_topic_id), true); | |
808 | xmlhttp.onreadystatechange=gethelp_callback; | |
809 | xmlhttp.send(null); | |
810 | ||
811 | } | |
812 | ||
813 | function dispOptionHelp(event, sender) { | |
814 | ||
815 | help_topic_id = sender.id; | |
816 | ||
817 | // document.setTimeout("do_dispOptionHelp()", 100); | |
818 | ||
819 | } */ | |
820 | ||
1c7f75ed | 821 |