From b1895692268f3500b473b63d236e0fd1c427972f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 17 Nov 2005 08:10:31 +0100 Subject: [PATCH] display help_text in prefs editor --- backend.php | 25 ++++++++++++++++++++++--- prefs.js | 33 +++++++++++++++++++++++++++++++++ prefs.php | 3 ++- tt-rss.css | 8 ++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/backend.php b/backend.php index ed497f47..e413fbaf 100644 --- a/backend.php +++ b/backend.php @@ -1506,7 +1506,7 @@ if ($op == "pref-prefs") { - $subop = $_POST["subop"]; + $subop = $_REQUEST["subop"]; if ($subop == "Save configuration") { @@ -1546,6 +1546,20 @@ } + } else if ($subop == "getHelp") { + + $pref_name = db_escape_string($_GET["pn"]); + + $result = db_query($link, "SELECT help_text FROM ttrss_prefs + WHERE pref_name = '$pref_name'"); + + if (db_num_rows($result) > 0) { + $help_text = db_fetch_result($result, 0, "help_text"); + print $help_text; + } else { + print "Unknown option: $pref_name"; + } + } else if ($subop == "Reset to defaults") { db_query($link, "UPDATE ttrss_prefs SET value = def_value"); @@ -1589,12 +1603,17 @@ print ""; - print "" . $line["short_desc"] . ""; - $type_name = $line["type_name"]; $pref_name = $line["pref_name"]; $value = $line["value"]; $def_value = $line["def_value"]; + $help_text = $line["help_text"]; + + print "" . $line["short_desc"]; + + if ($help_text) print "
$help_text
"; + + print ""; print ""; diff --git a/prefs.js b/prefs.js index a7764758..3e8b6b18 100644 --- a/prefs.js +++ b/prefs.js @@ -105,6 +105,15 @@ function prefslist_callback() { } } +function gethelp_callback() { + var container = document.getElementById('prefHelpBox'); + if (xmlhttp.readyState == 4) { + + container.innerHTML = xmlhttp.responseText; + container.style.display = "block"; + + } +} function notify_callback() { @@ -785,3 +794,27 @@ function init() { notify(""); } + +/* +var help_topic_id = false; + +function do_dispOptionHelp() { + + if (!xmlhttp_ready(xmlhttp)) + return; + + xmlhttp.open("GET", "backend.php?op=pref-prefs&subop=getHelp&pn=" + + param_escape(help_topic_id), true); + xmlhttp.onreadystatechange=gethelp_callback; + xmlhttp.send(null); + +} + +function dispOptionHelp(event, sender) { + + help_topic_id = sender.id; + +// document.setTimeout("do_dispOptionHelp()", 100); + +} */ + diff --git a/prefs.php b/prefs.php index 6b1cefe6..a2e7ac31 100644 --- a/prefs.php +++ b/prefs.php @@ -4,6 +4,7 @@ + @@ -23,7 +24,7 @@ -
+
logo diff --git a/tt-rss.css b/tt-rss.css index 5c3251ab..69745405 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -526,3 +526,11 @@ div.bigErrorMsg { td.innerSplash { margin : 35px; } + +div.prefHelp, td.prefHelp { + font-size : x-small; + color : gray; + padding : 5px; +} + + -- 2.39.2