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) {
67 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 labeltest_callback() {
86 var container
= document
.getElementById('label_test_result');
87 if (xmlhttp
.readyState
== 4) {
88 container
.innerHTML
=xmlhttp
.responseText
;
93 function feed_browser_callback() {
94 var container
= document
.getElementById('prefContent');
95 if (xmlhttp
.readyState
== 4) {
96 container
.innerHTML
=xmlhttp
.responseText
;
101 function userlist_callback() {
102 var container
= document
.getElementById('prefContent');
103 if (xmlhttp
.readyState
== 4) {
104 container
.innerHTML
=xmlhttp
.responseText
;
109 function prefslist_callback() {
110 var container
= document
.getElementById('prefContent');
111 if (xmlhttp
.readyState
== 4) {
113 container
.innerHTML
=xmlhttp
.responseText
;
119 function gethelp_callback() {
120 var container
= document
.getElementById('prefHelpBox');
121 if (xmlhttp
.readyState
== 4) {
123 container
.innerHTML
= xmlhttp
.responseText
;
124 container
.style
.display
= "block";
130 function notify_callback() {
131 var container
= document
.getElementById('notify');
132 if (xmlhttp
.readyState
== 4) {
133 container
.innerHTML
=xmlhttp
.responseText
;
137 function updateFeedList(sort_key
) {
139 if (!xmlhttp_ready(xmlhttp
)) {
144 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
146 // p_notify("Loading, please wait...");
148 var feed_search
= document
.getElementById("feed_search");
150 if (feed_search
) { search
= feed_search
.value
; }
152 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
153 "&sort=" + param_escape(sort_key
) +
154 "&search=" + param_escape(search
), true);
155 xmlhttp
.onreadystatechange
=feedlist_callback
;
160 function updateUsersList() {
162 if (!xmlhttp_ready(xmlhttp
)) {
167 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
169 // p_notify("Loading, please wait...");
171 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
172 xmlhttp
.onreadystatechange
=userlist_callback
;
177 function addLabel() {
179 if (!xmlhttp_ready(xmlhttp
)) {
184 var form
= document
.forms
['label_edit_form'];
186 var sql_exp
= form
.sql_exp
.value
;
187 var description
= form
.description
.value
;
190 alert("Can't create label: missing SQL expression.");
194 if (description
== "") {
195 alert("Can't create label: missing caption.");
199 var query
= Form
.serialize("label_edit_form");
201 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&" + query
, true);
202 xmlhttp
.onreadystatechange
=infobox_submit_callback
;
208 if (!xmlhttp_ready(xmlhttp
)) {
213 var link
= document
.getElementById("fadd_link");
215 if (link
.value
.length
== 0) {
216 alert("Error: No feed URL given.");
217 } else if (!isValidURL(link
.value
)) {
218 alert("Error: Invalid feed URL.");
220 notify("Adding feed...");
222 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&feed_url=" +
223 param_escape(link
.value
), true);
224 xmlhttp
.onreadystatechange
=feedlist_callback
;
233 function addFeedCat() {
235 if (!xmlhttp_ready(xmlhttp
)) {
240 var cat
= document
.getElementById("fadd_cat");
242 if (cat
.value
.length
== 0) {
243 alert("Can't add category: no name specified.");
245 notify("Adding feed category...");
247 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
248 param_escape(cat
.value
), true);
249 xmlhttp
.onreadystatechange
=feedlist_callback
;
259 if (!xmlhttp_ready(xmlhttp
)) {
264 var sqlexp
= document
.getElementById("uadd_box");
266 if (sqlexp
.value
.length
== 0) {
267 alert("Can't add user: no login specified.");
269 notify("Adding user...");
271 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
272 param_escape(sqlexp
.value
), true);
274 xmlhttp
.onreadystatechange
=userlist_callback
;
282 function editLabel(id
) {
284 if (!xmlhttp_ready(xmlhttp
)) {
289 document
.getElementById("label_create_btn").disabled
= true;
293 selectTableRowsByIdPrefix('prefLabelList', 'LILRR-', 'LICHK-', false);
294 selectTableRowById('LILRR-'+id
, 'LICHK-'+id
, true);
296 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
297 param_escape(id
), true);
298 xmlhttp
.onreadystatechange
=infobox_callback
;
303 function editUser(id
) {
305 if (!xmlhttp_ready(xmlhttp
)) {
310 selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
311 selectTableRowById('UMRR-'+id
, 'UMCHK-'+id
, true);
313 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
314 param_escape(id
), true);
315 xmlhttp
.onreadystatechange
=infobox_callback
;
320 function editFilter(id
) {
322 if (!xmlhttp_ready(xmlhttp
)) {
327 document
.getElementById("create_filter_btn").disabled
= true;
329 selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
330 selectTableRowById('FILRR-'+id
, 'FICHK-'+id
, true);
332 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id
), true);
333 xmlhttp
.onreadystatechange
=infobox_callback
;
337 function editFeed(feed
) {
339 // notify("Editing feed...");
341 if (!xmlhttp_ready(xmlhttp
)) {
346 // clean selection from all rows & select row being edited
347 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
348 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
350 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
351 param_escape(feed
), true);
353 xmlhttp
.onreadystatechange
=infobox_callback
;
358 function editFeedCat(cat
) {
360 if (!xmlhttp_ready(xmlhttp
)) {
365 active_feed_cat
= cat
;
367 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
368 param_escape(cat
), true);
369 xmlhttp
.onreadystatechange
=feedlist_callback
;
374 function getSelectedLabels() {
375 return getSelectedTableRowIds("prefLabelList", "LILRR");
378 function getSelectedUsers() {
379 return getSelectedTableRowIds("prefUserList", "UMRR");
382 function getSelectedFeeds() {
383 return getSelectedTableRowIds("prefFeedList", "FEEDR");
386 function getSelectedFilters() {
387 return getSelectedTableRowIds("prefFilterList", "FILRR");
390 function getSelectedFeedCats() {
391 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
394 function getSelectedFeedsFromBrowser() {
396 var list
= document
.getElementById("browseFeedList");
397 if (!list
) list
= document
.getElementById("browseBigFeedList");
399 var selected
= new Array();
401 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
402 var child
= list
.childNodes
[i
];
403 if (child
.id
&& child
.id
.match("FBROW-")) {
404 var id
= child
.id
.replace("FBROW-", "");
406 var cb
= document
.getElementById("FBCHK-" + id
);
417 function removeSelectedLabels() {
419 if (!xmlhttp_ready(xmlhttp
)) {
424 var sel_rows
= getSelectedLabels();
426 if (sel_rows
.length
> 0) {
428 var ok
= confirm("Remove selected labels?");
431 notify("Removing selected labels...");
433 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
434 param_escape(sel_rows
.toString()), true);
435 xmlhttp
.onreadystatechange
=labellist_callback
;
439 alert("No labels are selected.");
445 function removeSelectedUsers() {
447 if (!xmlhttp_ready(xmlhttp
)) {
452 var sel_rows
= getSelectedUsers();
454 if (sel_rows
.length
> 0) {
456 var ok
= confirm("Remove selected users?");
459 notify("Removing selected users...");
461 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
462 param_escape(sel_rows
.toString()), true);
463 xmlhttp
.onreadystatechange
=userlist_callback
;
468 alert("No users are selected.");
474 function removeSelectedFilters() {
476 if (!xmlhttp_ready(xmlhttp
)) {
481 var sel_rows
= getSelectedFilters();
483 if (sel_rows
.length
> 0) {
485 var ok
= confirm("Remove selected filters?");
488 notify("Removing selected filters...");
490 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
491 param_escape(sel_rows
.toString()), true);
492 xmlhttp
.onreadystatechange
=filterlist_callback
;
496 alert("No filters are selected.");
503 function removeSelectedFeeds() {
505 if (!xmlhttp_ready(xmlhttp
)) {
510 var sel_rows
= getSelectedFeeds();
512 if (sel_rows
.length
> 0) {
514 var ok
= confirm("Unsubscribe from selected feeds?");
518 notify("Unsubscribing from selected feeds...");
520 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
521 param_escape(sel_rows
.toString()), true);
522 xmlhttp
.onreadystatechange
=feedlist_callback
;
528 alert("No feeds are selected.");
535 function removeSelectedFeedCats() {
537 if (!xmlhttp_ready(xmlhttp
)) {
542 var sel_rows
= getSelectedFeedCats();
544 if (sel_rows
.length
> 0) {
546 var ok
= confirm("Remove selected categories?");
549 notify("Removing selected categories...");
551 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
552 param_escape(sel_rows
.toString()), true);
553 xmlhttp
.onreadystatechange
=feedlist_callback
;
559 alert("No categories are selected.");
566 function feedEditCancel() {
568 if (!xmlhttp_ready(xmlhttp
)) {
575 selectPrefRows('feed', false); // cleanup feed selection
580 function feedCatEditCancel() {
582 if (!xmlhttp_ready(xmlhttp
)) {
587 active_feed_cat
= false;
589 // notify("Operation cancelled.");
591 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
592 xmlhttp
.onreadystatechange
=feedlist_callback
;
598 function feedEditSave() {
602 if (!xmlhttp_ready(xmlhttp
)) {
607 // FIXME: add parameter validation
609 var query
= Form
.serialize("edit_feed_form");
611 notify("Saving feed...");
613 xmlhttp
.open("POST", "backend.php", true);
614 xmlhttp
.onreadystatechange
=feedlist_callback
;
615 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
623 exception_error("feedEditSave", e
);
627 function feedCatEditSave() {
629 if (!xmlhttp_ready(xmlhttp
)) {
634 notify("Saving category...");
636 var query
= Form
.serialize("feed_cat_edit_form");
638 xmlhttp
.open("GET", "backend.php?" + query
, true);
639 xmlhttp
.onreadystatechange
=feedlist_callback
;
642 active_feed_cat
= false;
648 function labelTest() {
650 var container
= document
.getElementById('label_test_result');
651 container
.style
.display
= "block";
652 container
.innerHTML
= "<p>Loading, please wait...</p>";
654 var form
= document
.forms
['label_edit_form'];
656 var sql_exp
= form
.sql_exp
.value
;
657 var description
= form
.description
.value
;
659 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
660 param_escape(sql_exp
) + "&descr=" + param_escape(description
), true);
662 xmlhttp
.onreadystatechange
=labeltest_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 document
.getElementById("label_create_btn").disabled
= false;
687 active_label
= false;
689 selectPrefRows('label', false); // cleanup feed selection
695 function userEditCancel() {
697 if (!xmlhttp_ready(xmlhttp
)) {
702 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
723 function labelEditSave() {
725 var label
= active_label
;
727 if (!xmlhttp_ready(xmlhttp
)) {
734 var sql_exp
= document
.forms
["label_edit_form"].sql_exp
.value
;
735 var description
= document
.forms
["label_edit_form"].description
.value
;
737 if (sql_exp
.length
== 0) {
738 alert("SQL Expression cannot be blank.");
742 if (description
.length
== 0) {
743 alert("Caption field cannot be blank.");
750 notify("Saving label...");
752 active_label
= false;
754 query
= Form
.serialize("label_edit_form");
756 xmlhttp
.open("GET", "backend.php?" + query
, true);
757 xmlhttp
.onreadystatechange
=labellist_callback
;
763 function userEditSave() {
765 if (!xmlhttp_ready(xmlhttp
)) {
770 var login
= document
.forms
["user_edit_form"].login
.value
;
772 if (login
.length
== 0) {
773 alert("Login field cannot be blank.");
777 notify("Saving user...");
781 var query
= Form
.serialize("user_edit_form");
783 xmlhttp
.open("GET", "backend.php?" + query
, true);
784 xmlhttp
.onreadystatechange
=userlist_callback
;
791 function filterEditSave() {
793 if (!xmlhttp_ready(xmlhttp
)) {
799 var reg_exp
= document
.forms
["filter_edit_form"].reg_exp
.value
;
801 if (reg_exp
.length
== 0) {
802 alert("Filter expression field cannot be blank.");
807 notify("Saving filter...");
809 var query
= Form
.serialize("filter_edit_form");
813 document
.getElementById("create_filter_btn").disabled
= false;
815 xmlhttp
.open("GET", "backend.php?" + query
, true);
816 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 debug("I LOVEDED IT!");
1052 var piggie
= document
.getElementById("piggie");
1053 piggie
.style
.display
= "block";
1055 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1063 function validateOpmlImport() {
1065 var opml_file
= document
.getElementById("opml_file");
1067 if (opml_file
.value
.length
== 0) {
1068 alert("No OPML file to upload.");
1075 function updateFilterList() {
1077 if (!xmlhttp_ready(xmlhttp
)) {
1078 printLockingError();
1082 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1084 // p_notify("Loading, please wait...");
1086 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1087 xmlhttp
.onreadystatechange
=filterlist_callback
;
1092 function updateLabelList() {
1094 if (!xmlhttp_ready(xmlhttp
)) {
1095 printLockingError();
1099 // p_notify("Loading, please wait...");
1101 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1103 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1104 xmlhttp
.onreadystatechange
=labellist_callback
;
1108 function updatePrefsList() {
1110 if (!xmlhttp_ready(xmlhttp
)) {
1111 printLockingError();
1115 // p_notify("Loading, please wait...");
1117 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1118 xmlhttp
.onreadystatechange
=prefslist_callback
;
1123 function selectTab(id
, noupdate
) {
1127 if (!id
) id
= active_tab
;
1131 if (!xmlhttp_ready(xmlhttp
)) {
1132 printLockingError();
1138 debug("selectTab: " + id
+ "(NU: " + noupdate
+ ")");
1140 // notify("Loading, please wait...", true);
1142 // close active infobox if needed
1145 // clean up all current selections, just in case
1146 active_feed_cat
= false;
1147 active_label
= false;
1149 if (id
== "feedConfig") {
1151 } else if (id
== "filterConfig") {
1153 } else if (id
== "labelConfig") {
1155 } else if (id
== "genConfig") {
1157 } else if (id
== "userConfig") {
1159 } else if (id
== "feedBrowser") {
1160 updateBigFeedBrowser();
1164 var tab
= document
.getElementById(active_tab
+ "Tab");
1167 if (tab
.className
.match("Selected")) {
1168 tab
.className
= "prefsTab";
1172 tab
= document
.getElementById(id
+ "Tab");
1175 if (!tab
.className
.match("Selected")) {
1176 tab
.className
= tab
.className
+ "Selected";
1180 if (active_tab
!= id
) {
1181 storeInitParam("prefs_active_tab", id
);
1187 exception_error("selectTab", e
);
1191 function backend_sanity_check_callback() {
1193 if (xmlhttp
.readyState
== 4) {
1197 if (!xmlhttp
.responseXML
) {
1198 fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp
.responseText
);
1202 var reply
= xmlhttp
.responseXML
.firstChild
.firstChild
;
1205 fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp
.responseText
);
1209 var error_code
= reply
.getAttribute("error-code");
1211 if (error_code
&& error_code
!= 0) {
1212 return fatalError(error_code
, reply
.getAttribute("error-msg"));
1215 debug("sanity check ok");
1217 var params
= reply
.nextSibling
;
1220 debug('reading init-params...');
1221 var param
= params
.firstChild
;
1224 var k
= param
.getAttribute("key");
1225 var v
= param
.getAttribute("value");
1226 debug(k
+ " => " + v
);
1228 param
= param
.nextSibling
;
1232 init_second_stage();
1235 exception_error("backend_sanity_check_callback", e
);
1240 function init_second_stage() {
1243 active_tab
= getInitParam("prefs_active_tab");
1244 if (!active_tab
) active_tab
= "genConfig";
1246 document
.onkeydown
= pref_hotkey_handler
;
1248 if (navigator
.userAgent
.match("Opera")) {
1249 setTimeout("selectTab()", 500);
1251 selectTab(active_tab
);
1255 exception_error("init_second_stage", e
);
1263 if (arguments
.callee
.done
) return;
1264 arguments
.callee
.done
= true;
1266 if (getURLParam('debug')) {
1267 document
.getElementById('debug_output').style
.display
= 'block';
1268 debug('debug mode activated');
1273 document
.getElementById("prefContent").innerHTML
=
1274 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1275 "to function properly. Your browser doesn't seem to support it.";
1279 xmlhttp
.open("GET", "backend.php?op=rpc&subop=sanityCheck", true);
1280 xmlhttp
.onreadystatechange
=backend_sanity_check_callback
;
1284 exception_error("init", e
);
1288 function categorizeSelectedFeeds() {
1290 if (!xmlhttp_ready(xmlhttp
)) {
1291 printLockingError();
1295 var sel_rows
= getSelectedFeeds();
1297 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1298 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].value
;
1300 if (sel_rows
.length
> 0) {
1302 notify("Changing category of selected feeds...");
1304 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1305 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1306 xmlhttp
.onreadystatechange
=feedlist_callback
;
1311 alert("No feeds are selected.");
1317 function validatePrefsReset() {
1318 return confirm("Reset to defaults?");
1321 function browseFeeds(limit
) {
1323 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1324 xmlhttp
.onreadystatechange
=infobox_callback
;
1329 function feedBrowserSubscribe() {
1332 var selected
= getSelectedFeedsFromBrowser();
1334 if (selected
.length
> 0) {
1336 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1337 param_escape(selected
.toString()), true);
1338 xmlhttp
.onreadystatechange
=feedlist_callback
;
1341 alert("No feeds are selected.");
1345 exception_error("feedBrowserSubscribe", e
);
1349 function updateBigFeedBrowser(limit
) {
1351 if (!xmlhttp_ready(xmlhttp
)) {
1352 printLockingError();
1356 // p_notify("Loading, please wait...");
1358 var query
= "backend.php?op=pref-feed-browser";
1360 var limit_sel
= document
.getElementById("feedBrowserLimit");
1363 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1364 query
= query
+ "&limit=" + param_escape(limit
);
1367 xmlhttp
.open("GET", query
, true);
1368 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1372 function browserToggleExpand(id
) {
1374 /* if (feed_to_expand && feed_to_expand != id) {
1375 var d = document.getElementById("BRDET-" + feed_to_expand);
1376 d.style.display = "none";
1379 if (!xmlhttp_ready(xmlhttp
)) {
1380 printLockingError();
1384 var d
= document
.getElementById("BRDET-" + id
);
1386 if (d
.style
.display
== "block") {
1387 d
.style
.display
= "none";
1391 feed_to_expand
= id
;
1393 d
.style
.display
= "block";
1394 d
.innerHTML
= "Loading, please wait...";
1396 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1397 + param_escape(id
), true);
1398 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1403 exception_error("browserExpand", e
);
1407 function validateNewPassword(form
) {
1408 if (form
.OLD_PASSWORD
.value
== "") {
1409 alert("Old password cannot be blank");
1412 if (form
.NEW_PASSWORD
.value
== "") {
1413 alert("New password cannot be blank");
1419 function selectPrefRows(kind
, select
) {
1422 var opbarid
= false;
1427 if (kind
== "feed") {
1428 opbarid
= "feedOpToolbar";
1431 lname
= "prefFeedList";
1432 } else if (kind
== "fcat") {
1433 opbarid
= "catOpToolbar";
1436 lname
= "prefFeedCatList";
1437 } else if (kind
== "filter") {
1438 opbarid
= "filterOpToolbar";
1441 lname
= "prefFilterList";
1442 } else if (kind
== "label") {
1443 opbarid
= "labelOpToolbar";
1446 lname
= "prefLabelList";
1447 } else if (kind
== "user") {
1448 opbarid
= "userOpToolbar";
1451 lname
= "prefUserList";
1455 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1456 disableContainerChildren(opbarid
, !select
);
1463 function toggleSelectPrefRow(sender
, kind
) {
1465 toggleSelectRow(sender
);
1468 var opbarid
= false;
1471 if (kind
== "feed") {
1472 opbarid
= "feedOpToolbar";
1473 nsel
= getSelectedFeeds();
1474 } else if (kind
== "fcat") {
1475 opbarid
= "catOpToolbar";
1476 nsel
= getSelectedFeedCats();
1477 } else if (kind
== "filter") {
1478 opbarid
= "filterOpToolbar";
1479 nsel
= getSelectedFilters();
1480 } else if (kind
== "label") {
1481 opbarid
= "labelOpToolbar";
1482 nsel
= getSelectedLabels();
1483 } else if (kind
== "user") {
1484 opbarid
= "userOpToolbar";
1485 nsel
= getSelectedUsers();
1488 if (opbarid
&& nsel
!= -1) {
1489 disableContainerChildren(opbarid
, nsel
== false);
1495 function toggleSelectFBListRow(sender
) {
1496 toggleSelectListRow(sender
);
1497 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);
1502 function pref_hotkey_handler(e
) {
1507 if (!hotkeys_enabled
) return;
1510 keycode
= window
.event
.keyCode
;
1515 if (keycode
== 13 || keycode
== 27) {
1518 seq
= seq
+ "" + keycode
;
1522 if (document
.getElementById("piggie")) {
1524 if (seq
.match("807371717369")) {
1526 localPiggieFunction(true);
1528 localPiggieFunction(false);
1533 exception_error("pref_hotkey_handler", e
);