]> git.wh0rd.org - tt-rss.git/blob - prefs.js
add shadow to userDlg
[tt-rss.git] / prefs.js
1 var xmlhttp = false;
2
3 var active_feed = false;
4 var active_feed_cat = false;
5 var active_filter = false;
6 var active_label = false;
7 var active_user = false;
8
9 var active_tab = false;
10
11 /*@cc_on @*/
12 /*@if (@_jscript_version >= 5)
13 // JScript gives us Conditional compilation, we can cope with old IE versions.
14 // and security blocked creation of the objects.
15 try {
16 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
17 } catch (e) {
18 try {
19 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
20 } catch (E) {
21 xmlhttp = false;
22 }
23 }
24 @end @*/
25
26 if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
27 xmlhttp = new XMLHttpRequest();
28 }
29
30 function feedlist_callback() {
31 if (xmlhttp.readyState == 4) {
32 var container = document.getElementById('prefContent');
33 container.innerHTML=xmlhttp.responseText;
34 if (active_feed) {
35 var row = document.getElementById("FEEDR-" + active_feed);
36 if (row) {
37 if (!row.className.match("Selected")) {
38 row.className = row.className + "Selected";
39 }
40 }
41 var checkbox = document.getElementById("FRCHK-" + active_feed);
42 if (checkbox) {
43 checkbox.checked = true;
44 }
45 }
46 p_notify("");
47 }
48 }
49
50 function filterlist_callback() {
51 var container = document.getElementById('prefContent');
52 if (xmlhttp.readyState == 4) {
53
54 container.innerHTML=xmlhttp.responseText;
55
56 if (active_filter) {
57 var row = document.getElementById("FILRR-" + active_filter);
58 if (row) {
59 if (!row.className.match("Selected")) {
60 row.className = row.className + "Selected";
61 }
62 }
63 var checkbox = document.getElementById("FICHK-" + active_filter);
64
65 if (checkbox) {
66 checkbox.checked = true;
67 }
68 }
69 p_notify("");
70 }
71 }
72
73 function labellist_callback() {
74 var container = document.getElementById('prefContent');
75 if (xmlhttp.readyState == 4) {
76 container.innerHTML=xmlhttp.responseText;
77
78 if (active_label) {
79 var row = document.getElementById("LILRR-" + active_label);
80 if (row) {
81 if (!row.className.match("Selected")) {
82 row.className = row.className + "Selected";
83 }
84 }
85 var checkbox = document.getElementById("LICHK-" + active_label);
86
87 if (checkbox) {
88 checkbox.checked = true;
89 }
90 }
91 p_notify("");
92 }
93 }
94
95 function userlist_callback() {
96 var container = document.getElementById('prefContent');
97 if (xmlhttp.readyState == 4) {
98 container.innerHTML=xmlhttp.responseText;
99
100 if (active_user) {
101 var row = document.getElementById("UMRR-" + active_user);
102 if (row) {
103 if (!row.className.match("Selected")) {
104 row.className = row.className + "Selected";
105 }
106 }
107 var checkbox = document.getElementById("UMCHK-" + active_user);
108
109 if (checkbox) {
110 checkbox.checked = true;
111 }
112 }
113
114 p_notify("");
115 }
116 }
117
118 function infobox_callback() {
119 if (xmlhttp.readyState == 4) {
120 var box = document.getElementById('infoBox');
121 var shadow = document.getElementById('infoBoxShadow');
122
123 if (box) {
124 box.innerHTML=xmlhttp.responseText;
125 if (shadow) {
126 shadow.style.display = "block";
127 } else {
128 box.style.display = "block";
129 }
130 }
131 }
132 }
133
134
135 function prefslist_callback() {
136 var container = document.getElementById('prefContent');
137 if (xmlhttp.readyState == 4) {
138
139 container.innerHTML=xmlhttp.responseText;
140
141 p_notify("");
142 }
143 }
144
145 function gethelp_callback() {
146 var container = document.getElementById('prefHelpBox');
147 if (xmlhttp.readyState == 4) {
148
149 container.innerHTML = xmlhttp.responseText;
150 container.style.display = "block";
151
152 }
153 }
154
155
156 function notify_callback() {
157 var container = document.getElementById('notify');
158 if (xmlhttp.readyState == 4) {
159 container.innerHTML=xmlhttp.responseText;
160 }
161 }
162
163 function updateFeedList(sort_key) {
164
165 if (!xmlhttp_ready(xmlhttp)) {
166 printLockingError();
167 return
168 }
169
170 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
171
172 p_notify("Loading, please wait...");
173
174 xmlhttp.open("GET", "backend.php?op=pref-feeds" +
175 "&sort=" + param_escape(sort_key), true);
176 xmlhttp.onreadystatechange=feedlist_callback;
177 xmlhttp.send(null);
178
179 }
180
181 function updateUsersList() {
182
183 if (!xmlhttp_ready(xmlhttp)) {
184 printLockingError();
185 return
186 }
187
188 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
189
190 p_notify("Loading, please wait...");
191
192 xmlhttp.open("GET", "backend.php?op=pref-users", true);
193 xmlhttp.onreadystatechange=userlist_callback;
194 xmlhttp.send(null);
195
196 }
197
198 function toggleSelectRow(sender) {
199 var parent_row = sender.parentNode.parentNode;
200
201 if (sender.checked) {
202 if (!parent_row.className.match("Selected")) {
203 parent_row.className = parent_row.className + "Selected";
204 }
205 } else {
206 if (parent_row.className.match("Selected")) {
207 parent_row.className = parent_row.className.replace("Selected", "");
208 }
209 }
210 }
211
212 function addLabel() {
213
214 if (!xmlhttp_ready(xmlhttp)) {
215 printLockingError();
216 return
217 }
218
219 var sqlexp = document.getElementById("ladd_expr");
220
221 if (sqlexp.value.length == 0) {
222 notify("Missing SQL expression.");
223 } else {
224 notify("Adding label...");
225
226 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
227 param_escape(sqlexp.value), true);
228
229 xmlhttp.onreadystatechange=labellist_callback;
230 xmlhttp.send(null);
231
232 sqlexp.value = "";
233 }
234
235 }
236
237 function addFilter() {
238
239 if (!xmlhttp_ready(xmlhttp)) {
240 printLockingError();
241 return
242 }
243
244 var regexp = document.getElementById("fadd_regexp");
245 var match = document.getElementById("fadd_match");
246 var feed = document.getElementById("fadd_feed");
247
248 if (regexp.value.length == 0) {
249 notify("Missing filter expression.");
250 } else {
251 notify("Adding filter...");
252
253 var v_match = match[match.selectedIndex].text;
254
255 var feed_id = feed[feed.selectedIndex].id;
256
257 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=add&regexp=" +
258 param_escape(regexp.value) + "&match=" + v_match +
259 "&fid=" + param_escape(feed_id), true);
260
261 xmlhttp.onreadystatechange=filterlist_callback;
262 xmlhttp.send(null);
263
264 regexp.value = "";
265 }
266
267 }
268
269 function addFeed() {
270
271 if (!xmlhttp_ready(xmlhttp)) {
272 printLockingError();
273 return
274 }
275
276 var link = document.getElementById("fadd_link");
277
278 if (link.value.length == 0) {
279 notify("Missing feed URL.");
280 } else {
281 notify("Adding feed...");
282
283 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
284 param_escape(link.value), true);
285 xmlhttp.onreadystatechange=feedlist_callback;
286 xmlhttp.send(null);
287
288 link.value = "";
289
290 }
291
292 }
293
294 function addFeedCat() {
295
296 if (!xmlhttp_ready(xmlhttp)) {
297 printLockingError();
298 return
299 }
300
301 var cat = document.getElementById("fadd_cat");
302
303 if (cat.value.length == 0) {
304 notify("Missing feed category.");
305 } else {
306 notify("Adding feed category...");
307
308 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
309 param_escape(cat.value), true);
310 xmlhttp.onreadystatechange=feedlist_callback;
311 xmlhttp.send(null);
312
313 link.value = "";
314
315 }
316
317 }
318 function addUser() {
319
320 if (!xmlhttp_ready(xmlhttp)) {
321 printLockingError();
322 return
323 }
324
325 var sqlexp = document.getElementById("uadd_box");
326
327 if (sqlexp.value.length == 0) {
328 notify("Missing user login.");
329 } else {
330 notify("Adding user...");
331
332 xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" +
333 param_escape(sqlexp.value), true);
334
335 xmlhttp.onreadystatechange=userlist_callback;
336 xmlhttp.send(null);
337
338 sqlexp.value = "";
339 }
340
341 }
342
343 function editLabel(id) {
344
345 if (!xmlhttp_ready(xmlhttp)) {
346 printLockingError();
347 return
348 }
349
350 active_label = id;
351
352 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
353 param_escape(id), true);
354 xmlhttp.onreadystatechange=labellist_callback;
355 xmlhttp.send(null);
356
357 }
358
359 function editUser(id) {
360
361 if (!xmlhttp_ready(xmlhttp)) {
362 printLockingError();
363 return
364 }
365
366 active_user = id;
367
368 xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
369 param_escape(id), true);
370 xmlhttp.onreadystatechange=userlist_callback;
371 xmlhttp.send(null);
372
373 }
374
375 function editFilter(id) {
376
377 if (!xmlhttp_ready(xmlhttp)) {
378 printLockingError();
379 return
380 }
381
382 active_filter = id;
383
384 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
385 param_escape(id), true);
386 xmlhttp.onreadystatechange=filterlist_callback;
387 xmlhttp.send(null);
388
389 }
390
391 function editFeed(feed) {
392
393 // notify("Editing feed...");
394
395 if (!xmlhttp_ready(xmlhttp)) {
396 printLockingError();
397 return
398 }
399
400 active_feed = feed;
401
402 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
403 param_escape(feed), true);
404 xmlhttp.onreadystatechange=feedlist_callback;
405 xmlhttp.send(null);
406
407 }
408
409 function editFeedCat(cat) {
410
411 if (!xmlhttp_ready(xmlhttp)) {
412 printLockingError();
413 return
414 }
415
416 active_feed_cat = cat;
417
418 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
419 param_escape(cat), true);
420 xmlhttp.onreadystatechange=feedlist_callback;
421 xmlhttp.send(null);
422
423 }
424
425 function getSelectedLabels() {
426 return getSelectedTableRowIds("prefLabelList", "LILRR");
427 }
428
429 function getSelectedUsers() {
430 return getSelectedTableRowIds("prefUserList", "UMRR");
431 }
432
433 function getSelectedFeeds() {
434 return getSelectedTableRowIds("prefFeedList", "FEEDR");
435 }
436
437 function getSelectedFilters() {
438 return getSelectedTableRowIds("prefFilterList", "FILRR");
439 }
440
441 function getSelectedFeedCats() {
442 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
443 }
444
445
446 function readSelectedFeeds(read) {
447
448 if (!xmlhttp_ready(xmlhttp)) {
449 printLockingError();
450 return
451 }
452
453 var sel_rows = getSelectedFeeds();
454
455 if (sel_rows.length > 0) {
456
457 if (!read) {
458 op = "unread";
459 } else {
460 op = "read";
461 }
462
463 notify("Marking selected feeds as " + op + "...");
464
465 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
466 param_escape(sel_rows.toString()), true);
467 xmlhttp.onreadystatechange=notify_callback;
468 xmlhttp.send(null);
469
470 } else {
471
472 notify("Please select some feeds first.");
473
474 }
475 }
476
477 function removeSelectedLabels() {
478
479 if (!xmlhttp_ready(xmlhttp)) {
480 printLockingError();
481 return
482 }
483
484 var sel_rows = getSelectedLabels();
485
486 if (sel_rows.length > 0) {
487
488 notify("Removing selected labels...");
489
490 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
491 param_escape(sel_rows.toString()), true);
492 xmlhttp.onreadystatechange=labellist_callback;
493 xmlhttp.send(null);
494
495 } else {
496 notify("Please select some labels first.");
497 }
498 }
499
500 function removeSelectedUsers() {
501
502 if (!xmlhttp_ready(xmlhttp)) {
503 printLockingError();
504 return
505 }
506
507 var sel_rows = getSelectedUsers();
508
509 if (sel_rows.length > 0) {
510
511 notify("Removing selected users...");
512
513 xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
514 param_escape(sel_rows.toString()), true);
515 xmlhttp.onreadystatechange=userlist_callback;
516 xmlhttp.send(null);
517
518 } else {
519 notify("Please select some labels first.");
520 }
521 }
522
523 function removeSelectedFilters() {
524
525 if (!xmlhttp_ready(xmlhttp)) {
526 printLockingError();
527 return
528 }
529
530 var sel_rows = getSelectedFilters();
531
532 if (sel_rows.length > 0) {
533
534 notify("Removing selected filters...");
535
536 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
537 param_escape(sel_rows.toString()), true);
538 xmlhttp.onreadystatechange=filterlist_callback;
539 xmlhttp.send(null);
540
541 } else {
542 notify("Please select some filters first.");
543 }
544 }
545
546
547 function removeSelectedFeeds() {
548
549 if (!xmlhttp_ready(xmlhttp)) {
550 printLockingError();
551 return
552 }
553
554 var sel_rows = getSelectedFeeds();
555
556 if (sel_rows.length > 0) {
557
558 notify("Removing selected feeds...");
559
560 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
561 param_escape(sel_rows.toString()), true);
562 xmlhttp.onreadystatechange=feedlist_callback;
563 xmlhttp.send(null);
564
565 } else {
566
567 notify("Please select some feeds first.");
568
569 }
570
571 }
572
573 function removeSelectedFeedCats() {
574
575 if (!xmlhttp_ready(xmlhttp)) {
576 printLockingError();
577 return
578 }
579
580 var sel_rows = getSelectedFeedCats();
581
582 if (sel_rows.length > 0) {
583
584 notify("Removing selected categories...");
585
586 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
587 param_escape(sel_rows.toString()), true);
588 xmlhttp.onreadystatechange=feedlist_callback;
589 xmlhttp.send(null);
590
591 } else {
592
593 notify("Please select some feeds first.");
594
595 }
596
597 }
598
599 function feedEditCancel() {
600
601 if (!xmlhttp_ready(xmlhttp)) {
602 printLockingError();
603 return
604 }
605
606 active_feed = false;
607
608 notify("Operation cancelled.");
609
610 xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
611 xmlhttp.onreadystatechange=feedlist_callback;
612 xmlhttp.send(null);
613
614 }
615
616 function feedCatEditCancel() {
617
618 if (!xmlhttp_ready(xmlhttp)) {
619 printLockingError();
620 return
621 }
622
623 active_feed_cat = false;
624
625 notify("Operation cancelled.");
626
627 xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
628 xmlhttp.onreadystatechange=feedlist_callback;
629 xmlhttp.send(null);
630
631 }
632
633 function feedEditSave() {
634
635 var feed = active_feed;
636
637 if (!xmlhttp_ready(xmlhttp)) {
638 printLockingError();
639 return
640 }
641
642 var link = document.getElementById("iedit_link").value;
643 var title = document.getElementById("iedit_title").value;
644 var upd_intl = document.getElementById("iedit_updintl").value;
645 var purge_intl = document.getElementById("iedit_purgintl").value;
646 var fcat = document.getElementById("iedit_fcat");
647
648 var fcat_id = fcat[fcat.selectedIndex].id;
649
650 // notify("Saving feed.");
651
652 /* if (upd_intl < 0) {
653 notify("Update interval must be &gt;= 0 (0 = default)");
654 return;
655 }
656
657 if (purge_intl < 0) {
658 notify("Purge days must be &gt;= 0 (0 = default)");
659 return;
660 } */
661
662 if (link.length == 0) {
663 notify("Feed link cannot be blank.");
664 return;
665 }
666
667 if (title.length == 0) {
668 notify("Feed title cannot be blank.");
669 return;
670 }
671
672 active_feed = false;
673
674 notify("");
675
676 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
677 feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
678 "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
679 "&catid=" + param_escape(fcat_id), true);
680 xmlhttp.onreadystatechange=feedlist_callback;
681 xmlhttp.send(null);
682
683 }
684
685 function labelTest() {
686
687 var sqlexp = document.getElementById("iedit_expr").value;
688 var descr = document.getElementById("iedit_descr").value;
689
690 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
691 param_escape(sqlexp) + "&descr=" + param_escape(descr), true);
692
693 xmlhttp.onreadystatechange=infobox_callback;
694 xmlhttp.send(null);
695
696 }
697
698 function labelEditCancel() {
699
700 if (!xmlhttp_ready(xmlhttp)) {
701 printLockingError();
702 return
703 }
704
705 active_label = false;
706
707 notify("Operation cancelled.");
708
709 xmlhttp.open("GET", "backend.php?op=pref-labels", true);
710 xmlhttp.onreadystatechange=labellist_callback;
711 xmlhttp.send(null);
712
713 }
714
715 function userEditCancel() {
716
717 if (!xmlhttp_ready(xmlhttp)) {
718 printLockingError();
719 return
720 }
721
722 active_user = false;
723
724 notify("Operation cancelled.");
725
726 xmlhttp.open("GET", "backend.php?op=pref-users", true);
727 xmlhttp.onreadystatechange=userlist_callback;
728 xmlhttp.send(null);
729
730 }
731
732 function filterEditCancel() {
733
734 if (!xmlhttp_ready(xmlhttp)) {
735 printLockingError();
736 return
737 }
738
739 active_filter = false;
740
741 notify("Operation cancelled.");
742
743 xmlhttp.open("GET", "backend.php?op=pref-filters", true);
744 xmlhttp.onreadystatechange=filterlist_callback;
745 xmlhttp.send(null);
746
747 }
748
749 function labelEditSave() {
750
751 var label = active_label;
752
753 if (!xmlhttp_ready(xmlhttp)) {
754 printLockingError();
755 return
756 }
757
758 var sqlexp = document.getElementById("iedit_expr").value;
759 var descr = document.getElementById("iedit_descr").value;
760
761 // notify("Saving label " + sqlexp + ": " + descr);
762
763 if (sqlexp.length == 0) {
764 notify("SQL expression cannot be blank.");
765 return;
766 }
767
768 if (descr.length == 0) {
769 notify("Caption cannot be blank.");
770 return;
771 }
772
773 notify("");
774
775 active_label = false;
776
777 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=editSave&id=" +
778 label + "&s=" + param_escape(sqlexp) + "&d=" + param_escape(descr),
779 true);
780
781 xmlhttp.onreadystatechange=labellist_callback;
782 xmlhttp.send(null);
783
784 }
785
786 function userEditSave() {
787
788 var user = active_user;
789
790 if (!xmlhttp_ready(xmlhttp)) {
791 printLockingError();
792 return
793 }
794
795 var login = document.getElementById("iedit_ulogin").value;
796 var level = document.getElementById("iedit_ulevel").value;
797
798 if (login.length == 0) {
799 notify("Login cannot be blank.");
800 return;
801 }
802
803 if (level.length == 0) {
804 notify("User level cannot be blank.");
805 return;
806 }
807
808 active_user = false;
809
810 notify("");
811
812 xmlhttp.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
813 user + "&l=" + param_escape(login) + "&al=" + param_escape(level),
814 true);
815
816 xmlhttp.onreadystatechange=userlist_callback;
817 xmlhttp.send(null);
818
819 }
820
821
822 function filterEditSave() {
823
824 var filter = active_filter;
825
826 if (!xmlhttp_ready(xmlhttp)) {
827 printLockingError();
828 return
829 }
830
831 var regexp = document.getElementById("iedit_regexp").value;
832 var descr = document.getElementById("iedit_descr").value;
833 var match = document.getElementById("iedit_match");
834
835 var v_match = match[match.selectedIndex].text;
836
837 var feed = document.getElementById("iedit_feed");
838 var feed_id = feed[feed.selectedIndex].id;
839
840 // notify("Saving filter " + filter + ": " + regexp + ", " + descr + ", " + match);
841
842 if (regexp.length == 0) {
843 notify("Filter expression cannot be blank.");
844 return;
845 }
846
847 active_filter = false;
848
849 xmlhttp.open("GET", "backend.php?op=pref-filters&subop=editSave&id=" +
850 filter + "&r=" + param_escape(regexp) + "&d=" + param_escape(descr) +
851 "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id), true);
852
853 notify("");
854
855 xmlhttp.onreadystatechange=filterlist_callback;
856 xmlhttp.send(null);
857
858 }
859
860 function editSelectedLabel() {
861 var rows = getSelectedLabels();
862
863 if (rows.length == 0) {
864 notify("No labels are selected.");
865 return;
866 }
867
868 if (rows.length > 1) {
869 notify("Please select one label.");
870 return;
871 }
872
873 notify("");
874
875 editLabel(rows[0]);
876
877 }
878
879 function editSelectedUser() {
880 var rows = getSelectedUsers();
881
882 if (rows.length == 0) {
883 notify("No users are selected.");
884 return;
885 }
886
887 if (rows.length > 1) {
888 notify("Please select one user.");
889 return;
890 }
891
892 notify("");
893
894 editUser(rows[0]);
895 }
896
897 function resetSelectedUserPass() {
898 var rows = getSelectedUsers();
899
900 if (rows.length == 0) {
901 notify("No users are selected.");
902 return;
903 }
904
905 if (rows.length > 1) {
906 notify("Please select one user.");
907 return;
908 }
909
910 notify("Resetting password for selected user...");
911
912 var id = rows[0];
913
914 xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
915 param_escape(id), true);
916 xmlhttp.onreadystatechange=userlist_callback;
917 xmlhttp.send(null);
918
919 }
920
921 function selectedUserDetails() {
922
923 if (!xmlhttp_ready(xmlhttp)) {
924 printLockingError();
925 return
926 }
927
928 var rows = getSelectedUsers();
929
930 if (rows.length == 0) {
931 notify("No users are selected.");
932 return;
933 }
934
935 if (rows.length > 1) {
936 notify("Please select one user.");
937 return;
938 }
939
940 var id = rows[0];
941
942 notify("");
943
944 xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true);
945 xmlhttp.onreadystatechange=infobox_callback;
946 xmlhttp.send(null);
947
948 }
949
950 function selectedFeedDetails() {
951
952 if (!xmlhttp_ready(xmlhttp)) {
953 printLockingError();
954 return
955 }
956
957 var rows = getSelectedFeeds();
958
959 if (rows.length == 0) {
960 notify("No feeds are selected.");
961 return;
962 }
963
964 if (rows.length > 1) {
965 notify("Please select one feed.");
966 return;
967 }
968
969 var id = rows[0];
970
971 notify("");
972
973 xmlhttp.open("GET", "backend.php?op=feed-details&id=" + id, true);
974 xmlhttp.onreadystatechange=infobox_callback;
975 xmlhttp.send(null);
976
977 }
978
979 function editSelectedFilter() {
980 var rows = getSelectedFilters();
981
982 if (rows.length == 0) {
983 notify("No filters are selected.");
984 return;
985 }
986
987 if (rows.length > 1) {
988 notify("Please select one filter.");
989 return;
990 }
991
992 notify("");
993
994 editFilter(rows[0]);
995
996 }
997
998
999 function editSelectedFeed() {
1000 var rows = getSelectedFeeds();
1001
1002 if (rows.length == 0) {
1003 notify("No feeds are selected.");
1004 return;
1005 }
1006
1007 if (rows.length > 1) {
1008 notify("Please select one feed.");
1009 return;
1010 }
1011
1012 notify("");
1013
1014 editFeed(rows[0]);
1015
1016 }
1017
1018 function editSelectedFeedCat() {
1019 var rows = getSelectedFeedCats();
1020
1021 if (rows.length == 0) {
1022 notify("No categories are selected.");
1023 return;
1024 }
1025
1026 if (rows.length > 1) {
1027 notify("Please select one category.");
1028 return;
1029 }
1030
1031 notify("");
1032
1033 editFeedCat(rows[0]);
1034
1035 }
1036
1037 function localPiggieFunction(enable) {
1038 if (enable) {
1039 piggie.style.display = "block";
1040 seq = "";
1041 notify("I loveded it!!!");
1042 } else {
1043 piggie.style.display = "none";
1044 notify("");
1045 }
1046 }
1047
1048 function validateOpmlImport() {
1049
1050 var opml_file = document.getElementById("opml_file");
1051
1052 if (opml_file.value.length == 0) {
1053 notify("Please select OPML file to upload.");
1054 return false;
1055 } else {
1056 return true;
1057 }
1058 }
1059
1060 function updateFilterList() {
1061
1062 if (!xmlhttp_ready(xmlhttp)) {
1063 printLockingError();
1064 return
1065 }
1066
1067 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1068
1069 p_notify("Loading, please wait...");
1070
1071 xmlhttp.open("GET", "backend.php?op=pref-filters", true);
1072 xmlhttp.onreadystatechange=filterlist_callback;
1073 xmlhttp.send(null);
1074
1075 }
1076
1077 function updateLabelList() {
1078
1079 if (!xmlhttp_ready(xmlhttp)) {
1080 printLockingError();
1081 return
1082 }
1083
1084 p_notify("Loading, please wait...");
1085
1086 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1087
1088 xmlhttp.open("GET", "backend.php?op=pref-labels", true);
1089 xmlhttp.onreadystatechange=labellist_callback;
1090 xmlhttp.send(null);
1091 }
1092
1093 function updatePrefsList() {
1094
1095 if (!xmlhttp_ready(xmlhttp)) {
1096 printLockingError();
1097 return
1098 }
1099
1100 p_notify("Loading, please wait...");
1101
1102 xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
1103 xmlhttp.onreadystatechange=prefslist_callback;
1104 xmlhttp.send(null);
1105
1106 }
1107
1108 function selectTab(id) {
1109
1110 if (!xmlhttp_ready(xmlhttp)) {
1111 printLockingError();
1112 return
1113 }
1114
1115 if (id == "feedConfig") {
1116 updateFeedList();
1117 } else if (id == "filterConfig") {
1118 updateFilterList();
1119 } else if (id == "labelConfig") {
1120 updateLabelList();
1121 } else if (id == "genConfig") {
1122 updatePrefsList();
1123 } else if (id == "userConfig") {
1124 updateUsersList();
1125 }
1126
1127 var tab = document.getElementById(active_tab + "Tab");
1128
1129 if (tab) {
1130 if (tab.className.match("Selected")) {
1131 tab.className = "prefsTab";
1132 }
1133 }
1134
1135 tab = document.getElementById(id + "Tab");
1136
1137 if (tab) {
1138 if (!tab.className.match("Selected")) {
1139 tab.className = tab.className + "Selected";
1140 }
1141 }
1142
1143 active_tab = id;
1144
1145 }
1146
1147 function init() {
1148
1149 try {
1150
1151 // IE kludge
1152 if (!xmlhttp) {
1153 document.getElementById("prefContent").innerHTML =
1154 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1155 "to function properly. Your browser doesn't seem to support it.";
1156 return;
1157 }
1158
1159 selectTab("genConfig");
1160
1161 document.onkeydown = hotkey_handler;
1162 notify("");
1163 } catch (e) {
1164 exception_error("init", e);
1165 }
1166 }
1167
1168 function closeInfoBox() {
1169 var box = document.getElementById('infoBox');
1170 var shadow = document.getElementById('infoBoxShadow');
1171
1172 if (shadow) {
1173 shadow.style.display = "none";
1174 } else if (box) {
1175 box.style.display = "none";
1176 }
1177 }