]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
3 var active_feed_cat
= false;
4 var active_filter
= false;
5 var active_label
= false;
6 var active_tab
= false;
7 var feed_to_expand
= false;
10 var piggie_fwd
= true;
12 var xmlhttp
= Ajax
.getTransport();
14 function expand_feed_callback() {
15 if (xmlhttp
.readyState
== 4) {
17 var container
= document
.getElementById("BRDET-" + feed_to_expand
);
18 container
.innerHTML
=xmlhttp
.responseText
;
19 container
.style
.display
= "block";
22 exception_error("expand_feed_callback", e
);
27 function feedlist_callback() {
28 if (xmlhttp
.readyState
== 4) {
30 var container
= document
.getElementById('prefContent');
31 container
.innerHTML
=xmlhttp
.responseText
;
32 selectTab("feedConfig", true);
34 if (active_feed_cat
) {
35 var row
= document
.getElementById("FCATR-" + active_feed_cat
);
37 if (!row
.className
.match("Selected")) {
38 row
.className
= row
.className
+ "Selected";
41 var checkbox
= document
.getElementById("FCCHK-" + active_feed_cat
);
43 checkbox
.checked
= true;
49 exception_error("feedlist_callback", e
);
54 function filterlist_callback() {
55 var container
= document
.getElementById('prefContent');
56 if (xmlhttp
.readyState
== 4) {
58 container
.innerHTML
=xmlhttp
.responseText
;
61 var row
= document
.getElementById("FILRR-" + active_filter
);
63 if (!row
.className
.match("Selected")) {
64 row
.className
= row
.className
+ "Selected";
67 var checkbox
= document
.getElementById("FICHK-" + active_filter
);
70 checkbox
.checked
= true;
77 function labellist_callback() {
78 var container
= document
.getElementById('prefContent');
79 if (xmlhttp
.readyState
== 4) {
80 container
.innerHTML
=xmlhttp
.responseText
;
83 var row
= document
.getElementById("LILRR-" + active_label
);
85 if (!row
.className
.match("Selected")) {
86 row
.className
= row
.className
+ "Selected";
89 var checkbox
= document
.getElementById("LICHK-" + active_label
);
92 checkbox
.checked
= true;
99 function feed_browser_callback() {
100 var container
= document
.getElementById('prefContent');
101 if (xmlhttp
.readyState
== 4) {
102 container
.innerHTML
=xmlhttp
.responseText
;
107 function userlist_callback() {
108 var container
= document
.getElementById('prefContent');
109 if (xmlhttp
.readyState
== 4) {
110 container
.innerHTML
=xmlhttp
.responseText
;
115 function prefslist_callback() {
116 var container
= document
.getElementById('prefContent');
117 if (xmlhttp
.readyState
== 4) {
119 container
.innerHTML
=xmlhttp
.responseText
;
125 function gethelp_callback() {
126 var container
= document
.getElementById('prefHelpBox');
127 if (xmlhttp
.readyState
== 4) {
129 container
.innerHTML
= xmlhttp
.responseText
;
130 container
.style
.display
= "block";
136 function notify_callback() {
137 var container
= document
.getElementById('notify');
138 if (xmlhttp
.readyState
== 4) {
139 container
.innerHTML
=xmlhttp
.responseText
;
143 function updateFeedList(sort_key
) {
145 if (!xmlhttp_ready(xmlhttp
)) {
150 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
152 // p_notify("Loading, please wait...");
154 var feed_search
= document
.getElementById("feed_search");
156 if (feed_search
) { search
= feed_search
.value
; }
158 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
159 "&sort=" + param_escape(sort_key
) +
160 "&search=" + param_escape(search
), true);
161 xmlhttp
.onreadystatechange
=feedlist_callback
;
166 function updateUsersList() {
168 if (!xmlhttp_ready(xmlhttp
)) {
173 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
175 // p_notify("Loading, please wait...");
177 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
178 xmlhttp
.onreadystatechange
=userlist_callback
;
183 function addLabel() {
185 if (!xmlhttp_ready(xmlhttp
)) {
190 var sqlexp
= document
.getElementById("ladd_expr");
192 if (sqlexp
.value
.length
== 0) {
193 alert("Can't add label: missing SQL expression.");
195 notify("Adding label...");
197 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
198 param_escape(sqlexp
.value
), true);
200 xmlhttp
.onreadystatechange
=labellist_callback
;
208 function addFilter() {
210 if (!xmlhttp_ready(xmlhttp
)) {
215 var regexp
= document
.getElementById("fadd_regexp");
216 var match
= document
.getElementById("fadd_match");
217 var feed
= document
.getElementById("fadd_feed");
218 var action
= document
.getElementById("fadd_action");
220 if (regexp
.value
.length
== 0) {
221 alert("Can't add filter: missing filter expression.");
223 notify("Adding filter...");
225 var v_match
= match
[match
.selectedIndex
].text
;
226 var feed_id
= feed
[feed
.selectedIndex
].id
;
227 var action_id
= action
[action
.selectedIndex
].id
;
229 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
230 param_escape(regexp
.value
) + "&match=" + v_match
+
231 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
233 xmlhttp
.onreadystatechange
=filterlist_callback
;
243 if (!xmlhttp_ready(xmlhttp
)) {
248 var link
= document
.getElementById("fadd_link");
250 if (link
.value
.length
== 0) {
251 alert("Error: No feed URL given.");
252 } else if (!isValidURL(link
.value
)) {
253 alert("Error: Invalid feed URL.");
255 notify("Adding feed...");
257 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&feed_url=" +
258 param_escape(link
.value
), true);
259 xmlhttp
.onreadystatechange
=feedlist_callback
;
268 function addFeedCat() {
270 if (!xmlhttp_ready(xmlhttp
)) {
275 var cat
= document
.getElementById("fadd_cat");
277 if (cat
.value
.length
== 0) {
278 alert("Can't add category: no name specified.");
280 notify("Adding feed category...");
282 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
283 param_escape(cat
.value
), true);
284 xmlhttp
.onreadystatechange
=feedlist_callback
;
294 if (!xmlhttp_ready(xmlhttp
)) {
299 var sqlexp
= document
.getElementById("uadd_box");
301 if (sqlexp
.value
.length
== 0) {
302 alert("Can't add user: no login specified.");
304 notify("Adding user...");
306 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
307 param_escape(sqlexp
.value
), true);
309 xmlhttp
.onreadystatechange
=userlist_callback
;
317 function editLabel(id
) {
319 if (!xmlhttp_ready(xmlhttp
)) {
326 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
327 param_escape(id
), true);
328 xmlhttp
.onreadystatechange
=labellist_callback
;
333 function editUser(id
) {
335 if (!xmlhttp_ready(xmlhttp
)) {
340 selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
341 selectTableRowById('UMRR-'+id
, 'UMCHK-'+id
, true);
343 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
344 param_escape(id
), true);
345 xmlhttp
.onreadystatechange
=infobox_callback
;
350 function editFilter(id
) {
352 if (!xmlhttp_ready(xmlhttp
)) {
359 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
360 param_escape(id
), true);
361 xmlhttp
.onreadystatechange
=filterlist_callback
;
366 function editFeed(feed
) {
368 // notify("Editing feed...");
370 if (!xmlhttp_ready(xmlhttp
)) {
375 // clean selection from all rows & select row being edited
376 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
377 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
379 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
380 param_escape(feed
), true);
382 xmlhttp
.onreadystatechange
=infobox_callback
;
387 function editFeedCat(cat
) {
389 if (!xmlhttp_ready(xmlhttp
)) {
394 active_feed_cat
= cat
;
396 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
397 param_escape(cat
), true);
398 xmlhttp
.onreadystatechange
=feedlist_callback
;
403 function getSelectedLabels() {
404 return getSelectedTableRowIds("prefLabelList", "LILRR");
407 function getSelectedUsers() {
408 return getSelectedTableRowIds("prefUserList", "UMRR");
411 function getSelectedFeeds() {
412 return getSelectedTableRowIds("prefFeedList", "FEEDR");
415 function getSelectedFilters() {
416 return getSelectedTableRowIds("prefFilterList", "FILRR");
419 function getSelectedFeedCats() {
420 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
423 function getSelectedFeedsFromBrowser() {
425 var list
= document
.getElementById("browseFeedList");
426 if (!list
) list
= document
.getElementById("browseBigFeedList");
428 var selected
= new Array();
430 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
431 var child
= list
.childNodes
[i
];
432 if (child
.id
&& child
.id
.match("FBROW-")) {
433 var id
= child
.id
.replace("FBROW-", "");
435 var cb
= document
.getElementById("FBCHK-" + id
);
446 function removeSelectedLabels() {
448 if (!xmlhttp_ready(xmlhttp
)) {
453 var sel_rows
= getSelectedLabels();
455 if (sel_rows
.length
> 0) {
457 var ok
= confirm("Remove selected labels?");
460 notify("Removing selected labels...");
462 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
463 param_escape(sel_rows
.toString()), true);
464 xmlhttp
.onreadystatechange
=labellist_callback
;
468 alert("No labels are selected.");
472 function removeSelectedUsers() {
474 if (!xmlhttp_ready(xmlhttp
)) {
479 var sel_rows
= getSelectedUsers();
481 if (sel_rows
.length
> 0) {
483 var ok
= confirm("Remove selected users?");
486 notify("Removing selected users...");
488 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
489 param_escape(sel_rows
.toString()), true);
490 xmlhttp
.onreadystatechange
=userlist_callback
;
495 alert("No users are selected.");
499 function removeSelectedFilters() {
501 if (!xmlhttp_ready(xmlhttp
)) {
506 var sel_rows
= getSelectedFilters();
508 if (sel_rows
.length
> 0) {
510 var ok
= confirm("Remove selected filters?");
513 notify("Removing selected filters...");
515 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
516 param_escape(sel_rows
.toString()), true);
517 xmlhttp
.onreadystatechange
=filterlist_callback
;
521 alert("No filters are selected.");
526 function removeSelectedFeeds() {
528 if (!xmlhttp_ready(xmlhttp
)) {
533 var sel_rows
= getSelectedFeeds();
535 if (sel_rows
.length
> 0) {
537 var ok
= confirm("Unsubscribe from selected feeds?");
541 notify("Unsubscribing from selected feeds...");
543 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
544 param_escape(sel_rows
.toString()), true);
545 xmlhttp
.onreadystatechange
=feedlist_callback
;
551 alert("No feeds are selected.");
557 function removeSelectedFeedCats() {
559 if (!xmlhttp_ready(xmlhttp
)) {
564 var sel_rows
= getSelectedFeedCats();
566 if (sel_rows
.length
> 0) {
568 var ok
= confirm("Remove selected categories?");
571 notify("Removing selected categories...");
573 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
574 param_escape(sel_rows
.toString()), true);
575 xmlhttp
.onreadystatechange
=feedlist_callback
;
581 alert("No categories are selected.");
587 function feedEditCancel() {
589 if (!xmlhttp_ready(xmlhttp
)) {
596 selectPrefRows('feed', false); // cleanup feed selection
600 function feedCatEditCancel() {
602 if (!xmlhttp_ready(xmlhttp
)) {
607 active_feed_cat
= false;
609 // notify("Operation cancelled.");
611 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
612 xmlhttp
.onreadystatechange
=feedlist_callback
;
617 function feedEditSave() {
621 if (!xmlhttp_ready(xmlhttp
)) {
626 // FIXME: add parameter validation
628 var query
= Form
.serialize("edit_feed_form");
630 notify("Saving feed...");
632 xmlhttp
.open("POST", "backend.php", true);
633 xmlhttp
.onreadystatechange
=feedlist_callback
;
634 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
642 exception_error("feedEditSave", e
);
646 function feedCatEditSave() {
648 if (!xmlhttp_ready(xmlhttp
)) {
653 notify("Saving category...");
655 var query
= Form
.serialize("feed_cat_edit_form");
657 xmlhttp
.open("GET", "backend.php?" + query
, true);
658 xmlhttp
.onreadystatechange
=feedlist_callback
;
661 active_feed_cat
= false;
666 function labelTest() {
668 var form
= document
.forms
['label_edit_form'];
670 var sql_exp
= form
.sql_exp
.value
;
671 var description
= form
.description
.value
;
673 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
674 param_escape(sql_exp
) + "&descr=" + param_escape(description
), true);
676 xmlhttp
.onreadystatechange
=infobox_callback
;
681 function displayHelpInfobox(topic_id
) {
683 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
684 param_escape(topic_id
) + "&noheaders=1", true);
686 xmlhttp
.onreadystatechange
=infobox_callback
;
691 function labelEditCancel() {
693 if (!xmlhttp_ready(xmlhttp
)) {
698 active_label
= false;
700 // notify("Operation cancelled.");
702 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
703 xmlhttp
.onreadystatechange
=labellist_callback
;
708 function userEditCancel() {
710 if (!xmlhttp_ready(xmlhttp
)) {
715 selectPrefRows('user', false); // cleanup feed selection
720 function filterEditCancel() {
722 if (!xmlhttp_ready(xmlhttp
)) {
727 active_filter
= false;
729 // notify("Operation cancelled.");
731 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
732 xmlhttp
.onreadystatechange
=filterlist_callback
;
737 function labelEditSave() {
739 var label
= active_label
;
741 if (!xmlhttp_ready(xmlhttp
)) {
746 var sql_exp
= document
.forms
["label_edit_form"].sql_exp
.value
;
747 var description
= document
.forms
["label_edit_form"].description
.value
;
749 if (sql_exp
.length
== 0) {
750 alert("SQL Expression cannot be blank.");
754 if (description
.length
== 0) {
755 alert("Caption field cannot be blank.");
759 notify("Saving label...");
761 active_label
= false;
763 query
= Form
.serialize("label_edit_form");
765 xmlhttp
.open("GET", "backend.php?" + query
, true);
767 xmlhttp
.onreadystatechange
=labellist_callback
;
772 function userEditSave() {
774 if (!xmlhttp_ready(xmlhttp
)) {
779 var login
= document
.forms
["user_edit_form"].login
.value
;
781 if (login
.length
== 0) {
782 alert("Login field cannot be blank.");
786 notify("Saving user...");
788 var query
= Form
.serialize("user_edit_form");
790 xmlhttp
.open("GET", "backend.php?" + query
, true);
791 xmlhttp
.onreadystatechange
=userlist_callback
;
796 function filterEditSave() {
798 if (!xmlhttp_ready(xmlhttp
)) {
803 var reg_exp
= document
.forms
["filter_edit_form"].reg_exp
.value
;
805 if (reg_exp
.length
== 0) {
806 alert("Filter expression field cannot be blank.");
810 notify("Saving filter...");
812 active_filter
= false;
814 var query
= Form
.serialize("filter_edit_form");
816 xmlhttp
.open("GET", "backend.php?" + query
, true);
817 xmlhttp
.onreadystatechange
=filterlist_callback
;
822 function editSelectedLabel() {
823 var rows
= getSelectedLabels();
825 if (rows
.length
== 0) {
826 alert("No labels are selected.");
830 if (rows
.length
> 1) {
831 alert("Please select only one label.");
841 function editSelectedUser() {
842 var rows
= getSelectedUsers();
844 if (rows
.length
== 0) {
845 alert("No users are selected.");
849 if (rows
.length
> 1) {
850 alert("Please select only one user.");
859 function resetSelectedUserPass() {
860 var rows
= getSelectedUsers();
862 if (rows
.length
== 0) {
863 alert("No users are selected.");
867 if (rows
.length
> 1) {
868 alert("Please select only one user.");
872 var ok
= confirm("Reset password of selected user?");
875 notify("Resetting password for selected user...");
879 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
880 param_escape(id
), true);
881 xmlhttp
.onreadystatechange
=userlist_callback
;
886 function selectedUserDetails() {
888 if (!xmlhttp_ready(xmlhttp
)) {
893 var rows
= getSelectedUsers();
895 if (rows
.length
== 0) {
896 alert("No users are selected.");
900 if (rows
.length
> 1) {
901 alert("Please select only one user.");
909 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
910 xmlhttp
.onreadystatechange
=infobox_callback
;
915 function selectedFeedDetails() {
917 if (!xmlhttp_ready(xmlhttp
)) {
922 var rows
= getSelectedFeeds();
924 if (rows
.length
== 0) {
925 alert("No feeds are selected.");
929 if (rows
.length
> 1) {
930 notify("Please select only one feed.");
938 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
939 param_escape(rows
.toString()), true);
940 xmlhttp
.onreadystatechange
=infobox_callback
;
945 function editSelectedFilter() {
946 var rows
= getSelectedFilters();
948 if (rows
.length
== 0) {
949 alert("No filters are selected.");
953 if (rows
.length
> 1) {
954 alert("Please select only one filter.");
965 function editSelectedFeed() {
966 var rows
= getSelectedFeeds();
968 if (rows
.length
== 0) {
969 notify("No feeds are selected.");
973 if (rows
.length
> 1) {
974 notify("Please select one feed.");
984 function editSelectedFeedCat() {
985 var rows
= getSelectedFeedCats();
987 if (rows
.length
== 0) {
988 alert("No categories are selected.");
992 if (rows
.length
> 1) {
993 alert("Please select only one category.");
999 editFeedCat(rows
[0]);
1003 function piggie_callback() {
1004 var piggie
= document
.getElementById("piggie");
1006 piggie
.style
.top
= piggie_top
;
1007 piggie
.style
.backgroundColor
= "white";
1008 piggie
.style
.borderWidth
= "1px";
1010 if (piggie_fwd
&& piggie_top
< 0) {
1011 setTimeout("piggie_callback()", 50);
1012 piggie_top
= piggie_top
+ 10;
1013 } else if (piggie_fwd
&& piggie_top
>= 0) {
1015 setTimeout("piggie_callback()", 50);
1016 } else if (!piggie_fwd
&& piggie_top
> -400) {
1017 setTimeout("piggie_callback()", 50);
1018 piggie_top
= piggie_top
- 10;
1019 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1020 piggie
.style
.display
= "none";
1025 var piggie_opacity
= 0;
1027 function piggie2_callback() {
1028 var piggie
= document
.getElementById("piggie");
1029 piggie
.style
.top
= 0;
1030 piggie
.style
.opacity
= piggie_opacity
;
1031 piggie
.style
.backgroundColor
= "transparent";
1032 piggie
.style
.borderWidth
= "0px";
1034 if (piggie_fwd
&& piggie_opacity
< 1) {
1035 setTimeout("piggie2_callback()", 50);
1036 piggie_opacity
= piggie_opacity
+ 0.03;
1037 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1039 setTimeout("piggie2_callback()", 50);
1040 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1041 setTimeout("piggie2_callback()", 50);
1042 piggie_opacity
= piggie_opacity
- 0.03;
1043 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1044 piggie
.style
.display
= "none";
1049 function localPiggieFunction(enable
) {
1051 var piggie
= document
.getElementById("piggie");
1052 piggie
.style
.display
= "block";
1054 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1062 function validateOpmlImport() {
1064 var opml_file
= document
.getElementById("opml_file");
1066 if (opml_file
.value
.length
== 0) {
1067 alert("No OPML file to upload.");
1074 function updateFilterList() {
1076 if (!xmlhttp_ready(xmlhttp
)) {
1077 printLockingError();
1081 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1083 // p_notify("Loading, please wait...");
1085 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1086 xmlhttp
.onreadystatechange
=filterlist_callback
;
1091 function updateLabelList() {
1093 if (!xmlhttp_ready(xmlhttp
)) {
1094 printLockingError();
1098 // p_notify("Loading, please wait...");
1100 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1102 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1103 xmlhttp
.onreadystatechange
=labellist_callback
;
1107 function updatePrefsList() {
1109 if (!xmlhttp_ready(xmlhttp
)) {
1110 printLockingError();
1114 // p_notify("Loading, please wait...");
1116 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1117 xmlhttp
.onreadystatechange
=prefslist_callback
;
1122 function selectTab(id
, noupdate
) {
1126 if (!xmlhttp_ready(xmlhttp
)) {
1127 printLockingError();
1133 notify("Loading, please wait...", true);
1135 // close active infobox if needed
1138 // clean up all current selections, just in case
1139 active_feed_cat
= false;
1140 active_filter
= false;
1141 active_label
= false;
1143 if (id
== "feedConfig") {
1145 } else if (id
== "filterConfig") {
1147 } else if (id
== "labelConfig") {
1149 } else if (id
== "genConfig") {
1151 } else if (id
== "userConfig") {
1153 } else if (id
== "feedBrowser") {
1154 updateBigFeedBrowser();
1158 var tab
= document
.getElementById(active_tab
+ "Tab");
1161 if (tab
.className
.match("Selected")) {
1162 tab
.className
= "prefsTab";
1166 tab
= document
.getElementById(id
+ "Tab");
1169 if (!tab
.className
.match("Selected")) {
1170 tab
.className
= tab
.className
+ "Selected";
1176 setCookie('ttrss_pref_acttab', active_tab
);
1184 if (arguments
.callee
.done
) return;
1185 arguments
.callee
.done
= true;
1189 document
.getElementById("prefContent").innerHTML
=
1190 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1191 "to function properly. Your browser doesn't seem to support it.";
1195 active_tab
= getCookie("ttrss_pref_acttab");
1196 if (!active_tab
) active_tab
= "genConfig";
1197 selectTab(active_tab
);
1199 document
.onkeydown
= hotkey_handler
;
1202 exception_error("init", e
);
1206 function categorizeSelectedFeeds() {
1208 if (!xmlhttp_ready(xmlhttp
)) {
1209 printLockingError();
1213 var sel_rows
= getSelectedFeeds();
1215 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1216 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].value
;
1218 if (sel_rows
.length
> 0) {
1220 notify("Changing category of selected feeds...");
1222 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1223 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1224 xmlhttp
.onreadystatechange
=feedlist_callback
;
1229 alert("No feeds are selected.");
1235 function validatePrefsReset() {
1236 return confirm("Reset to defaults?");
1239 function browseFeeds(limit
) {
1241 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1242 xmlhttp
.onreadystatechange
=infobox_callback
;
1247 function feedBrowserSubscribe() {
1250 var selected
= getSelectedFeedsFromBrowser();
1252 if (selected
.length
> 0) {
1254 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1255 param_escape(selected
.toString()), true);
1256 xmlhttp
.onreadystatechange
=feedlist_callback
;
1259 alert("No feeds are selected.");
1263 exception_error("feedBrowserSubscribe", e
);
1267 function updateBigFeedBrowser(limit
) {
1269 if (!xmlhttp_ready(xmlhttp
)) {
1270 printLockingError();
1274 // p_notify("Loading, please wait...");
1276 var query
= "backend.php?op=pref-feed-browser";
1278 var limit_sel
= document
.getElementById("feedBrowserLimit");
1281 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1282 query
= query
+ "&limit=" + param_escape(limit
);
1285 xmlhttp
.open("GET", query
, true);
1286 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1290 function browserToggleExpand(id
) {
1292 /* if (feed_to_expand && feed_to_expand != id) {
1293 var d = document.getElementById("BRDET-" + feed_to_expand);
1294 d.style.display = "none";
1297 if (!xmlhttp_ready(xmlhttp
)) {
1298 printLockingError();
1302 var d
= document
.getElementById("BRDET-" + id
);
1304 if (d
.style
.display
== "block") {
1305 d
.style
.display
= "none";
1309 feed_to_expand
= id
;
1311 d
.style
.display
= "block";
1312 d
.innerHTML
= "Loading, please wait...";
1314 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1315 + param_escape(id
), true);
1316 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1321 exception_error("browserExpand", e
);
1325 function validateNewPassword(form
) {
1326 if (form
.OLD_PASSWORD
.value
== "") {
1327 alert("Old password cannot be blank");
1330 if (form
.NEW_PASSWORD
.value
== "") {
1331 alert("New password cannot be blank");
1337 function selectPrefRows(kind
, select
) {
1340 var opbarid
= false;
1345 if (kind
== "feed") {
1346 opbarid
= "feedOpToolbar";
1349 lname
= "prefFeedList";
1350 } else if (kind
== "fcat") {
1351 opbarid
= "catOpToolbar";
1354 lname
= "prefFeedCatList";
1355 } else if (kind
== "filter") {
1356 opbarid
= "filterOpToolbar";
1359 lname
= "prefFilterList";
1360 } else if (kind
== "label") {
1361 opbarid
= "labelOpToolbar";
1364 lname
= "prefLabelList";
1365 } else if (kind
== "user") {
1366 opbarid
= "userOpToolbar";
1369 lname
= "prefUserList";
1373 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1374 disableContainerChildren(opbarid
, !select
);
1381 function toggleSelectPrefRow(sender
, kind
) {
1383 toggleSelectRow(sender
);
1386 var opbarid
= false;
1389 if (kind
== "feed") {
1390 opbarid
= "feedOpToolbar";
1391 nsel
= getSelectedFeeds();
1392 } else if (kind
== "fcat") {
1393 opbarid
= "catOpToolbar";
1394 nsel
= getSelectedFeedCats();
1395 } else if (kind
== "filter") {
1396 opbarid
= "filterOpToolbar";
1397 nsel
= getSelectedFilters();
1398 } else if (kind
== "label") {
1399 opbarid
= "labelOpToolbar";
1400 nsel
= getSelectedLabels();
1401 } else if (kind
== "user") {
1402 opbarid
= "userOpToolbar";
1403 nsel
= getSelectedUsers();
1406 if (opbarid
&& nsel
!= -1) {
1407 disableContainerChildren(opbarid
, nsel
== false);
1413 function toggleSelectFBListRow(sender
) {
1414 toggleSelectListRow(sender
);
1415 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);