]>
Commit | Line | Data |
---|---|---|
007bda35 AD |
1 | var xmlhttp = false; |
2 | ||
91ff844a | 3 | var active_feed_cat = false; |
48f0adb0 | 4 | var active_label = false; |
f5a50b25 | 5 | var active_tab = false; |
c6232e43 | 6 | var feed_to_expand = false; |
f5a50b25 | 7 | |
a58069db | 8 | var xmlhttp = Ajax.getTransport(); |
007bda35 | 9 | |
a7565293 AD |
10 | var init_params = new Array(); |
11 | ||
e513a74a AD |
12 | var caller_subop = false; |
13 | ||
7a09510c AD |
14 | var sanity_check_done = false; |
15 | ||
e4f4b46f | 16 | function replace_pubkey_callback() { |
c6232e43 AD |
17 | if (xmlhttp.readyState == 4) { |
18 | try { | |
e4f4b46f AD |
19 | var link = document.getElementById("pubGenAddress"); |
20 | ||
21 | if (xmlhttp.responseXML) { | |
22 | ||
945c243e AD |
23 | var new_link = xmlhttp.responseXML.getElementsByTagName("link")[0]; |
24 | ||
25 | if (new_link) { | |
26 | link.href = new_link.firstChild.nodeValue; | |
27 | link.innerHTML = new_link.firstChild.nodeValue; | |
28 | ||
3076c7b8 AD |
29 | new Effect.Highlight(link); |
30 | ||
f56e3080 | 31 | notify_info("Address changed."); |
945c243e | 32 | } else { |
f56e3080 | 33 | notify_error("Could not change address."); |
945c243e | 34 | } |
e4f4b46f AD |
35 | |
36 | } else { | |
f56e3080 | 37 | notify_error("Could not change address."); |
e4f4b46f | 38 | } |
c6232e43 | 39 | } catch (e) { |
e4f4b46f | 40 | exception_error("replace_pubkey_callback", e); |
c6232e43 AD |
41 | } |
42 | } | |
945c243e | 43 | } |
c6232e43 | 44 | |
e4f4b46f | 45 | function expand_feed_callback() { |
bc0ed820 AD |
46 | if (xmlhttp.readyState == 4) { |
47 | try { | |
e4f4b46f | 48 | var container = document.getElementById("BRDET-" + feed_to_expand); |
bc0ed820 | 49 | container.innerHTML=xmlhttp.responseText; |
34a01a20 | 50 | // container.style.display = "block"; |
e4f4b46f | 51 | // p_notify(""); |
051c4d56 | 52 | Effect.Appear(container, {duration : 0.5}); |
bc0ed820 | 53 | } catch (e) { |
e4f4b46f | 54 | exception_error("expand_feed_callback", e); |
bc0ed820 AD |
55 | } |
56 | } | |
57 | } | |
58 | ||
007bda35 | 59 | function feedlist_callback() { |
007bda35 | 60 | if (xmlhttp.readyState == 4) { |
47c6c988 AD |
61 | try { |
62 | var container = document.getElementById('prefContent'); | |
63 | container.innerHTML=xmlhttp.responseText; | |
a7f22b70 | 64 | selectTab("feedConfig", true); |
e513a74a AD |
65 | |
66 | if (caller_subop) { | |
67 | var tuple = caller_subop.split(":"); | |
68 | if (tuple[0] == 'editFeed') { | |
69 | window.setTimeout('editFeed('+tuple[1]+')', 100); | |
70 | } | |
71 | ||
72 | caller_subop = false; | |
73 | } | |
23943c9b AD |
74 | if (typeof correctPNG != 'undefined') { |
75 | correctPNG(); | |
76 | } | |
7f74a9da | 77 | notify(""); |
47c6c988 AD |
78 | } catch (e) { |
79 | exception_error("feedlist_callback", e); | |
961513a3 | 80 | } |
007bda35 AD |
81 | } |
82 | } | |
83 | ||
442d77f1 AD |
84 | /* stub for subscription dialog */ |
85 | ||
86 | function dlg_frefresh_callback() { | |
87 | if (xmlhttp.readyState == 4) { | |
88 | // setTimeout("updateFeedList()", 500); | |
89 | ||
90 | try { | |
91 | var container = document.getElementById('prefContent'); | |
92 | container.innerHTML=xmlhttp.responseText; | |
93 | selectTab("feedConfig", true); | |
94 | ||
95 | if (caller_subop) { | |
96 | var tuple = caller_subop.split(":"); | |
97 | if (tuple[0] == 'editFeed') { | |
98 | window.setTimeout('editFeed('+tuple[1]+')', 100); | |
99 | } | |
100 | ||
101 | caller_subop = false; | |
102 | } | |
103 | if (typeof correctPNG != 'undefined') { | |
104 | correctPNG(); | |
105 | } | |
106 | notify(""); | |
107 | } catch (e) { | |
108 | exception_error("feedlist_callback", e); | |
109 | } | |
110 | } | |
111 | } | |
112 | ||
a0d53889 | 113 | function filterlist_callback() { |
f5a50b25 | 114 | var container = document.getElementById('prefContent'); |
a0d53889 AD |
115 | if (xmlhttp.readyState == 4) { |
116 | container.innerHTML=xmlhttp.responseText; | |
23943c9b AD |
117 | if (typeof correctPNG != 'undefined') { |
118 | correctPNG(); | |
119 | } | |
7f74a9da | 120 | notify(""); |
a0d53889 AD |
121 | } |
122 | } | |
123 | ||
48f0adb0 | 124 | function labellist_callback() { |
f5a50b25 | 125 | var container = document.getElementById('prefContent'); |
48f0adb0 | 126 | if (xmlhttp.readyState == 4) { |
f156fd00 | 127 | closeInfoBox(); |
48f0adb0 | 128 | container.innerHTML=xmlhttp.responseText; |
967955b7 | 129 | if (active_label) { |
48f0adb0 AD |
130 | var row = document.getElementById("LILRR-" + active_label); |
131 | if (row) { | |
132 | if (!row.className.match("Selected")) { | |
133 | row.className = row.className + "Selected"; | |
134 | } | |
135 | } | |
136 | var checkbox = document.getElementById("LICHK-" + active_label); | |
137 | ||
138 | if (checkbox) { | |
139 | checkbox.checked = true; | |
140 | } | |
141 | } | |
23943c9b AD |
142 | if (typeof correctPNG != 'undefined') { |
143 | correctPNG(); | |
144 | } | |
7f74a9da | 145 | notify(""); |
48f0adb0 AD |
146 | } |
147 | } | |
4255b24c | 148 | |
c6232e43 AD |
149 | function feed_browser_callback() { |
150 | var container = document.getElementById('prefContent'); | |
151 | if (xmlhttp.readyState == 4) { | |
152 | container.innerHTML=xmlhttp.responseText; | |
7f74a9da | 153 | notify(""); |
c6232e43 AD |
154 | } |
155 | } | |
156 | ||
e6cb77a0 AD |
157 | function userlist_callback() { |
158 | var container = document.getElementById('prefContent'); | |
159 | if (xmlhttp.readyState == 4) { | |
160 | container.innerHTML=xmlhttp.responseText; | |
7f74a9da | 161 | notify(""); |
e6cb77a0 AD |
162 | } |
163 | } | |
164 | ||
4255b24c AD |
165 | function prefslist_callback() { |
166 | var container = document.getElementById('prefContent'); | |
167 | if (xmlhttp.readyState == 4) { | |
168 | ||
169 | container.innerHTML=xmlhttp.responseText; | |
7f74a9da AD |
170 | |
171 | notify(""); | |
4255b24c AD |
172 | } |
173 | } | |
174 | ||
b1895692 AD |
175 | function gethelp_callback() { |
176 | var container = document.getElementById('prefHelpBox'); | |
177 | if (xmlhttp.readyState == 4) { | |
178 | ||
179 | container.innerHTML = xmlhttp.responseText; | |
180 | container.style.display = "block"; | |
181 | ||
182 | } | |
183 | } | |
4255b24c | 184 | |
0e091d38 | 185 | function notify_callback() { |
0e091d38 | 186 | if (xmlhttp.readyState == 4) { |
42c32916 AD |
187 | notify_info(xmlhttp.responseText); |
188 | } | |
0e091d38 AD |
189 | } |
190 | ||
b652c1b7 AD |
191 | function prefs_reset_callback() { |
192 | if (xmlhttp.readyState == 4) { | |
193 | notify_info(xmlhttp.responseText); | |
194 | selectTab(); | |
195 | } | |
196 | } | |
197 | ||
d95bd220 AD |
198 | |
199 | function changepass_callback() { | |
42395d28 AD |
200 | try { |
201 | if (xmlhttp.readyState == 4) { | |
202 | ||
203 | if (xmlhttp.responseText.indexOf("ERROR: ") == 0) { | |
204 | notify_error(xmlhttp.responseText.replace("ERROR: ", "")); | |
205 | } else { | |
206 | notify_info(xmlhttp.responseText); | |
207 | var warn = document.getElementById("default_pass_warning"); | |
208 | if (warn) warn.style.display = "none"; | |
209 | } | |
210 | ||
211 | document.forms['change_pass_form'].reset(); | |
d95bd220 | 212 | |
42395d28 AD |
213 | } |
214 | } catch (e) { | |
215 | exception_error("changepass_callback", e); | |
216 | } | |
d95bd220 AD |
217 | } |
218 | ||
11f083e7 AD |
219 | function infobox_feed_cat_callback() { |
220 | if (xmlhttp.readyState == 4) { | |
221 | try { | |
222 | ||
223 | infobox_callback(); | |
224 | ||
225 | if (document.getElementById("prefFeedCatList")) { | |
226 | var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN"); | |
227 | ||
228 | for (var i = 0; i < elems.length; i++) { | |
229 | if (elems[i].id && elems[i].id.match("FCATT-")) { | |
230 | var cat_id = elems[i].id.replace("FCATT-", ""); | |
231 | ||
232 | new Ajax.InPlaceEditor(elems[i], | |
233 | 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id); | |
234 | } | |
235 | } | |
236 | } | |
237 | ||
238 | } catch (e) { | |
239 | exception_error("infobox_feed_cat_callback", e); | |
240 | } | |
241 | } | |
242 | } | |
243 | ||
b83c7545 | 244 | function updateFeedList(sort_key) { |
007bda35 | 245 | |
c0e5a40e | 246 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
247 | printLockingError(); |
248 | return | |
249 | } | |
250 | ||
f5a50b25 AD |
251 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; |
252 | ||
ce3bf408 | 253 | // p_notify("Loading, please wait..."); |
007bda35 | 254 | |
f932bc9f AD |
255 | var feed_search = document.getElementById("feed_search"); |
256 | var search = ""; | |
257 | if (feed_search) { search = feed_search.value; } | |
258 | ||
400b60d8 AD |
259 | var slat = document.getElementById("show_last_article_times"); |
260 | ||
261 | var slat_checked = false; | |
262 | if (slat) { | |
263 | slat_checked = slat.checked; | |
264 | } | |
265 | ||
b83c7545 | 266 | xmlhttp.open("GET", "backend.php?op=pref-feeds" + |
f932bc9f | 267 | "&sort=" + param_escape(sort_key) + |
400b60d8 | 268 | "&slat=" + param_escape(slat_checked) + |
f932bc9f | 269 | "&search=" + param_escape(search), true); |
007bda35 AD |
270 | xmlhttp.onreadystatechange=feedlist_callback; |
271 | xmlhttp.send(null); | |
272 | ||
273 | } | |
274 | ||
79ec0f2f | 275 | function updateUsersList(sort_key) { |
e6cb77a0 AD |
276 | |
277 | if (!xmlhttp_ready(xmlhttp)) { | |
278 | printLockingError(); | |
279 | return | |
280 | } | |
281 | ||
282 | // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; | |
283 | ||
ce3bf408 | 284 | // p_notify("Loading, please wait..."); |
e6cb77a0 | 285 | |
79ec0f2f AD |
286 | xmlhttp.open("GET", "backend.php?op=pref-users&sort=" |
287 | + param_escape(sort_key), true); | |
e6cb77a0 AD |
288 | xmlhttp.onreadystatechange=userlist_callback; |
289 | xmlhttp.send(null); | |
290 | ||
291 | } | |
292 | ||
48f0adb0 AD |
293 | function addLabel() { |
294 | ||
295 | if (!xmlhttp_ready(xmlhttp)) { | |
296 | printLockingError(); | |
297 | return | |
298 | } | |
299 | ||
f156fd00 | 300 | var form = document.forms['label_edit_form']; |
48f0adb0 | 301 | |
f156fd00 AD |
302 | var sql_exp = form.sql_exp.value; |
303 | var description = form.description.value; | |
48f0adb0 | 304 | |
f156fd00 | 305 | if (sql_exp == "") { |
89cb787e | 306 | alert(__("Can't create label: missing SQL expression.")); |
f156fd00 | 307 | return false; |
48f0adb0 AD |
308 | } |
309 | ||
f156fd00 | 310 | if (description == "") { |
89cb787e | 311 | alert(__("Can't create label: missing caption.")); |
f156fd00 | 312 | return false; |
de435974 AD |
313 | } |
314 | ||
f156fd00 | 315 | var query = Form.serialize("label_edit_form"); |
de435974 | 316 | |
f156fd00 AD |
317 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true); |
318 | xmlhttp.onreadystatechange=infobox_submit_callback; | |
319 | xmlhttp.send(null); | |
de435974 | 320 | } |
48f0adb0 | 321 | |
71ad3959 AD |
322 | function addFeed() { |
323 | ||
c0e5a40e | 324 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
325 | printLockingError(); |
326 | return | |
327 | } | |
328 | ||
331900c6 AD |
329 | var link = document.getElementById("fadd_link"); |
330 | ||
83fe4d6d | 331 | if (link.value.length == 0) { |
f3977cf5 | 332 | alert(__("Error: No feed URL given.")); |
605f7d46 | 333 | } else if (!isValidURL(link.value)) { |
f3977cf5 | 334 | alert(__("Error: Invalid feed URL.")); |
331900c6 | 335 | } else { |
42c32916 | 336 | notify_progress("Adding feed..."); |
331900c6 | 337 | |
e513a74a | 338 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" + |
331900c6 AD |
339 | param_escape(link.value), true); |
340 | xmlhttp.onreadystatechange=feedlist_callback; | |
341 | xmlhttp.send(null); | |
342 | ||
343 | link.value = ""; | |
344 | ||
345 | } | |
346 | ||
347 | } | |
348 | ||
91ff844a AD |
349 | function addFeedCat() { |
350 | ||
351 | if (!xmlhttp_ready(xmlhttp)) { | |
352 | printLockingError(); | |
353 | return | |
354 | } | |
355 | ||
356 | var cat = document.getElementById("fadd_cat"); | |
357 | ||
358 | if (cat.value.length == 0) { | |
f3977cf5 | 359 | alert(__("Can't add category: no name specified.")); |
91ff844a | 360 | } else { |
42c32916 | 361 | notify_progress("Adding feed category..."); |
91ff844a | 362 | |
9c483746 | 363 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" + |
91ff844a | 364 | param_escape(cat.value), true); |
9c483746 | 365 | xmlhttp.onreadystatechange=infobox_callback; |
91ff844a AD |
366 | xmlhttp.send(null); |
367 | ||
368 | link.value = ""; | |
369 | ||
370 | } | |
371 | ||
372 | } | |
e6cb77a0 AD |
373 | function addUser() { |
374 | ||
375 | if (!xmlhttp_ready(xmlhttp)) { | |
376 | printLockingError(); | |
377 | return | |
378 | } | |
379 | ||
380 | var sqlexp = document.getElementById("uadd_box"); | |
381 | ||
382 | if (sqlexp.value.length == 0) { | |
89cb787e | 383 | alert(__("Can't add user: no login specified.")); |
e6cb77a0 | 384 | } else { |
42c32916 | 385 | notify_progress("Adding user..."); |
e6cb77a0 AD |
386 | |
387 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" + | |
388 | param_escape(sqlexp.value), true); | |
389 | ||
390 | xmlhttp.onreadystatechange=userlist_callback; | |
391 | xmlhttp.send(null); | |
392 | ||
393 | sqlexp.value = ""; | |
394 | } | |
395 | ||
396 | } | |
397 | ||
48f0adb0 AD |
398 | function editLabel(id) { |
399 | ||
400 | if (!xmlhttp_ready(xmlhttp)) { | |
401 | printLockingError(); | |
402 | return | |
403 | } | |
404 | ||
9e31e1b9 AD |
405 | notify_progress("Loading, please wait..."); |
406 | ||
f156fd00 AD |
407 | document.getElementById("label_create_btn").disabled = true; |
408 | ||
48f0adb0 AD |
409 | active_label = id; |
410 | ||
a4dbc524 AD |
411 | selectTableRowsByIdPrefix('prefLabelList', 'LILRR-', 'LICHK-', false); |
412 | selectTableRowById('LILRR-'+id, 'LICHK-'+id, true); | |
413 | ||
48f0adb0 AD |
414 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" + |
415 | param_escape(id), true); | |
a4dbc524 | 416 | xmlhttp.onreadystatechange=infobox_callback; |
48f0adb0 AD |
417 | xmlhttp.send(null); |
418 | ||
419 | } | |
420 | ||
e6cb77a0 AD |
421 | function editUser(id) { |
422 | ||
423 | if (!xmlhttp_ready(xmlhttp)) { | |
424 | printLockingError(); | |
425 | return | |
426 | } | |
427 | ||
9e31e1b9 AD |
428 | notify_progress("Loading, please wait..."); |
429 | ||
3c5783b7 AD |
430 | selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false); |
431 | selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true); | |
e6cb77a0 AD |
432 | |
433 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" + | |
434 | param_escape(id), true); | |
3c5783b7 | 435 | xmlhttp.onreadystatechange=infobox_callback; |
e6cb77a0 AD |
436 | xmlhttp.send(null); |
437 | ||
438 | } | |
439 | ||
a0d53889 AD |
440 | function editFilter(id) { |
441 | ||
442 | if (!xmlhttp_ready(xmlhttp)) { | |
443 | printLockingError(); | |
444 | return | |
445 | } | |
446 | ||
9e31e1b9 AD |
447 | notify_progress("Loading, please wait..."); |
448 | ||
4220b0bd AD |
449 | document.getElementById("create_filter_btn").disabled = true; |
450 | ||
07164479 AD |
451 | selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false); |
452 | selectTableRowById('FILRR-'+id, 'FICHK-'+id, true); | |
a0d53889 | 453 | |
07164479 AD |
454 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id), true); |
455 | xmlhttp.onreadystatechange=infobox_callback; | |
a0d53889 | 456 | xmlhttp.send(null); |
a0d53889 AD |
457 | } |
458 | ||
331900c6 AD |
459 | function editFeed(feed) { |
460 | ||
508a81e1 AD |
461 | // notify("Editing feed..."); |
462 | ||
c0e5a40e | 463 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
464 | printLockingError(); |
465 | return | |
466 | } | |
331900c6 | 467 | |
9e31e1b9 AD |
468 | notify_progress("Loading, please wait..."); |
469 | ||
a349077c AD |
470 | document.getElementById("subscribe_to_feed_btn").disabled = true; |
471 | ||
472 | try { | |
473 | document.getElementById("top25_feeds_btn").disabled = true; | |
474 | } catch (e) { | |
475 | // this button is not always available, no-op if not found | |
476 | } | |
477 | ||
673d54ca | 478 | // clean selection from all rows & select row being edited |
0ea4fb50 | 479 | selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false); |
6c12c809 | 480 | selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true); |
0ea4fb50 AD |
481 | |
482 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" + | |
3c5783b7 | 483 | param_escape(feed), true); |
0ea4fb50 AD |
484 | |
485 | xmlhttp.onreadystatechange=infobox_callback; | |
331900c6 AD |
486 | xmlhttp.send(null); |
487 | ||
488 | } | |
489 | ||
91ff844a | 490 | function editFeedCat(cat) { |
48f0adb0 | 491 | |
91ff844a AD |
492 | if (!xmlhttp_ready(xmlhttp)) { |
493 | printLockingError(); | |
494 | return | |
48f0adb0 AD |
495 | } |
496 | ||
9e31e1b9 AD |
497 | notify_progress("Loading, please wait..."); |
498 | ||
91ff844a | 499 | active_feed_cat = cat; |
e6cb77a0 | 500 | |
9c483746 | 501 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=edit&id=" + |
91ff844a | 502 | param_escape(cat), true); |
9c483746 | 503 | xmlhttp.onreadystatechange=infobox_callback; |
91ff844a | 504 | xmlhttp.send(null); |
e6cb77a0 | 505 | |
e6cb77a0 AD |
506 | } |
507 | ||
91ff844a AD |
508 | function getSelectedLabels() { |
509 | return getSelectedTableRowIds("prefLabelList", "LILRR"); | |
510 | } | |
48f0adb0 | 511 | |
91ff844a AD |
512 | function getSelectedUsers() { |
513 | return getSelectedTableRowIds("prefUserList", "UMRR"); | |
a0d53889 AD |
514 | } |
515 | ||
83fe4d6d | 516 | function getSelectedFeeds() { |
91ff844a AD |
517 | return getSelectedTableRowIds("prefFeedList", "FEEDR"); |
518 | } | |
331900c6 | 519 | |
91ff844a AD |
520 | function getSelectedFilters() { |
521 | return getSelectedTableRowIds("prefFilterList", "FILRR"); | |
522 | } | |
331900c6 | 523 | |
91ff844a AD |
524 | function getSelectedFeedCats() { |
525 | return getSelectedTableRowIds("prefFeedCatList", "FCATR"); | |
83fe4d6d AD |
526 | } |
527 | ||
c0ae0fdb AD |
528 | function getSelectedFeedsFromBrowser() { |
529 | ||
530 | var list = document.getElementById("browseFeedList"); | |
531 | if (!list) list = document.getElementById("browseBigFeedList"); | |
532 | ||
533 | var selected = new Array(); | |
534 | ||
535 | for (i = 0; i < list.childNodes.length; i++) { | |
536 | var child = list.childNodes[i]; | |
537 | if (child.id && child.id.match("FBROW-")) { | |
538 | var id = child.id.replace("FBROW-", ""); | |
539 | ||
540 | var cb = document.getElementById("FBCHK-" + id); | |
541 | ||
542 | if (cb.checked) { | |
543 | selected.push(id); | |
544 | } | |
545 | } | |
546 | } | |
547 | ||
548 | return selected; | |
549 | } | |
550 | ||
48f0adb0 AD |
551 | function removeSelectedLabels() { |
552 | ||
553 | if (!xmlhttp_ready(xmlhttp)) { | |
554 | printLockingError(); | |
555 | return | |
556 | } | |
557 | ||
558 | var sel_rows = getSelectedLabels(); | |
559 | ||
560 | if (sel_rows.length > 0) { | |
561 | ||
f56e3080 | 562 | var ok = confirm(__("Remove selected labels?")); |
48f0adb0 | 563 | |
69668465 | 564 | if (ok) { |
42c32916 | 565 | notify_progress("Removing selected labels..."); |
69668465 AD |
566 | |
567 | xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ | |
568 | param_escape(sel_rows.toString()), true); | |
569 | xmlhttp.onreadystatechange=labellist_callback; | |
570 | xmlhttp.send(null); | |
571 | } | |
48f0adb0 | 572 | } else { |
89cb787e | 573 | alert(__("No labels are selected.")); |
48f0adb0 | 574 | } |
90ac84df AD |
575 | |
576 | return false; | |
48f0adb0 AD |
577 | } |
578 | ||
e6cb77a0 AD |
579 | function removeSelectedUsers() { |
580 | ||
581 | if (!xmlhttp_ready(xmlhttp)) { | |
582 | printLockingError(); | |
583 | return | |
584 | } | |
585 | ||
586 | var sel_rows = getSelectedUsers(); | |
587 | ||
588 | if (sel_rows.length > 0) { | |
589 | ||
f56e3080 | 590 | var ok = confirm(__("Remove selected users?")); |
e6cb77a0 | 591 | |
69668465 | 592 | if (ok) { |
42c32916 | 593 | notify_progress("Removing selected users..."); |
69668465 AD |
594 | |
595 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+ | |
596 | param_escape(sel_rows.toString()), true); | |
597 | xmlhttp.onreadystatechange=userlist_callback; | |
598 | xmlhttp.send(null); | |
599 | } | |
e6cb77a0 AD |
600 | |
601 | } else { | |
89cb787e | 602 | alert(__("No users are selected.")); |
e6cb77a0 | 603 | } |
90ac84df AD |
604 | |
605 | return false; | |
e6cb77a0 AD |
606 | } |
607 | ||
48f0adb0 AD |
608 | function removeSelectedFilters() { |
609 | ||
610 | if (!xmlhttp_ready(xmlhttp)) { | |
611 | printLockingError(); | |
612 | return | |
613 | } | |
614 | ||
615 | var sel_rows = getSelectedFilters(); | |
616 | ||
617 | if (sel_rows.length > 0) { | |
618 | ||
f56e3080 | 619 | var ok = confirm(__("Remove selected filters?")); |
48f0adb0 | 620 | |
69668465 | 621 | if (ok) { |
42c32916 | 622 | notify_progress("Removing selected filters..."); |
69668465 AD |
623 | |
624 | xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ | |
625 | param_escape(sel_rows.toString()), true); | |
626 | xmlhttp.onreadystatechange=filterlist_callback; | |
627 | xmlhttp.send(null); | |
628 | } | |
48f0adb0 | 629 | } else { |
89cb787e | 630 | alert(__("No filters are selected.")); |
48f0adb0 | 631 | } |
90ac84df AD |
632 | |
633 | return false; | |
48f0adb0 AD |
634 | } |
635 | ||
636 | ||
83fe4d6d AD |
637 | function removeSelectedFeeds() { |
638 | ||
c0e5a40e | 639 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
640 | printLockingError(); |
641 | return | |
642 | } | |
643 | ||
83fe4d6d AD |
644 | var sel_rows = getSelectedFeeds(); |
645 | ||
331900c6 AD |
646 | if (sel_rows.length > 0) { |
647 | ||
f56e3080 | 648 | var ok = confirm(__("Unsubscribe from selected feeds?")); |
331900c6 | 649 | |
69668465 AD |
650 | if (ok) { |
651 | ||
42c32916 | 652 | notify_progress("Unsubscribing from selected feeds..."); |
69668465 AD |
653 | |
654 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ | |
655 | param_escape(sel_rows.toString()), true); | |
656 | xmlhttp.onreadystatechange=feedlist_callback; | |
657 | xmlhttp.send(null); | |
658 | } | |
71ad3959 | 659 | |
71ad3959 | 660 | } else { |
331900c6 | 661 | |
89cb787e | 662 | alert(__("No feeds are selected.")); |
331900c6 | 663 | |
71ad3959 | 664 | } |
90ac84df AD |
665 | |
666 | return false; | |
71ad3959 | 667 | } |
007bda35 | 668 | |
91ff844a AD |
669 | function removeSelectedFeedCats() { |
670 | ||
671 | if (!xmlhttp_ready(xmlhttp)) { | |
672 | printLockingError(); | |
673 | return | |
674 | } | |
675 | ||
676 | var sel_rows = getSelectedFeedCats(); | |
677 | ||
678 | if (sel_rows.length > 0) { | |
679 | ||
f56e3080 | 680 | var ok = confirm(__("Remove selected categories?")); |
91ff844a | 681 | |
69668465 | 682 | if (ok) { |
42c32916 | 683 | notify_progress("Removing selected categories..."); |
69668465 | 684 | |
9c483746 | 685 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+ |
69668465 | 686 | param_escape(sel_rows.toString()), true); |
9c483746 | 687 | xmlhttp.onreadystatechange=infobox_callback; |
69668465 AD |
688 | xmlhttp.send(null); |
689 | } | |
91ff844a AD |
690 | |
691 | } else { | |
692 | ||
89cb787e | 693 | alert(__("No categories are selected.")); |
91ff844a AD |
694 | |
695 | } | |
696 | ||
90ac84df | 697 | return false; |
91ff844a AD |
698 | } |
699 | ||
508a81e1 AD |
700 | function feedEditCancel() { |
701 | ||
c0e5a40e | 702 | if (!xmlhttp_ready(xmlhttp)) { |
508a81e1 AD |
703 | printLockingError(); |
704 | return | |
705 | } | |
706 | ||
a349077c AD |
707 | document.getElementById("subscribe_to_feed_btn").disabled = false; |
708 | ||
709 | try { | |
710 | document.getElementById("top25_feeds_btn").disabled = false; | |
711 | } catch (e) { | |
712 | // this button is not always available, no-op if not found | |
713 | } | |
714 | ||
327a3bbe AD |
715 | closeInfoBox(); |
716 | ||
673d54ca | 717 | selectPrefRows('feed', false); // cleanup feed selection |
508a81e1 | 718 | |
90ac84df | 719 | return false; |
508a81e1 AD |
720 | } |
721 | ||
91ff844a AD |
722 | function feedCatEditCancel() { |
723 | ||
724 | if (!xmlhttp_ready(xmlhttp)) { | |
725 | printLockingError(); | |
726 | return | |
727 | } | |
728 | ||
729 | active_feed_cat = false; | |
730 | ||
0ceded7a | 731 | // notify("Operation cancelled."); |
91ff844a | 732 | |
9c483746 AD |
733 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true); |
734 | xmlhttp.onreadystatechange=infobox_callback; | |
91ff844a AD |
735 | xmlhttp.send(null); |
736 | ||
90ac84df | 737 | return false; |
91ff844a AD |
738 | } |
739 | ||
603c27f8 AD |
740 | function feedEditSave() { |
741 | ||
47c6c988 | 742 | try { |
47c6c988 AD |
743 | |
744 | if (!xmlhttp_ready(xmlhttp)) { | |
745 | printLockingError(); | |
746 | return | |
747 | } | |
ad815c71 | 748 | |
14f69488 | 749 | // FIXME: add parameter validation |
e3c99f3b | 750 | |
14f69488 | 751 | var query = Form.serialize("edit_feed_form"); |
b0da3a7b | 752 | |
42c32916 | 753 | notify_progress("Saving feed..."); |
673d54ca | 754 | |
47c6c988 AD |
755 | xmlhttp.open("POST", "backend.php", true); |
756 | xmlhttp.onreadystatechange=feedlist_callback; | |
757 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
14f69488 AD |
758 | xmlhttp.send(query); |
759 | ||
59a543f0 AD |
760 | closeInfoBox(); |
761 | ||
c14b5566 AD |
762 | return false; |
763 | ||
47c6c988 AD |
764 | } catch (e) { |
765 | exception_error("feedEditSave", e); | |
b0da3a7b | 766 | } |
508a81e1 AD |
767 | } |
768 | ||
5ddadb4c AD |
769 | function feedCatEditSave() { |
770 | ||
771 | if (!xmlhttp_ready(xmlhttp)) { | |
772 | printLockingError(); | |
773 | return | |
774 | } | |
775 | ||
42c32916 | 776 | notify_progress("Saving category..."); |
5ddadb4c | 777 | |
0666e120 AD |
778 | var query = Form.serialize("feed_cat_edit_form"); |
779 | ||
780 | xmlhttp.open("GET", "backend.php?" + query, true); | |
9c483746 | 781 | xmlhttp.onreadystatechange=infobox_callback; |
5ddadb4c AD |
782 | xmlhttp.send(null); |
783 | ||
784 | active_feed_cat = false; | |
785 | ||
90ac84df | 786 | return false; |
5ddadb4c AD |
787 | } |
788 | ||
789 | ||
d9dde1d6 | 790 | |
01c9c74a AD |
791 | function displayHelpInfobox(topic_id) { |
792 | ||
442d77f1 | 793 | /* if (!xmlhttp_ready(xmlhttp)) { |
9e31e1b9 AD |
794 | printLockingError(); |
795 | return | |
796 | } | |
797 | ||
798 | notify_progress("Loading help..."); | |
799 | ||
01c9c74a | 800 | xmlhttp.open("GET", "backend.php?op=help&tid=" + |
442d77f1 | 801 | param_escape(topic_id), true); |
01c9c74a | 802 | |
442d77f1 AD |
803 | xmlhttp.onreadystatechange=helpbox_callback; |
804 | xmlhttp.send(null); */ | |
805 | ||
806 | var url = "backend.php?op=help&tid=" + param_escape(topic_id); | |
807 | ||
808 | var w = window.open(url, "ttrss_help", | |
809 | "status=0,toolbar=0,location=0,width=400,height=450,menubar=0"); | |
01c9c74a AD |
810 | |
811 | } | |
812 | ||
48f0adb0 AD |
813 | function labelEditCancel() { |
814 | ||
815 | if (!xmlhttp_ready(xmlhttp)) { | |
816 | printLockingError(); | |
817 | return | |
818 | } | |
819 | ||
f156fd00 AD |
820 | document.getElementById("label_create_btn").disabled = false; |
821 | ||
48f0adb0 AD |
822 | active_label = false; |
823 | ||
a4dbc524 | 824 | selectPrefRows('label', false); // cleanup feed selection |
50bad812 AD |
825 | closeInfoBox(); |
826 | ||
90ac84df | 827 | return false; |
48f0adb0 AD |
828 | } |
829 | ||
e6cb77a0 AD |
830 | function userEditCancel() { |
831 | ||
832 | if (!xmlhttp_ready(xmlhttp)) { | |
833 | printLockingError(); | |
834 | return | |
835 | } | |
836 | ||
3c5783b7 | 837 | selectPrefRows('user', false); // cleanup feed selection |
3c5783b7 | 838 | closeInfoBox(); |
90ac84df AD |
839 | |
840 | return false; | |
e6cb77a0 | 841 | } |
48f0adb0 | 842 | |
a0d53889 AD |
843 | function filterEditCancel() { |
844 | ||
845 | if (!xmlhttp_ready(xmlhttp)) { | |
846 | printLockingError(); | |
847 | return | |
848 | } | |
4220b0bd AD |
849 | |
850 | document.getElementById("create_filter_btn").disabled = false; | |
07164479 AD |
851 | |
852 | selectPrefRows('filter', false); // cleanup feed selection | |
853 | closeInfoBox(); | |
90ac84df AD |
854 | |
855 | return false; | |
a0d53889 AD |
856 | } |
857 | ||
48f0adb0 AD |
858 | function labelEditSave() { |
859 | ||
860 | var label = active_label; | |
861 | ||
862 | if (!xmlhttp_ready(xmlhttp)) { | |
863 | printLockingError(); | |
864 | return | |
865 | } | |
866 | ||
9ee3ac59 | 867 | /* if (!is_opera()) { |
48f0adb0 | 868 | |
7c620da8 AD |
869 | var sql_exp = document.forms["label_edit_form"].sql_exp.value; |
870 | var description = document.forms["label_edit_form"].description.value; | |
871 | ||
872 | if (sql_exp.length == 0) { | |
873 | alert("SQL Expression cannot be blank."); | |
874 | return false; | |
875 | } | |
876 | ||
877 | if (description.length == 0) { | |
878 | alert("Caption field cannot be blank."); | |
879 | return false; | |
880 | } | |
9ee3ac59 | 881 | } */ |
48f0adb0 | 882 | |
50bad812 AD |
883 | closeInfoBox(); |
884 | ||
42c32916 | 885 | notify_progress("Saving label..."); |
dbd9e2f1 | 886 | |
48f0adb0 AD |
887 | active_label = false; |
888 | ||
f3120e5a AD |
889 | query = Form.serialize("label_edit_form"); |
890 | ||
50bad812 | 891 | xmlhttp.open("GET", "backend.php?" + query, true); |
48f0adb0 AD |
892 | xmlhttp.onreadystatechange=labellist_callback; |
893 | xmlhttp.send(null); | |
894 | ||
90ac84df | 895 | return false; |
48f0adb0 AD |
896 | } |
897 | ||
e6cb77a0 AD |
898 | function userEditSave() { |
899 | ||
e6cb77a0 AD |
900 | if (!xmlhttp_ready(xmlhttp)) { |
901 | printLockingError(); | |
902 | return | |
903 | } | |
904 | ||
3c5783b7 | 905 | var login = document.forms["user_edit_form"].login.value; |
e6cb77a0 AD |
906 | |
907 | if (login.length == 0) { | |
89cb787e | 908 | alert(__("Login field cannot be blank.")); |
e6cb77a0 AD |
909 | return; |
910 | } | |
3c5783b7 | 911 | |
42c32916 | 912 | notify_progress("Saving user..."); |
4220b0bd AD |
913 | |
914 | closeInfoBox(); | |
915 | ||
3c5783b7 AD |
916 | var query = Form.serialize("user_edit_form"); |
917 | ||
918 | xmlhttp.open("GET", "backend.php?" + query, true); | |
dbd9e2f1 | 919 | xmlhttp.onreadystatechange=userlist_callback; |
e6cb77a0 | 920 | xmlhttp.send(null); |
90ac84df AD |
921 | |
922 | return false; | |
e6cb77a0 AD |
923 | } |
924 | ||
925 | ||
a0d53889 AD |
926 | function filterEditSave() { |
927 | ||
a0d53889 AD |
928 | if (!xmlhttp_ready(xmlhttp)) { |
929 | printLockingError(); | |
930 | return | |
931 | } | |
932 | ||
9ee3ac59 | 933 | /* if (!is_opera()) { |
7c620da8 AD |
934 | var reg_exp = document.forms["filter_edit_form"].reg_exp.value; |
935 | ||
936 | if (reg_exp.length == 0) { | |
937 | alert("Filter expression field cannot be blank."); | |
938 | return; | |
939 | } | |
9ee3ac59 | 940 | } */ |
a0d53889 | 941 | |
42c32916 | 942 | notify_progress("Saving filter..."); |
a0d53889 | 943 | |
7e939457 | 944 | var query = Form.serialize("filter_edit_form"); |
dbd9e2f1 | 945 | |
07164479 AD |
946 | closeInfoBox(); |
947 | ||
4220b0bd AD |
948 | document.getElementById("create_filter_btn").disabled = false; |
949 | ||
7e939457 | 950 | xmlhttp.open("GET", "backend.php?" + query, true); |
a0d53889 | 951 | xmlhttp.onreadystatechange=filterlist_callback; |
7e939457 | 952 | xmlhttp.send(null); |
a0d53889 | 953 | |
90ac84df | 954 | return false; |
a0d53889 AD |
955 | } |
956 | ||
48f0adb0 AD |
957 | function editSelectedLabel() { |
958 | var rows = getSelectedLabels(); | |
a0d53889 | 959 | |
48f0adb0 | 960 | if (rows.length == 0) { |
f3977cf5 | 961 | alert(__("No labels are selected.")); |
48f0adb0 | 962 | return; |
a0d53889 AD |
963 | } |
964 | ||
48f0adb0 | 965 | if (rows.length > 1) { |
f3977cf5 | 966 | alert(__("Please select only one label.")); |
48f0adb0 AD |
967 | return; |
968 | } | |
a0d53889 | 969 | |
dbd9e2f1 AD |
970 | notify(""); |
971 | ||
48f0adb0 | 972 | editLabel(rows[0]); |
a0d53889 | 973 | |
a0d53889 AD |
974 | } |
975 | ||
e6cb77a0 AD |
976 | function editSelectedUser() { |
977 | var rows = getSelectedUsers(); | |
978 | ||
979 | if (rows.length == 0) { | |
f3977cf5 | 980 | alert(__("No users are selected.")); |
e6cb77a0 AD |
981 | return; |
982 | } | |
983 | ||
984 | if (rows.length > 1) { | |
f3977cf5 | 985 | alert(__("Please select only one user.")); |
e6cb77a0 AD |
986 | return; |
987 | } | |
988 | ||
dbd9e2f1 AD |
989 | notify(""); |
990 | ||
e6cb77a0 AD |
991 | editUser(rows[0]); |
992 | } | |
993 | ||
994 | function resetSelectedUserPass() { | |
995 | var rows = getSelectedUsers(); | |
996 | ||
997 | if (rows.length == 0) { | |
f3977cf5 | 998 | alert(__("No users are selected.")); |
e6cb77a0 AD |
999 | return; |
1000 | } | |
1001 | ||
1002 | if (rows.length > 1) { | |
f3977cf5 | 1003 | alert(__("Please select only one user.")); |
e6cb77a0 AD |
1004 | return; |
1005 | } | |
1006 | ||
f3977cf5 | 1007 | var ok = confirm(__("Reset password of selected user?")); |
e6cb77a0 | 1008 | |
69668465 | 1009 | if (ok) { |
42c32916 | 1010 | notify_progress("Resetting password for selected user..."); |
69668465 AD |
1011 | |
1012 | var id = rows[0]; | |
1013 | ||
1014 | xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" + | |
1015 | param_escape(id), true); | |
1016 | xmlhttp.onreadystatechange=userlist_callback; | |
1017 | xmlhttp.send(null); | |
1018 | } | |
e6cb77a0 AD |
1019 | } |
1020 | ||
717f5e64 | 1021 | function selectedUserDetails() { |
e6cb77a0 | 1022 | |
1a7572cb AD |
1023 | if (!xmlhttp_ready(xmlhttp)) { |
1024 | printLockingError(); | |
1025 | return | |
1026 | } | |
1027 | ||
717f5e64 AD |
1028 | var rows = getSelectedUsers(); |
1029 | ||
1030 | if (rows.length == 0) { | |
f3977cf5 | 1031 | alert(__("No users are selected.")); |
717f5e64 AD |
1032 | return; |
1033 | } | |
1034 | ||
1035 | if (rows.length > 1) { | |
f3977cf5 | 1036 | alert(__("Please select only one user.")); |
717f5e64 AD |
1037 | return; |
1038 | } | |
1039 | ||
0077a65c | 1040 | notify_progress("Loading, please wait..."); |
717f5e64 | 1041 | |
0077a65c | 1042 | var id = rows[0]; |
dbd9e2f1 | 1043 | |
1a7572cb | 1044 | xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true); |
c6c3a07f AD |
1045 | xmlhttp.onreadystatechange=infobox_callback; |
1046 | xmlhttp.send(null); | |
1047 | ||
1048 | } | |
1049 | ||
1050 | function selectedFeedDetails() { | |
1051 | ||
1052 | if (!xmlhttp_ready(xmlhttp)) { | |
1053 | printLockingError(); | |
1054 | return | |
1055 | } | |
1056 | ||
1057 | var rows = getSelectedFeeds(); | |
1058 | ||
1059 | if (rows.length == 0) { | |
f3977cf5 | 1060 | alert(__("No feeds are selected.")); |
c6c3a07f AD |
1061 | return; |
1062 | } | |
1063 | ||
01b3e191 | 1064 | if (rows.length > 1) { |
f3977cf5 | 1065 | alert(__("Please select only one feed.")); |
01b3e191 AD |
1066 | return; |
1067 | } | |
c6c3a07f | 1068 | |
df268d47 | 1069 | // var id = rows[0]; |
c6c3a07f | 1070 | |
dbd9e2f1 AD |
1071 | notify(""); |
1072 | ||
df268d47 AD |
1073 | xmlhttp.open("GET", "backend.php?op=feed-details&id=" + |
1074 | param_escape(rows.toString()), true); | |
c6c3a07f | 1075 | xmlhttp.onreadystatechange=infobox_callback; |
1a7572cb | 1076 | xmlhttp.send(null); |
717f5e64 AD |
1077 | |
1078 | } | |
a0d53889 AD |
1079 | |
1080 | function editSelectedFilter() { | |
1081 | var rows = getSelectedFilters(); | |
1082 | ||
1083 | if (rows.length == 0) { | |
f3977cf5 | 1084 | alert(__("No filters are selected.")); |
a0d53889 AD |
1085 | return; |
1086 | } | |
1087 | ||
1088 | if (rows.length > 1) { | |
f3977cf5 | 1089 | alert(__("Please select only one filter.")); |
a0d53889 AD |
1090 | return; |
1091 | } | |
1092 | ||
dbd9e2f1 AD |
1093 | notify(""); |
1094 | ||
a0d53889 AD |
1095 | editFilter(rows[0]); |
1096 | ||
1097 | } | |
1098 | ||
1099 | ||
508a81e1 AD |
1100 | function editSelectedFeed() { |
1101 | var rows = getSelectedFeeds(); | |
1102 | ||
1103 | if (rows.length == 0) { | |
f3977cf5 | 1104 | alert(__("No feeds are selected.")); |
508a81e1 AD |
1105 | return; |
1106 | } | |
1107 | ||
1108 | if (rows.length > 1) { | |
f3977cf5 | 1109 | alert(__("Please select one feed.")); |
508a81e1 AD |
1110 | return; |
1111 | } | |
1112 | ||
dbd9e2f1 AD |
1113 | notify(""); |
1114 | ||
508a81e1 | 1115 | editFeed(rows[0]); |
91ff844a AD |
1116 | |
1117 | } | |
1118 | ||
1119 | function editSelectedFeedCat() { | |
1120 | var rows = getSelectedFeedCats(); | |
1121 | ||
1122 | if (rows.length == 0) { | |
f3977cf5 | 1123 | alert(__("No categories are selected.")); |
91ff844a AD |
1124 | return; |
1125 | } | |
1126 | ||
1127 | if (rows.length > 1) { | |
f3977cf5 | 1128 | alert(__("Please select only one category.")); |
91ff844a AD |
1129 | return; |
1130 | } | |
1131 | ||
1132 | notify(""); | |
1133 | ||
1134 | editFeedCat(rows[0]); | |
508a81e1 AD |
1135 | |
1136 | } | |
1137 | ||
13ad9102 AD |
1138 | function localPiggieFunction(enable) { |
1139 | if (enable) { | |
d437c8cf | 1140 | debug("I LOVEDED IT!"); |
1cac3c31 | 1141 | var piggie = document.getElementById("piggie"); |
33377ef3 | 1142 | |
537625c6 AD |
1143 | Element.show(piggie); |
1144 | Position.Center(piggie); | |
1145 | Effect.Puff(piggie); | |
1146 | ||
508a81e1 | 1147 | } |
508a81e1 AD |
1148 | } |
1149 | ||
9f311df6 AD |
1150 | function validateOpmlImport() { |
1151 | ||
1152 | var opml_file = document.getElementById("opml_file"); | |
1153 | ||
1154 | if (opml_file.value.length == 0) { | |
f3977cf5 | 1155 | alert(__("No OPML file to upload.")); |
9f311df6 AD |
1156 | return false; |
1157 | } else { | |
1158 | return true; | |
1159 | } | |
1160 | } | |
1161 | ||
0e317f9d | 1162 | function updateFilterList(sort_key) { |
a0d53889 AD |
1163 | |
1164 | if (!xmlhttp_ready(xmlhttp)) { | |
1165 | printLockingError(); | |
1166 | return | |
1167 | } | |
1168 | ||
f5a50b25 AD |
1169 | // document.getElementById("prefContent").innerHTML = "Loading filters, please wait..."; |
1170 | ||
ce3bf408 | 1171 | // p_notify("Loading, please wait..."); |
a0d53889 | 1172 | |
e161a2cc AD |
1173 | xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + |
1174 | param_escape(sort_key), true); | |
a0d53889 AD |
1175 | xmlhttp.onreadystatechange=filterlist_callback; |
1176 | xmlhttp.send(null); | |
1177 | ||
1178 | } | |
1179 | ||
e161a2cc | 1180 | function updateLabelList(sort_key) { |
48f0adb0 AD |
1181 | |
1182 | if (!xmlhttp_ready(xmlhttp)) { | |
1183 | printLockingError(); | |
1184 | return | |
1185 | } | |
1186 | ||
ce3bf408 | 1187 | // p_notify("Loading, please wait..."); |
f5a50b25 AD |
1188 | |
1189 | // document.getElementById("prefContent").innerHTML = "Loading labels, please wait..."; | |
48f0adb0 | 1190 | |
e161a2cc AD |
1191 | xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" + |
1192 | param_escape(sort_key), true); | |
48f0adb0 AD |
1193 | xmlhttp.onreadystatechange=labellist_callback; |
1194 | xmlhttp.send(null); | |
48f0adb0 AD |
1195 | } |
1196 | ||
4255b24c AD |
1197 | function updatePrefsList() { |
1198 | ||
1199 | if (!xmlhttp_ready(xmlhttp)) { | |
1200 | printLockingError(); | |
1201 | return | |
1202 | } | |
1203 | ||
ce3bf408 | 1204 | // p_notify("Loading, please wait..."); |
4255b24c AD |
1205 | |
1206 | xmlhttp.open("GET", "backend.php?op=pref-prefs", true); | |
1207 | xmlhttp.onreadystatechange=prefslist_callback; | |
1208 | xmlhttp.send(null); | |
1209 | ||
1210 | } | |
1211 | ||
e513a74a | 1212 | function selectTab(id, noupdate, subop) { |
a7f22b70 AD |
1213 | |
1214 | // alert(id); | |
48f0adb0 | 1215 | |
b2caf812 | 1216 | if (!id) id = active_tab; |
7f74a9da | 1217 | |
b2caf812 | 1218 | try { |
59a543f0 | 1219 | |
b2caf812 AD |
1220 | if (!xmlhttp_ready(xmlhttp)) { |
1221 | printLockingError(); | |
1222 | return | |
a7f22b70 | 1223 | } |
f5a50b25 | 1224 | |
a422968f AD |
1225 | try { |
1226 | var c = document.getElementById('prefContent'); | |
1227 | c.scrollTop = 0; | |
1228 | } catch (e) { }; | |
1229 | ||
b2caf812 | 1230 | if (!noupdate) { |
f5a50b25 | 1231 | |
b2caf812 AD |
1232 | debug("selectTab: " + id + "(NU: " + noupdate + ")"); |
1233 | ||
9e31e1b9 | 1234 | notify_progress("Loading, please wait..."); |
b2caf812 AD |
1235 | |
1236 | // close active infobox if needed | |
1237 | closeInfoBox(); | |
1238 | ||
1239 | // clean up all current selections, just in case | |
1240 | active_feed_cat = false; | |
1241 | active_label = false; | |
1242 | ||
1243 | if (id == "feedConfig") { | |
1244 | updateFeedList(); | |
1245 | } else if (id == "filterConfig") { | |
1246 | updateFilterList(); | |
1247 | } else if (id == "labelConfig") { | |
1248 | updateLabelList(); | |
1249 | } else if (id == "genConfig") { | |
1250 | updatePrefsList(); | |
1251 | } else if (id == "userConfig") { | |
1252 | updateUsersList(); | |
1253 | } else if (id == "feedBrowser") { | |
1254 | updateBigFeedBrowser(); | |
1255 | } | |
f5a50b25 | 1256 | } |
b2caf812 AD |
1257 | |
1258 | var tab = document.getElementById(active_tab + "Tab"); | |
1259 | ||
1260 | if (tab) { | |
1261 | if (tab.className.match("Selected")) { | |
1262 | tab.className = "prefsTab"; | |
1263 | } | |
f5a50b25 | 1264 | } |
b2caf812 AD |
1265 | |
1266 | tab = document.getElementById(id + "Tab"); | |
1267 | ||
1268 | if (tab) { | |
1269 | if (!tab.className.match("Selected")) { | |
1270 | tab.className = tab.className + "Selected"; | |
1271 | } | |
1272 | } | |
1273 | ||
b2caf812 | 1274 | active_tab = id; |
f5a50b25 | 1275 | |
b2caf812 AD |
1276 | } catch (e) { |
1277 | exception_error("selectTab", e); | |
a7565293 | 1278 | } |
a7565293 AD |
1279 | } |
1280 | ||
1281 | function backend_sanity_check_callback() { | |
f5a50b25 | 1282 | |
a7565293 AD |
1283 | if (xmlhttp.readyState == 4) { |
1284 | ||
1285 | try { | |
7a09510c AD |
1286 | |
1287 | if (sanity_check_done) { | |
81352b54 AD |
1288 | fatalError(11, "Sanity check request received twice. This can indicate "+ |
1289 | "presence of Firebug or some other disrupting extension. "+ | |
1290 | "Please disable it and try again."); | |
7a09510c AD |
1291 | return; |
1292 | } | |
1293 | ||
a7565293 AD |
1294 | if (!xmlhttp.responseXML) { |
1295 | fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText); | |
1296 | return; | |
1297 | } | |
1298 | ||
1299 | var reply = xmlhttp.responseXML.firstChild.firstChild; | |
1300 | ||
1301 | if (!reply) { | |
1302 | fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText); | |
1303 | return; | |
1304 | } | |
1305 | ||
1306 | var error_code = reply.getAttribute("error-code"); | |
1307 | ||
1308 | if (error_code && error_code != 0) { | |
1309 | return fatalError(error_code, reply.getAttribute("error-msg")); | |
1310 | } | |
1311 | ||
1312 | debug("sanity check ok"); | |
1313 | ||
1314 | var params = reply.nextSibling; | |
1315 | ||
1316 | if (params) { | |
1317 | debug('reading init-params...'); | |
1318 | var param = params.firstChild; | |
1319 | ||
1320 | while (param) { | |
1321 | var k = param.getAttribute("key"); | |
1322 | var v = param.getAttribute("value"); | |
1323 | debug(k + " => " + v); | |
1324 | init_params[k] = v; | |
1325 | param = param.nextSibling; | |
1326 | } | |
1327 | } | |
1328 | ||
7a09510c AD |
1329 | sanity_check_done = true; |
1330 | ||
a7565293 AD |
1331 | init_second_stage(); |
1332 | ||
1333 | } catch (e) { | |
1334 | exception_error("backend_sanity_check_callback", e); | |
1335 | } | |
1336 | } | |
1337 | } | |
1338 | ||
1339 | function init_second_stage() { | |
1340 | ||
b2caf812 AD |
1341 | try { |
1342 | active_tab = getInitParam("prefs_active_tab"); | |
fe8d2059 | 1343 | if (!active_tab || active_tab == '0') active_tab = "genConfig"; |
4da47970 | 1344 | |
d437c8cf AD |
1345 | document.onkeydown = pref_hotkey_handler; |
1346 | ||
e513a74a AD |
1347 | var tab = getURLParam('tab'); |
1348 | ||
1349 | caller_subop = getURLParam('subop'); | |
1350 | ||
1351 | if (tab) { | |
1352 | active_tab = tab; | |
1353 | } | |
1354 | ||
b2caf812 AD |
1355 | if (navigator.userAgent.match("Opera")) { |
1356 | setTimeout("selectTab()", 500); | |
1357 | } else { | |
1358 | selectTab(active_tab); | |
1359 | } | |
1360 | notify(""); | |
1361 | } catch (e) { | |
1362 | exception_error("init_second_stage", e); | |
1363 | } | |
a0d53889 AD |
1364 | } |
1365 | ||
007bda35 | 1366 | function init() { |
e2ec66a8 | 1367 | |
7719618b AD |
1368 | try { |
1369 | ||
97dcd654 AD |
1370 | if (arguments.callee.done) return; |
1371 | arguments.callee.done = true; | |
1372 | ||
a7565293 AD |
1373 | if (getURLParam('debug')) { |
1374 | document.getElementById('debug_output').style.display = 'block'; | |
1375 | debug('debug mode activated'); | |
1376 | } | |
1377 | ||
7719618b AD |
1378 | // IE kludge |
1379 | if (!xmlhttp) { | |
1380 | document.getElementById("prefContent").innerHTML = | |
1381 | "<b>Fatal error:</b> This program needs XmlHttpRequest " + | |
1382 | "to function properly. Your browser doesn't seem to support it."; | |
1383 | return; | |
1384 | } | |
4da47970 | 1385 | |
a7565293 AD |
1386 | xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck", true); |
1387 | xmlhttp.onreadystatechange=backend_sanity_check_callback; | |
1388 | xmlhttp.send(null); | |
1389 | ||
7719618b AD |
1390 | } catch (e) { |
1391 | exception_error("init", e); | |
e2ec66a8 | 1392 | } |
007bda35 | 1393 | } |
b1895692 | 1394 | |
f932bc9f AD |
1395 | function categorizeSelectedFeeds() { |
1396 | ||
1397 | if (!xmlhttp_ready(xmlhttp)) { | |
1398 | printLockingError(); | |
1399 | return | |
1400 | } | |
1401 | ||
1402 | var sel_rows = getSelectedFeeds(); | |
1403 | ||
1404 | var cat_sel = document.getElementById("sfeed_set_fcat"); | |
79f3553b | 1405 | var cat_id = cat_sel[cat_sel.selectedIndex].value; |
f932bc9f AD |
1406 | |
1407 | if (sel_rows.length > 0) { | |
1408 | ||
42c32916 | 1409 | notify_progress("Changing category of selected feeds..."); |
f932bc9f AD |
1410 | |
1411 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+ | |
1412 | param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true); | |
1413 | xmlhttp.onreadystatechange=feedlist_callback; | |
1414 | xmlhttp.send(null); | |
1415 | ||
1416 | } else { | |
1417 | ||
f3977cf5 | 1418 | alert(__("No feeds are selected.")); |
f932bc9f AD |
1419 | |
1420 | } | |
1421 | ||
1422 | } | |
69668465 AD |
1423 | |
1424 | function validatePrefsReset() { | |
b652c1b7 AD |
1425 | try { |
1426 | var ok = confirm(__("Reset to defaults?")); | |
1427 | ||
1428 | if (ok) { | |
1429 | ||
1430 | var query = Form.serialize("pref_prefs_form"); | |
1431 | query = query + "&subop=reset-config"; | |
1432 | debug(query); | |
1433 | ||
1434 | xmlhttp.open("POST", "backend.php", true); | |
1435 | xmlhttp.onreadystatechange=prefs_reset_callback; | |
1436 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
1437 | xmlhttp.send(query); | |
1438 | } | |
1439 | ||
1440 | } catch (e) { | |
1441 | exception_error("validatePrefsSave", e); | |
1442 | } | |
1443 | ||
1444 | return false; | |
1445 | ||
69668465 | 1446 | } |
f9cb39ac | 1447 | |
6311acbe | 1448 | function browseFeeds(limit) { |
f9cb39ac AD |
1449 | |
1450 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true); | |
1451 | xmlhttp.onreadystatechange=infobox_callback; | |
1452 | xmlhttp.send(null); | |
1453 | ||
1454 | } | |
a0476535 AD |
1455 | |
1456 | function feedBrowserSubscribe() { | |
1457 | try { | |
a0476535 | 1458 | |
c0ae0fdb | 1459 | var selected = getSelectedFeedsFromBrowser(); |
a0476535 AD |
1460 | |
1461 | if (selected.length > 0) { | |
1462 | closeInfoBox(); | |
1463 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+ | |
1464 | param_escape(selected.toString()), true); | |
1465 | xmlhttp.onreadystatechange=feedlist_callback; | |
1466 | xmlhttp.send(null); | |
1467 | } else { | |
89cb787e | 1468 | alert(__("No feeds are selected.")); |
a0476535 AD |
1469 | } |
1470 | ||
1471 | } catch (e) { | |
1472 | exception_error("feedBrowserSubscribe", e); | |
1473 | } | |
1474 | } | |
c6232e43 | 1475 | |
6311acbe | 1476 | function updateBigFeedBrowser(limit) { |
c6232e43 AD |
1477 | |
1478 | if (!xmlhttp_ready(xmlhttp)) { | |
1479 | printLockingError(); | |
1480 | return | |
1481 | } | |
1482 | ||
ce3bf408 | 1483 | // p_notify("Loading, please wait..."); |
c6232e43 | 1484 | |
6311acbe AD |
1485 | var query = "backend.php?op=pref-feed-browser"; |
1486 | ||
1487 | var limit_sel = document.getElementById("feedBrowserLimit"); | |
1488 | ||
1489 | if (limit_sel) { | |
1490 | var limit = limit_sel[limit_sel.selectedIndex].value; | |
1491 | query = query + "&limit=" + param_escape(limit); | |
1492 | } | |
1493 | ||
1494 | xmlhttp.open("GET", query, true); | |
c6232e43 AD |
1495 | xmlhttp.onreadystatechange=feed_browser_callback; |
1496 | xmlhttp.send(null); | |
c6232e43 AD |
1497 | } |
1498 | ||
c2b2aee0 | 1499 | function browserToggleExpand(id) { |
c6232e43 AD |
1500 | try { |
1501 | /* if (feed_to_expand && feed_to_expand != id) { | |
1502 | var d = document.getElementById("BRDET-" + feed_to_expand); | |
1503 | d.style.display = "none"; | |
1504 | } */ | |
c2b2aee0 | 1505 | |
ff725e9b AD |
1506 | if (!xmlhttp_ready(xmlhttp)) { |
1507 | printLockingError(); | |
1508 | return | |
1509 | } | |
1510 | ||
051c4d56 AD |
1511 | /* if (feed_to_expand && id != feed_to_expand) { |
1512 | Effect.Fade('BRDET-' + feed_to_expand, {duration : 0.5}); | |
1513 | } */ | |
c2b2aee0 | 1514 | |
051c4d56 | 1515 | var d = document.getElementById("BRDET-" + id); |
c6232e43 | 1516 | |
34a01a20 | 1517 | if (Element.visible(d)) { |
051c4d56 | 1518 | Effect.Fade(d, {duration : 0.5}); |
34a01a20 | 1519 | } else { |
c2b2aee0 | 1520 | feed_to_expand = id; |
c6232e43 | 1521 | |
c2b2aee0 AD |
1522 | xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id=" |
1523 | + param_escape(id), true); | |
1524 | xmlhttp.onreadystatechange=expand_feed_callback; | |
1525 | xmlhttp.send(null); | |
1526 | } | |
c6232e43 AD |
1527 | |
1528 | } catch (e) { | |
34a01a20 | 1529 | exception_error("browserToggleExpand", e); |
c6232e43 AD |
1530 | } |
1531 | } | |
64dc5976 | 1532 | |
ce3bf408 AD |
1533 | function selectPrefRows(kind, select) { |
1534 | ||
1535 | if (kind) { | |
1536 | var opbarid = false; | |
1537 | var nchk = false; | |
1538 | var nrow = false; | |
1539 | var lname = false; | |
1540 | ||
1541 | if (kind == "feed") { | |
1542 | opbarid = "feedOpToolbar"; | |
1543 | nrow = "FEEDR-"; | |
1544 | nchk = "FRCHK-"; | |
1545 | lname = "prefFeedList"; | |
1546 | } else if (kind == "fcat") { | |
1547 | opbarid = "catOpToolbar"; | |
1548 | nrow = "FCATR-"; | |
9c483746 | 1549 | nchk = "FCCHK-"; |
ce3bf408 AD |
1550 | lname = "prefFeedCatList"; |
1551 | } else if (kind == "filter") { | |
1552 | opbarid = "filterOpToolbar"; | |
1553 | nrow = "FILRR-"; | |
1554 | nchk = "FICHK-"; | |
1555 | lname = "prefFilterList"; | |
1556 | } else if (kind == "label") { | |
1557 | opbarid = "labelOpToolbar"; | |
1558 | nrow = "LILRR-"; | |
a4dbc524 | 1559 | nchk = "LICHK-"; |
ce3bf408 AD |
1560 | lname = "prefLabelList"; |
1561 | } else if (kind == "user") { | |
1562 | opbarid = "userOpToolbar"; | |
1563 | nrow = "UMRR-"; | |
1564 | nchk = "UMCHK-"; | |
1565 | lname = "prefUserList"; | |
1566 | } | |
1567 | ||
1568 | if (opbarid) { | |
1569 | selectTableRowsByIdPrefix(lname, nrow, nchk, select); | |
1570 | disableContainerChildren(opbarid, !select); | |
1571 | } | |
1572 | ||
1573 | } | |
1574 | } | |
1575 | ||
1576 | ||
1577 | function toggleSelectPrefRow(sender, kind) { | |
1578 | ||
1579 | toggleSelectRow(sender); | |
1580 | ||
1581 | if (kind) { | |
1582 | var opbarid = false; | |
1583 | var nsel = -1; | |
1584 | ||
1585 | if (kind == "feed") { | |
1586 | opbarid = "feedOpToolbar"; | |
1587 | nsel = getSelectedFeeds(); | |
1588 | } else if (kind == "fcat") { | |
1589 | opbarid = "catOpToolbar"; | |
1590 | nsel = getSelectedFeedCats(); | |
1591 | } else if (kind == "filter") { | |
1592 | opbarid = "filterOpToolbar"; | |
1593 | nsel = getSelectedFilters(); | |
1594 | } else if (kind == "label") { | |
1595 | opbarid = "labelOpToolbar"; | |
1596 | nsel = getSelectedLabels(); | |
1597 | } else if (kind == "user") { | |
1598 | opbarid = "userOpToolbar"; | |
1599 | nsel = getSelectedUsers(); | |
1600 | } | |
1601 | ||
1602 | if (opbarid && nsel != -1) { | |
1603 | disableContainerChildren(opbarid, nsel == false); | |
1604 | } | |
1605 | ||
1606 | } | |
1607 | } | |
1608 | ||
c0ae0fdb AD |
1609 | function toggleSelectFBListRow(sender) { |
1610 | toggleSelectListRow(sender); | |
1611 | disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0); | |
1612 | } | |
d437c8cf AD |
1613 | |
1614 | var seq = ""; | |
1615 | ||
1616 | function pref_hotkey_handler(e) { | |
1617 | try { | |
1618 | ||
1619 | var keycode; | |
1620 | ||
1621 | if (!hotkeys_enabled) return; | |
1622 | ||
1623 | if (window.event) { | |
1624 | keycode = window.event.keyCode; | |
1625 | } else if (e) { | |
1626 | keycode = e.which; | |
1627 | } | |
1628 | ||
1629 | if (keycode == 13 || keycode == 27) { | |
1630 | seq = ""; | |
1631 | } else { | |
1632 | seq = seq + "" + keycode; | |
1633 | } | |
1634 | ||
1635 | ||
1636 | if (document.getElementById("piggie")) { | |
1637 | ||
1638 | if (seq.match("807371717369")) { | |
1639 | seq = ""; | |
1640 | localPiggieFunction(true); | |
1641 | } else { | |
1642 | localPiggieFunction(false); | |
1643 | } | |
1644 | } | |
1645 | ||
1646 | } catch (e) { | |
1647 | exception_error("pref_hotkey_handler", e); | |
1648 | } | |
1649 | } | |
1650 | ||
23c2a4e7 AD |
1651 | function userSwitch() { |
1652 | var chooser = document.getElementById("userSwitch"); | |
1653 | var user = chooser[chooser.selectedIndex].value; | |
1654 | window.location = "prefs.php?swu=" + user; | |
1655 | } | |
9c483746 AD |
1656 | |
1657 | function editFeedCats() { | |
1658 | if (!xmlhttp_ready(xmlhttp)) { | |
1659 | printLockingError(); | |
1660 | return | |
1661 | } | |
1662 | ||
a349077c AD |
1663 | document.getElementById("subscribe_to_feed_btn").disabled = true; |
1664 | ||
1665 | try { | |
1666 | document.getElementById("top25_feeds_btn").disabled = true; | |
1667 | } catch (e) { | |
1668 | // this button is not always available, no-op if not found | |
1669 | } | |
1670 | ||
9c483746 | 1671 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true); |
11f083e7 | 1672 | xmlhttp.onreadystatechange=infobox_feed_cat_callback; |
9c483746 AD |
1673 | xmlhttp.send(null); |
1674 | } | |
a3656a41 AD |
1675 | |
1676 | function showFeedsWithErrors() { | |
1677 | displayDlg('feedUpdateErrors'); | |
1678 | } | |
073ca0e6 | 1679 | |
d95bd220 AD |
1680 | function changeUserPassword() { |
1681 | ||
1682 | try { | |
1683 | ||
1684 | if (!xmlhttp_ready(xmlhttp)) { | |
1685 | printLockingError(); | |
1686 | return false; | |
1687 | } | |
1688 | ||
ae661a8c AD |
1689 | var f = document.forms["change_pass_form"]; |
1690 | ||
1691 | if (f) { | |
1692 | if (f.OLD_PASSWORD.value == "") { | |
1693 | new Effect.Highlight(f.OLD_PASSWORD); | |
1694 | notify_error("Old password cannot be blank."); | |
1695 | return false; | |
1696 | } | |
1697 | ||
1698 | if (f.NEW_PASSWORD.value == "") { | |
1699 | new Effect.Highlight(f.NEW_PASSWORD); | |
1700 | notify_error("New password cannot be blank."); | |
1701 | return false; | |
1702 | } | |
1703 | ||
1704 | if (f.CONFIRM_PASSWORD.value == "") { | |
1705 | new Effect.Highlight(f.CONFIRM_PASSWORD); | |
1706 | notify_error("Entered passwords do not match."); | |
1707 | return false; | |
1708 | } | |
1709 | ||
1710 | if (f.CONFIRM_PASSWORD.value != f.NEW_PASSWORD.value) { | |
1711 | new Effect.Highlight(f.CONFIRM_PASSWORD); | |
1712 | new Effect.Highlight(f.NEW_PASSWORD); | |
1713 | notify_error("Entered passwords do not match."); | |
1714 | return false; | |
1715 | } | |
1716 | ||
1717 | } | |
1718 | ||
d95bd220 AD |
1719 | var query = Form.serialize("change_pass_form"); |
1720 | ||
1721 | notify_progress("Trying to change password..."); | |
1722 | ||
1723 | xmlhttp.open("POST", "backend.php", true); | |
1724 | xmlhttp.onreadystatechange=changepass_callback; | |
1725 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
1726 | xmlhttp.send(query); | |
1727 | ||
1728 | } catch (e) { | |
1729 | exception_error("changeUserPassword", e); | |
1730 | } | |
1731 | ||
1732 | return false; | |
1733 | } | |
073ca0e6 | 1734 | |
42395d28 AD |
1735 | function changeUserEmail() { |
1736 | ||
1737 | try { | |
1738 | ||
1739 | if (!xmlhttp_ready(xmlhttp)) { | |
1740 | printLockingError(); | |
1741 | return false; | |
1742 | } | |
1743 | ||
1744 | var query = Form.serialize("change_email_form"); | |
1745 | ||
1746 | notify_progress("Trying to change e-mail..."); | |
1747 | ||
1748 | xmlhttp.open("POST", "backend.php", true); | |
1749 | xmlhttp.onreadystatechange=notify_callback; | |
1750 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
1751 | xmlhttp.send(query); | |
1752 | ||
1753 | } catch (e) { | |
1754 | exception_error("changeUserPassword", e); | |
1755 | } | |
1756 | ||
1757 | return false; | |
1758 | ||
1759 | } | |
400b60d8 AD |
1760 | |
1761 | function feedlistToggleSLAT() { | |
1762 | notify_progress("Loading, please wait..."); | |
1763 | updateFeedList() | |
1764 | } | |
bc0ed820 | 1765 | |
e4f4b46f AD |
1766 | function pubRegenKey() { |
1767 | ||
bc0ed820 AD |
1768 | if (!xmlhttp_ready(xmlhttp)) { |
1769 | printLockingError(); | |
e4f4b46f | 1770 | return false; |
bc0ed820 AD |
1771 | } |
1772 | ||
f56e3080 | 1773 | var ok = confirm(__("Replace current publishing address with a new one?")); |
bc0ed820 | 1774 | |
e4f4b46f AD |
1775 | if (ok) { |
1776 | ||
1777 | notify_progress("Trying to change address..."); | |
1778 | ||
945c243e | 1779 | xmlhttp.open("GET", "backend.php?op=rpc&subop=regenPubKey"); |
e4f4b46f AD |
1780 | xmlhttp.onreadystatechange=replace_pubkey_callback; |
1781 | xmlhttp.send(null); | |
1782 | } | |
1783 | ||
1784 | return false; | |
945c243e | 1785 | } |
b652c1b7 AD |
1786 | |
1787 | function validatePrefsSave() { | |
1788 | try { | |
1789 | ||
1790 | var ok = confirm(__("Save current configuration?")); | |
1791 | ||
1792 | if (ok) { | |
1793 | ||
1794 | var query = Form.serialize("pref_prefs_form"); | |
1795 | query = query + "&subop=save-config"; | |
1796 | debug(query); | |
1797 | ||
1798 | xmlhttp.open("POST", "backend.php", true); | |
1799 | xmlhttp.onreadystatechange=notify_callback; | |
1800 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
1801 | xmlhttp.send(query); | |
1802 | } | |
1803 | ||
1804 | } catch (e) { | |
1805 | exception_error("validatePrefsSave", e); | |
1806 | } | |
1807 | ||
1808 | return false; | |
1809 | } |