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