pref helpers: move some methods to their own sections

master
Andrew Dolgov 4 years ago
parent 6af83e3881
commit 481bd76100

@ -1394,7 +1394,7 @@ class Pref_Feeds extends Handler_Protected {
print "<button dojoType='dijit.form.Button' class='alt-primary' print "<button dojoType='dijit.form.Button' class='alt-primary'
onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\", \"".__("Published articles")."\")'>". onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\", \"".__("Published articles")."\")'>".
__('Display URL')."</button> __('Display URL')."</button>
<button class='alt-danger' dojoType='dijit.form.Button' onclick='return Helpers.clearFeedAccessKeys()'>". <button class='alt-danger' dojoType='dijit.form.Button' onclick='return Helpers.Feeds.clearFeedAccessKeys()'>".
__('Clear all generated URLs')."</button> "; __('Clear all generated URLs')."</button> ";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated"); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated");

@ -715,7 +715,7 @@ class Pref_Prefs extends Handler_Protected {
print "</select>"; print "</select>";
print " <button dojoType=\"dijit.form.Button\" class='alt-info' print " <button dojoType=\"dijit.form.Button\" class='alt-info'
onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>"; onclick=\"Helpers.Prefs.customizeCSS()\">" . __('Customize') . "</button>";
print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'> print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'>
<i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>"; <i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>";
@ -830,10 +830,10 @@ class Pref_Prefs extends Handler_Protected {
</div> </div>
</div>"; </div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.editProfiles()\">". print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.Profiles.edit()\">".
__('Manage profiles')."</button> "; __('Manage profiles')."</button> ";
print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return Helpers.confirmReset()\">". print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return Helpers.Prefs.confirmReset()\">".
__('Reset to defaults')."</button>"; __('Reset to defaults')."</button>";
print "&nbsp;"; print "&nbsp;";
@ -968,7 +968,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) { if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) { if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
print " <button dojoType='dijit.form.Button' print " <button dojoType='dijit.form.Button'
onclick=\"Helpers.clearPluginData('$name')\"> onclick=\"Helpers.Prefs.clearPluginData('$name')\">
<i class='material-icons'>clear</i> ".__("Clear data")."</button>"; <i class='material-icons'>clear</i> ".__("Clear data")."</button>";
} }
} }

@ -40,6 +40,7 @@ const Helpers = {
} }
}, },
}, },
Feeds: {
clearFeedAccessKeys: function() { clearFeedAccessKeys: function() {
if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) { if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) {
Notify.progress("Clearing URLs..."); Notify.progress("Clearing URLs...");
@ -51,6 +52,7 @@ const Helpers = {
return false; return false;
}, },
},
System: { System: {
getPHPInfo: function(widget) { getPHPInfo: function(widget) {
xhrPost("backend.php", {op: 'pref-system', method: 'getphpinfo'}, (transport) => { xhrPost("backend.php", {op: 'pref-system', method: 'getphpinfo'}, (transport) => {
@ -90,7 +92,8 @@ const Helpers = {
} }
}, },
}, },
editProfiles: function() { Profiles: {
edit: function() {
const dialog = new fox.SingleUseDialog({ const dialog = new fox.SingleUseDialog({
id: "profileEditDlg", id: "profileEditDlg",
title: __("Settings Profiles"), title: __("Settings Profiles"),
@ -159,6 +162,8 @@ const Helpers = {
dialog.refresh(); dialog.refresh();
dialog.show(); dialog.show();
}, },
},
Prefs: {
customizeCSS: function() { customizeCSS: function() {
xhrJson("backend.php", {op: "pref-prefs", method: "customizeCSS"}, (reply) => { xhrJson("backend.php", {op: "pref-prefs", method: "customizeCSS"}, (reply) => {
@ -216,7 +221,7 @@ const Helpers = {
confirmReset: function() { confirmReset: function() {
if (confirm(__("Reset to defaults?"))) { if (confirm(__("Reset to defaults?"))) {
xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => { xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => {
Helpers.refresh(); Helpers.Prefs.refresh();
Notify.info(transport.responseText); Notify.info(transport.responseText);
}); });
} }
@ -226,7 +231,7 @@ const Helpers = {
Notify.progress("Loading, please wait..."); Notify.progress("Loading, please wait...");
xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => { xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => {
Helpers.refresh(); Helpers.Prefs.refresh();
}); });
} }
}, },
@ -236,6 +241,7 @@ const Helpers = {
Notify.close(); Notify.close();
}); });
}, },
},
OPML: { OPML: {
import: function() { import: function() {
const opml_file = $("opml_file"); const opml_file = $("opml_file");

Loading…
Cancel
Save