From 27211afe92ab90a89d1879a31a8543cdf2b6aab6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 23 Aug 2012 20:23:19 +0400 Subject: implement experimental web-based updater --- js/prefs.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'js/prefs.js') diff --git a/js/prefs.js b/js/prefs.js index f7a68bf6d..10e33f701 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -2130,3 +2130,50 @@ function batchSubscribe() { } } +function updateSelf() { + try { + var query = "backend.php?op=pref-prefs&method=updateSelf"; + + if (dijit.byId("updateSelfDlg")) + dijit.byId("updateSelfDlg").destroyRecursive(); + + var dialog = new dijit.Dialog({ + id: "updateSelfDlg", + title: __("Update Tiny Tiny RSS"), + style: "width: 600px", + closable: false, + performUpdate: function() { + dijit.byId("self_update_start_btn").attr("disabled", true); + notify_progress("Loading, please wait...", true); + new Ajax.Request("backend.php", { + parameters: "?op=pref-prefs&method=performUpdate", + onComplete: function(transport) { + try { + notify(''); + $("self_update_log").innerHTML = transport.responseText; + dialog.attr("updated", true); + } catch (e) { + exception_error("updateSelf/inner", e); + } + } }); + }, + close: function() { + if (dialog.attr("updated")) { + window.location.reload(); + } else { + dialog.hide(); + } + }, + start: function() { + if (prompt(__("Live updating is considered experimental. Backup your tt-rss directory before continuing. Please type 'yes' to continue.")) == 'yes') { + dialog.performUpdate(); + } + }, + href: query}); + + dialog.show(); + } catch (e) { + exception_error("batchSubscribe", e); + } +} + -- cgit v1.2.3