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