]> git.wh0rd.org - tt-rss.git/blame - prefs.js
disable more feeds button in single user mode
[tt-rss.git] / prefs.js
CommitLineData
007bda35
AD
1var xmlhttp = false;
2
91ff844a 3var active_feed_cat = false;
f5a50b25 4var active_tab = false;
c6232e43 5var feed_to_expand = false;
f5a50b25 6
a58069db 7var xmlhttp = Ajax.getTransport();
007bda35 8
a7565293
AD
9var init_params = new Array();
10
e513a74a 11var caller_subop = false;
7a09510c 12var sanity_check_done = false;
746dcf42 13var hotkey_prefix = false;
7a09510c 14
288487e4
AD
15function infobox_callback() {
16 if (xmlhttp.readyState == 4) {
17 infobox_callback2(xmlhttp);
18 }
19}
20
21function infobox_submit_callback() {
22 if (xmlhttp.readyState == 4) {
23 infobox_submit_callback2(xmlhttp);
24 }
25}
26
27
e4f4b46f 28function replace_pubkey_callback() {
c6232e43
AD
29 if (xmlhttp.readyState == 4) {
30 try {
e4f4b46f
AD
31 var link = document.getElementById("pubGenAddress");
32
33 if (xmlhttp.responseXML) {
34
945c243e
AD
35 var new_link = xmlhttp.responseXML.getElementsByTagName("link")[0];
36
37 if (new_link) {
38 link.href = new_link.firstChild.nodeValue;
e635d56a 39 //link.innerHTML = new_link.firstChild.nodeValue;
945c243e 40
3076c7b8
AD
41 new Effect.Highlight(link);
42
e635d56a 43 notify_info("Published feed URL changed.");
945c243e 44 } else {
e635d56a 45 notify_error("Could not change feed URL.");
945c243e 46 }
e4f4b46f
AD
47
48 } else {
e635d56a 49 notify_error("Could not change feed URL.");
e4f4b46f 50 }
c6232e43 51 } catch (e) {
e4f4b46f 52 exception_error("replace_pubkey_callback", e);
c6232e43
AD
53 }
54 }
945c243e 55}
c6232e43 56
e4f4b46f 57function expand_feed_callback() {
bc0ed820
AD
58 if (xmlhttp.readyState == 4) {
59 try {
e4f4b46f 60 var container = document.getElementById("BRDET-" + feed_to_expand);
bc0ed820 61 container.innerHTML=xmlhttp.responseText;
34a01a20 62// container.style.display = "block";
051c4d56 63 Effect.Appear(container, {duration : 0.5});
602ed7f2 64 notify('');
bc0ed820 65 } catch (e) {
e4f4b46f 66 exception_error("expand_feed_callback", e);
bc0ed820
AD
67 }
68 }
69}
70
007bda35 71function feedlist_callback() {
007bda35 72 if (xmlhttp.readyState == 4) {
47c6c988
AD
73 try {
74 var container = document.getElementById('prefContent');
75 container.innerHTML=xmlhttp.responseText;
a7f22b70 76 selectTab("feedConfig", true);
e513a74a
AD
77
78 if (caller_subop) {
79 var tuple = caller_subop.split(":");
80 if (tuple[0] == 'editFeed') {
81 window.setTimeout('editFeed('+tuple[1]+')', 100);
82 }
83
84 caller_subop = false;
85 }
23943c9b
AD
86 if (typeof correctPNG != 'undefined') {
87 correctPNG();
88 }
7f74a9da 89 notify("");
08827aaf
AD
90 remove_splash();
91
47c6c988
AD
92 } catch (e) {
93 exception_error("feedlist_callback", e);
961513a3 94 }
007bda35
AD
95 }
96}
97
442d77f1
AD
98/* stub for subscription dialog */
99
288487e4 100function dlg_frefresh_callback(transport) {
442d77f1 101
288487e4
AD
102 try {
103 var container = document.getElementById('prefContent');
104 container.innerHTML=transport.responseText;
105 selectTab("feedConfig", true);
442d77f1 106
288487e4
AD
107 if (caller_subop) {
108 var tuple = caller_subop.split(":");
109 if (tuple[0] == 'editFeed') {
110 window.setTimeout('editFeed('+tuple[1]+')', 100);
111 }
442d77f1 112
288487e4 113 caller_subop = false;
442d77f1 114 }
288487e4
AD
115 if (typeof correctPNG != 'undefined') {
116 correctPNG();
117 }
118 notify("");
119 } catch (e) {
120 exception_error("feedlist_callback", e);
442d77f1 121 }
288487e4 122
442d77f1
AD
123}
124
a0d53889 125function filterlist_callback() {
f5a50b25 126 var container = document.getElementById('prefContent');
a0d53889
AD
127 if (xmlhttp.readyState == 4) {
128 container.innerHTML=xmlhttp.responseText;
23943c9b
AD
129 if (typeof correctPNG != 'undefined') {
130 correctPNG();
131 }
7f74a9da 132 notify("");
08827aaf 133 remove_splash();
a0d53889
AD
134 }
135}
136
48f0adb0 137function labellist_callback() {
ceb30ba4
AD
138
139 try {
140
141 var container = document.getElementById('prefContent');
142 if (xmlhttp.readyState == 4) {
143 closeInfoBox();
144 container.innerHTML=xmlhttp.responseText;
145
146 if (document.getElementById("prefLabelList")) {
147 var elems = document.getElementById("prefLabelList").getElementsByTagName("SPAN");
148
149 for (var i = 0; i < elems.length; i++) {
150 if (elems[i].id && elems[i].id.match("LILT-")) {
151
152 var id = elems[i].id.replace("LILT-", "");
153 new Ajax.InPlaceEditor(elems[i],
9c5e85fe
AD
154 'backend.php?op=pref-labels&subop=save&id=' + id,
155 {cols: 20, rows: 1});
ceb30ba4
AD
156 }
157 }
48f0adb0 158 }
ceb30ba4
AD
159
160 if (typeof correctPNG != 'undefined') {
161 correctPNG();
48f0adb0 162 }
ceb30ba4
AD
163 notify("");
164 remove_splash();
48f0adb0 165 }
ceb30ba4
AD
166
167 } catch (e) {
168 exception_error("labellist_callback", e);
48f0adb0
AD
169 }
170}
4255b24c 171
c6232e43
AD
172function feed_browser_callback() {
173 var container = document.getElementById('prefContent');
174 if (xmlhttp.readyState == 4) {
175 container.innerHTML=xmlhttp.responseText;
7f74a9da 176 notify("");
08827aaf 177 remove_splash();
c6232e43
AD
178 }
179}
180
e6cb77a0
AD
181function userlist_callback() {
182 var container = document.getElementById('prefContent');
183 if (xmlhttp.readyState == 4) {
184 container.innerHTML=xmlhttp.responseText;
7f74a9da 185 notify("");
08827aaf 186 remove_splash();
e6cb77a0
AD
187 }
188}
189
4255b24c
AD
190function prefslist_callback() {
191 var container = document.getElementById('prefContent');
192 if (xmlhttp.readyState == 4) {
4255b24c 193 container.innerHTML=xmlhttp.responseText;
7f74a9da 194 notify("");
08827aaf 195 remove_splash();
4255b24c
AD
196 }
197}
198
b1895692
AD
199function gethelp_callback() {
200 var container = document.getElementById('prefHelpBox');
201 if (xmlhttp.readyState == 4) {
202
203 container.innerHTML = xmlhttp.responseText;
204 container.style.display = "block";
205
206 }
207}
4255b24c 208
0e091d38 209function notify_callback() {
0e091d38 210 if (xmlhttp.readyState == 4) {
42c32916
AD
211 notify_info(xmlhttp.responseText);
212 }
0e091d38
AD
213}
214
b652c1b7
AD
215function prefs_reset_callback() {
216 if (xmlhttp.readyState == 4) {
217 notify_info(xmlhttp.responseText);
218 selectTab();
219 }
220}
221
d95bd220
AD
222
223function changepass_callback() {
42395d28
AD
224 try {
225 if (xmlhttp.readyState == 4) {
226
227 if (xmlhttp.responseText.indexOf("ERROR: ") == 0) {
228 notify_error(xmlhttp.responseText.replace("ERROR: ", ""));
229 } else {
230 notify_info(xmlhttp.responseText);
231 var warn = document.getElementById("default_pass_warning");
232 if (warn) warn.style.display = "none";
233 }
234
235 document.forms['change_pass_form'].reset();
d95bd220 236
42395d28
AD
237 }
238 } catch (e) {
239 exception_error("changepass_callback", e);
240 }
d95bd220
AD
241}
242
11f083e7
AD
243function infobox_feed_cat_callback() {
244 if (xmlhttp.readyState == 4) {
245 try {
246
247 infobox_callback();
248
249 if (document.getElementById("prefFeedCatList")) {
250 var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN");
251
252 for (var i = 0; i < elems.length; i++) {
253 if (elems[i].id && elems[i].id.match("FCATT-")) {
254 var cat_id = elems[i].id.replace("FCATT-", "");
255
256 new Ajax.InPlaceEditor(elems[i],
257 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id);
258 }
259 }
260 }
261
262 } catch (e) {
263 exception_error("infobox_feed_cat_callback", e);
264 }
265 }
266}
267
b83c7545 268function updateFeedList(sort_key) {
007bda35 269
c0e5a40e 270 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
271 printLockingError();
272 return
273 }
274
f932bc9f
AD
275 var feed_search = document.getElementById("feed_search");
276 var search = "";
277 if (feed_search) { search = feed_search.value; }
278
400b60d8
AD
279 var slat = document.getElementById("show_last_article_times");
280
281 var slat_checked = false;
282 if (slat) {
283 slat_checked = slat.checked;
284 }
285
b83c7545 286 xmlhttp.open("GET", "backend.php?op=pref-feeds" +
f932bc9f 287 "&sort=" + param_escape(sort_key) +
400b60d8 288 "&slat=" + param_escape(slat_checked) +
f932bc9f 289 "&search=" + param_escape(search), true);
007bda35
AD
290 xmlhttp.onreadystatechange=feedlist_callback;
291 xmlhttp.send(null);
292
293}
294
79ec0f2f 295function updateUsersList(sort_key) {
e6cb77a0
AD
296
297 if (!xmlhttp_ready(xmlhttp)) {
298 printLockingError();
299 return
300 }
301
a5bd7bf0
AD
302 var user_search = document.getElementById("user_search");
303 var search = "";
304 if (user_search) { search = user_search.value; }
305
79ec0f2f 306 xmlhttp.open("GET", "backend.php?op=pref-users&sort="
a5bd7bf0
AD
307 + param_escape(sort_key) +
308 "&search=" + param_escape(search), true);
e6cb77a0
AD
309 xmlhttp.onreadystatechange=userlist_callback;
310 xmlhttp.send(null);
311
312}
313
48f0adb0
AD
314function addLabel() {
315
ceb30ba4
AD
316 try {
317
48f0adb0
AD
318 if (!xmlhttp_ready(xmlhttp)) {
319 printLockingError();
320 return
321 }
322
ceb30ba4 323 var caption = prompt(__("Please enter label caption:"), "");
48f0adb0 324
4264f0b5
AD
325 if (caption == null) {
326 return false;
327 }
328
ceb30ba4 329 if (caption == "") {
89cb787e 330 alert(__("Can't create label: missing caption."));
f156fd00 331 return false;
de435974
AD
332 }
333
6068d33b
AD
334 // we can be called from some other tab
335 active_tab = "labelConfig";
336
ceb30ba4
AD
337 var query = "caption=" + param_escape(caption);
338
f156fd00
AD
339 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);
340 xmlhttp.onreadystatechange=infobox_submit_callback;
341 xmlhttp.send(null);
ceb30ba4
AD
342
343 } catch (e) {
344 exception_error("addLabel", e);
345 }
de435974 346}
48f0adb0 347
71ad3959
AD
348function addFeed() {
349
c0e5a40e 350 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
351 printLockingError();
352 return
353 }
354
331900c6
AD
355 var link = document.getElementById("fadd_link");
356
83fe4d6d 357 if (link.value.length == 0) {
f3977cf5 358 alert(__("Error: No feed URL given."));
605f7d46 359 } else if (!isValidURL(link.value)) {
f3977cf5 360 alert(__("Error: Invalid feed URL."));
331900c6 361 } else {
42c32916 362 notify_progress("Adding feed...");
331900c6 363
e513a74a 364 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" +
331900c6
AD
365 param_escape(link.value), true);
366 xmlhttp.onreadystatechange=feedlist_callback;
367 xmlhttp.send(null);
368
369 link.value = "";
370
371 }
372
373}
374
91ff844a
AD
375function addFeedCat() {
376
377 if (!xmlhttp_ready(xmlhttp)) {
378 printLockingError();
379 return
380 }
381
382 var cat = document.getElementById("fadd_cat");
383
384 if (cat.value.length == 0) {
f3977cf5 385 alert(__("Can't add category: no name specified."));
91ff844a 386 } else {
42c32916 387 notify_progress("Adding feed category...");
91ff844a 388
9c483746 389 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" +
91ff844a 390 param_escape(cat.value), true);
9c483746 391 xmlhttp.onreadystatechange=infobox_callback;
91ff844a
AD
392 xmlhttp.send(null);
393
394 link.value = "";
395
396 }
397
398}
e6cb77a0
AD
399function addUser() {
400
401 if (!xmlhttp_ready(xmlhttp)) {
402 printLockingError();
403 return
404 }
405
406 var sqlexp = document.getElementById("uadd_box");
407
408 if (sqlexp.value.length == 0) {
89cb787e 409 alert(__("Can't add user: no login specified."));
e6cb77a0 410 } else {
42c32916 411 notify_progress("Adding user...");
e6cb77a0
AD
412
413 xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" +
414 param_escape(sqlexp.value), true);
415
416 xmlhttp.onreadystatechange=userlist_callback;
417 xmlhttp.send(null);
418
419 sqlexp.value = "";
420 }
421
422}
423
e6cb77a0
AD
424function editUser(id) {
425
426 if (!xmlhttp_ready(xmlhttp)) {
427 printLockingError();
428 return
429 }
430
6068d33b
AD
431 disableHotkeys();
432
9e31e1b9
AD
433 notify_progress("Loading, please wait...");
434
3c5783b7
AD
435 selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
436 selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true);
e6cb77a0
AD
437
438 xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
439 param_escape(id), true);
3c5783b7 440 xmlhttp.onreadystatechange=infobox_callback;
e6cb77a0
AD
441 xmlhttp.send(null);
442
443}
444
a0d53889
AD
445function editFilter(id) {
446
447 if (!xmlhttp_ready(xmlhttp)) {
448 printLockingError();
449 return
450 }
451
6068d33b
AD
452 disableHotkeys();
453
9e31e1b9
AD
454 notify_progress("Loading, please wait...");
455
38bb1ceb 456// document.getElementById("create_filter_btn").disabled = true;
4220b0bd 457
07164479
AD
458 selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
459 selectTableRowById('FILRR-'+id, 'FICHK-'+id, true);
a0d53889 460
07164479
AD
461 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id), true);
462 xmlhttp.onreadystatechange=infobox_callback;
a0d53889 463 xmlhttp.send(null);
a0d53889
AD
464}
465
331900c6
AD
466function editFeed(feed) {
467
508a81e1
AD
468// notify("Editing feed...");
469
c0e5a40e 470 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
471 printLockingError();
472 return
473 }
331900c6 474
6068d33b
AD
475 disableHotkeys();
476
9e31e1b9
AD
477 notify_progress("Loading, please wait...");
478
38bb1ceb 479/* document.getElementById("subscribe_to_feed_btn").disabled = true;
a349077c
AD
480
481 try {
482 document.getElementById("top25_feeds_btn").disabled = true;
483 } catch (e) {
484 // this button is not always available, no-op if not found
38bb1ceb 485 } */
a349077c 486
673d54ca 487 // clean selection from all rows & select row being edited
0ea4fb50 488 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
6c12c809 489 selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
0ea4fb50
AD
490
491 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
3c5783b7 492 param_escape(feed), true);
0ea4fb50
AD
493
494 xmlhttp.onreadystatechange=infobox_callback;
331900c6
AD
495 xmlhttp.send(null);
496
497}
498
91ff844a 499function editFeedCat(cat) {
48f0adb0 500
91ff844a
AD
501 if (!xmlhttp_ready(xmlhttp)) {
502 printLockingError();
503 return
48f0adb0
AD
504 }
505
6068d33b
AD
506 disableHotkeys();
507
9e31e1b9
AD
508 notify_progress("Loading, please wait...");
509
91ff844a 510 active_feed_cat = cat;
e6cb77a0 511
9c483746 512 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=edit&id=" +
91ff844a 513 param_escape(cat), true);
9c483746 514 xmlhttp.onreadystatechange=infobox_callback;
91ff844a 515 xmlhttp.send(null);
e6cb77a0 516
e6cb77a0
AD
517}
518
91ff844a
AD
519function getSelectedLabels() {
520 return getSelectedTableRowIds("prefLabelList", "LILRR");
521}
48f0adb0 522
91ff844a
AD
523function getSelectedUsers() {
524 return getSelectedTableRowIds("prefUserList", "UMRR");
a0d53889
AD
525}
526
83fe4d6d 527function getSelectedFeeds() {
91ff844a
AD
528 return getSelectedTableRowIds("prefFeedList", "FEEDR");
529}
331900c6 530
91ff844a
AD
531function getSelectedFilters() {
532 return getSelectedTableRowIds("prefFilterList", "FILRR");
533}
331900c6 534
91ff844a
AD
535function getSelectedFeedCats() {
536 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
83fe4d6d
AD
537}
538
c0ae0fdb
AD
539function getSelectedFeedsFromBrowser() {
540
541 var list = document.getElementById("browseFeedList");
542 if (!list) list = document.getElementById("browseBigFeedList");
543
544 var selected = new Array();
545
546 for (i = 0; i < list.childNodes.length; i++) {
547 var child = list.childNodes[i];
548 if (child.id && child.id.match("FBROW-")) {
549 var id = child.id.replace("FBROW-", "");
550
551 var cb = document.getElementById("FBCHK-" + id);
552
553 if (cb.checked) {
554 selected.push(id);
555 }
556 }
557 }
558
559 return selected;
560}
561
48f0adb0
AD
562function removeSelectedLabels() {
563
564 if (!xmlhttp_ready(xmlhttp)) {
565 printLockingError();
566 return
567 }
568
569 var sel_rows = getSelectedLabels();
570
571 if (sel_rows.length > 0) {
572
f56e3080 573 var ok = confirm(__("Remove selected labels?"));
48f0adb0 574
69668465 575 if (ok) {
42c32916 576 notify_progress("Removing selected labels...");
69668465
AD
577
578 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
579 param_escape(sel_rows.toString()), true);
580 xmlhttp.onreadystatechange=labellist_callback;
581 xmlhttp.send(null);
582 }
48f0adb0 583 } else {
89cb787e 584 alert(__("No labels are selected."));
48f0adb0 585 }
90ac84df
AD
586
587 return false;
48f0adb0
AD
588}
589
e6cb77a0
AD
590function removeSelectedUsers() {
591
592 if (!xmlhttp_ready(xmlhttp)) {
593 printLockingError();
594 return
595 }
596
597 var sel_rows = getSelectedUsers();
598
599 if (sel_rows.length > 0) {
600
f56e3080 601 var ok = confirm(__("Remove selected users?"));
e6cb77a0 602
69668465 603 if (ok) {
42c32916 604 notify_progress("Removing selected users...");
69668465
AD
605
606 xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
607 param_escape(sel_rows.toString()), true);
608 xmlhttp.onreadystatechange=userlist_callback;
609 xmlhttp.send(null);
610 }
e6cb77a0
AD
611
612 } else {
89cb787e 613 alert(__("No users are selected."));
e6cb77a0 614 }
90ac84df
AD
615
616 return false;
e6cb77a0
AD
617}
618
48f0adb0
AD
619function removeSelectedFilters() {
620
621 if (!xmlhttp_ready(xmlhttp)) {
622 printLockingError();
623 return
624 }
625
626 var sel_rows = getSelectedFilters();
627
628 if (sel_rows.length > 0) {
629
f56e3080 630 var ok = confirm(__("Remove selected filters?"));
48f0adb0 631
69668465 632 if (ok) {
42c32916 633 notify_progress("Removing selected filters...");
69668465
AD
634
635 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
636 param_escape(sel_rows.toString()), true);
637 xmlhttp.onreadystatechange=filterlist_callback;
638 xmlhttp.send(null);
639 }
48f0adb0 640 } else {
89cb787e 641 alert(__("No filters are selected."));
48f0adb0 642 }
90ac84df
AD
643
644 return false;
48f0adb0
AD
645}
646
647
83fe4d6d
AD
648function removeSelectedFeeds() {
649
c0e5a40e 650 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
651 printLockingError();
652 return
653 }
654
83fe4d6d
AD
655 var sel_rows = getSelectedFeeds();
656
331900c6
AD
657 if (sel_rows.length > 0) {
658
f56e3080 659 var ok = confirm(__("Unsubscribe from selected feeds?"));
331900c6 660
69668465
AD
661 if (ok) {
662
42c32916 663 notify_progress("Unsubscribing from selected feeds...");
69668465
AD
664
665 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
666 param_escape(sel_rows.toString()), true);
667 xmlhttp.onreadystatechange=feedlist_callback;
668 xmlhttp.send(null);
669 }
71ad3959 670
71ad3959 671 } else {
331900c6 672
89cb787e 673 alert(__("No feeds are selected."));
331900c6 674
71ad3959 675 }
90ac84df
AD
676
677 return false;
71ad3959 678}
007bda35 679
c4a36709
AD
680function clearSelectedFeeds() {
681
682 if (!xmlhttp_ready(xmlhttp)) {
683 printLockingError();
684 return
685 }
686
687 var sel_rows = getSelectedFeeds();
688
689 if (sel_rows.length > 1) {
690 alert(__("Please select only one feed."));
691 return;
692 }
693
694 if (sel_rows.length > 0) {
695
696 var ok = confirm(__("Erase all non-starred articles in selected feed?"));
697
698 if (ok) {
699 notify_progress("Clearing selected feed...");
700 clearFeedArticles(sel_rows[0]);
701 }
702
703 } else {
704
705 alert(__("No feeds are selected."));
706
707 }
708
709 return false;
710}
711
e88a65f4
AD
712function purgeSelectedFeeds() {
713
714 if (!xmlhttp_ready(xmlhttp)) {
715 printLockingError();
716 return
717 }
718
719 var sel_rows = getSelectedFeeds();
720
721 if (sel_rows.length > 0) {
722
723 var pr = prompt(__("How many days of articles to keep (0 - use default)?"), "0");
724
725 if (pr != undefined) {
726 notify_progress("Purging selected feed...");
727
728 var query = "backend.php?op=rpc&subop=purge&ids="+
729 param_escape(sel_rows.toString()) + "&days=" + pr;
730
731 debug(query);
732
733 new Ajax.Request(query, {
734 onComplete: function(transport) {
735 notify('');
736 } });
737 }
738
739 } else {
740
741 alert(__("No feeds are selected."));
742
743 }
744
745 return false;
746}
747
91ff844a
AD
748function removeSelectedFeedCats() {
749
750 if (!xmlhttp_ready(xmlhttp)) {
751 printLockingError();
752 return
753 }
754
755 var sel_rows = getSelectedFeedCats();
756
757 if (sel_rows.length > 0) {
758
f56e3080 759 var ok = confirm(__("Remove selected categories?"));
91ff844a 760
69668465 761 if (ok) {
42c32916 762 notify_progress("Removing selected categories...");
69668465 763
9c483746 764 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+
69668465 765 param_escape(sel_rows.toString()), true);
9c483746 766 xmlhttp.onreadystatechange=infobox_callback;
69668465
AD
767 xmlhttp.send(null);
768 }
91ff844a
AD
769
770 } else {
771
89cb787e 772 alert(__("No categories are selected."));
91ff844a
AD
773
774 }
775
90ac84df 776 return false;
91ff844a
AD
777}
778
508a81e1
AD
779function feedEditCancel() {
780
c0e5a40e 781 if (!xmlhttp_ready(xmlhttp)) {
508a81e1
AD
782 printLockingError();
783 return
784 }
785
a349077c 786 try {
57f734c8 787 document.getElementById("subscribe_to_feed_btn").disabled = false;
a349077c
AD
788 document.getElementById("top25_feeds_btn").disabled = false;
789 } catch (e) {
790 // this button is not always available, no-op if not found
791 }
792
327a3bbe
AD
793 closeInfoBox();
794
673d54ca 795 selectPrefRows('feed', false); // cleanup feed selection
508a81e1 796
90ac84df 797 return false;
508a81e1
AD
798}
799
91ff844a
AD
800function feedCatEditCancel() {
801
802 if (!xmlhttp_ready(xmlhttp)) {
803 printLockingError();
804 return
805 }
806
807 active_feed_cat = false;
808
0ceded7a 809// notify("Operation cancelled.");
91ff844a 810
9c483746
AD
811 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true);
812 xmlhttp.onreadystatechange=infobox_callback;
91ff844a
AD
813 xmlhttp.send(null);
814
90ac84df 815 return false;
91ff844a
AD
816}
817
603c27f8
AD
818function feedEditSave() {
819
47c6c988 820 try {
47c6c988
AD
821
822 if (!xmlhttp_ready(xmlhttp)) {
823 printLockingError();
824 return
825 }
ad815c71 826
14f69488 827 // FIXME: add parameter validation
e3c99f3b 828
14f69488 829 var query = Form.serialize("edit_feed_form");
b0da3a7b 830
42c32916 831 notify_progress("Saving feed...");
673d54ca 832
47c6c988
AD
833 xmlhttp.open("POST", "backend.php", true);
834 xmlhttp.onreadystatechange=feedlist_callback;
835 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
14f69488
AD
836 xmlhttp.send(query);
837
59a543f0
AD
838 closeInfoBox();
839
c14b5566
AD
840 return false;
841
47c6c988
AD
842 } catch (e) {
843 exception_error("feedEditSave", e);
b0da3a7b 844 }
508a81e1
AD
845}
846
5ddadb4c
AD
847function feedCatEditSave() {
848
849 if (!xmlhttp_ready(xmlhttp)) {
850 printLockingError();
851 return
852 }
853
42c32916 854 notify_progress("Saving category...");
5ddadb4c 855
0666e120
AD
856 var query = Form.serialize("feed_cat_edit_form");
857
858 xmlhttp.open("GET", "backend.php?" + query, true);
9c483746 859 xmlhttp.onreadystatechange=infobox_callback;
5ddadb4c
AD
860 xmlhttp.send(null);
861
862 active_feed_cat = false;
863
90ac84df 864 return false;
5ddadb4c
AD
865}
866
e6cb77a0
AD
867function userEditCancel() {
868
869 if (!xmlhttp_ready(xmlhttp)) {
870 printLockingError();
871 return
872 }
873
3c5783b7 874 selectPrefRows('user', false); // cleanup feed selection
3c5783b7 875 closeInfoBox();
90ac84df
AD
876
877 return false;
e6cb77a0 878}
48f0adb0 879
a0d53889
AD
880function filterEditCancel() {
881
882 if (!xmlhttp_ready(xmlhttp)) {
883 printLockingError();
884 return
885 }
4220b0bd 886
57f734c8
AD
887 try {
888 document.getElementById("create_filter_btn").disabled = false;
889 selectPrefRows('filter', false); // cleanup feed selection
890 } catch (e) { }
891
07164479 892 closeInfoBox();
90ac84df
AD
893
894 return false;
a0d53889
AD
895}
896
e6cb77a0
AD
897function userEditSave() {
898
e6cb77a0
AD
899 if (!xmlhttp_ready(xmlhttp)) {
900 printLockingError();
901 return
902 }
903
3c5783b7 904 var login = document.forms["user_edit_form"].login.value;
e6cb77a0
AD
905
906 if (login.length == 0) {
89cb787e 907 alert(__("Login field cannot be blank."));
e6cb77a0
AD
908 return;
909 }
3c5783b7 910
42c32916 911 notify_progress("Saving user...");
4220b0bd
AD
912
913 closeInfoBox();
914
3c5783b7
AD
915 var query = Form.serialize("user_edit_form");
916
917 xmlhttp.open("GET", "backend.php?" + query, true);
dbd9e2f1 918 xmlhttp.onreadystatechange=userlist_callback;
e6cb77a0 919 xmlhttp.send(null);
90ac84df
AD
920
921 return false;
e6cb77a0
AD
922}
923
924
a0d53889
AD
925function filterEditSave() {
926
a0d53889
AD
927 if (!xmlhttp_ready(xmlhttp)) {
928 printLockingError();
929 return
930 }
931
9ee3ac59 932/* if (!is_opera()) {
7c620da8
AD
933 var reg_exp = document.forms["filter_edit_form"].reg_exp.value;
934
935 if (reg_exp.length == 0) {
936 alert("Filter expression field cannot be blank.");
937 return;
938 }
9ee3ac59 939 } */
a0d53889 940
42c32916 941 notify_progress("Saving filter...");
a0d53889 942
7e939457 943 var query = Form.serialize("filter_edit_form");
dbd9e2f1 944
07164479
AD
945 closeInfoBox();
946
4220b0bd
AD
947 document.getElementById("create_filter_btn").disabled = false;
948
7e939457 949 xmlhttp.open("GET", "backend.php?" + query, true);
a0d53889 950 xmlhttp.onreadystatechange=filterlist_callback;
7e939457 951 xmlhttp.send(null);
a0d53889 952
90ac84df 953 return false;
a0d53889
AD
954}
955
a0d53889 956
e6cb77a0
AD
957function editSelectedUser() {
958 var rows = getSelectedUsers();
959
960 if (rows.length == 0) {
f3977cf5 961 alert(__("No users are selected."));
e6cb77a0
AD
962 return;
963 }
964
965 if (rows.length > 1) {
f3977cf5 966 alert(__("Please select only one user."));
e6cb77a0
AD
967 return;
968 }
969
dbd9e2f1
AD
970 notify("");
971
e6cb77a0
AD
972 editUser(rows[0]);
973}
974
975function resetSelectedUserPass() {
976 var rows = getSelectedUsers();
977
978 if (rows.length == 0) {
f3977cf5 979 alert(__("No users are selected."));
e6cb77a0
AD
980 return;
981 }
982
983 if (rows.length > 1) {
f3977cf5 984 alert(__("Please select only one user."));
e6cb77a0
AD
985 return;
986 }
987
f3977cf5 988 var ok = confirm(__("Reset password of selected user?"));
e6cb77a0 989
69668465 990 if (ok) {
42c32916 991 notify_progress("Resetting password for selected user...");
69668465
AD
992
993 var id = rows[0];
994
995 xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
996 param_escape(id), true);
997 xmlhttp.onreadystatechange=userlist_callback;
998 xmlhttp.send(null);
999 }
e6cb77a0
AD
1000}
1001
717f5e64 1002function selectedUserDetails() {
e6cb77a0 1003
1a7572cb
AD
1004 if (!xmlhttp_ready(xmlhttp)) {
1005 printLockingError();
1006 return
1007 }
1008
717f5e64
AD
1009 var rows = getSelectedUsers();
1010
1011 if (rows.length == 0) {
f3977cf5 1012 alert(__("No users are selected."));
717f5e64
AD
1013 return;
1014 }
1015
1016 if (rows.length > 1) {
f3977cf5 1017 alert(__("Please select only one user."));
717f5e64
AD
1018 return;
1019 }
1020
0077a65c 1021 notify_progress("Loading, please wait...");
717f5e64 1022
0077a65c 1023 var id = rows[0];
dbd9e2f1 1024
5a437c88 1025 xmlhttp.open("GET", "backend.php?op=pref-users&subop=user-details&id=" + id, true);
c6c3a07f
AD
1026 xmlhttp.onreadystatechange=infobox_callback;
1027 xmlhttp.send(null);
1028
1029}
1030
1031function selectedFeedDetails() {
1032
1033 if (!xmlhttp_ready(xmlhttp)) {
1034 printLockingError();
1035 return
1036 }
1037
1038 var rows = getSelectedFeeds();
1039
1040 if (rows.length == 0) {
f3977cf5 1041 alert(__("No feeds are selected."));
c6c3a07f
AD
1042 return;
1043 }
1044
01b3e191 1045 if (rows.length > 1) {
f3977cf5 1046 alert(__("Please select only one feed."));
01b3e191
AD
1047 return;
1048 }
c6c3a07f 1049
df268d47 1050// var id = rows[0];
c6c3a07f 1051
dbd9e2f1
AD
1052 notify("");
1053
df268d47
AD
1054 xmlhttp.open("GET", "backend.php?op=feed-details&id=" +
1055 param_escape(rows.toString()), true);
c6c3a07f 1056 xmlhttp.onreadystatechange=infobox_callback;
1a7572cb 1057 xmlhttp.send(null);
717f5e64
AD
1058
1059}
a0d53889
AD
1060
1061function editSelectedFilter() {
1062 var rows = getSelectedFilters();
1063
1064 if (rows.length == 0) {
f3977cf5 1065 alert(__("No filters are selected."));
a0d53889
AD
1066 return;
1067 }
1068
1069 if (rows.length > 1) {
f3977cf5 1070 alert(__("Please select only one filter."));
a0d53889
AD
1071 return;
1072 }
1073
dbd9e2f1
AD
1074 notify("");
1075
a0d53889
AD
1076 editFilter(rows[0]);
1077
1078}
1079
1080
508a81e1
AD
1081function editSelectedFeed() {
1082 var rows = getSelectedFeeds();
1083
1084 if (rows.length == 0) {
f3977cf5 1085 alert(__("No feeds are selected."));
508a81e1
AD
1086 return;
1087 }
1088
1089 if (rows.length > 1) {
f3977cf5 1090 alert(__("Please select one feed."));
508a81e1
AD
1091 return;
1092 }
1093
dbd9e2f1
AD
1094 notify("");
1095
508a81e1 1096 editFeed(rows[0]);
91ff844a
AD
1097
1098}
1099
758e1c4a
AD
1100function editSelectedFeeds() {
1101
1102 if (!xmlhttp_ready(xmlhttp)) {
1103 printLockingError();
1104 return
1105 }
1106
1107 var rows = getSelectedFeeds();
1108
1109 if (rows.length == 0) {
1110 alert(__("No feeds are selected."));
1111 return;
1112 }
1113
1114 notify("");
1115
1116 disableHotkeys();
1117
1118 notify_progress("Loading, please wait...");
1119
1120 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
1121 param_escape(rows.toString()), true);
1122
1123 xmlhttp.onreadystatechange=infobox_callback;
1124 xmlhttp.send(null);
1125
1126}
1127
91ff844a
AD
1128function editSelectedFeedCat() {
1129 var rows = getSelectedFeedCats();
1130
1131 if (rows.length == 0) {
f3977cf5 1132 alert(__("No categories are selected."));
91ff844a
AD
1133 return;
1134 }
1135
1136 if (rows.length > 1) {
f3977cf5 1137 alert(__("Please select only one category."));
91ff844a
AD
1138 return;
1139 }
1140
1141 notify("");
1142
1143 editFeedCat(rows[0]);
508a81e1
AD
1144
1145}
1146
eec498c3 1147function piggie(enable) {
13ad9102 1148 if (enable) {
d437c8cf 1149 debug("I LOVEDED IT!");
1cac3c31 1150 var piggie = document.getElementById("piggie");
33377ef3 1151
537625c6
AD
1152 Element.show(piggie);
1153 Position.Center(piggie);
1154 Effect.Puff(piggie);
1155
508a81e1 1156 }
508a81e1
AD
1157}
1158
9f311df6
AD
1159function validateOpmlImport() {
1160
1161 var opml_file = document.getElementById("opml_file");
1162
1163 if (opml_file.value.length == 0) {
f3977cf5 1164 alert(__("No OPML file to upload."));
9f311df6
AD
1165 return false;
1166 } else {
1167 return true;
1168 }
1169}
1170
0e317f9d 1171function updateFilterList(sort_key) {
a0d53889
AD
1172
1173 if (!xmlhttp_ready(xmlhttp)) {
1174 printLockingError();
1175 return
1176 }
1177
9c87d75c
AD
1178 var filter_search = document.getElementById("filter_search");
1179 var search = "";
1180 if (filter_search) { search = filter_search.value; }
1181
e161a2cc 1182 xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" +
9c87d75c
AD
1183 param_escape(sort_key) +
1184 "&search=" + param_escape(search), true);
a0d53889
AD
1185 xmlhttp.onreadystatechange=filterlist_callback;
1186 xmlhttp.send(null);
1187
1188}
1189
e161a2cc 1190function updateLabelList(sort_key) {
48f0adb0
AD
1191
1192 if (!xmlhttp_ready(xmlhttp)) {
1193 printLockingError();
1194 return
1195 }
1196
112d2aec
AD
1197 var label_search = document.getElementById("label_search");
1198 var search = "";
1199 if (label_search) { search = label_search.value; }
1200
e161a2cc 1201 xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" +
112d2aec
AD
1202 param_escape(sort_key) +
1203 "&search=" + param_escape(search), true);
48f0adb0
AD
1204 xmlhttp.onreadystatechange=labellist_callback;
1205 xmlhttp.send(null);
48f0adb0
AD
1206}
1207
4255b24c
AD
1208function updatePrefsList() {
1209
1210 if (!xmlhttp_ready(xmlhttp)) {
1211 printLockingError();
1212 return
1213 }
1214
4255b24c
AD
1215 xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
1216 xmlhttp.onreadystatechange=prefslist_callback;
1217 xmlhttp.send(null);
1218
1219}
1220
e513a74a 1221function selectTab(id, noupdate, subop) {
a7f22b70
AD
1222
1223// alert(id);
48f0adb0 1224
b2caf812 1225 if (!id) id = active_tab;
7f74a9da 1226
b2caf812 1227 try {
59a543f0 1228
b2caf812
AD
1229 if (!xmlhttp_ready(xmlhttp)) {
1230 printLockingError();
1231 return
a7f22b70 1232 }
f5a50b25 1233
a422968f
AD
1234 try {
1235 var c = document.getElementById('prefContent');
1236 c.scrollTop = 0;
1237 } catch (e) { };
1238
b2caf812 1239 if (!noupdate) {
f5a50b25 1240
b2caf812
AD
1241 debug("selectTab: " + id + "(NU: " + noupdate + ")");
1242
9e31e1b9 1243 notify_progress("Loading, please wait...");
b2caf812
AD
1244
1245 // close active infobox if needed
1246 closeInfoBox();
1247
1248 // clean up all current selections, just in case
1249 active_feed_cat = false;
d15f8675
AD
1250
1251// Effect.Fade("prefContent", {duration: 1, to: 0.01,
1252// queue: { position:'end', scope: 'FEED_TAB', limit: 1 } } );
1253
b2caf812
AD
1254 if (id == "feedConfig") {
1255 updateFeedList();
1256 } else if (id == "filterConfig") {
1257 updateFilterList();
1258 } else if (id == "labelConfig") {
1259 updateLabelList();
1260 } else if (id == "genConfig") {
1261 updatePrefsList();
1262 } else if (id == "userConfig") {
1263 updateUsersList();
1264 } else if (id == "feedBrowser") {
1265 updateBigFeedBrowser();
1266 }
f5a50b25 1267 }
6068d33b
AD
1268
1269 /* clean selection from all tabs */
b2caf812 1270
6068d33b
AD
1271 var tabs_holder = document.getElementById("prefTabs");
1272 var tab = tabs_holder.firstChild;
1273
1274 while (tab) {
1275 if (tab.className && tab.className.match("prefsTabSelected")) {
b2caf812
AD
1276 tab.className = "prefsTab";
1277 }
6068d33b 1278 tab = tab.nextSibling;
f5a50b25 1279 }
6068d33b
AD
1280
1281 /* mark new tab as selected */
1282
b2caf812
AD
1283 tab = document.getElementById(id + "Tab");
1284
1285 if (tab) {
1286 if (!tab.className.match("Selected")) {
1287 tab.className = tab.className + "Selected";
1288 }
1289 }
1290
b2caf812 1291 active_tab = id;
f5a50b25 1292
b2caf812
AD
1293 } catch (e) {
1294 exception_error("selectTab", e);
a7565293 1295 }
a7565293
AD
1296}
1297
1298function backend_sanity_check_callback() {
f5a50b25 1299
a7565293
AD
1300 if (xmlhttp.readyState == 4) {
1301
1302 try {
7a09510c
AD
1303
1304 if (sanity_check_done) {
81352b54
AD
1305 fatalError(11, "Sanity check request received twice. This can indicate "+
1306 "presence of Firebug or some other disrupting extension. "+
1307 "Please disable it and try again.");
7a09510c
AD
1308 return;
1309 }
1310
a7565293
AD
1311 if (!xmlhttp.responseXML) {
1312 fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText);
1313 return;
1314 }
1315
1316 var reply = xmlhttp.responseXML.firstChild.firstChild;
1317
1318 if (!reply) {
1319 fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText);
1320 return;
1321 }
1322
1323 var error_code = reply.getAttribute("error-code");
1324
1325 if (error_code && error_code != 0) {
1326 return fatalError(error_code, reply.getAttribute("error-msg"));
1327 }
1328
1329 debug("sanity check ok");
1330
1331 var params = reply.nextSibling;
1332
1333 if (params) {
1334 debug('reading init-params...');
1335 var param = params.firstChild;
1336
1337 while (param) {
1338 var k = param.getAttribute("key");
1339 var v = param.getAttribute("value");
1340 debug(k + " => " + v);
1341 init_params[k] = v;
1342 param = param.nextSibling;
1343 }
1344 }
1345
7a09510c
AD
1346 sanity_check_done = true;
1347
a7565293
AD
1348 init_second_stage();
1349
1350 } catch (e) {
1351 exception_error("backend_sanity_check_callback", e);
1352 }
1353 }
1354}
1355
1356function init_second_stage() {
1357
b2caf812
AD
1358 try {
1359 active_tab = getInitParam("prefs_active_tab");
fe8d2059 1360 if (!active_tab || active_tab == '0') active_tab = "genConfig";
4da47970 1361
d437c8cf
AD
1362 document.onkeydown = pref_hotkey_handler;
1363
e513a74a
AD
1364 var tab = getURLParam('tab');
1365
1366 caller_subop = getURLParam('subop');
1367
1368 if (tab) {
1369 active_tab = tab;
1370 }
1371
b2caf812
AD
1372 if (navigator.userAgent.match("Opera")) {
1373 setTimeout("selectTab()", 500);
1374 } else {
1375 selectTab(active_tab);
1376 }
1377 notify("");
08827aaf
AD
1378
1379 loading_set_progress(60);
1380
b2caf812
AD
1381 } catch (e) {
1382 exception_error("init_second_stage", e);
1383 }
a0d53889
AD
1384}
1385
007bda35 1386function init() {
e2ec66a8 1387
7719618b
AD
1388 try {
1389
97dcd654
AD
1390 if (arguments.callee.done) return;
1391 arguments.callee.done = true;
1392
a7565293 1393 if (getURLParam('debug')) {
8836613c 1394 Element.show("debug_output");
a7565293
AD
1395 debug('debug mode activated');
1396 }
1397
7719618b
AD
1398 // IE kludge
1399 if (!xmlhttp) {
1400 document.getElementById("prefContent").innerHTML =
1401 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1402 "to function properly. Your browser doesn't seem to support it.";
1403 return;
1404 }
4da47970 1405
08827aaf
AD
1406 loading_set_progress(30);
1407
a7565293
AD
1408 xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck", true);
1409 xmlhttp.onreadystatechange=backend_sanity_check_callback;
1410 xmlhttp.send(null);
1411
7719618b
AD
1412 } catch (e) {
1413 exception_error("init", e);
e2ec66a8 1414 }
007bda35 1415}
b1895692 1416
f932bc9f
AD
1417function categorizeSelectedFeeds() {
1418
1419 if (!xmlhttp_ready(xmlhttp)) {
1420 printLockingError();
1421 return
1422 }
1423
1424 var sel_rows = getSelectedFeeds();
1425
1426 var cat_sel = document.getElementById("sfeed_set_fcat");
79f3553b 1427 var cat_id = cat_sel[cat_sel.selectedIndex].value;
f932bc9f
AD
1428
1429 if (sel_rows.length > 0) {
1430
42c32916 1431 notify_progress("Changing category of selected feeds...");
f932bc9f
AD
1432
1433 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1434 param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);
1435 xmlhttp.onreadystatechange=feedlist_callback;
1436 xmlhttp.send(null);
1437
1438 } else {
1439
f3977cf5 1440 alert(__("No feeds are selected."));
f932bc9f
AD
1441
1442 }
1443
1444}
69668465
AD
1445
1446function validatePrefsReset() {
b652c1b7
AD
1447 try {
1448 var ok = confirm(__("Reset to defaults?"));
1449
1450 if (ok) {
1451
1452 var query = Form.serialize("pref_prefs_form");
1453 query = query + "&subop=reset-config";
1454 debug(query);
1455
1456 xmlhttp.open("POST", "backend.php", true);
1457 xmlhttp.onreadystatechange=prefs_reset_callback;
1458 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1459 xmlhttp.send(query);
1460 }
1461
1462 } catch (e) {
1463 exception_error("validatePrefsSave", e);
1464 }
1465
1466 return false;
1467
69668465 1468}
f9cb39ac 1469
6311acbe 1470function browseFeeds(limit) {
f9cb39ac
AD
1471
1472 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1473 xmlhttp.onreadystatechange=infobox_callback;
1474 xmlhttp.send(null);
1475
1476}
a0476535
AD
1477
1478function feedBrowserSubscribe() {
1479 try {
a0476535 1480
c0ae0fdb 1481 var selected = getSelectedFeedsFromBrowser();
a0476535
AD
1482
1483 if (selected.length > 0) {
1484 closeInfoBox();
1485 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1486 param_escape(selected.toString()), true);
1487 xmlhttp.onreadystatechange=feedlist_callback;
1488 xmlhttp.send(null);
1489 } else {
89cb787e 1490 alert(__("No feeds are selected."));
a0476535
AD
1491 }
1492
1493 } catch (e) {
1494 exception_error("feedBrowserSubscribe", e);
1495 }
1496}
c6232e43 1497
ce8de904
AD
1498function updateBigFeedBrowserBtn() {
1499 notify_progress("Loading, please wait...");
1500 return updateBigFeedBrowser();
1501}
1502
1503function updateBigFeedBrowser(limit, from_button) {
c6232e43
AD
1504
1505 if (!xmlhttp_ready(xmlhttp)) {
1506 printLockingError();
1507 return
1508 }
1509
6311acbe
AD
1510 var query = "backend.php?op=pref-feed-browser";
1511
1512 var limit_sel = document.getElementById("feedBrowserLimit");
1513
1514 if (limit_sel) {
1515 var limit = limit_sel[limit_sel.selectedIndex].value;
1516 query = query + "&limit=" + param_escape(limit);
1517 }
1518
76e9a473
AD
1519 var search = document.getElementById("feed_browser_search");
1520
1521 if (search) {
1522 query = query + "&search=" + param_escape(search.value);
1523 }
1524
6311acbe 1525 xmlhttp.open("GET", query, true);
c6232e43
AD
1526 xmlhttp.onreadystatechange=feed_browser_callback;
1527 xmlhttp.send(null);
c6232e43
AD
1528}
1529
c2b2aee0 1530function browserToggleExpand(id) {
c6232e43
AD
1531 try {
1532/* if (feed_to_expand && feed_to_expand != id) {
1533 var d = document.getElementById("BRDET-" + feed_to_expand);
1534 d.style.display = "none";
1535 } */
c2b2aee0 1536
ff725e9b
AD
1537 if (!xmlhttp_ready(xmlhttp)) {
1538 printLockingError();
1539 return
1540 }
1541
051c4d56
AD
1542/* if (feed_to_expand && id != feed_to_expand) {
1543 Effect.Fade('BRDET-' + feed_to_expand, {duration : 0.5});
1544 } */
c2b2aee0 1545
051c4d56 1546 var d = document.getElementById("BRDET-" + id);
c6232e43 1547
de84c092
AD
1548 notify_progress("Loading, please wait...");
1549
34a01a20 1550 if (Element.visible(d)) {
051c4d56 1551 Effect.Fade(d, {duration : 0.5});
34a01a20 1552 } else {
c2b2aee0 1553 feed_to_expand = id;
c6232e43 1554
c2b2aee0
AD
1555 xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1556 + param_escape(id), true);
1557 xmlhttp.onreadystatechange=expand_feed_callback;
1558 xmlhttp.send(null);
1559 }
c6232e43
AD
1560
1561 } catch (e) {
34a01a20 1562 exception_error("browserToggleExpand", e);
c6232e43
AD
1563 }
1564}
64dc5976 1565
ce3bf408
AD
1566function selectPrefRows(kind, select) {
1567
1568 if (kind) {
1569 var opbarid = false;
1570 var nchk = false;
1571 var nrow = false;
1572 var lname = false;
1573
1574 if (kind == "feed") {
1575 opbarid = "feedOpToolbar";
1576 nrow = "FEEDR-";
1577 nchk = "FRCHK-";
1578 lname = "prefFeedList";
1579 } else if (kind == "fcat") {
1580 opbarid = "catOpToolbar";
1581 nrow = "FCATR-";
9c483746 1582 nchk = "FCCHK-";
ce3bf408
AD
1583 lname = "prefFeedCatList";
1584 } else if (kind == "filter") {
1585 opbarid = "filterOpToolbar";
1586 nrow = "FILRR-";
1587 nchk = "FICHK-";
1588 lname = "prefFilterList";
1589 } else if (kind == "label") {
1590 opbarid = "labelOpToolbar";
1591 nrow = "LILRR-";
a4dbc524 1592 nchk = "LICHK-";
ce3bf408
AD
1593 lname = "prefLabelList";
1594 } else if (kind == "user") {
1595 opbarid = "userOpToolbar";
1596 nrow = "UMRR-";
1597 nchk = "UMCHK-";
1598 lname = "prefUserList";
1599 }
1600
1601 if (opbarid) {
1602 selectTableRowsByIdPrefix(lname, nrow, nchk, select);
1603 disableContainerChildren(opbarid, !select);
1604 }
1605
1606 }
1607}
1608
1609
1610function toggleSelectPrefRow(sender, kind) {
1611
1612 toggleSelectRow(sender);
1613
1614 if (kind) {
1615 var opbarid = false;
1616 var nsel = -1;
1617
1618 if (kind == "feed") {
1619 opbarid = "feedOpToolbar";
1620 nsel = getSelectedFeeds();
1621 } else if (kind == "fcat") {
1622 opbarid = "catOpToolbar";
1623 nsel = getSelectedFeedCats();
1624 } else if (kind == "filter") {
1625 opbarid = "filterOpToolbar";
1626 nsel = getSelectedFilters();
1627 } else if (kind == "label") {
1628 opbarid = "labelOpToolbar";
1629 nsel = getSelectedLabels();
1630 } else if (kind == "user") {
1631 opbarid = "userOpToolbar";
1632 nsel = getSelectedUsers();
1633 }
1634
1635 if (opbarid && nsel != -1) {
1636 disableContainerChildren(opbarid, nsel == false);
1637 }
1638
1639 }
1640}
1641
c0ae0fdb
AD
1642function toggleSelectFBListRow(sender) {
1643 toggleSelectListRow(sender);
1644 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);
1645}
d437c8cf
AD
1646
1647var seq = "";
1648
1649function pref_hotkey_handler(e) {
1650 try {
1651
1652 var keycode;
746dcf42
AD
1653 var shift_key = false;
1654
1655 try {
1656 shift_key = e.shiftKey;
1657 } catch (e) {
1658
1659 }
1660
d437c8cf
AD
1661 if (window.event) {
1662 keycode = window.event.keyCode;
1663 } else if (e) {
1664 keycode = e.which;
1665 }
746dcf42 1666
eec498c3
AD
1667 var keychar = String.fromCharCode(keycode);
1668
746dcf42
AD
1669 if (keycode == 27) { // escape
1670 if (Element.visible("hotkey_help_overlay")) {
1671 Element.hide("hotkey_help_overlay");
1672 }
1673 hotkey_prefix = false;
1674 closeInfoBox();
1675 }
1676
1677 if (!hotkeys_enabled) {
1678 debug("hotkeys disabled");
1679 return;
1680 }
1681
1682 if (keycode == 16) return; // ignore lone shift
1683
6068d33b
AD
1684 if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
1685 hotkey_prefix = keycode;
eec498c3 1686 debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
6068d33b
AD
1687 return;
1688 }
1689
746dcf42
AD
1690 if (Element.visible("hotkey_help_overlay")) {
1691 Element.hide("hotkey_help_overlay");
1692 }
1693
d437c8cf
AD
1694 if (keycode == 13 || keycode == 27) {
1695 seq = "";
1696 } else {
1697 seq = seq + "" + keycode;
1698 }
1699
746dcf42 1700 /* Global hotkeys */
d437c8cf 1701
746dcf42
AD
1702 if (!hotkey_prefix) {
1703
1704 if (keycode == 68 && shift_key) { // d
8836613c
AD
1705 if (!Element.visible("debug_output")) {
1706 Element.show("debug_output");
746dcf42
AD
1707 debug('debug mode activated');
1708 } else {
8836613c 1709 Element.hide("debug_output");
746dcf42 1710 }
746dcf42
AD
1711 return;
1712 }
1713
eec498c3 1714 if ((keycode == 191 || keychar == '?') && shift_key) { // ?
746dcf42 1715 if (!Element.visible("hotkey_help_overlay")) {
86deaa0e
AD
1716 //Element.show("hotkey_help_overlay");
1717 Effect.Appear("hotkey_help_overlay", {duration : 0.3});
746dcf42
AD
1718 } else {
1719 Element.hide("hotkey_help_overlay");
1720 }
eec498c3 1721 return false;
746dcf42
AD
1722 }
1723
eec498c3 1724 if (keycode == 191 || keychar == '/') { // /
477402d8 1725 var search_boxes = new Array("label_search",
e8be0f5b 1726 "feed_search", "filter_search", "user_search", "feed_browser_search");
477402d8
AD
1727
1728 for (var i = 0; i < search_boxes.length; i++) {
1729 var elem = document.getElementById(search_boxes[i]);
1730 if (elem) {
eec498c3
AD
1731 focus_element(search_boxes[i]);
1732 return false;
477402d8
AD
1733 }
1734 }
477402d8 1735 }
6068d33b
AD
1736 }
1737
1738 /* Prefix c */
1739
1740 if (hotkey_prefix == 67) { // c
1741 hotkey_prefix = false;
1742
1743 if (keycode == 70) { // f
eec498c3
AD
1744 displayDlg("quickAddFilter");
1745 return false;
6068d33b
AD
1746 }
1747
1748 if (keycode == 83) { // s
eec498c3
AD
1749 displayDlg("quickAddFeed");
1750 return false;
6068d33b
AD
1751 }
1752
ceb30ba4 1753/* if (keycode == 76) { // l
eec498c3
AD
1754 displayDlg("quickAddLabel");
1755 return false;
ceb30ba4 1756 } */
6068d33b
AD
1757
1758 if (keycode == 85) { // u
1759 // no-op
1760 }
1761
57f734c8 1762 if (keycode == 67) { // c
eec498c3
AD
1763 editFeedCats();
1764 return false;
57f734c8
AD
1765 }
1766
a80b05ea 1767 if (keycode == 84 && shift_key) { // T
eec498c3
AD
1768 browseFeeds();
1769 return false;
a80b05ea
AD
1770 }
1771
6068d33b
AD
1772 }
1773
1774 /* Prefix g */
1775
1776 if (hotkey_prefix == 71) { // g
1777
1778 hotkey_prefix = false;
1779
1780 if (keycode == 49 && document.getElementById("genConfigTab")) { // 1
746dcf42 1781 selectTab("genConfig");
eec498c3 1782 return false;
746dcf42
AD
1783 }
1784
1785 if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2
eec498c3
AD
1786 selectTab("feedConfig");
1787 return false;
746dcf42
AD
1788 }
1789
1790 if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3
eec498c3
AD
1791 selectTab("feedBrowser");
1792 return false;
746dcf42
AD
1793 }
1794
1795 if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4
eec498c3
AD
1796 selectTab("filterConfig");
1797 return false;
746dcf42
AD
1798 }
1799
1800 if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5
eec498c3
AD
1801 selectTab("labelConfig");
1802 return false;
746dcf42
AD
1803 }
1804
1805 if (keycode == 54 && document.getElementById("userConfigTab")) { // 6
eec498c3
AD
1806 selectTab("userConfig");
1807 return false;
746dcf42
AD
1808 }
1809
8d727bfc
AD
1810 if (keycode == 88) { // x
1811 return gotoMain();
1812 }
1813
746dcf42
AD
1814 }
1815
1816 if (document.getElementById("piggie")) {
1817
1818 if (seq.match("807371717369")) {
1819 seq = "";
eec498c3 1820 piggie(true);
746dcf42 1821 } else {
eec498c3 1822 piggie(false);
746dcf42
AD
1823 }
1824 }
1825
1826 if (hotkey_prefix) {
eec498c3 1827 debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
d437c8cf 1828 } else {
eec498c3 1829 debug("KP: CODE=" + keycode + " CHAR=" + keychar);
d437c8cf 1830 }
d437c8cf
AD
1831
1832 } catch (e) {
1833 exception_error("pref_hotkey_handler", e);
1834 }
1835}
1836
9c483746
AD
1837function editFeedCats() {
1838 if (!xmlhttp_ready(xmlhttp)) {
1839 printLockingError();
1840 return
1841 }
1842
a349077c
AD
1843 document.getElementById("subscribe_to_feed_btn").disabled = true;
1844
1845 try {
1846 document.getElementById("top25_feeds_btn").disabled = true;
1847 } catch (e) {
1848 // this button is not always available, no-op if not found
1849 }
1850
9c483746 1851 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true);
11f083e7 1852 xmlhttp.onreadystatechange=infobox_feed_cat_callback;
9c483746
AD
1853 xmlhttp.send(null);
1854}
a3656a41
AD
1855
1856function showFeedsWithErrors() {
1857 displayDlg('feedUpdateErrors');
1858}
073ca0e6 1859
d95bd220
AD
1860function changeUserPassword() {
1861
1862 try {
1863
1864 if (!xmlhttp_ready(xmlhttp)) {
1865 printLockingError();
1866 return false;
1867 }
1868
ae661a8c
AD
1869 var f = document.forms["change_pass_form"];
1870
1871 if (f) {
1872 if (f.OLD_PASSWORD.value == "") {
1873 new Effect.Highlight(f.OLD_PASSWORD);
1874 notify_error("Old password cannot be blank.");
1875 return false;
1876 }
1877
1878 if (f.NEW_PASSWORD.value == "") {
1879 new Effect.Highlight(f.NEW_PASSWORD);
1880 notify_error("New password cannot be blank.");
1881 return false;
1882 }
1883
1884 if (f.CONFIRM_PASSWORD.value == "") {
1885 new Effect.Highlight(f.CONFIRM_PASSWORD);
1886 notify_error("Entered passwords do not match.");
1887 return false;
1888 }
1889
1890 if (f.CONFIRM_PASSWORD.value != f.NEW_PASSWORD.value) {
1891 new Effect.Highlight(f.CONFIRM_PASSWORD);
1892 new Effect.Highlight(f.NEW_PASSWORD);
1893 notify_error("Entered passwords do not match.");
1894 return false;
1895 }
1896
1897 }
1898
d95bd220
AD
1899 var query = Form.serialize("change_pass_form");
1900
1901 notify_progress("Trying to change password...");
1902
1903 xmlhttp.open("POST", "backend.php", true);
1904 xmlhttp.onreadystatechange=changepass_callback;
1905 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1906 xmlhttp.send(query);
1907
1908 } catch (e) {
1909 exception_error("changeUserPassword", e);
1910 }
1911
1912 return false;
1913}
073ca0e6 1914
42395d28
AD
1915function changeUserEmail() {
1916
1917 try {
1918
1919 if (!xmlhttp_ready(xmlhttp)) {
1920 printLockingError();
1921 return false;
1922 }
1923
1924 var query = Form.serialize("change_email_form");
1925
1926 notify_progress("Trying to change e-mail...");
1927
1928 xmlhttp.open("POST", "backend.php", true);
1929 xmlhttp.onreadystatechange=notify_callback;
1930 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1931 xmlhttp.send(query);
1932
1933 } catch (e) {
1934 exception_error("changeUserPassword", e);
1935 }
1936
1937 return false;
1938
1939}
400b60d8
AD
1940
1941function feedlistToggleSLAT() {
1942 notify_progress("Loading, please wait...");
1943 updateFeedList()
1944}
bc0ed820 1945
e4f4b46f
AD
1946function pubRegenKey() {
1947
bc0ed820
AD
1948 if (!xmlhttp_ready(xmlhttp)) {
1949 printLockingError();
e4f4b46f 1950 return false;
bc0ed820
AD
1951 }
1952
f56e3080 1953 var ok = confirm(__("Replace current publishing address with a new one?"));
bc0ed820 1954
e4f4b46f
AD
1955 if (ok) {
1956
1957 notify_progress("Trying to change address...");
1958
945c243e 1959 xmlhttp.open("GET", "backend.php?op=rpc&subop=regenPubKey");
e4f4b46f
AD
1960 xmlhttp.onreadystatechange=replace_pubkey_callback;
1961 xmlhttp.send(null);
1962 }
1963
1964 return false;
945c243e 1965}
b652c1b7 1966
e635d56a
AD
1967function pubToClipboard() {
1968
1969 try {
1970
1971 if (!xmlhttp_ready(xmlhttp)) {
1972 printLockingError();
1973 return false;
1974 }
1975
1976 var link = document.getElementById("pubGenAddress");
1977 alert(link.href);
1978
1979 } catch (e) {
1980 exception_error("pubToClipboard", e);
1981 }
1982
1983 return false;
1984}
1985
b652c1b7
AD
1986function validatePrefsSave() {
1987 try {
1988
1989 var ok = confirm(__("Save current configuration?"));
1990
1991 if (ok) {
1992
1993 var query = Form.serialize("pref_prefs_form");
1994 query = query + "&subop=save-config";
1995 debug(query);
1996
1997 xmlhttp.open("POST", "backend.php", true);
1998 xmlhttp.onreadystatechange=notify_callback;
1999 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2000 xmlhttp.send(query);
2001 }
2002
2003 } catch (e) {
2004 exception_error("validatePrefsSave", e);
2005 }
2006
2007 return false;
2008}
c4a36709
AD
2009
2010function feedActionChange() {
2011 try {
2012 var chooser = document.getElementById("feedActionChooser");
2013 var opid = chooser[chooser.selectedIndex].value;
2014
2015 chooser.selectedIndex = 0;
2016 feedActionGo(opid);
2017 } catch (e) {
2018 exception_error("feedActionChange", e);
2019 }
2020}
2021
2022function feedActionGo(op) {
2023 try {
2024 if (op == "facEdit") {
cd935c42
AD
2025
2026 var rows = getSelectedFeeds();
2027
2028 if (rows.length > 1) {
2029 editSelectedFeeds();
2030 } else {
2031 editSelectedFeed();
2032 }
c4a36709
AD
2033 }
2034
2035 if (op == "facClear") {
2036 clearSelectedFeeds();
2037 }
2038
2039 if (op == "facPurge") {
2040 purgeSelectedFeeds();
2041 }
2042
e88a65f4
AD
2043 if (op == "facEditCats") {
2044 editFeedCats();
2045 }
2046
fee840fb
AD
2047 if (op == "facRescore") {
2048 rescoreSelectedFeeds();
2049 }
2050
c4a36709
AD
2051 if (op == "facUnsubscribe") {
2052 removeSelectedFeeds();
2053 }
2054
2055 } catch (e) {
2056 exception_error("feedActionGo", e);
2057
2058 }
2059}
2060
2061function clearFeedArticles(feed_id) {
2062
2063 notify_progress("Clearing feed...");
2064
2065 var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id;
2066
2067 new Ajax.Request(query, {
2068 onComplete: function(transport) {
2069 notify('');
2070 } });
2071
2072 return false;
2073}
2074
fee840fb
AD
2075function rescoreSelectedFeeds() {
2076
2077 if (!xmlhttp_ready(xmlhttp)) {
2078 printLockingError();
2079 return
2080 }
2081
2082 var sel_rows = getSelectedFeeds();
2083
2084 if (sel_rows.length > 0) {
2085
ef1b0366
AD
2086 //var ok = confirm(__("Rescore last 100 articles in selected feeds?"));
2087 var ok = confirm(__("Rescore articles in selected feeds?"));
fee840fb
AD
2088
2089 if (ok) {
3df4869b 2090 notify_progress("Rescoring selected feeds...", true);
fee840fb
AD
2091
2092 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
2093 param_escape(sel_rows.toString()), true);
2094 xmlhttp.onreadystatechange=notify_callback;
2095 xmlhttp.send(null);
2096 }
2097 } else {
2098 alert(__("No feeds are selected."));
2099 }
2100
2101 return false;
2102}
c4a36709 2103
95a948a5
AD
2104function rescore_all_feeds() {
2105 var ok = confirm(__("Rescore all articles? This operation may take a lot of time."));
2106
2107 if (ok) {
3df4869b 2108 notify_progress("Rescoring feeds...", true);
95a948a5
AD
2109
2110 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1", true);
2111 xmlhttp.onreadystatechange=notify_callback;
2112 xmlhttp.send(null);
2113 }
a80b05ea 2114}
a44db887
AD
2115
2116function removeFilter(id, title) {
2117
2118 if (!xmlhttp_ready(xmlhttp)) {
2119 printLockingError();
2120 return
2121 }
2122
2123 var msg = __("Remove filter %s?").replace("%s", title);
2124
2125 var ok = confirm(msg);
2126
2127 if (ok) {
2128 closeInfoBox();
2129
2130 notify_progress("Removing filter...");
2131
2132 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
2133 param_escape(id), true);
2134 xmlhttp.onreadystatechange=filterlist_callback;
2135 xmlhttp.send(null);
2136 }
2137
2138 return false;
2139}
2140
c8d5dcfe
AD
2141function unsubscribeFeed(id, title) {
2142
2143 if (!xmlhttp_ready(xmlhttp)) {
2144 printLockingError();
2145 return
2146 }
2147
2148 var msg = __("Unsubscribe from %s?").replace("%s", title);
2149
2150 var ok = confirm(msg);
2151
2152 if (ok) {
2153 closeInfoBox();
2154
2155 notify_progress("Removing feed...");
2156
2157 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
2158 param_escape(id), true);
2159 xmlhttp.onreadystatechange=filterlist_callback;
2160 xmlhttp.send(null);
2161 }
2162
2163 return false;
2164
2165 return false;
2166
2167}
2168
758e1c4a
AD
2169function feedsEditSave() {
2170 try {
2171
2172 if (!xmlhttp_ready(xmlhttp)) {
2173 printLockingError();
2174 return
2175 }
2176
cd935c42 2177 var ok = confirm(__("Save changes to selected feeds?"));
758e1c4a 2178
b0f015a2
AD
2179 if (ok) {
2180
5d538f4f
AD
2181 var f = document.forms["batch_edit_feed_form"];
2182
b0f015a2 2183 var query = Form.serialize("batch_edit_feed_form");
5d538f4f
AD
2184
2185 /* Form.serialize ignores unchecked checkboxes */
2186
cd935c42 2187 if (!query.match("&hidden=") &&
5d538f4f
AD
2188 f.hidden.disabled == false) {
2189 query = query + "&hidden=false";
2190 }
2191
cd935c42 2192 if (!query.match("&rtl_content=") &&
5d538f4f
AD
2193 f.rtl_content.disabled == false) {
2194 query = query + "&rtl_content=false";
2195 }
2196
cd935c42 2197 if (!query.match("&private=") &&
5d538f4f
AD
2198 f.private.disabled == false) {
2199 query = query + "&private=false";
2200 }
2201
cd935c42 2202 if (!query.match("&cache_images=") &&
5d538f4f
AD
2203 f.cache_images.disabled == false) {
2204 query = query + "&cache_images=false";
2205 }
2206
cd935c42 2207 if (!query.match("&include_in_digest=") &&
5d538f4f
AD
2208 f.include_in_digest.disabled == false) {
2209 query = query + "&include_in_digest=false";
2210 }
b0f015a2
AD
2211
2212 closeInfoBox();
2213
2214 notify_progress("Saving feeds...");
2215
2216 xmlhttp.open("POST", "backend.php", true);
2217 xmlhttp.onreadystatechange=feedlist_callback;
2218 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2219 xmlhttp.send(query);
2220 }
758e1c4a
AD
2221
2222 return false;
2223 } catch (e) {
2224 exception_error("feedsEditSave", e);
2225 }
2226}
2227
2228function batchFeedsToggleField(cb, elem, label) {
2229 try {
2230 var f = document.forms["batch_edit_feed_form"];
2231 var l = document.getElementById(label);
2232
2233 if (cb.checked) {
2234 f[elem].disabled = false;
2235
2236 if (l) {
2237 l.className = "";
2238 };
2239
2240// new Effect.Highlight(f[elem], {duration: 1, startcolor: "#fff7d5",
2241// queue: { position:'end', scope: 'BPEFQ', limit: 1 } } );
2242
2243 } else {
2244 f[elem].disabled = true;
2245
2246 if (l) {
2247 l.className = "insensitive";
2248 };
2249
2250 }
2251 } catch (e) {
2252 exception_error("batchFeedsToggleField", e);
2253 }
2254}
2255