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