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