]>
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&link=" +
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');
640 exception_error("feedEditSave", e
);
644 function feedCatEditSave() {
646 if (!xmlhttp_ready(xmlhttp
)) {
651 notify("Saving category...");
653 var query
= Form
.serialize("feed_cat_edit_form");
655 xmlhttp
.open("GET", "backend.php?" + query
, true);
656 xmlhttp
.onreadystatechange
=feedlist_callback
;
659 active_feed_cat
= false;
664 function labelTest() {
666 var form
= document
.forms
['label_edit_form'];
668 var sql_exp
= form
.sql_exp
.value
;
669 var description
= form
.description
.value
;
671 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
672 param_escape(sql_exp
) + "&descr=" + param_escape(description
), true);
674 xmlhttp
.onreadystatechange
=infobox_callback
;
679 function displayHelpInfobox(topic_id
) {
681 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
682 param_escape(topic_id
) + "&noheaders=1", true);
684 xmlhttp
.onreadystatechange
=infobox_callback
;
689 function labelEditCancel() {
691 if (!xmlhttp_ready(xmlhttp
)) {
696 active_label
= false;
698 // notify("Operation cancelled.");
700 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
701 xmlhttp
.onreadystatechange
=labellist_callback
;
706 function userEditCancel() {
708 if (!xmlhttp_ready(xmlhttp
)) {
713 selectPrefRows('user', false); // cleanup feed selection
718 function filterEditCancel() {
720 if (!xmlhttp_ready(xmlhttp
)) {
725 active_filter
= false;
727 // notify("Operation cancelled.");
729 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
730 xmlhttp
.onreadystatechange
=filterlist_callback
;
735 function labelEditSave() {
737 var label
= active_label
;
739 if (!xmlhttp_ready(xmlhttp
)) {
744 var sql_exp
= document
.forms
["label_edit_form"].sql_exp
.value
;
745 var description
= document
.forms
["label_edit_form"].description
.value
;
747 if (sql_exp
.length
== 0) {
748 alert("SQL Expression cannot be blank.");
752 if (description
.length
== 0) {
753 alert("Caption field cannot be blank.");
757 notify("Saving label...");
759 active_label
= false;
761 query
= Form
.serialize("label_edit_form");
763 xmlhttp
.open("GET", "backend.php?" + query
, true);
765 xmlhttp
.onreadystatechange
=labellist_callback
;
770 function userEditSave() {
772 if (!xmlhttp_ready(xmlhttp
)) {
777 var login
= document
.forms
["user_edit_form"].login
.value
;
779 if (login
.length
== 0) {
780 alert("Login field cannot be blank.");
784 notify("Saving user...");
786 var query
= Form
.serialize("user_edit_form");
788 xmlhttp
.open("GET", "backend.php?" + query
, true);
789 xmlhttp
.onreadystatechange
=userlist_callback
;
794 function filterEditSave() {
796 if (!xmlhttp_ready(xmlhttp
)) {
801 var reg_exp
= document
.forms
["filter_edit_form"].reg_exp
.value
;
803 if (reg_exp
.length
== 0) {
804 alert("Filter expression field cannot be blank.");
808 notify("Saving filter...");
810 active_filter
= false;
812 var query
= Form
.serialize("filter_edit_form");
814 xmlhttp
.open("GET", "backend.php?" + query
, true);
815 xmlhttp
.onreadystatechange
=filterlist_callback
;
820 function editSelectedLabel() {
821 var rows
= getSelectedLabels();
823 if (rows
.length
== 0) {
824 alert("No labels are selected.");
828 if (rows
.length
> 1) {
829 alert("Please select only one label.");
839 function editSelectedUser() {
840 var rows
= getSelectedUsers();
842 if (rows
.length
== 0) {
843 alert("No users are selected.");
847 if (rows
.length
> 1) {
848 alert("Please select only one user.");
857 function resetSelectedUserPass() {
858 var rows
= getSelectedUsers();
860 if (rows
.length
== 0) {
861 alert("No users are selected.");
865 if (rows
.length
> 1) {
866 alert("Please select only one user.");
870 var ok
= confirm("Reset password of selected user?");
873 notify("Resetting password for selected user...");
877 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
878 param_escape(id
), true);
879 xmlhttp
.onreadystatechange
=userlist_callback
;
884 function selectedUserDetails() {
886 if (!xmlhttp_ready(xmlhttp
)) {
891 var rows
= getSelectedUsers();
893 if (rows
.length
== 0) {
894 alert("No users are selected.");
898 if (rows
.length
> 1) {
899 alert("Please select only one user.");
907 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
908 xmlhttp
.onreadystatechange
=infobox_callback
;
913 function selectedFeedDetails() {
915 if (!xmlhttp_ready(xmlhttp
)) {
920 var rows
= getSelectedFeeds();
922 if (rows
.length
== 0) {
923 alert("No feeds are selected.");
927 if (rows
.length
> 1) {
928 notify("Please select only one feed.");
936 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
937 param_escape(rows
.toString()), true);
938 xmlhttp
.onreadystatechange
=infobox_callback
;
943 function editSelectedFilter() {
944 var rows
= getSelectedFilters();
946 if (rows
.length
== 0) {
947 alert("No filters are selected.");
951 if (rows
.length
> 1) {
952 alert("Please select only one filter.");
963 function editSelectedFeed() {
964 var rows
= getSelectedFeeds();
966 if (rows
.length
== 0) {
967 notify("No feeds are selected.");
971 if (rows
.length
> 1) {
972 notify("Please select one feed.");
982 function editSelectedFeedCat() {
983 var rows
= getSelectedFeedCats();
985 if (rows
.length
== 0) {
986 alert("No categories are selected.");
990 if (rows
.length
> 1) {
991 alert("Please select only one category.");
997 editFeedCat(rows
[0]);
1001 function piggie_callback() {
1002 var piggie
= document
.getElementById("piggie");
1004 piggie
.style
.top
= piggie_top
;
1005 piggie
.style
.backgroundColor
= "white";
1006 piggie
.style
.borderWidth
= "1px";
1008 if (piggie_fwd
&& piggie_top
< 0) {
1009 setTimeout("piggie_callback()", 50);
1010 piggie_top
= piggie_top
+ 10;
1011 } else if (piggie_fwd
&& piggie_top
>= 0) {
1013 setTimeout("piggie_callback()", 50);
1014 } else if (!piggie_fwd
&& piggie_top
> -400) {
1015 setTimeout("piggie_callback()", 50);
1016 piggie_top
= piggie_top
- 10;
1017 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1018 piggie
.style
.display
= "none";
1023 var piggie_opacity
= 0;
1025 function piggie2_callback() {
1026 var piggie
= document
.getElementById("piggie");
1027 piggie
.style
.top
= 0;
1028 piggie
.style
.opacity
= piggie_opacity
;
1029 piggie
.style
.backgroundColor
= "transparent";
1030 piggie
.style
.borderWidth
= "0px";
1032 if (piggie_fwd
&& piggie_opacity
< 1) {
1033 setTimeout("piggie2_callback()", 50);
1034 piggie_opacity
= piggie_opacity
+ 0.03;
1035 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1037 setTimeout("piggie2_callback()", 50);
1038 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1039 setTimeout("piggie2_callback()", 50);
1040 piggie_opacity
= piggie_opacity
- 0.03;
1041 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1042 piggie
.style
.display
= "none";
1047 function localPiggieFunction(enable
) {
1049 var piggie
= document
.getElementById("piggie");
1050 piggie
.style
.display
= "block";
1052 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1060 function validateOpmlImport() {
1062 var opml_file
= document
.getElementById("opml_file");
1064 if (opml_file
.value
.length
== 0) {
1065 alert("No OPML file to upload.");
1072 function updateFilterList() {
1074 if (!xmlhttp_ready(xmlhttp
)) {
1075 printLockingError();
1079 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1081 // p_notify("Loading, please wait...");
1083 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1084 xmlhttp
.onreadystatechange
=filterlist_callback
;
1089 function updateLabelList() {
1091 if (!xmlhttp_ready(xmlhttp
)) {
1092 printLockingError();
1096 // p_notify("Loading, please wait...");
1098 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1100 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1101 xmlhttp
.onreadystatechange
=labellist_callback
;
1105 function updatePrefsList() {
1107 if (!xmlhttp_ready(xmlhttp
)) {
1108 printLockingError();
1112 // p_notify("Loading, please wait...");
1114 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1115 xmlhttp
.onreadystatechange
=prefslist_callback
;
1120 function selectTab(id
, noupdate
) {
1124 if (!xmlhttp_ready(xmlhttp
)) {
1125 printLockingError();
1131 notify("Loading, please wait...", true);
1133 // clean up all current selections, just in case
1134 active_feed_cat
= false;
1135 active_filter
= false;
1136 active_label
= false;
1138 if (id
== "feedConfig") {
1140 } else if (id
== "filterConfig") {
1142 } else if (id
== "labelConfig") {
1144 } else if (id
== "genConfig") {
1146 } else if (id
== "userConfig") {
1148 } else if (id
== "feedBrowser") {
1149 updateBigFeedBrowser();
1153 var tab
= document
.getElementById(active_tab
+ "Tab");
1156 if (tab
.className
.match("Selected")) {
1157 tab
.className
= "prefsTab";
1161 tab
= document
.getElementById(id
+ "Tab");
1164 if (!tab
.className
.match("Selected")) {
1165 tab
.className
= tab
.className
+ "Selected";
1171 setCookie('ttrss_pref_acttab', active_tab
);
1179 if (arguments
.callee
.done
) return;
1180 arguments
.callee
.done
= true;
1184 document
.getElementById("prefContent").innerHTML
=
1185 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1186 "to function properly. Your browser doesn't seem to support it.";
1190 active_tab
= getCookie("ttrss_pref_acttab");
1191 if (!active_tab
) active_tab
= "genConfig";
1192 selectTab(active_tab
);
1194 document
.onkeydown
= hotkey_handler
;
1197 exception_error("init", e
);
1201 function categorizeSelectedFeeds() {
1203 if (!xmlhttp_ready(xmlhttp
)) {
1204 printLockingError();
1208 var sel_rows
= getSelectedFeeds();
1210 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1211 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].value
;
1213 if (sel_rows
.length
> 0) {
1215 notify("Changing category of selected feeds...");
1217 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1218 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1219 xmlhttp
.onreadystatechange
=feedlist_callback
;
1224 alert("No feeds are selected.");
1230 function validatePrefsReset() {
1231 return confirm("Reset to defaults?");
1234 function browseFeeds(limit
) {
1236 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1237 xmlhttp
.onreadystatechange
=infobox_callback
;
1242 function feedBrowserSubscribe() {
1245 var selected
= getSelectedFeedsFromBrowser();
1247 if (selected
.length
> 0) {
1249 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1250 param_escape(selected
.toString()), true);
1251 xmlhttp
.onreadystatechange
=feedlist_callback
;
1254 alert("No feeds are selected.");
1258 exception_error("feedBrowserSubscribe", e
);
1262 function updateBigFeedBrowser(limit
) {
1264 if (!xmlhttp_ready(xmlhttp
)) {
1265 printLockingError();
1269 // p_notify("Loading, please wait...");
1271 var query
= "backend.php?op=pref-feed-browser";
1273 var limit_sel
= document
.getElementById("feedBrowserLimit");
1276 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1277 query
= query
+ "&limit=" + param_escape(limit
);
1280 xmlhttp
.open("GET", query
, true);
1281 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1285 function browserToggleExpand(id
) {
1287 /* if (feed_to_expand && feed_to_expand != id) {
1288 var d = document.getElementById("BRDET-" + feed_to_expand);
1289 d.style.display = "none";
1292 if (!xmlhttp_ready(xmlhttp
)) {
1293 printLockingError();
1297 var d
= document
.getElementById("BRDET-" + id
);
1299 if (d
.style
.display
== "block") {
1300 d
.style
.display
= "none";
1304 feed_to_expand
= id
;
1306 d
.style
.display
= "block";
1307 d
.innerHTML
= "Loading, please wait...";
1309 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1310 + param_escape(id
), true);
1311 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1316 exception_error("browserExpand", e
);
1320 function validateNewPassword(form
) {
1321 if (form
.OLD_PASSWORD
.value
== "") {
1322 alert("Old password cannot be blank");
1325 if (form
.NEW_PASSWORD
.value
== "") {
1326 alert("New password cannot be blank");
1332 function selectPrefRows(kind
, select
) {
1335 var opbarid
= false;
1340 if (kind
== "feed") {
1341 opbarid
= "feedOpToolbar";
1344 lname
= "prefFeedList";
1345 } else if (kind
== "fcat") {
1346 opbarid
= "catOpToolbar";
1349 lname
= "prefFeedCatList";
1350 } else if (kind
== "filter") {
1351 opbarid
= "filterOpToolbar";
1354 lname
= "prefFilterList";
1355 } else if (kind
== "label") {
1356 opbarid
= "labelOpToolbar";
1359 lname
= "prefLabelList";
1360 } else if (kind
== "user") {
1361 opbarid
= "userOpToolbar";
1364 lname
= "prefUserList";
1368 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1369 disableContainerChildren(opbarid
, !select
);
1376 function toggleSelectPrefRow(sender
, kind
) {
1378 toggleSelectRow(sender
);
1381 var opbarid
= false;
1384 if (kind
== "feed") {
1385 opbarid
= "feedOpToolbar";
1386 nsel
= getSelectedFeeds();
1387 } else if (kind
== "fcat") {
1388 opbarid
= "catOpToolbar";
1389 nsel
= getSelectedFeedCats();
1390 } else if (kind
== "filter") {
1391 opbarid
= "filterOpToolbar";
1392 nsel
= getSelectedFilters();
1393 } else if (kind
== "label") {
1394 opbarid
= "labelOpToolbar";
1395 nsel
= getSelectedLabels();
1396 } else if (kind
== "user") {
1397 opbarid
= "userOpToolbar";
1398 nsel
= getSelectedUsers();
1401 if (opbarid
&& nsel
!= -1) {
1402 disableContainerChildren(opbarid
, nsel
== false);
1408 function toggleSelectFBListRow(sender
) {
1409 toggleSelectListRow(sender
);
1410 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);