3 var active_feed_cat
= false;
4 var active_label
= false;
5 var active_tab
= false;
6 var feed_to_expand
= false;
11 var xmlhttp
= Ajax
.getTransport();
13 var init_params
= new Array();
15 function expand_feed_callback() {
16 if (xmlhttp
.readyState
== 4) {
18 var container
= document
.getElementById("BRDET-" + feed_to_expand
);
19 container
.innerHTML
=xmlhttp
.responseText
;
20 container
.style
.display
= "block";
23 exception_error("expand_feed_callback", e
);
28 function feedlist_callback() {
29 if (xmlhttp
.readyState
== 4) {
31 var container
= document
.getElementById('prefContent');
32 container
.innerHTML
=xmlhttp
.responseText
;
33 selectTab("feedConfig", true);
35 if (active_feed_cat
) {
36 var row
= document
.getElementById("FCATR-" + active_feed_cat
);
38 if (!row
.className
.match("Selected")) {
39 row
.className
= row
.className
+ "Selected";
42 var checkbox
= document
.getElementById("FCCHK-" + active_feed_cat
);
44 checkbox
.checked
= true;
50 exception_error("feedlist_callback", e
);
55 function filterlist_callback() {
56 var container
= document
.getElementById('prefContent');
57 if (xmlhttp
.readyState
== 4) {
58 container
.innerHTML
=xmlhttp
.responseText
;
63 function labellist_callback() {
64 var container
= document
.getElementById('prefContent');
65 if (xmlhttp
.readyState
== 4) {
66 container
.innerHTML
=xmlhttp
.responseText
;
69 var row
= document
.getElementById("LILRR-" + active_label
);
71 if (!row
.className
.match("Selected")) {
72 row
.className
= row
.className
+ "Selected";
75 var checkbox
= document
.getElementById("LICHK-" + active_label
);
78 checkbox
.checked
= true;
85 function feed_browser_callback() {
86 var container
= document
.getElementById('prefContent');
87 if (xmlhttp
.readyState
== 4) {
88 container
.innerHTML
=xmlhttp
.responseText
;
93 function userlist_callback() {
94 var container
= document
.getElementById('prefContent');
95 if (xmlhttp
.readyState
== 4) {
96 container
.innerHTML
=xmlhttp
.responseText
;
101 function prefslist_callback() {
102 var container
= document
.getElementById('prefContent');
103 if (xmlhttp
.readyState
== 4) {
105 container
.innerHTML
=xmlhttp
.responseText
;
111 function gethelp_callback() {
112 var container
= document
.getElementById('prefHelpBox');
113 if (xmlhttp
.readyState
== 4) {
115 container
.innerHTML
= xmlhttp
.responseText
;
116 container
.style
.display
= "block";
122 function notify_callback() {
123 var container
= document
.getElementById('notify');
124 if (xmlhttp
.readyState
== 4) {
125 container
.innerHTML
=xmlhttp
.responseText
;
129 function updateFeedList(sort_key
) {
131 if (!xmlhttp_ready(xmlhttp
)) {
136 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
138 // p_notify("Loading, please wait...");
140 var feed_search
= document
.getElementById("feed_search");
142 if (feed_search
) { search
= feed_search
.value
; }
144 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
145 "&sort=" + param_escape(sort_key
) +
146 "&search=" + param_escape(search
), true);
147 xmlhttp
.onreadystatechange
=feedlist_callback
;
152 function updateUsersList() {
154 if (!xmlhttp_ready(xmlhttp
)) {
159 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
161 // p_notify("Loading, please wait...");
163 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
164 xmlhttp
.onreadystatechange
=userlist_callback
;
169 function addLabel() {
171 if (!xmlhttp_ready(xmlhttp
)) {
176 var sqlexp
= document
.getElementById("ladd_expr");
178 if (sqlexp
.value
.length
== 0) {
179 alert("Can't add label: missing SQL expression.");
181 notify("Adding label...");
183 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
184 param_escape(sqlexp
.value
), true);
186 xmlhttp
.onreadystatechange
=labellist_callback
;
194 function addFilter() {
196 if (!xmlhttp_ready(xmlhttp
)) {
201 var regexp
= document
.getElementById("fadd_regexp");
202 var match
= document
.getElementById("fadd_match");
203 var feed
= document
.getElementById("fadd_feed");
204 var action
= document
.getElementById("fadd_action");
206 if (regexp
.value
.length
== 0) {
207 alert("Can't add filter: missing filter expression.");
209 notify("Adding filter...");
211 var v_match
= match
[match
.selectedIndex
].text
;
212 var feed_id
= feed
[feed
.selectedIndex
].id
;
213 var action_id
= action
[action
.selectedIndex
].id
;
215 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
216 param_escape(regexp
.value
) + "&match=" + v_match
+
217 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
219 xmlhttp
.onreadystatechange
=filterlist_callback
;
229 if (!xmlhttp_ready(xmlhttp
)) {
234 var link
= document
.getElementById("fadd_link");
236 if (link
.value
.length
== 0) {
237 alert("Error: No feed URL given.");
238 } else if (!isValidURL(link
.value
)) {
239 alert("Error: Invalid feed URL.");
241 notify("Adding feed...");
243 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&feed_url=" +
244 param_escape(link
.value
), true);
245 xmlhttp
.onreadystatechange
=feedlist_callback
;
254 function addFeedCat() {
256 if (!xmlhttp_ready(xmlhttp
)) {
261 var cat
= document
.getElementById("fadd_cat");
263 if (cat
.value
.length
== 0) {
264 alert("Can't add category: no name specified.");
266 notify("Adding feed category...");
268 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
269 param_escape(cat
.value
), true);
270 xmlhttp
.onreadystatechange
=feedlist_callback
;
280 if (!xmlhttp_ready(xmlhttp
)) {
285 var sqlexp
= document
.getElementById("uadd_box");
287 if (sqlexp
.value
.length
== 0) {
288 alert("Can't add user: no login specified.");
290 notify("Adding user...");
292 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
293 param_escape(sqlexp
.value
), true);
295 xmlhttp
.onreadystatechange
=userlist_callback
;
303 function editLabel(id
) {
305 if (!xmlhttp_ready(xmlhttp
)) {
312 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
313 param_escape(id
), true);
314 xmlhttp
.onreadystatechange
=labellist_callback
;
319 function editUser(id
) {
321 if (!xmlhttp_ready(xmlhttp
)) {
326 selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
327 selectTableRowById('UMRR-'+id
, 'UMCHK-'+id
, true);
329 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
330 param_escape(id
), true);
331 xmlhttp
.onreadystatechange
=infobox_callback
;
336 function editFilter(id
) {
338 if (!xmlhttp_ready(xmlhttp
)) {
343 document
.getElementById("create_filter_btn").disabled
= true;
345 selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
346 selectTableRowById('FILRR-'+id
, 'FICHK-'+id
, true);
348 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id
), true);
349 xmlhttp
.onreadystatechange
=infobox_callback
;
353 function editFeed(feed
) {
355 // notify("Editing feed...");
357 if (!xmlhttp_ready(xmlhttp
)) {
362 // clean selection from all rows & select row being edited
363 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
364 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
366 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
367 param_escape(feed
), true);
369 xmlhttp
.onreadystatechange
=infobox_callback
;
374 function editFeedCat(cat
) {
376 if (!xmlhttp_ready(xmlhttp
)) {
381 active_feed_cat
= cat
;
383 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
384 param_escape(cat
), true);
385 xmlhttp
.onreadystatechange
=feedlist_callback
;
390 function getSelectedLabels() {
391 return getSelectedTableRowIds("prefLabelList", "LILRR");
394 function getSelectedUsers() {
395 return getSelectedTableRowIds("prefUserList", "UMRR");
398 function getSelectedFeeds() {
399 return getSelectedTableRowIds("prefFeedList", "FEEDR");
402 function getSelectedFilters() {
403 return getSelectedTableRowIds("prefFilterList", "FILRR");
406 function getSelectedFeedCats() {
407 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
410 function getSelectedFeedsFromBrowser() {
412 var list
= document
.getElementById("browseFeedList");
413 if (!list
) list
= document
.getElementById("browseBigFeedList");
415 var selected
= new Array();
417 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
418 var child
= list
.childNodes
[i
];
419 if (child
.id
&& child
.id
.match("FBROW-")) {
420 var id
= child
.id
.replace("FBROW-", "");
422 var cb
= document
.getElementById("FBCHK-" + id
);
433 function removeSelectedLabels() {
435 if (!xmlhttp_ready(xmlhttp
)) {
440 var sel_rows
= getSelectedLabels();
442 if (sel_rows
.length
> 0) {
444 var ok
= confirm("Remove selected labels?");
447 notify("Removing selected labels...");
449 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
450 param_escape(sel_rows
.toString()), true);
451 xmlhttp
.onreadystatechange
=labellist_callback
;
455 alert("No labels are selected.");
459 function removeSelectedUsers() {
461 if (!xmlhttp_ready(xmlhttp
)) {
466 var sel_rows
= getSelectedUsers();
468 if (sel_rows
.length
> 0) {
470 var ok
= confirm("Remove selected users?");
473 notify("Removing selected users...");
475 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
476 param_escape(sel_rows
.toString()), true);
477 xmlhttp
.onreadystatechange
=userlist_callback
;
482 alert("No users are selected.");
486 function removeSelectedFilters() {
488 if (!xmlhttp_ready(xmlhttp
)) {
493 var sel_rows
= getSelectedFilters();
495 if (sel_rows
.length
> 0) {
497 var ok
= confirm("Remove selected filters?");
500 notify("Removing selected filters...");
502 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
503 param_escape(sel_rows
.toString()), true);
504 xmlhttp
.onreadystatechange
=filterlist_callback
;
508 alert("No filters are selected.");
513 function removeSelectedFeeds() {
515 if (!xmlhttp_ready(xmlhttp
)) {
520 var sel_rows
= getSelectedFeeds();
522 if (sel_rows
.length
> 0) {
524 var ok
= confirm("Unsubscribe from selected feeds?");
528 notify("Unsubscribing from selected feeds...");
530 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
531 param_escape(sel_rows
.toString()), true);
532 xmlhttp
.onreadystatechange
=feedlist_callback
;
538 alert("No feeds are selected.");
544 function removeSelectedFeedCats() {
546 if (!xmlhttp_ready(xmlhttp
)) {
551 var sel_rows
= getSelectedFeedCats();
553 if (sel_rows
.length
> 0) {
555 var ok
= confirm("Remove selected categories?");
558 notify("Removing selected categories...");
560 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
561 param_escape(sel_rows
.toString()), true);
562 xmlhttp
.onreadystatechange
=feedlist_callback
;
568 alert("No categories are selected.");
574 function feedEditCancel() {
576 if (!xmlhttp_ready(xmlhttp
)) {
583 selectPrefRows('feed', false); // cleanup feed selection
587 function feedCatEditCancel() {
589 if (!xmlhttp_ready(xmlhttp
)) {
594 active_feed_cat
= false;
596 // notify("Operation cancelled.");
598 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
599 xmlhttp
.onreadystatechange
=feedlist_callback
;
604 function feedEditSave() {
608 if (!xmlhttp_ready(xmlhttp
)) {
613 // FIXME: add parameter validation
615 var query
= Form
.serialize("edit_feed_form");
617 notify("Saving feed...");
619 xmlhttp
.open("POST", "backend.php", true);
620 xmlhttp
.onreadystatechange
=feedlist_callback
;
621 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
629 exception_error("feedEditSave", e
);
633 function feedCatEditSave() {
635 if (!xmlhttp_ready(xmlhttp
)) {
640 notify("Saving category...");
642 var query
= Form
.serialize("feed_cat_edit_form");
644 xmlhttp
.open("GET", "backend.php?" + query
, true);
645 xmlhttp
.onreadystatechange
=feedlist_callback
;
648 active_feed_cat
= false;
653 function labelTest() {
655 var form
= document
.forms
['label_edit_form'];
657 var sql_exp
= form
.sql_exp
.value
;
658 var description
= form
.description
.value
;
660 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
661 param_escape(sql_exp
) + "&descr=" + param_escape(description
), true);
663 xmlhttp
.onreadystatechange
=infobox_callback
;
668 function displayHelpInfobox(topic_id
) {
670 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
671 param_escape(topic_id
) + "&noheaders=1", true);
673 xmlhttp
.onreadystatechange
=infobox_callback
;
678 function labelEditCancel() {
680 if (!xmlhttp_ready(xmlhttp
)) {
685 active_label
= false;
687 // notify("Operation cancelled.");
691 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
692 xmlhttp
.onreadystatechange
=labellist_callback
;
697 function userEditCancel() {
699 if (!xmlhttp_ready(xmlhttp
)) {
704 selectPrefRows('user', false); // cleanup feed selection
708 function filterEditCancel() {
710 if (!xmlhttp_ready(xmlhttp
)) {
715 document
.getElementById("create_filter_btn").disabled
= false;
717 selectPrefRows('filter', false); // cleanup feed selection
721 function labelEditSave() {
723 var label
= active_label
;
725 if (!xmlhttp_ready(xmlhttp
)) {
730 var sql_exp
= document
.forms
["label_edit_form"].sql_exp
.value
;
731 var description
= document
.forms
["label_edit_form"].description
.value
;
733 if (sql_exp
.length
== 0) {
734 alert("SQL Expression cannot be blank.");
738 if (description
.length
== 0) {
739 alert("Caption field cannot be blank.");
745 notify("Saving label...");
747 active_label
= false;
749 query
= Form
.serialize("label_edit_form");
751 xmlhttp
.open("GET", "backend.php?" + query
, true);
752 xmlhttp
.onreadystatechange
=labellist_callback
;
757 function userEditSave() {
759 if (!xmlhttp_ready(xmlhttp
)) {
764 var login
= document
.forms
["user_edit_form"].login
.value
;
766 if (login
.length
== 0) {
767 alert("Login field cannot be blank.");
771 notify("Saving user...");
775 var query
= Form
.serialize("user_edit_form");
777 xmlhttp
.open("GET", "backend.php?" + query
, true);
778 xmlhttp
.onreadystatechange
=userlist_callback
;
783 function filterEditSave() {
785 if (!xmlhttp_ready(xmlhttp
)) {
790 var reg_exp
= document
.forms
["filter_edit_form"].reg_exp
.value
;
792 if (reg_exp
.length
== 0) {
793 alert("Filter expression field cannot be blank.");
797 notify("Saving filter...");
799 var query
= Form
.serialize("filter_edit_form");
803 document
.getElementById("create_filter_btn").disabled
= false;
805 xmlhttp
.open("GET", "backend.php?" + query
, true);
806 xmlhttp
.onreadystatechange
=filterlist_callback
;
811 function editSelectedLabel() {
812 var rows
= getSelectedLabels();
814 if (rows
.length
== 0) {
815 alert("No labels are selected.");
819 if (rows
.length
> 1) {
820 alert("Please select only one label.");
830 function editSelectedUser() {
831 var rows
= getSelectedUsers();
833 if (rows
.length
== 0) {
834 alert("No users are selected.");
838 if (rows
.length
> 1) {
839 alert("Please select only one user.");
848 function resetSelectedUserPass() {
849 var rows
= getSelectedUsers();
851 if (rows
.length
== 0) {
852 alert("No users are selected.");
856 if (rows
.length
> 1) {
857 alert("Please select only one user.");
861 var ok
= confirm("Reset password of selected user?");
864 notify("Resetting password for selected user...");
868 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
869 param_escape(id
), true);
870 xmlhttp
.onreadystatechange
=userlist_callback
;
875 function selectedUserDetails() {
877 if (!xmlhttp_ready(xmlhttp
)) {
882 var rows
= getSelectedUsers();
884 if (rows
.length
== 0) {
885 alert("No users are selected.");
889 if (rows
.length
> 1) {
890 alert("Please select only one user.");
898 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
899 xmlhttp
.onreadystatechange
=infobox_callback
;
904 function selectedFeedDetails() {
906 if (!xmlhttp_ready(xmlhttp
)) {
911 var rows
= getSelectedFeeds();
913 if (rows
.length
== 0) {
914 alert("No feeds are selected.");
918 if (rows
.length
> 1) {
919 notify("Please select only one feed.");
927 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
928 param_escape(rows
.toString()), true);
929 xmlhttp
.onreadystatechange
=infobox_callback
;
934 function editSelectedFilter() {
935 var rows
= getSelectedFilters();
937 if (rows
.length
== 0) {
938 alert("No filters are selected.");
942 if (rows
.length
> 1) {
943 alert("Please select only one filter.");
954 function editSelectedFeed() {
955 var rows
= getSelectedFeeds();
957 if (rows
.length
== 0) {
958 notify("No feeds are selected.");
962 if (rows
.length
> 1) {
963 notify("Please select one feed.");
973 function editSelectedFeedCat() {
974 var rows
= getSelectedFeedCats();
976 if (rows
.length
== 0) {
977 alert("No categories are selected.");
981 if (rows
.length
> 1) {
982 alert("Please select only one category.");
988 editFeedCat(rows
[0]);
992 function piggie_callback() {
993 var piggie
= document
.getElementById("piggie");
995 piggie
.style
.top
= piggie_top
;
996 piggie
.style
.backgroundColor
= "white";
997 piggie
.style
.borderWidth
= "1px";
999 if (piggie_fwd
&& piggie_top
< 0) {
1000 setTimeout("piggie_callback()", 50);
1001 piggie_top
= piggie_top
+ 10;
1002 } else if (piggie_fwd
&& piggie_top
>= 0) {
1004 setTimeout("piggie_callback()", 50);
1005 } else if (!piggie_fwd
&& piggie_top
> -400) {
1006 setTimeout("piggie_callback()", 50);
1007 piggie_top
= piggie_top
- 10;
1008 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1009 piggie
.style
.display
= "none";
1014 var piggie_opacity
= 0;
1016 function piggie2_callback() {
1017 var piggie
= document
.getElementById("piggie");
1018 piggie
.style
.top
= 0;
1019 piggie
.style
.opacity
= piggie_opacity
;
1020 piggie
.style
.backgroundColor
= "transparent";
1021 piggie
.style
.borderWidth
= "0px";
1023 if (piggie_fwd
&& piggie_opacity
< 1) {
1024 setTimeout("piggie2_callback()", 50);
1025 piggie_opacity
= piggie_opacity
+ 0.03;
1026 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1028 setTimeout("piggie2_callback()", 50);
1029 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1030 setTimeout("piggie2_callback()", 50);
1031 piggie_opacity
= piggie_opacity
- 0.03;
1032 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1033 piggie
.style
.display
= "none";
1038 function localPiggieFunction(enable
) {
1040 var piggie
= document
.getElementById("piggie");
1041 piggie
.style
.display
= "block";
1043 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1051 function validateOpmlImport() {
1053 var opml_file
= document
.getElementById("opml_file");
1055 if (opml_file
.value
.length
== 0) {
1056 alert("No OPML file to upload.");
1063 function updateFilterList() {
1065 if (!xmlhttp_ready(xmlhttp
)) {
1066 printLockingError();
1070 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1072 // p_notify("Loading, please wait...");
1074 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1075 xmlhttp
.onreadystatechange
=filterlist_callback
;
1080 function updateLabelList() {
1082 if (!xmlhttp_ready(xmlhttp
)) {
1083 printLockingError();
1087 // p_notify("Loading, please wait...");
1089 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1091 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1092 xmlhttp
.onreadystatechange
=labellist_callback
;
1096 function updatePrefsList() {
1098 if (!xmlhttp_ready(xmlhttp
)) {
1099 printLockingError();
1103 // p_notify("Loading, please wait...");
1105 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1106 xmlhttp
.onreadystatechange
=prefslist_callback
;
1111 function selectTab(id
, noupdate
) {
1115 if (!xmlhttp_ready(xmlhttp
)) {
1116 printLockingError();
1122 notify("Loading, please wait...", true);
1124 // close active infobox if needed
1127 // clean up all current selections, just in case
1128 active_feed_cat
= false;
1129 active_label
= false;
1131 if (id
== "feedConfig") {
1133 } else if (id
== "filterConfig") {
1135 } else if (id
== "labelConfig") {
1137 } else if (id
== "genConfig") {
1139 } else if (id
== "userConfig") {
1141 } else if (id
== "feedBrowser") {
1142 updateBigFeedBrowser();
1146 var tab
= document
.getElementById(active_tab
+ "Tab");
1149 if (tab
.className
.match("Selected")) {
1150 tab
.className
= "prefsTab";
1154 tab
= document
.getElementById(id
+ "Tab");
1157 if (!tab
.className
.match("Selected")) {
1158 tab
.className
= tab
.className
+ "Selected";
1162 if (active_tab
!= id
) {
1163 storeInitParam("prefs_active_tab", id
);
1169 function backend_sanity_check_callback() {
1171 if (xmlhttp
.readyState
== 4) {
1175 if (!xmlhttp
.responseXML
) {
1176 fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp
.responseText
);
1180 var reply
= xmlhttp
.responseXML
.firstChild
.firstChild
;
1183 fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp
.responseText
);
1187 var error_code
= reply
.getAttribute("error-code");
1189 if (error_code
&& error_code
!= 0) {
1190 return fatalError(error_code
, reply
.getAttribute("error-msg"));
1193 debug("sanity check ok");
1195 var params
= reply
.nextSibling
;
1198 debug('reading init-params...');
1199 var param
= params
.firstChild
;
1202 var k
= param
.getAttribute("key");
1203 var v
= param
.getAttribute("value");
1204 debug(k
+ " => " + v
);
1206 param
= param
.nextSibling
;
1210 init_second_stage();
1213 exception_error("backend_sanity_check_callback", e
);
1218 function init_second_stage() {
1220 active_tab
= getInitParam("prefs_active_tab");
1221 if (!active_tab
) active_tab
= "genConfig";
1222 selectTab(active_tab
);
1232 if (arguments
.callee
.done
) return;
1233 arguments
.callee
.done
= true;
1235 if (getURLParam('debug')) {
1236 document
.getElementById('debug_output').style
.display
= 'block';
1237 debug('debug mode activated');
1242 document
.getElementById("prefContent").innerHTML
=
1243 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1244 "to function properly. Your browser doesn't seem to support it.";
1248 xmlhttp
.open("GET", "backend.php?op=rpc&subop=sanityCheck", true);
1249 xmlhttp
.onreadystatechange
=backend_sanity_check_callback
;
1253 exception_error("init", e
);
1257 function categorizeSelectedFeeds() {
1259 if (!xmlhttp_ready(xmlhttp
)) {
1260 printLockingError();
1264 var sel_rows
= getSelectedFeeds();
1266 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1267 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].value
;
1269 if (sel_rows
.length
> 0) {
1271 notify("Changing category of selected feeds...");
1273 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1274 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1275 xmlhttp
.onreadystatechange
=feedlist_callback
;
1280 alert("No feeds are selected.");
1286 function validatePrefsReset() {
1287 return confirm("Reset to defaults?");
1290 function browseFeeds(limit
) {
1292 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1293 xmlhttp
.onreadystatechange
=infobox_callback
;
1298 function feedBrowserSubscribe() {
1301 var selected
= getSelectedFeedsFromBrowser();
1303 if (selected
.length
> 0) {
1305 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1306 param_escape(selected
.toString()), true);
1307 xmlhttp
.onreadystatechange
=feedlist_callback
;
1310 alert("No feeds are selected.");
1314 exception_error("feedBrowserSubscribe", e
);
1318 function updateBigFeedBrowser(limit
) {
1320 if (!xmlhttp_ready(xmlhttp
)) {
1321 printLockingError();
1325 // p_notify("Loading, please wait...");
1327 var query
= "backend.php?op=pref-feed-browser";
1329 var limit_sel
= document
.getElementById("feedBrowserLimit");
1332 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1333 query
= query
+ "&limit=" + param_escape(limit
);
1336 xmlhttp
.open("GET", query
, true);
1337 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1341 function browserToggleExpand(id
) {
1343 /* if (feed_to_expand && feed_to_expand != id) {
1344 var d = document.getElementById("BRDET-" + feed_to_expand);
1345 d.style.display = "none";
1348 if (!xmlhttp_ready(xmlhttp
)) {
1349 printLockingError();
1353 var d
= document
.getElementById("BRDET-" + id
);
1355 if (d
.style
.display
== "block") {
1356 d
.style
.display
= "none";
1360 feed_to_expand
= id
;
1362 d
.style
.display
= "block";
1363 d
.innerHTML
= "Loading, please wait...";
1365 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1366 + param_escape(id
), true);
1367 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1372 exception_error("browserExpand", e
);
1376 function validateNewPassword(form
) {
1377 if (form
.OLD_PASSWORD
.value
== "") {
1378 alert("Old password cannot be blank");
1381 if (form
.NEW_PASSWORD
.value
== "") {
1382 alert("New password cannot be blank");
1388 function selectPrefRows(kind
, select
) {
1391 var opbarid
= false;
1396 if (kind
== "feed") {
1397 opbarid
= "feedOpToolbar";
1400 lname
= "prefFeedList";
1401 } else if (kind
== "fcat") {
1402 opbarid
= "catOpToolbar";
1405 lname
= "prefFeedCatList";
1406 } else if (kind
== "filter") {
1407 opbarid
= "filterOpToolbar";
1410 lname
= "prefFilterList";
1411 } else if (kind
== "label") {
1412 opbarid
= "labelOpToolbar";
1415 lname
= "prefLabelList";
1416 } else if (kind
== "user") {
1417 opbarid
= "userOpToolbar";
1420 lname
= "prefUserList";
1424 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1425 disableContainerChildren(opbarid
, !select
);
1432 function toggleSelectPrefRow(sender
, kind
) {
1434 toggleSelectRow(sender
);
1437 var opbarid
= false;
1440 if (kind
== "feed") {
1441 opbarid
= "feedOpToolbar";
1442 nsel
= getSelectedFeeds();
1443 } else if (kind
== "fcat") {
1444 opbarid
= "catOpToolbar";
1445 nsel
= getSelectedFeedCats();
1446 } else if (kind
== "filter") {
1447 opbarid
= "filterOpToolbar";
1448 nsel
= getSelectedFilters();
1449 } else if (kind
== "label") {
1450 opbarid
= "labelOpToolbar";
1451 nsel
= getSelectedLabels();
1452 } else if (kind
== "user") {
1453 opbarid
= "userOpToolbar";
1454 nsel
= getSelectedUsers();
1457 if (opbarid
&& nsel
!= -1) {
1458 disableContainerChildren(opbarid
, nsel
== false);
1464 function toggleSelectFBListRow(sender
) {
1465 toggleSelectListRow(sender
);
1466 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);