From 2cbdc95bb00faad46df8976cf9b33e1bc188ec91 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 08:42:39 +0400 Subject: [PATCH] add a separate tab for the logger --- classes/pref/prefs.php | 45 ------------------------ classes/pref/system.php | 78 +++++++++++++++++++++++++++++++++++++++++ js/prefs.js | 11 ++++++ prefs.php | 3 ++ 4 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 classes/pref/system.php diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index dcd83ae26..2f316b48b 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -725,51 +725,6 @@ class Pref_Prefs extends Handler_Protected { print ""; #pane - if ($_SESSION["access_level"] == 10) { - - print "
"; - print "

".__("Error Log")."

"; - - $result = db_query($this->link, "SELECT errno, errstr, filename, lineno, - created_at, login FROM ttrss_error_log - LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id) - ORDER BY ttrss_error_log.id DESC - LIMIT 100"); - - print "

"; - - print " - - - - - - "; - - while ($line = db_fetch_assoc($result)) { - print ""; - - foreach ($line as $k => $v) { - $line[$k] = htmlspecialchars($v); - } - - print ""; - print ""; - print ""; - print ""; - - print ""; - - print ""; - } - - print "
".__("Error")."".__("Filename")."".__("Message")."".__("User")."".__("Date")."
" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")" . $line["filename"] . ":" . $line["lineno"] . "" . $line["errstr"] . "" . - make_local_datetime($this->link, - $line["created_at"], false) . "
"; - - print "

"; - } - print "
"; print "

".__("Plugins")."

"; diff --git a/classes/pref/system.php b/classes/pref/system.php new file mode 100644 index 000000000..2957b7b96 --- /dev/null +++ b/classes/pref/system.php @@ -0,0 +1,78 @@ +"; + print "
"; + + $result = db_query($this->link, "SELECT errno, errstr, filename, lineno, + created_at, login FROM ttrss_error_log + LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id) + ORDER BY ttrss_error_log.id DESC + LIMIT 100"); + + print "

"; + + print " + + + + + + "; + + while ($line = db_fetch_assoc($result)) { + print ""; + + foreach ($line as $k => $v) { + $line[$k] = htmlspecialchars($v); + } + + print ""; + print ""; + print ""; + print ""; + + print ""; + + print ""; + } + + print "
".__("Error")."".__("Filename")."".__("Message")."".__("User")."".__("Date")."
" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")" . $line["filename"] . ":" . $line["lineno"] . "" . $line["errstr"] . "" . + make_local_datetime($this->link, + $line["created_at"], false) . "
"; + + print "

"; + + global $pluginhost; + $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB, + "hook_prefs_tab", "prefSystem"); + + print "
"; #container + } + +} +?> diff --git a/js/prefs.js b/js/prefs.js index b1decede5..8612b70fb 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -852,6 +852,15 @@ function updatePrefsList() { } }); } +function updateSystemList() { + new Ajax.Request("backend.php", { + parameters: "?op=pref-system", + onComplete: function(transport) { + dijit.byId('systemConfigTab').attr('content', transport.responseText); + notify(""); + } }); +} + function selectTab(id, noupdate, method) { try { if (!noupdate) { @@ -867,6 +876,8 @@ function selectTab(id, noupdate, method) { updatePrefsList(); } else if (id == "userConfig") { updateUsersList(); + } else if (id == "systemConfig") { + updateSystemList(); } var tab = dijit.byId(id + "Tab"); diff --git a/prefs.php b/prefs.php index 476ad2578..a047931c6 100644 --- a/prefs.php +++ b/prefs.php @@ -130,6 +130,9 @@
+
run_hooks($pluginhost::HOOK_PREFS_TABS,