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