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