]>
Commit | Line | Data |
---|---|---|
1 | var xmlhttp = false; | |
2 | var total_unread = 0; | |
3 | var first_run = true; | |
4 | var display_tags = false; | |
5 | var global_unread = -1; | |
6 | var active_title_text = ""; | |
7 | var current_subtitle = ""; | |
8 | var daemon_enabled = false; | |
9 | var daemon_refresh_only = false; | |
10 | var _qfd_deleted_feed = 0; | |
11 | var firsttime_update = true; | |
12 | var last_refetch = 0; | |
13 | var cookie_lifetime = 0; | |
14 | var active_feed_id = 0; | |
15 | var active_feed_is_cat = false; | |
16 | var number_of_feeds = 0; | |
17 | var sanity_check_done = false; | |
18 | ||
19 | var xmlhttp = Ajax.getTransport(); | |
20 | var xmlhttp_ctr = Ajax.getTransport(); | |
21 | ||
22 | var init_params = new Object(); | |
23 | ||
24 | function tagsAreDisplayed() { | |
25 | return display_tags; | |
26 | } | |
27 | ||
28 | function toggleTags(show_all) { | |
29 | ||
30 | try { | |
31 | ||
32 | debug("toggleTags: " + show_all + "; " + display_tags); | |
33 | ||
34 | var p = document.getElementById("dispSwitchPrompt"); | |
35 | ||
36 | if (!show_all && !display_tags) { | |
37 | displayDlg("printTagCloud"); | |
38 | } else if (show_all) { | |
39 | closeInfoBox(); | |
40 | display_tags = true; | |
41 | p.innerHTML = __("display feeds"); | |
42 | notify_progress("Loading, please wait...", true); | |
43 | updateFeedList(); | |
44 | } else if (display_tags) { | |
45 | display_tags = false; | |
46 | p.innerHTML = __("tag cloud"); | |
47 | notify_progress("Loading, please wait...", true); | |
48 | updateFeedList(); | |
49 | } | |
50 | ||
51 | } catch (e) { | |
52 | exception_error("toggleTags", e); | |
53 | } | |
54 | } | |
55 | ||
56 | function dlg_frefresh_callback() { | |
57 | if (xmlhttp.readyState == 4) { | |
58 | // notify(xmlhttp.responseText); | |
59 | ||
60 | if (getActiveFeedId() == _qfd_deleted_feed) { | |
61 | var h = document.getElementById("headlines-frame"); | |
62 | if (h) { | |
63 | h.innerHTML = "<div class='whiteBox'>" + __('No feed selected.') + "</div>"; | |
64 | } | |
65 | } | |
66 | ||
67 | setTimeout('updateFeedList(false, false)', 50); | |
68 | closeInfoBox(); | |
69 | } | |
70 | } | |
71 | ||
72 | function refetch_callback() { | |
73 | if (xmlhttp_ctr.readyState == 4) { | |
74 | try { | |
75 | ||
76 | var date = new Date(); | |
77 | ||
78 | last_refetch = date.getTime() / 1000; | |
79 | ||
80 | parse_counters_reply(xmlhttp_ctr, true); | |
81 | ||
82 | debug("refetch_callback: done"); | |
83 | ||
84 | if (!daemon_enabled && !daemon_refresh_only) { | |
85 | notify_info("All feeds updated."); | |
86 | updateTitle(""); | |
87 | } else { | |
88 | //notify(""); | |
89 | } | |
90 | } catch (e) { | |
91 | exception_error("refetch_callback", e); | |
92 | updateTitle(""); | |
93 | } | |
94 | } | |
95 | } | |
96 | ||
97 | function backend_sanity_check_callback() { | |
98 | ||
99 | if (xmlhttp.readyState == 4) { | |
100 | ||
101 | try { | |
102 | ||
103 | if (sanity_check_done) { | |
104 | fatalError(11, "Sanity check request received twice. This can indicate "+ | |
105 | "presence of Firebug or some other disrupting extension. "+ | |
106 | "Please disable it and try again."); | |
107 | return; | |
108 | } | |
109 | ||
110 | if (!xmlhttp.responseXML) { | |
111 | fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText); | |
112 | return; | |
113 | } | |
114 | ||
115 | var reply = xmlhttp.responseXML.firstChild.firstChild; | |
116 | ||
117 | if (!reply) { | |
118 | fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText); | |
119 | return; | |
120 | } | |
121 | ||
122 | var error_code = reply.getAttribute("error-code"); | |
123 | ||
124 | if (error_code && error_code != 0) { | |
125 | return fatalError(error_code, reply.getAttribute("error-msg")); | |
126 | } | |
127 | ||
128 | debug("sanity check ok"); | |
129 | ||
130 | var params = reply.nextSibling; | |
131 | ||
132 | if (params) { | |
133 | debug('reading init-params...'); | |
134 | var param = params.firstChild; | |
135 | ||
136 | while (param) { | |
137 | var k = param.getAttribute("key"); | |
138 | var v = param.getAttribute("value"); | |
139 | debug(k + " => " + v); | |
140 | init_params[k] = v; | |
141 | param = param.nextSibling; | |
142 | } | |
143 | } | |
144 | ||
145 | sanity_check_done = true; | |
146 | ||
147 | init_second_stage(); | |
148 | ||
149 | } catch (e) { | |
150 | exception_error("backend_sanity_check_callback", e); | |
151 | } | |
152 | } | |
153 | } | |
154 | ||
155 | function scheduleFeedUpdate(force) { | |
156 | ||
157 | if (!daemon_enabled && !daemon_refresh_only) { | |
158 | notify_progress("Updating feeds, please wait.", true); | |
159 | updateTitle("Updating"); | |
160 | } | |
161 | ||
162 | var query_str = "backend.php?op=rpc&subop="; | |
163 | ||
164 | if (force) { | |
165 | query_str = query_str + "forceUpdateAllFeeds"; | |
166 | } else { | |
167 | query_str = query_str + "updateAllFeeds"; | |
168 | } | |
169 | ||
170 | var omode; | |
171 | ||
172 | if (firsttime_update && !navigator.userAgent.match("Opera")) { | |
173 | firsttime_update = false; | |
174 | omode = "T"; | |
175 | } else { | |
176 | if (display_tags) { | |
177 | omode = "tl"; | |
178 | } else { | |
179 | omode = "flc"; | |
180 | } | |
181 | } | |
182 | ||
183 | query_str = query_str + "&omode=" + omode; | |
184 | query_str = query_str + "&uctr=" + global_unread; | |
185 | ||
186 | debug("in scheduleFeedUpdate"); | |
187 | ||
188 | var date = new Date(); | |
189 | ||
190 | var timestamp = Math.round(date.getTime() / 1000); | |
191 | query_str = query_str + "&ts=" + timestamp | |
192 | ||
193 | if (!xmlhttp_ready(xmlhttp_ctr) && last_refetch < date.getTime() / 1000 - 60) { | |
194 | debug("<b>xmlhttp seems to be stuck, aborting</b>"); | |
195 | xmlhttp_ctr.abort(); | |
196 | if (is_safari()) { | |
197 | xmlhttp_ctr = Ajax.getTransport(); | |
198 | } | |
199 | } | |
200 | ||
201 | debug("REFETCH query: " + query_str); | |
202 | ||
203 | if (xmlhttp_ready(xmlhttp_ctr)) { | |
204 | xmlhttp_ctr.open("GET", query_str, true); | |
205 | xmlhttp_ctr.onreadystatechange=refetch_callback; | |
206 | xmlhttp_ctr.send(null); | |
207 | } else { | |
208 | debug("xmlhttp_ctr busy"); | |
209 | //printLockingError(); | |
210 | } | |
211 | } | |
212 | ||
213 | function updateFeedList(silent, fetch) { | |
214 | ||
215 | // if (silent != true) { | |
216 | // notify("Loading feed list..."); | |
217 | // } | |
218 | ||
219 | debug("<b>updateFeedList</b>"); | |
220 | ||
221 | var query_str = "backend.php?op=feeds"; | |
222 | ||
223 | if (display_tags) { | |
224 | query_str = query_str + "&tags=1"; | |
225 | } | |
226 | ||
227 | if (getActiveFeedId() && !activeFeedIsCat()) { | |
228 | query_str = query_str + "&actid=" + getActiveFeedId(); | |
229 | } | |
230 | ||
231 | var date = new Date(); | |
232 | var timestamp = Math.round(date.getTime() / 1000); | |
233 | query_str = query_str + "&ts=" + timestamp | |
234 | ||
235 | if (fetch) query_str = query_str + "&fetch=yes"; | |
236 | ||
237 | // var feeds_frame = document.getElementById("feeds-frame"); | |
238 | // feeds_frame.src = query_str; | |
239 | ||
240 | debug("updateFeedList Q=" + query_str); | |
241 | ||
242 | if (xmlhttp_ready(xmlhttp)) { | |
243 | xmlhttp.open("GET", query_str, true); | |
244 | xmlhttp.onreadystatechange=feedlist_callback; | |
245 | xmlhttp.send(null); | |
246 | } else { | |
247 | debug("xmlhttp busy"); | |
248 | //printLockingError(); | |
249 | } | |
250 | ||
251 | } | |
252 | ||
253 | function catchupAllFeeds() { | |
254 | ||
255 | var query_str = "backend.php?op=feeds&subop=catchupAll"; | |
256 | ||
257 | notify_progress("Marking all feeds as read..."); | |
258 | ||
259 | debug("catchupAllFeeds Q=" + query_str); | |
260 | ||
261 | if (xmlhttp_ready(xmlhttp)) { | |
262 | xmlhttp.open("GET", query_str, true); | |
263 | xmlhttp.onreadystatechange=feedlist_callback; | |
264 | xmlhttp.send(null); | |
265 | } else { | |
266 | debug("xmlhttp busy"); | |
267 | //printLockingError(); | |
268 | } | |
269 | ||
270 | global_unread = 0; | |
271 | updateTitle(""); | |
272 | ||
273 | } | |
274 | ||
275 | function viewCurrentFeed(subop) { | |
276 | ||
277 | // if (getActiveFeedId()) { | |
278 | if (getActiveFeedId() != undefined) { | |
279 | viewfeed(getActiveFeedId(), subop); | |
280 | } else { | |
281 | disableContainerChildren("headlinesToolbar", false, document); | |
282 | // viewfeed(-1, subop); // FIXME | |
283 | } | |
284 | return false; // block unneeded form submits | |
285 | } | |
286 | ||
287 | function viewfeed(feed, subop) { | |
288 | var f = window.frames["feeds-frame"]; | |
289 | f.viewfeed(feed, subop); | |
290 | } | |
291 | ||
292 | function timeout() { | |
293 | scheduleFeedUpdate(false); | |
294 | ||
295 | var refresh_time = getInitParam("feeds_frame_refresh"); | |
296 | ||
297 | if (!refresh_time) refresh_time = 600; | |
298 | ||
299 | setTimeout("timeout()", refresh_time*1000); | |
300 | } | |
301 | ||
302 | function resetSearch() { | |
303 | var searchbox = document.getElementById("searchbox") | |
304 | ||
305 | if (searchbox.value != "" && getActiveFeedId()) { | |
306 | searchbox.value = ""; | |
307 | viewfeed(getActiveFeedId(), ""); | |
308 | } | |
309 | } | |
310 | ||
311 | function searchCancel() { | |
312 | closeInfoBox(true); | |
313 | } | |
314 | ||
315 | function search() { | |
316 | closeInfoBox(); | |
317 | viewCurrentFeed(0, ""); | |
318 | } | |
319 | ||
320 | function localPiggieFunction(enable) { | |
321 | if (enable) { | |
322 | var query_str = "backend.php?op=feeds&subop=piggie"; | |
323 | ||
324 | if (xmlhttp_ready(xmlhttp)) { | |
325 | ||
326 | xmlhttp.open("GET", query_str, true); | |
327 | xmlhttp.onreadystatechange=feedlist_callback; | |
328 | xmlhttp.send(null); | |
329 | } | |
330 | } | |
331 | } | |
332 | ||
333 | // if argument is undefined, current subtitle is not updated | |
334 | // use blank string to clear subtitle | |
335 | function updateTitle(s) { | |
336 | var tmp = "Tiny Tiny RSS"; | |
337 | ||
338 | if (s != undefined) { | |
339 | current_subtitle = s; | |
340 | } | |
341 | ||
342 | if (global_unread > 0) { | |
343 | tmp = tmp + " (" + global_unread + ")"; | |
344 | } | |
345 | ||
346 | if (current_subtitle) { | |
347 | tmp = tmp + " - " + current_subtitle; | |
348 | } | |
349 | ||
350 | if (active_title_text.length > 0) { | |
351 | tmp = tmp + " > " + active_title_text; | |
352 | } | |
353 | ||
354 | document.title = tmp; | |
355 | } | |
356 | ||
357 | function genericSanityCheck() { | |
358 | ||
359 | if (!xmlhttp) fatalError(1); | |
360 | ||
361 | setCookie("ttrss_vf_test", "TEST"); | |
362 | ||
363 | if (getCookie("ttrss_vf_test") != "TEST") { | |
364 | fatalError(2); | |
365 | } | |
366 | ||
367 | return true; | |
368 | } | |
369 | ||
370 | function init() { | |
371 | ||
372 | try { | |
373 | ||
374 | // this whole shebang is based on http://www.birnamdesigns.com/misc/busted2.html | |
375 | ||
376 | if (arguments.callee.done) return; | |
377 | arguments.callee.done = true; | |
378 | ||
379 | disableContainerChildren("headlinesToolbar", true); | |
380 | ||
381 | Form.disable("main_toolbar_form"); | |
382 | ||
383 | if (!genericSanityCheck()) | |
384 | return; | |
385 | ||
386 | if (getURLParam('debug')) { | |
387 | document.getElementById('debug_output').style.display = 'block'; | |
388 | debug('debug mode activated'); | |
389 | } | |
390 | ||
391 | var params = "&ua=" + param_escape(navigator.userAgent); | |
392 | ||
393 | xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck" + params, true); | |
394 | xmlhttp.onreadystatechange=backend_sanity_check_callback; | |
395 | xmlhttp.send(null); | |
396 | ||
397 | } catch (e) { | |
398 | exception_error("init", e); | |
399 | } | |
400 | } | |
401 | ||
402 | function resize_headlines() { | |
403 | ||
404 | var h_frame = document.getElementById("headlines-frame"); | |
405 | var c_frame = document.getElementById("content-frame"); | |
406 | var f_frame = document.getElementById("footer"); | |
407 | ||
408 | if (!c_frame || !h_frame) return; | |
409 | ||
410 | debug("resize_headlines"); | |
411 | ||
412 | if (!is_msie()) { | |
413 | h_frame.style.height = 30 + "%"; | |
414 | c_frame.style.top = h_frame.offsetTop + h_frame.offsetHeight + 1 + "px"; | |
415 | h_frame.style.height = h_frame.offsetHeight + "px"; | |
416 | } else { | |
417 | h_frame.style.height = document.documentElement.clientHeight * 0.3 + "px"; | |
418 | c_frame.style.top = h_frame.offsetTop + h_frame.offsetHeight + 1 + "px"; | |
419 | ||
420 | var c_bottom = document.documentElement.clientHeight; | |
421 | ||
422 | if (f_frame) { | |
423 | c_bottom = f_frame.offsetTop; | |
424 | } | |
425 | ||
426 | c_frame.style.height = c_bottom - (h_frame.offsetTop + | |
427 | h_frame.offsetHeight + 1) + "px"; | |
428 | h_frame.style.height = h_frame.offsetHeight + "px"; | |
429 | ||
430 | } | |
431 | } | |
432 | ||
433 | function init_second_stage() { | |
434 | ||
435 | try { | |
436 | ||
437 | cookie_lifetime = getCookie("ttrss_cltime"); | |
438 | ||
439 | delCookie("ttrss_vf_test"); | |
440 | ||
441 | // document.onresize = resize_headlines; | |
442 | resize_headlines(); | |
443 | ||
444 | var toolbar = document.forms["main_toolbar_form"]; | |
445 | ||
446 | dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode")); | |
447 | dropboxSelect(toolbar.limit, getInitParam("default_view_limit")); | |
448 | ||
449 | daemon_enabled = getInitParam("daemon_enabled") == 1; | |
450 | daemon_refresh_only = getInitParam("daemon_refresh_only") == 1; | |
451 | ||
452 | setTimeout('updateFeedList(false, false)', 50); | |
453 | ||
454 | debug("second stage ok"); | |
455 | ||
456 | } catch (e) { | |
457 | exception_error("init_second_stage", e); | |
458 | } | |
459 | } | |
460 | ||
461 | function quickMenuChange() { | |
462 | var chooser = document.getElementById("quickMenuChooser"); | |
463 | var opid = chooser[chooser.selectedIndex].value; | |
464 | ||
465 | chooser.selectedIndex = 0; | |
466 | quickMenuGo(opid); | |
467 | } | |
468 | ||
469 | function quickMenuGo(opid) { | |
470 | try { | |
471 | ||
472 | if (opid == "qmcPrefs") { | |
473 | gotoPreferences(); | |
474 | } | |
475 | ||
476 | if (opid == "qmcSearch") { | |
477 | displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat()); | |
478 | return; | |
479 | } | |
480 | ||
481 | if (opid == "qmcAddFeed") { | |
482 | displayDlg("quickAddFeed"); | |
483 | return; | |
484 | } | |
485 | ||
486 | if (opid == "qmcEditFeed") { | |
487 | editFeedDlg(getActiveFeedId()); | |
488 | } | |
489 | ||
490 | if (opid == "qmcRemoveFeed") { | |
491 | var actid = getActiveFeedId(); | |
492 | ||
493 | if (activeFeedIsCat()) { | |
494 | alert("You can't unsubscribe from the category."); | |
495 | return; | |
496 | } | |
497 | ||
498 | if (!actid) { | |
499 | alert("Please select some feed first."); | |
500 | return; | |
501 | } | |
502 | ||
503 | var fn = getFeedName(actid); | |
504 | ||
505 | if (confirm("Unsubscribe from " + fn + "?")) { | |
506 | qfdDelete(actid); | |
507 | } | |
508 | ||
509 | return; | |
510 | } | |
511 | ||
512 | if (opid == "qmcUpdateFeeds") { | |
513 | scheduleFeedUpdate(true); | |
514 | return; | |
515 | } | |
516 | ||
517 | if (opid == "qmcCatchupAll") { | |
518 | catchupAllFeeds(); | |
519 | return; | |
520 | } | |
521 | ||
522 | if (opid == "qmcShowOnlyUnread") { | |
523 | toggleDispRead(); | |
524 | return; | |
525 | } | |
526 | ||
527 | if (opid == "qmcAddFilter") { | |
528 | displayDlg("quickAddFilter", getActiveFeedId()); | |
529 | } | |
530 | ||
531 | } catch (e) { | |
532 | exception_error("quickMenuGo", e); | |
533 | } | |
534 | } | |
535 | ||
536 | function qfdDelete(feed_id) { | |
537 | ||
538 | notify_progress("Removing feed..."); | |
539 | ||
540 | if (!xmlhttp_ready(xmlhttp)) { | |
541 | printLockingError(); | |
542 | return | |
543 | } | |
544 | ||
545 | _qfd_deleted_feed = feed_id; | |
546 | ||
547 | xmlhttp.open("GET", "backend.php?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id); | |
548 | xmlhttp.onreadystatechange=dlg_frefresh_callback; | |
549 | xmlhttp.send(null); | |
550 | ||
551 | return false; | |
552 | } | |
553 | ||
554 | ||
555 | function updateFeedTitle(t) { | |
556 | active_title_text = t; | |
557 | updateTitle(); | |
558 | } | |
559 | ||
560 | function toggleDispRead() { | |
561 | try { | |
562 | ||
563 | if (!xmlhttp_ready(xmlhttp)) { | |
564 | printLockingError(); | |
565 | return | |
566 | } | |
567 | ||
568 | var hide_read_feeds = (getInitParam("hide_read_feeds") == "1"); | |
569 | ||
570 | hide_read_feeds = !hide_read_feeds; | |
571 | ||
572 | debug("toggle_disp_read => " + hide_read_feeds); | |
573 | ||
574 | hideOrShowFeeds(getFeedsContext().document, hide_read_feeds); | |
575 | ||
576 | storeInitParam("hide_read_feeds", hide_read_feeds, true); | |
577 | ||
578 | /* var query = "backend.php?op=rpc&subop=setpref" + | |
579 | "&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds); | |
580 | ||
581 | new Ajax.Request(query); */ | |
582 | ||
583 | } catch (e) { | |
584 | exception_error("toggleDispRead", e); | |
585 | } | |
586 | } | |
587 | ||
588 | function parse_runtime_info(elem) { | |
589 | if (!elem) { | |
590 | debug("parse_runtime_info: elem is null, aborting"); | |
591 | return; | |
592 | } | |
593 | ||
594 | var param = elem.firstChild; | |
595 | ||
596 | debug("parse_runtime_info: " + param); | |
597 | ||
598 | while (param) { | |
599 | var k = param.getAttribute("key"); | |
600 | var v = param.getAttribute("value"); | |
601 | ||
602 | debug("RI: " + k + " => " + v); | |
603 | ||
604 | if (k == "new_version_available") { | |
605 | var icon = document.getElementById("newVersionIcon"); | |
606 | if (icon) { | |
607 | if (v == "1") { | |
608 | icon.style.display = "inline"; | |
609 | } else { | |
610 | icon.style.display = "none"; | |
611 | } | |
612 | } | |
613 | } | |
614 | ||
615 | var error_flag; | |
616 | ||
617 | if (k == "daemon_is_running" && v != 1) { | |
618 | notify_error("<span onclick=\"javascript:explainError(1)\">Update daemon is not running.</span>", true); | |
619 | error_flag = true; | |
620 | } | |
621 | ||
622 | if (k == "daemon_stamp_ok" && v != 1) { | |
623 | notify_error("<span onclick=\"javascript:explainError(3)\">Update daemon is not updating feeds.</span>", true); | |
624 | error_flag = true; | |
625 | } | |
626 | ||
627 | if (!error_flag) { | |
628 | notify(''); | |
629 | } | |
630 | ||
631 | /* var w = document.getElementById("noDaemonWarning"); | |
632 | ||
633 | if (w) { | |
634 | if (k == "daemon_is_running" && v != 1) { | |
635 | w.style.display = "block"; | |
636 | } else { | |
637 | w.style.display = "none"; | |
638 | } | |
639 | } */ | |
640 | param = param.nextSibling; | |
641 | } | |
642 | } | |
643 | ||
644 | function catchupCurrentFeed() { | |
645 | ||
646 | var fn = getFeedName(getActiveFeedId(), active_feed_is_cat); | |
647 | ||
648 | var str = "Mark all articles in " + fn + " as read?"; | |
649 | ||
650 | /* if (active_feed_is_cat) { | |
651 | str = "Mark all articles in this category as read?"; | |
652 | } */ | |
653 | ||
654 | if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { | |
655 | return viewCurrentFeed('MarkAllRead') | |
656 | } | |
657 | } | |
658 | ||
659 | function userSwitch() { | |
660 | var chooser = document.getElementById("userSwitch"); | |
661 | var user = chooser[chooser.selectedIndex].value; | |
662 | window.location = "tt-rss.php?swu=" + user; | |
663 | } | |
664 | ||
665 | function editFeedDlg(feed) { | |
666 | ||
667 | disableHotkeys(); | |
668 | ||
669 | if (!feed) { | |
670 | alert("Please select some feed first."); | |
671 | return; | |
672 | } | |
673 | ||
674 | if (feed <= 0 || activeFeedIsCat() || tagsAreDisplayed()) { | |
675 | alert("You can't edit this kind of feed."); | |
676 | return; | |
677 | } | |
678 | ||
679 | if (xmlhttp_ready(xmlhttp)) { | |
680 | xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" + | |
681 | param_escape(feed), true); | |
682 | xmlhttp.onreadystatechange=infobox_callback; | |
683 | xmlhttp.send(null); | |
684 | } else { | |
685 | printLockingError(); | |
686 | } | |
687 | } | |
688 | ||
689 | /* this functions duplicate those of prefs.js feed editor, with | |
690 | some differences because there is no feedlist */ | |
691 | ||
692 | function feedEditCancel() { | |
693 | closeInfoBox(); | |
694 | return false; | |
695 | } | |
696 | ||
697 | function feedEditSave() { | |
698 | ||
699 | try { | |
700 | ||
701 | if (!xmlhttp_ready(xmlhttp)) { | |
702 | printLockingError(); | |
703 | return | |
704 | } | |
705 | ||
706 | // FIXME: add parameter validation | |
707 | ||
708 | var query = Form.serialize("edit_feed_form"); | |
709 | ||
710 | notify_progress("Saving feed..."); | |
711 | ||
712 | xmlhttp.open("POST", "backend.php", true); | |
713 | xmlhttp.onreadystatechange=dlg_frefresh_callback; | |
714 | xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
715 | xmlhttp.send(query); | |
716 | ||
717 | closeInfoBox(); | |
718 | ||
719 | return false; | |
720 | ||
721 | } catch (e) { | |
722 | exception_error("feedEditSave (main)", e); | |
723 | } | |
724 | } | |
725 | ||
726 |