]>
git.wh0rd.org - tt-rss.git/blob - prefs.js
3 var active_feed
= false;
4 var active_feed_cat
= false;
5 var active_filter
= false;
6 var active_label
= false;
7 var active_user
= false;
8 var active_tab
= false;
9 var feed_to_expand
= false;
11 var piggie_top
= -400;
12 var piggie_fwd
= true;
15 /*@if (@_jscript_version >= 5)
16 // JScript gives us Conditional compilation, we can cope with old IE versions.
17 // and security blocked creation of the objects.
19 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
22 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
29 if (!xmlhttp
&& typeof XMLHttpRequest
!='undefined') {
30 xmlhttp
= new XMLHttpRequest();
33 function expand_feed_callback() {
34 if (xmlhttp
.readyState
== 4) {
36 var container
= document
.getElementById("BRDET-" + feed_to_expand
);
37 container
.innerHTML
=xmlhttp
.responseText
;
38 container
.style
.display
= "block";
41 exception_error("expand_feed_callback", e
);
46 function feedlist_callback() {
47 if (xmlhttp
.readyState
== 4) {
49 var container
= document
.getElementById('prefContent');
50 container
.innerHTML
=xmlhttp
.responseText
;
51 selectTab("feedConfig", true);
54 var row
= document
.getElementById("FEEDR-" + active_feed
);
56 if (!row
.className
.match("Selected")) {
57 row
.className
= row
.className
+ "Selected";
60 var checkbox
= document
.getElementById("FRCHK-" + active_feed
);
62 checkbox
.checked
= true;
67 exception_error("feedlist_callback", e
);
72 function filterlist_callback() {
73 var container
= document
.getElementById('prefContent');
74 if (xmlhttp
.readyState
== 4) {
76 container
.innerHTML
=xmlhttp
.responseText
;
79 var row
= document
.getElementById("FILRR-" + active_filter
);
81 if (!row
.className
.match("Selected")) {
82 row
.className
= row
.className
+ "Selected";
85 var checkbox
= document
.getElementById("FICHK-" + active_filter
);
88 checkbox
.checked
= true;
95 function labellist_callback() {
96 var container
= document
.getElementById('prefContent');
97 if (xmlhttp
.readyState
== 4) {
98 container
.innerHTML
=xmlhttp
.responseText
;
101 var row
= document
.getElementById("LILRR-" + active_label
);
103 if (!row
.className
.match("Selected")) {
104 row
.className
= row
.className
+ "Selected";
107 var checkbox
= document
.getElementById("LICHK-" + active_label
);
110 checkbox
.checked
= true;
117 function feed_browser_callback() {
118 var container
= document
.getElementById('prefContent');
119 if (xmlhttp
.readyState
== 4) {
120 container
.innerHTML
=xmlhttp
.responseText
;
125 function userlist_callback() {
126 var container
= document
.getElementById('prefContent');
127 if (xmlhttp
.readyState
== 4) {
128 container
.innerHTML
=xmlhttp
.responseText
;
131 var row
= document
.getElementById("UMRR-" + active_user
);
133 if (!row
.className
.match("Selected")) {
134 row
.className
= row
.className
+ "Selected";
137 var checkbox
= document
.getElementById("UMCHK-" + active_user
);
140 checkbox
.checked
= true;
147 function prefslist_callback() {
148 var container
= document
.getElementById('prefContent');
149 if (xmlhttp
.readyState
== 4) {
151 container
.innerHTML
=xmlhttp
.responseText
;
157 function gethelp_callback() {
158 var container
= document
.getElementById('prefHelpBox');
159 if (xmlhttp
.readyState
== 4) {
161 container
.innerHTML
= xmlhttp
.responseText
;
162 container
.style
.display
= "block";
168 function notify_callback() {
169 var container
= document
.getElementById('notify');
170 if (xmlhttp
.readyState
== 4) {
171 container
.innerHTML
=xmlhttp
.responseText
;
175 function updateFeedList(sort_key
) {
177 if (!xmlhttp_ready(xmlhttp
)) {
182 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
184 // p_notify("Loading, please wait...");
186 var feed_search
= document
.getElementById("feed_search");
188 if (feed_search
) { search
= feed_search
.value
; }
190 xmlhttp
.open("GET", "backend.php?op=pref-feeds" +
191 "&sort=" + param_escape(sort_key
) +
192 "&search=" + param_escape(search
), true);
193 xmlhttp
.onreadystatechange
=feedlist_callback
;
198 function updateUsersList() {
200 if (!xmlhttp_ready(xmlhttp
)) {
205 // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
207 // p_notify("Loading, please wait...");
209 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
210 xmlhttp
.onreadystatechange
=userlist_callback
;
215 function addLabel() {
217 if (!xmlhttp_ready(xmlhttp
)) {
222 var sqlexp
= document
.getElementById("ladd_expr");
224 if (sqlexp
.value
.length
== 0) {
225 alert("Can't add label: missing SQL expression.");
227 notify("Adding label...");
229 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=add&exp=" +
230 param_escape(sqlexp
.value
), true);
232 xmlhttp
.onreadystatechange
=labellist_callback
;
240 function addFilter() {
242 if (!xmlhttp_ready(xmlhttp
)) {
247 var regexp
= document
.getElementById("fadd_regexp");
248 var match
= document
.getElementById("fadd_match");
249 var feed
= document
.getElementById("fadd_feed");
250 var action
= document
.getElementById("fadd_action");
252 if (regexp
.value
.length
== 0) {
253 alert("Can't add filter: missing filter expression.");
255 notify("Adding filter...");
257 var v_match
= match
[match
.selectedIndex
].text
;
258 var feed_id
= feed
[feed
.selectedIndex
].id
;
259 var action_id
= action
[action
.selectedIndex
].id
;
261 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=add®exp=" +
262 param_escape(regexp
.value
) + "&match=" + v_match
+
263 "&fid=" + param_escape(feed_id
) + "&aid=" + param_escape(action_id
), true);
265 xmlhttp
.onreadystatechange
=filterlist_callback
;
275 if (!xmlhttp_ready(xmlhttp
)) {
280 var link
= document
.getElementById("fadd_link");
282 if (link
.value
.length
== 0) {
283 alert("Error: No feed URL given.");
284 } else if (!isValidURL(link
.value
)) {
285 alert("Error: Invalid feed URL.");
287 notify("Adding feed...");
289 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
290 param_escape(link
.value
), true);
291 xmlhttp
.onreadystatechange
=feedlist_callback
;
300 function addFeedCat() {
302 if (!xmlhttp_ready(xmlhttp
)) {
307 var cat
= document
.getElementById("fadd_cat");
309 if (cat
.value
.length
== 0) {
310 alert("Can't add category: no name specified.");
312 notify("Adding feed category...");
314 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=addCat&cat=" +
315 param_escape(cat
.value
), true);
316 xmlhttp
.onreadystatechange
=feedlist_callback
;
326 if (!xmlhttp_ready(xmlhttp
)) {
331 var sqlexp
= document
.getElementById("uadd_box");
333 if (sqlexp
.value
.length
== 0) {
334 alert("Can't add user: no login specified.");
336 notify("Adding user...");
338 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=add&login=" +
339 param_escape(sqlexp
.value
), true);
341 xmlhttp
.onreadystatechange
=userlist_callback
;
349 function editLabel(id
) {
351 if (!xmlhttp_ready(xmlhttp
)) {
358 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
359 param_escape(id
), true);
360 xmlhttp
.onreadystatechange
=labellist_callback
;
365 function editUser(id
) {
367 if (!xmlhttp_ready(xmlhttp
)) {
374 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
375 param_escape(id
), true);
376 xmlhttp
.onreadystatechange
=userlist_callback
;
381 function editFilter(id
) {
383 if (!xmlhttp_ready(xmlhttp
)) {
390 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=edit&id=" +
391 param_escape(id
), true);
392 xmlhttp
.onreadystatechange
=filterlist_callback
;
397 function editFeed(feed
) {
399 // notify("Editing feed...");
401 if (!xmlhttp_ready(xmlhttp
)) {
408 // clean selection from all rows & select row being edited
409 selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
410 selectTableRowById('FEEDR-'+feed
, 'FRCHK-'+feed
, true);
412 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
413 param_escape(active_feed
), true);
415 xmlhttp
.onreadystatechange
=infobox_callback
;
420 function editFeedCat(cat
) {
422 if (!xmlhttp_ready(xmlhttp
)) {
427 active_feed_cat
= cat
;
429 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=editCat&id=" +
430 param_escape(cat
), true);
431 xmlhttp
.onreadystatechange
=feedlist_callback
;
436 function getSelectedLabels() {
437 return getSelectedTableRowIds("prefLabelList", "LILRR");
440 function getSelectedUsers() {
441 return getSelectedTableRowIds("prefUserList", "UMRR");
444 function getSelectedFeeds() {
445 return getSelectedTableRowIds("prefFeedList", "FEEDR");
448 function getSelectedFilters() {
449 return getSelectedTableRowIds("prefFilterList", "FILRR");
452 function getSelectedFeedCats() {
453 return getSelectedTableRowIds("prefFeedCatList", "FCATR");
456 function getSelectedFeedsFromBrowser() {
458 var list
= document
.getElementById("browseFeedList");
459 if (!list
) list
= document
.getElementById("browseBigFeedList");
461 var selected
= new Array();
463 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
464 var child
= list
.childNodes
[i
];
465 if (child
.id
&& child
.id
.match("FBROW-")) {
466 var id
= child
.id
.replace("FBROW-", "");
468 var cb
= document
.getElementById("FBCHK-" + id
);
480 /*function readSelectedFeeds(read) {
482 if (!xmlhttp_ready(xmlhttp)) {
487 var sel_rows = getSelectedFeeds();
489 if (sel_rows.length > 0) {
497 notify("Marking selected feeds as " + op + "...");
499 xmlhttp.open("GET", "backend.php?op=pref-rpc&subop=" + op + "&ids="+
500 param_escape(sel_rows.toString()), true);
501 xmlhttp.onreadystatechange=notify_callback;
506 alert("No feeds are selected.");
511 function removeSelectedLabels() {
513 if (!xmlhttp_ready(xmlhttp
)) {
518 var sel_rows
= getSelectedLabels();
520 if (sel_rows
.length
> 0) {
522 var ok
= confirm("Remove selected labels?");
525 notify("Removing selected labels...");
527 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
528 param_escape(sel_rows
.toString()), true);
529 xmlhttp
.onreadystatechange
=labellist_callback
;
533 alert("No labels are selected.");
537 function removeSelectedUsers() {
539 if (!xmlhttp_ready(xmlhttp
)) {
544 var sel_rows
= getSelectedUsers();
546 if (sel_rows
.length
> 0) {
548 var ok
= confirm("Remove selected users?");
551 notify("Removing selected users...");
553 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
554 param_escape(sel_rows
.toString()), true);
555 xmlhttp
.onreadystatechange
=userlist_callback
;
560 alert("No users are selected.");
564 function removeSelectedFilters() {
566 if (!xmlhttp_ready(xmlhttp
)) {
571 var sel_rows
= getSelectedFilters();
573 if (sel_rows
.length
> 0) {
575 var ok
= confirm("Remove selected filters?");
578 notify("Removing selected filters...");
580 xmlhttp
.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
581 param_escape(sel_rows
.toString()), true);
582 xmlhttp
.onreadystatechange
=filterlist_callback
;
586 alert("No filters are selected.");
591 function removeSelectedFeeds() {
593 if (!xmlhttp_ready(xmlhttp
)) {
598 var sel_rows
= getSelectedFeeds();
600 if (sel_rows
.length
> 0) {
602 var ok
= confirm("Unsubscribe from selected feeds?");
606 notify("Unsubscribing from selected feeds...");
608 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
609 param_escape(sel_rows
.toString()), true);
610 xmlhttp
.onreadystatechange
=feedlist_callback
;
616 alert("No feeds are selected.");
622 function removeSelectedFeedCats() {
624 if (!xmlhttp_ready(xmlhttp
)) {
629 var sel_rows
= getSelectedFeedCats();
631 if (sel_rows
.length
> 0) {
633 var ok
= confirm("Remove selected categories?");
636 notify("Removing selected categories...");
638 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
639 param_escape(sel_rows
.toString()), true);
640 xmlhttp
.onreadystatechange
=feedlist_callback
;
646 alert("No categories are selected.");
652 function feedEditCancel() {
654 if (!xmlhttp_ready(xmlhttp
)) {
661 selectPrefRows('feed', false); // cleanup feed selection
667 function feedCatEditCancel() {
669 if (!xmlhttp_ready(xmlhttp
)) {
674 active_feed_cat
= false;
676 // notify("Operation cancelled.");
678 xmlhttp
.open("GET", "backend.php?op=pref-feeds", true);
679 xmlhttp
.onreadystatechange
=feedlist_callback
;
684 function feedEditSave() {
688 if (!xmlhttp_ready(xmlhttp
)) {
693 // FIXME: add parameter validation
695 var query
= Form
.serialize("edit_feed_form");
699 notify("Saving feed...");
701 xmlhttp
.open("POST", "backend.php", true);
702 xmlhttp
.onreadystatechange
=feedlist_callback
;
703 xmlhttp
.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
709 exception_error("feedEditSave", e
);
713 function feedCatEditSave() {
715 if (!xmlhttp_ready(xmlhttp
)) {
720 notify("Saving category...");
722 // var cat_title = document.getElementById("iedit_title").value;
724 var query
= Form
.serialize("feed_cat_edit_form");
726 xmlhttp
.open("GET", "backend.php?" + query
, true);
727 xmlhttp
.onreadystatechange
=feedlist_callback
;
730 active_feed_cat
= false;
735 function labelTest() {
737 var form
= document
.forms
['label_edit_form'];
739 var sql_exp
= form
.sql_exp
.value
;
740 var description
= form
.description
.value
;
742 xmlhttp
.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
743 param_escape(sql_exp
) + "&descr=" + param_escape(description
), true);
745 xmlhttp
.onreadystatechange
=infobox_callback
;
750 function displayHelpInfobox(topic_id
) {
752 xmlhttp
.open("GET", "backend.php?op=help&tid=" +
753 param_escape(topic_id
) + "&noheaders=1", true);
755 xmlhttp
.onreadystatechange
=infobox_callback
;
760 function labelEditCancel() {
762 if (!xmlhttp_ready(xmlhttp
)) {
767 active_label
= false;
769 // notify("Operation cancelled.");
771 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
772 xmlhttp
.onreadystatechange
=labellist_callback
;
777 function userEditCancel() {
779 if (!xmlhttp_ready(xmlhttp
)) {
786 // notify("Operation cancelled.");
788 xmlhttp
.open("GET", "backend.php?op=pref-users", true);
789 xmlhttp
.onreadystatechange
=userlist_callback
;
794 function filterEditCancel() {
796 if (!xmlhttp_ready(xmlhttp
)) {
801 active_filter
= false;
803 // notify("Operation cancelled.");
805 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
806 xmlhttp
.onreadystatechange
=filterlist_callback
;
811 function labelEditSave() {
813 var label
= active_label
;
815 if (!xmlhttp_ready(xmlhttp
)) {
820 /* var sqlexp = document.getElementById("iedit_expr").value;
821 var descr = document.getElementById("iedit_descr").value;
823 // notify("Saving label " + sqlexp + ": " + descr);
825 if (sqlexp.length == 0) {
826 notify("SQL expression cannot be blank.");
830 if (descr.length == 0) {
831 notify("Caption cannot be blank.");
835 // FIXME: input validation
837 notify("Saving label...");
839 active_label
= false;
841 query
= Form
.serialize("label_edit_form");
843 xmlhttp
.open("GET", "backend.php?" + query
, true);
845 xmlhttp
.onreadystatechange
=labellist_callback
;
850 function userEditSave() {
852 var user
= active_user
;
854 if (!xmlhttp_ready(xmlhttp
)) {
859 var login
= document
.getElementById("iedit_ulogin").value
;
860 var level
= document
.getElementById("iedit_ulevel");
862 level
= level
[level
.selectedIndex
].id
;
864 var email
= document
.getElementById("iedit_email").value
;
866 if (login
.length
== 0) {
867 notify("Login cannot be blank.");
871 if (level
.length
== 0) {
872 notify("User level cannot be blank.");
878 notify("Saving user...");
880 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
881 user
+ "&l=" + param_escape(login
) + "&al=" + param_escape(level
) +
882 "&e=" + param_escape(email
), true);
884 xmlhttp
.onreadystatechange
=userlist_callback
;
890 function filterEditSave() {
892 if (!xmlhttp_ready(xmlhttp
)) {
897 // FIXME: input validation
899 notify("Saving filter...");
901 active_filter
= false;
903 var query
= Form
.serialize("filter_edit_form");
905 xmlhttp
.open("GET", "backend.php?" + query
, true);
906 xmlhttp
.onreadystatechange
=filterlist_callback
;
911 function editSelectedLabel() {
912 var rows
= getSelectedLabels();
914 if (rows
.length
== 0) {
915 alert("No labels are selected.");
919 if (rows
.length
> 1) {
920 alert("Please select only one label.");
930 function editSelectedUser() {
931 var rows
= getSelectedUsers();
933 if (rows
.length
== 0) {
934 alert("No users are selected.");
938 if (rows
.length
> 1) {
939 alert("Please select only one user.");
948 function resetSelectedUserPass() {
949 var rows
= getSelectedUsers();
951 if (rows
.length
== 0) {
952 alert("No users are selected.");
956 if (rows
.length
> 1) {
957 alert("Please select only one user.");
961 var ok
= confirm("Reset password of selected user?");
964 notify("Resetting password for selected user...");
968 xmlhttp
.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
969 param_escape(id
), true);
970 xmlhttp
.onreadystatechange
=userlist_callback
;
975 function selectedUserDetails() {
977 if (!xmlhttp_ready(xmlhttp
)) {
982 var rows
= getSelectedUsers();
984 if (rows
.length
== 0) {
985 alert("No users are selected.");
989 if (rows
.length
> 1) {
990 alert("Please select only one user.");
998 xmlhttp
.open("GET", "backend.php?op=user-details&id=" + id
, true);
999 xmlhttp
.onreadystatechange
=infobox_callback
;
1004 function selectedFeedDetails() {
1006 if (!xmlhttp_ready(xmlhttp
)) {
1007 printLockingError();
1011 var rows
= getSelectedFeeds();
1013 if (rows
.length
== 0) {
1014 alert("No feeds are selected.");
1018 if (rows
.length
> 1) {
1019 notify("Please select only one feed.");
1023 // var id = rows[0];
1027 xmlhttp
.open("GET", "backend.php?op=feed-details&id=" +
1028 param_escape(rows
.toString()), true);
1029 xmlhttp
.onreadystatechange
=infobox_callback
;
1034 function editSelectedFilter() {
1035 var rows
= getSelectedFilters();
1037 if (rows
.length
== 0) {
1038 alert("No filters are selected.");
1042 if (rows
.length
> 1) {
1043 alert("Please select only one filter.");
1049 editFilter(rows
[0]);
1054 function editSelectedFeed() {
1055 var rows
= getSelectedFeeds();
1057 if (rows
.length
== 0) {
1058 notify("No feeds are selected.");
1062 if (rows
.length
> 1) {
1063 notify("Please select one feed.");
1073 function editSelectedFeedCat() {
1074 var rows
= getSelectedFeedCats();
1076 if (rows
.length
== 0) {
1077 alert("No categories are selected.");
1081 if (rows
.length
> 1) {
1082 alert("Please select only one category.");
1088 editFeedCat(rows
[0]);
1092 function piggie_callback() {
1093 var piggie
= document
.getElementById("piggie");
1095 piggie
.style
.top
= piggie_top
;
1096 piggie
.style
.backgroundColor
= "white";
1097 piggie
.style
.borderWidth
= "1px";
1099 if (piggie_fwd
&& piggie_top
< 0) {
1100 setTimeout("piggie_callback()", 50);
1101 piggie_top
= piggie_top
+ 10;
1102 } else if (piggie_fwd
&& piggie_top
>= 0) {
1104 setTimeout("piggie_callback()", 50);
1105 } else if (!piggie_fwd
&& piggie_top
> -400) {
1106 setTimeout("piggie_callback()", 50);
1107 piggie_top
= piggie_top
- 10;
1108 } else if (!piggie_fwd
&& piggie_top
<= -400) {
1109 piggie
.style
.display
= "none";
1114 var piggie_opacity
= 0;
1116 function piggie2_callback() {
1117 var piggie
= document
.getElementById("piggie");
1118 piggie
.style
.top
= 0;
1119 piggie
.style
.opacity
= piggie_opacity
;
1120 piggie
.style
.backgroundColor
= "transparent";
1121 piggie
.style
.borderWidth
= "0px";
1123 if (piggie_fwd
&& piggie_opacity
< 1) {
1124 setTimeout("piggie2_callback()", 50);
1125 piggie_opacity
= piggie_opacity
+ 0.03;
1126 } else if (piggie_fwd
&& piggie_opacity
>= 1) {
1128 setTimeout("piggie2_callback()", 50);
1129 } else if (!piggie_fwd
&& piggie_opacity
> 0) {
1130 setTimeout("piggie2_callback()", 50);
1131 piggie_opacity
= piggie_opacity
- 0.03;
1132 } else if (!piggie_fwd
&& piggie_opacity
<= 0) {
1133 piggie
.style
.display
= "none";
1138 function localPiggieFunction(enable
) {
1140 var piggie
= document
.getElementById("piggie");
1141 piggie
.style
.display
= "block";
1143 if (navigator
.userAgent
.match("Gecko") && Math
.random(1) > 0.5) {
1151 function validateOpmlImport() {
1153 var opml_file
= document
.getElementById("opml_file");
1155 if (opml_file
.value
.length
== 0) {
1156 alert("No OPML file to upload.");
1163 function updateFilterList() {
1165 if (!xmlhttp_ready(xmlhttp
)) {
1166 printLockingError();
1170 // document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
1172 // p_notify("Loading, please wait...");
1174 xmlhttp
.open("GET", "backend.php?op=pref-filters", true);
1175 xmlhttp
.onreadystatechange
=filterlist_callback
;
1180 function updateLabelList() {
1182 if (!xmlhttp_ready(xmlhttp
)) {
1183 printLockingError();
1187 // p_notify("Loading, please wait...");
1189 // document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
1191 xmlhttp
.open("GET", "backend.php?op=pref-labels", true);
1192 xmlhttp
.onreadystatechange
=labellist_callback
;
1196 function updatePrefsList() {
1198 if (!xmlhttp_ready(xmlhttp
)) {
1199 printLockingError();
1203 // p_notify("Loading, please wait...");
1205 xmlhttp
.open("GET", "backend.php?op=pref-prefs", true);
1206 xmlhttp
.onreadystatechange
=prefslist_callback
;
1211 function selectTab(id
, noupdate
) {
1215 if (!xmlhttp_ready(xmlhttp
)) {
1216 printLockingError();
1222 notify("Loading, please wait...", true);
1224 // clean up all current selections, just in case
1225 active_feed
= false;
1226 active_feed_cat
= false;
1227 active_filter
= false;
1228 active_label
= false;
1229 active_user
= false;
1231 if (id
== "feedConfig") {
1233 } else if (id
== "filterConfig") {
1235 } else if (id
== "labelConfig") {
1237 } else if (id
== "genConfig") {
1239 } else if (id
== "userConfig") {
1241 } else if (id
== "feedBrowser") {
1242 updateBigFeedBrowser();
1246 var tab
= document
.getElementById(active_tab
+ "Tab");
1249 if (tab
.className
.match("Selected")) {
1250 tab
.className
= "prefsTab";
1254 tab
= document
.getElementById(id
+ "Tab");
1257 if (!tab
.className
.match("Selected")) {
1258 tab
.className
= tab
.className
+ "Selected";
1264 setCookie('ttrss_pref_acttab', active_tab
);
1272 if (arguments
.callee
.done
) return;
1273 arguments
.callee
.done
= true;
1277 document
.getElementById("prefContent").innerHTML
=
1278 "<b>Fatal error:</b> This program needs XmlHttpRequest " +
1279 "to function properly. Your browser doesn't seem to support it.";
1283 active_tab
= getCookie("ttrss_pref_acttab");
1284 if (!active_tab
) active_tab
= "genConfig";
1285 selectTab(active_tab
);
1287 document
.onkeydown
= hotkey_handler
;
1290 exception_error("init", e
);
1294 function categorizeSelectedFeeds() {
1296 if (!xmlhttp_ready(xmlhttp
)) {
1297 printLockingError();
1301 var sel_rows
= getSelectedFeeds();
1303 var cat_sel
= document
.getElementById("sfeed_set_fcat");
1304 var cat_id
= cat_sel
[cat_sel
.selectedIndex
].value
;
1306 if (sel_rows
.length
> 0) {
1308 notify("Changing category of selected feeds...");
1310 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
1311 param_escape(sel_rows
.toString()) + "&cat_id=" + param_escape(cat_id
), true);
1312 xmlhttp
.onreadystatechange
=feedlist_callback
;
1317 alert("No feeds are selected.");
1323 function validatePrefsReset() {
1324 return confirm("Reset to defaults?");
1327 function browseFeeds(limit
) {
1329 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
1330 xmlhttp
.onreadystatechange
=infobox_callback
;
1335 function feedBrowserSubscribe() {
1338 var selected
= getSelectedFeedsFromBrowser();
1340 if (selected
.length
> 0) {
1342 xmlhttp
.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
1343 param_escape(selected
.toString()), true);
1344 xmlhttp
.onreadystatechange
=feedlist_callback
;
1347 alert("No feeds are selected.");
1351 exception_error("feedBrowserSubscribe", e
);
1355 function updateBigFeedBrowser(limit
) {
1357 if (!xmlhttp_ready(xmlhttp
)) {
1358 printLockingError();
1362 // p_notify("Loading, please wait...");
1364 var query
= "backend.php?op=pref-feed-browser";
1366 var limit_sel
= document
.getElementById("feedBrowserLimit");
1369 var limit
= limit_sel
[limit_sel
.selectedIndex
].value
;
1370 query
= query
+ "&limit=" + param_escape(limit
);
1373 xmlhttp
.open("GET", query
, true);
1374 xmlhttp
.onreadystatechange
=feed_browser_callback
;
1378 function browserToggleExpand(id
) {
1380 /* if (feed_to_expand && feed_to_expand != id) {
1381 var d = document.getElementById("BRDET-" + feed_to_expand);
1382 d.style.display = "none";
1385 if (!xmlhttp_ready(xmlhttp
)) {
1386 printLockingError();
1390 var d
= document
.getElementById("BRDET-" + id
);
1392 if (d
.style
.display
== "block") {
1393 d
.style
.display
= "none";
1397 feed_to_expand
= id
;
1399 d
.style
.display
= "block";
1400 d
.innerHTML
= "Loading, please wait...";
1402 xmlhttp
.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
1403 + param_escape(id
), true);
1404 xmlhttp
.onreadystatechange
=expand_feed_callback
;
1409 exception_error("browserExpand", e
);
1413 function validateNewPassword(form
) {
1414 if (form
.OLD_PASSWORD
.value
== "") {
1415 alert("Current password cannot be blank");
1418 if (form
.NEW_PASSWORD
.value
== "") {
1419 alert("New password cannot be blank");
1425 function selectPrefRows(kind
, select
) {
1428 var opbarid
= false;
1433 if (kind
== "feed") {
1434 opbarid
= "feedOpToolbar";
1437 lname
= "prefFeedList";
1438 } else if (kind
== "fcat") {
1439 opbarid
= "catOpToolbar";
1442 lname
= "prefFeedCatList";
1443 } else if (kind
== "filter") {
1444 opbarid
= "filterOpToolbar";
1447 lname
= "prefFilterList";
1448 } else if (kind
== "label") {
1449 opbarid
= "labelOpToolbar";
1452 lname
= "prefLabelList";
1453 } else if (kind
== "user") {
1454 opbarid
= "userOpToolbar";
1457 lname
= "prefUserList";
1461 selectTableRowsByIdPrefix(lname
, nrow
, nchk
, select
);
1462 disableContainerChildren(opbarid
, !select
);
1469 function toggleSelectPrefRow(sender
, kind
) {
1471 toggleSelectRow(sender
);
1474 var opbarid
= false;
1477 if (kind
== "feed") {
1478 opbarid
= "feedOpToolbar";
1479 nsel
= getSelectedFeeds();
1480 } else if (kind
== "fcat") {
1481 opbarid
= "catOpToolbar";
1482 nsel
= getSelectedFeedCats();
1483 } else if (kind
== "filter") {
1484 opbarid
= "filterOpToolbar";
1485 nsel
= getSelectedFilters();
1486 } else if (kind
== "label") {
1487 opbarid
= "labelOpToolbar";
1488 nsel
= getSelectedLabels();
1489 } else if (kind
== "user") {
1490 opbarid
= "userOpToolbar";
1491 nsel
= getSelectedUsers();
1494 if (opbarid
&& nsel
!= -1) {
1495 disableContainerChildren(opbarid
, nsel
== false);
1501 function toggleSelectFBListRow(sender
) {
1502 toggleSelectListRow(sender
);
1503 disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);