summaryrefslogtreecommitdiff
path: root/classes/pref
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref')
-rwxr-xr-xclasses/pref/feeds.php105
-rwxr-xr-xclasses/pref/filters.php18
-rw-r--r--classes/pref/labels.php10
-rw-r--r--classes/pref/prefs.php57
-rw-r--r--classes/pref/system.php6
-rw-r--r--classes/pref/users.php61
6 files changed, 124 insertions, 133 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index 43570c740..e0ee82fad 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -492,7 +492,7 @@ class Pref_Feeds extends Handler_Protected {
@unlink($icon_file);
print "<script type=\"text/javascript\">";
- print "parent.uploadIconHandler($rc);";
+ print "parent.CommonDialogs.uploadIconHandler($rc);";
print "</script>";
return;
}
@@ -745,9 +745,9 @@ class Pref_Feeds extends Handler_Protected {
<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
<input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
<input type=\"hidden\" name=\"method\" value=\"uploadicon\">
- <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
+ <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.uploadFeedIcon();\"
type=\"submit\">".__('Replace')."</button>
- <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
+ <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.removeFeedIcon($feed_id);\"
type=\"submit\">".__('Remove')."</button>
</form>";
@@ -765,7 +765,7 @@ class Pref_Feeds extends Handler_Protected {
print "<div class='dlgButtons'>
<div style=\"float : left\">
- <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
+ <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return CommonDialogs.unsubscribeFeed($feed_id, \"$title\")'>".
__('Unsubscribe')."</button>";
print "</div>";
@@ -1149,14 +1149,14 @@ class Pref_Feeds extends Handler_Protected {
if ($num_errors > 0) {
$error_button = "<button dojoType=\"dijit.form.Button\"
- onclick=\"showFeedsWithErrors()\" id=\"errorButton\">" .
+ onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" .
__("Feeds with errors") . "</button>";
}
$inactive_button = "<button dojoType=\"dijit.form.Button\"
id=\"pref_feeds_inactive_btn\"
style=\"display : none\"
- onclick=\"showInactiveFeeds()\">" .
+ onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" .
__("Inactive feeds") . "</button>";
$feed_search = clean($_REQUEST["search"]);
@@ -1174,7 +1174,7 @@ class Pref_Feeds extends Handler_Protected {
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"
value=\"$feed_search\">
- <button dojoType=\"dijit.form.Button\" onclick=\"updateFeedList()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedTree').reload()\">".
__('Search')."</button>
</div>";
@@ -1190,15 +1190,15 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Feeds')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"quickAddFeed()\"
+ print "<div onclick=\"CommonDialogs.quickAddFeed()\"
dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>";
- print "<div onclick=\"editSelectedFeed()\"
+ print "<div onclick=\"dijit.byId('feedTree').editSelectedFeed()\"
dojoType=\"dijit.MenuItem\">".__('Edit selected feeds')."</div>";
- print "<div onclick=\"resetFeedOrder()\"
+ print "<div onclick=\"dijit.byId('feedTree').resetFeedOrder()\"
dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
- print "<div onclick=\"batchSubscribe()\"
+ print "<div onclick=\"dijit.byId('feedTree').batchSubscribe()\"
dojoType=\"dijit.MenuItem\">".__('Batch subscribe')."</div>";
- print "<div dojoType=\"dijit.MenuItem\" onclick=\"removeSelectedFeeds()\">"
+ print "<div dojoType=\"dijit.MenuItem\" onclick=\"dijit.byId('feedTree').removeSelectedFeeds()\">"
.__('Unsubscribe')."</div> ";
print "</div></div>";
@@ -1206,11 +1206,11 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Categories')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"createCategory()\"
+ print "<div onclick=\"dijit.byId('feedTree').createCategory()\"
dojoType=\"dijit.MenuItem\">".__('Add category')."</div>";
- print "<div onclick=\"resetCatOrder()\"
+ print "<div onclick=\"dijit.byId('feedTree').resetCatOrder()\"
dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
- print "<div onclick=\"removeSelectedCategories()\"
+ print "<div onclick=\"dijit.byId('feedTree').removeSelectedCategories()\"
dojoType=\"dijit.MenuItem\">".__('Remove selected')."</div>";
print "</div></div>";
@@ -1247,15 +1247,15 @@ class Pref_Feeds extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FEED:')) {
- editFeed(bare_id);
+ CommonDialogs.editFeed(bare_id);
} else if (id.match('CAT:')) {
- editCat(bare_id, item);
+ dijit.byId('feedTree').editCategory(bare_id, item);
}
</script>
<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
Element.hide(\"feedlistLoading\");
- checkInactiveFeeds();
+ dijit.byId('feedTree').checkInactiveFeeds();
</script>
</div>";
@@ -1270,11 +1270,11 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('OPML')."\">";
- print "<p>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
- __("Only main settings profile can be migrated using OPML.") . "</p>";
+ print_notice(__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
+ __("Only main settings profile can be migrated using OPML."));
print "<iframe id=\"upload_iframe\"
- name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
+ name=\"upload_iframe\" onload=\"Helpers.OPML.onImportComplete(this)\"
style=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
@@ -1285,28 +1285,33 @@ class Pref_Feeds extends Handler_Protected {
</label>
<input type=\"hidden\" name=\"op\" value=\"dlg\">
<input type=\"hidden\" name=\"method\" value=\"importOpml\">
- <button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
- __('Import my OPML') . "</button>";
+ <button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.OPML.import();\" type=\"submit\">" .
+ __('Import OPML') . "</button>";
- print "<hr>";
+ print "</form>";
+
+ print "<p/>";
- $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
+ print "<form dojoType=\"dijit.form.Form\" id=\"opmlExportForm\">";
- print "<p>" . __('Filename:') .
- " <input class=\"input input-text\" type=\"text\" id=\"filename\" value=\"$opml_export_filename\" />&nbsp;" .
- __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"Helpers.OPML.export()\" >" .
+ __('Export OPML') . "</button>";
- print "</p><button dojoType=\"dijit.form.Button\"
- onclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" .
- __('Export OPML') . "</button></p></form>";
+ print "<label>";
+ print_checkbox("include_settings", true, "1", "");
+ print "&nbsp;" . __("Include settings");
+ print "</label>";
+
+ print "</form>";
print "<hr>";
- print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "</p>";
+ print_notice(__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'));
print_warning("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.");
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">".
__('Display published OPML URL')."</button> ";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
@@ -1323,10 +1328,10 @@ class Pref_Feeds extends Handler_Protected {
print "<p>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('".__("View as RSS")."','generatedFeed', '$rss_url')\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">".
__('Display URL')."</button> ";
- print "<button class=\"warning\" dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">".
+ print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Helpers.clearFeedAccessKeys()\">".
__('Clear all generated URLs')."</button> ";
print "</p>";
@@ -1412,9 +1417,9 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
+ print "<div onclick=\"Tables.select('prefInactiveFeedList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
+ print "<div onclick=\"Tables.select('prefInactiveFeedList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
print "</div>"; #toolbar
@@ -1428,20 +1433,17 @@ class Pref_Feeds extends Handler_Protected {
while ($line = $sth->fetch()) {
$feed_id = $line["id"];
- $this_row_id = "id=\"FUPDD-$feed_id\"";
- # class needed for selectTableRows()
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$feed_id'>";
- # id needed for selectTableRows()
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
+ onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
- "onclick=\"editFeed(".$line["id"].")\">".
+ "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>";
print "</td><td class=\"insensitive\" align='right'>";
@@ -1477,9 +1479,9 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
+ print "<div onclick=\"Tables.select('prefErrorFeedList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
+ print "<div onclick=\"Tables.select('prefErrorFeedList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
print "</div>"; #toolbar
@@ -1493,20 +1495,17 @@ class Pref_Feeds extends Handler_Protected {
while ($line = $sth->fetch()) {
$feed_id = $line["id"];
- $this_row_id = "id=\"FERDD-$feed_id\"";
- # class needed for selectTableRows()
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$feed_id'>";
- # id needed for selectTableRows()
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" id=\"FERDC-$feed_id\"></td>";
+ onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
- "onclick=\"editFeed(".$line["id"].")\">".
+ "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>: ";
print "<span class=\"insensitive\">";
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index e3503d545..8fe3bbda6 100755
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -429,7 +429,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
- print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
+ print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editRule(this)\">".$this->getRuleName($line)."</span>".
"<input type='hidden' name='rule[]' value=\"$data\"/></li>";
}
@@ -473,7 +473,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
- print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
+ print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editAction(this)\">".$this->getActionName($line)."</span>".
"<input type='hidden' name='action[]' value=\"$data\"/></li>";
}
@@ -797,20 +797,20 @@ class Pref_Filters extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Filters.quickAddFilter()\">".
__('Create filter')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return joinSelectedFilters()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').joinSelectedFilters()\">".
__('Combine')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return editSelectedFilter()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').editSelectedFilter()\">".
__('Edit')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return resetFilterOrder()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').resetFilterOrder()\">".
__('Reset sort order')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').removeSelectedFilters()\">".
__('Remove')."</button> ";
print "</div>"; # toolbar
@@ -840,7 +840,7 @@ class Pref_Filters extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FILTER:')) {
- editFilter(bare_id);
+ dijit.byId('filterTree').editFilter(bare_id);
}
</script>
@@ -1044,7 +1044,7 @@ class Pref_Filters extends Handler_Protected {
print "<div class=\"dlgSecCont\">";
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
- onchange=\"filterDlgCheckAction(this)\">";
+ onchange=\"Filters.filterDlgCheckAction(this)\">";
$res = $this->pdo->query("SELECT id,description FROM ttrss_filter_actions
ORDER BY name");
diff --git a/classes/pref/labels.php b/classes/pref/labels.php
index 1dbe3e18c..49118ab4a 100644
--- a/classes/pref/labels.php
+++ b/classes/pref/labels.php
@@ -275,13 +275,13 @@ class Pref_Labels extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print"<button dojoType=\"dijit.form.Button\" onclick=\"return addLabel()\">".
+ print"<button dojoType=\"dijit.form.Button\" onclick=\"CommonDialogs.addLabel()\">".
__('Create label')."</button dojoType=\"dijit.form.Button\"> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedLabels()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('labelTree').removeSelected()\">".
__('Remove')."</button dojoType=\"dijit.form.Button\"> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"labelColorReset()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('labelTree').resetColors()\">".
__('Clear colors')."</button dojoType=\"dijit.form.Button\">";
@@ -310,7 +310,7 @@ class Pref_Labels extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('LABEL:')) {
- editLabel(bare_id);
+ dijit.byId('labelTree').editLabel(bare_id);
}
</script>
</div>";
@@ -323,4 +323,4 @@ class Pref_Labels extends Handler_Protected {
print "</div>"; #container
}
-} \ No newline at end of file
+}
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 82456f342..41beabb9e 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -183,7 +183,7 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
@@ -249,12 +249,12 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Changing password...', true);
+ Notify.progress('Changing password...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR: ') == 0) {
$('pwd_change_infobox').innerHTML =
@@ -316,14 +316,14 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Disabling OTP', true);
+ Notify.progress('Disabling OTP', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR: ') == 0) {
- notify_error(transport.responseText.replace('ERROR: ', ''));
+ Notify.error(transport.responseText.replace('ERROR: ', ''));
} else {
window.location.reload();
}
@@ -367,14 +367,14 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR:') == 0) {
- notify_error(transport.responseText.replace('ERROR:', ''));
+ Notify.error(transport.responseText.replace('ERROR:', ''));
} else {
window.location.reload();
}
@@ -436,12 +436,12 @@ class Pref_Prefs extends Handler_Protected {
onComplete: function(transport) {
var msg = transport.responseText;
if (quit) {
- gotoMain();
+ document.location.href = 'index.php';
} else {
if (msg == 'PREFS_NEED_RELOAD') {
window.location.reload();
} else {
- notify_info(msg);
+ Notify.info(msg);
}
}
} });
@@ -542,7 +542,7 @@ class Pref_Prefs extends Handler_Protected {
} else if ($pref_name == "USER_STYLESHEET") {
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"customizeCSS()\">" . __('Customize') . "</button>";
+ onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>";
} else if ($pref_name == "USER_CSS_THEME") {
@@ -608,11 +608,11 @@ class Pref_Prefs extends Handler_Protected {
print "<br/>";
print " <button dojoType=\"dijit.form.Button\" disabled=\"$has_serial\"
- onclick=\"insertSSLserial('$cert_serial')\">" .
+ onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" .
__('Register') . "</button>";
print " <button dojoType=\"dijit.form.Button\"
- onclick=\"insertSSLserial('')\">" .
+ onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" .
__('Clear') . "</button>";
} else if ($pref_name == 'DIGEST_PREFERRED_TIME') {
@@ -659,10 +659,10 @@ class Pref_Prefs extends Handler_Protected {
</div>
</div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.editProfiles()\">".
__('Manage profiles')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" class=\"btn-danger\" onclick=\"return validatePrefsReset()\">".
+ print "<button dojoType=\"dijit.form.Button\" class=\"btn-danger\" onclick=\"return Helpers.confirmReset()\">".
__('Reset to defaults')."</button>";
print "&nbsp;";
@@ -689,12 +689,12 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (confirm(__('Selected plugins have been enabled. Reload?'))) {
window.location.reload();
}
@@ -756,7 +756,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled)) {
- print "<td><a href='#' onclick=\"clearPluginData('$name')\"
+ print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\"
class='visibleLink'>".__("Clear data")."</a></td>";
}
}
@@ -799,7 +799,7 @@ class Pref_Prefs extends Handler_Protected {
$plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
- print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='toggleSelectRow2(this);'
+ print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\" $checked $disabled
type=\"checkbox\"></td>";
@@ -816,7 +816,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
- print "<td><a href='#' onclick=\"clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
+ print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
}
}
@@ -992,9 +992,9 @@ class Pref_Prefs extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\"
+ print "<div onclick=\"Tables.select('prefFeedProfileList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\"
+ print "<div onclick=\"Tables.select('prefFeedProfileList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
@@ -1019,11 +1019,10 @@ class Pref_Prefs extends Handler_Protected {
print "<table width=\"100%\" class=\"prefFeedProfileList\"
cellspacing=\"0\" id=\"prefFeedProfileList\">";
- print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
+ print "<tr class=\"placeholder\">"; # data-row-id='0' <-- no point, shouldn't be removed
print "<td width='5%' align='center'><input
- id='FCATC-0'
- onclick='toggleSelectRow2(this);'
+ onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
@@ -1043,15 +1042,13 @@ class Pref_Prefs extends Handler_Protected {
while ($line = $sth->fetch()) {
$profile_id = $line["id"];
- $this_row_id = "id=\"FCATR-$profile_id\"";
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$profile_id'>";
$edit_title = htmlspecialchars($line["title"]);
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);'
- id='FCATC-$profile_id'
+ onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
diff --git a/classes/pref/system.php b/classes/pref/system.php
index 2099ebb9c..d60b419cf 100644
--- a/classes/pref/system.php
+++ b/classes/pref/system.php
@@ -26,7 +26,7 @@ class Pref_System extends Handler_Protected {
function index() {
print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
- print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Error Log')."\">";
+ print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Event Log')."\">";
if (LOG_DESTINATION == "sql") {
@@ -37,10 +37,10 @@ class Pref_System extends Handler_Protected {
LIMIT 100");
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"updateSystemList()\">".__('Refresh')."</button> ";
+ onclick=\"Helpers.updateEventLog()\">".__('Refresh')."</button> ";
print "&nbsp;<button dojoType=\"dijit.form.Button\"
- onclick=\"clearSqlLog()\">".__('Clear log')."</button> ";
+ class=\"btn-danger\" onclick=\"Helpers.clearEventLog()\">".__('Clear')."</button> ";
print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 1e6eae227..aeab28153 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -218,12 +218,13 @@ class Pref_Users extends Handler_Protected {
}
function add() {
-
$login = trim(clean($_REQUEST["login"]));
$tmp_user_pwd = make_password(8);
$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$pwd_hash = encrypt_password($tmp_user_pwd, $salt, true);
+ if (!$login) return; // no blank usernames
+
$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
login = ?");
$sth->execute([$login]);
@@ -243,18 +244,18 @@ class Pref_Users extends Handler_Protected {
$new_uid = $row['id'];
- print format_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>",
- $login, $tmp_user_pwd));
+ print T_sprintf("Added user %s with password %s",
+ $login, $tmp_user_pwd);
initialize_user($new_uid);
} else {
- print format_warning(T_sprintf("Could not create user <b>%s</b>", $login));
+ print T_sprintf("Could not create user %s", $login);
}
} else {
- print format_warning(T_sprintf("User <b>%s</b> already exists.", $login));
+ print T_sprintf("User %s already exists.", $login);
}
}
@@ -282,9 +283,9 @@ class Pref_Users extends Handler_Protected {
$sth->execute([$pwd_hash, $new_salt, $uid]);
if ($show_password) {
- print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
+ print T_sprintf("Changed password of user %s to %s", $login, $tmp_user_pwd);
} else {
- print_notice(T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email));
+ print_notice(T_sprintf("Sending new password of user %s to %s", $login, $email));
}
if ($email) {
@@ -341,7 +342,7 @@ class Pref_Users extends Handler_Protected {
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"user_search\" size=\"20\" type=\"search\"
value=\"$user_search\">
- <button dojoType=\"dijit.form.Button\" onclick=\"updateUsersList()\">".
+ <button dojoType=\"dijit.form.Button\" oncl1ick=\"Users.reload()\">".
__('Search')."</button>
</div>";
@@ -354,20 +355,20 @@ class Pref_Users extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefUserList', 'all')\"
+ print "<div onclick=\"Tables.select('prefUserList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefUserList', 'none')\"
+ print "<div onclick=\"Tables.select('prefUserList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"addUser()\">".__('Create user')."</button>";
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"Users.add()\">".__('Create user')."</button>";
print "
- <button dojoType=\"dijit.form.Button\" onclick=\"editSelectedUser()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.editSelected()\">".
__('Edit')."</button dojoType=\"dijit.form.Button\">
- <button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedUsers()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.removeSelected()\">".
__('Remove')."</button dojoType=\"dijit.form.Button\">
- <button dojoType=\"dijit.form.Button\" onclick=\"resetSelectedUserPass()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.resetSelected()\">".
__('Reset password')."</button dojoType=\"dijit.form.Button\">";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
@@ -400,11 +401,11 @@ class Pref_Users extends Handler_Protected {
print "<tr class=\"title\">
<td align='center' width=\"5%\">&nbsp;</td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('login')\">".__('Login')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('access_level')\">".__('Access Level')."</a></td>
- <td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Subscribed feeds')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('created')\">".__('Registered')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_login')\">".__('Last login')."</a></td></tr>";
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('login')\">".__('Login')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('access_level')\">".__('Access Level')."</a></td>
+ <td width='10%'><a href=\"#\" onclick=\"Users.reload('num_feeds')\">".__('Subscribed feeds')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('created')\">".__('Registered')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('last_login')\">".__('Last login')."</a></td></tr>";
$lnum = 0;
@@ -412,27 +413,21 @@ class Pref_Users extends Handler_Protected {
$uid = $line["id"];
- print "<tr id=\"UMRR-$uid\">";
+ print "<tr data-row-id=\"$uid\" onclick='Users.edit($uid)'>";
$line["login"] = htmlspecialchars($line["login"]);
-
$line["created"] = make_local_datetime($line["created"], false);
$line["last_login"] = make_local_datetime($line["last_login"], false);
- print "<td align='center'><input onclick='toggleSelectRow2(this);'
- dojoType=\"dijit.form.CheckBox\" type=\"checkbox\"
- id=\"UMCHK-$uid\"></td>";
-
- $onclick = "onclick='editUser($uid, event)' title='".__('Click to edit')."'";
-
- print "<td $onclick><img src='images/user.png' class='marked-pic' alt=''> " . $line["login"] . "</td>";
+ print "<td align='center'><input onclick='Tables.onRowChecked(this); event.stopPropagation();'
+ dojoType=\"dijit.form.CheckBox\" type=\"checkbox\"></td>";
- if (!$line["email"]) $line["email"] = "&nbsp;";
+ print "<td title='".__('Click to edit')."'><img src='images/user.png' class='marked-pic' alt=''> " . $line["login"] . "</td>";
- print "<td $onclick>" . $access_level_names[$line["access_level"]] . "</td>";
- print "<td $onclick>" . $line["num_feeds"] . "</td>";
- print "<td $onclick>" . $line["created"] . "</td>";
- print "<td $onclick>" . $line["last_login"] . "</td>";
+ print "<td>" . $access_level_names[$line["access_level"]] . "</td>";
+ print "<td>" . $line["num_feeds"] . "</td>";
+ print "<td>" . $line["created"] . "</td>";
+ print "<td>" . $line["last_login"] . "</td>";
print "</tr>";