]> git.wh0rd.org - tt-rss.git/blobdiff - prefs.js
display help_text in prefs editor
[tt-rss.git] / prefs.js
index 1b52776745406337f666267e10d01d39b1d5ab31..3e8b6b18102b0fc15f3b72e3dc14531788f4414f 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -9,6 +9,8 @@ var active_feed = false;
 var active_filter = false;
 var active_label = false;
 
+var active_tab = false;
+
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
 // JScript gives us Conditional compilation, we can cope with old IE versions.
@@ -29,10 +31,9 @@ if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 }
 
 function feedlist_callback() {
-       var container = document.getElementById('feedConfPane');
+       var container = document.getElementById('prefContent');
        if (xmlhttp.readyState == 4) {
                container.innerHTML=xmlhttp.responseText;
-
                if (active_feed) {
                        var row = document.getElementById("FEEDR-" + active_feed);
                        if (row) {
@@ -45,12 +46,14 @@ function feedlist_callback() {
                                checkbox.checked = true;
                        }
                }
+               p_notify("");
        }
 }
 
 function filterlist_callback() {
-       var container = document.getElementById('filterConfPane');
+       var container = document.getElementById('prefContent');
        if (xmlhttp.readyState == 4) {
+
                container.innerHTML=xmlhttp.responseText;
 
                if (active_filter) {
@@ -66,11 +69,12 @@ function filterlist_callback() {
                                checkbox.checked = true;
                        }
                }
+               p_notify("");
        }
 }
 
 function labellist_callback() {
-       var container = document.getElementById('labelConfPane');
+       var container = document.getElementById('prefContent');
        if (xmlhttp.readyState == 4) {
                container.innerHTML=xmlhttp.responseText;
 
@@ -87,8 +91,31 @@ function labellist_callback() {
                                checkbox.checked = true;
                        }
                }
+               p_notify("");
+       }
+}
+
+function prefslist_callback() {
+       var container = document.getElementById('prefContent');
+       if (xmlhttp.readyState == 4) {
+
+               container.innerHTML=xmlhttp.responseText;
+
+               p_notify("");
+       }
+}
+
+function gethelp_callback() {
+       var container = document.getElementById('prefHelpBox');
+       if (xmlhttp.readyState == 4) {
+
+               container.innerHTML = xmlhttp.responseText;
+               container.style.display = "block";
+
        }
 }
+
+
 function notify_callback() {
        var container = document.getElementById('notify');
        if (xmlhttp.readyState == 4) {
@@ -104,7 +131,9 @@ function updateFeedList() {
                return
        }
 
-       document.getElementById("feedConfPane").innerHTML = "Loading feeds, please wait...";
+//     document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
+
+       p_notify("Loading, please wait...");
 
        xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
        xmlhttp.onreadystatechange=feedlist_callback;
@@ -455,14 +484,19 @@ function feedEditSave() {
        var link = document.getElementById("iedit_link").value;
        var title = document.getElementById("iedit_title").value;
        var upd_intl = document.getElementById("iedit_updintl").value;
+       var purge_intl = document.getElementById("iedit_purgintl").value;
 
 //     notify("Saving feed.");
 
-       if (upd_intl < 0) {
+/*     if (upd_intl < 0) {
                notify("Update interval must be &gt;= 0 (0 = default)");
                return;
        }
 
+       if (purge_intl < 0) {
+               notify("Purge days must be &gt;= 0 (0 = default)");
+               return;
+       } */
 
        if (link.length == 0) {
                notify("Feed link cannot be blank.");
@@ -478,7 +512,7 @@ function feedEditSave() {
 
        xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
                feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
-               "&ui=" + param_escape(upd_intl), true);
+               "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl), true);
        xmlhttp.onreadystatechange=feedlist_callback;
        xmlhttp.send(null);
 
@@ -670,7 +704,9 @@ function updateFilterList() {
                return
        }
 
-       document.getElementById("filterConfPane").innerHTML = "Loading filters, please wait...";
+//     document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
+
+       p_notify("Loading, please wait...");
 
        xmlhttp.open("GET", "backend.php?op=pref-filters", true);
        xmlhttp.onreadystatechange=filterlist_callback;
@@ -685,28 +721,60 @@ function updateLabelList() {
                return
        }
 
-       document.getElementById("labelConfPane").innerHTML = "Loading labels, please wait...";
+       p_notify("Loading, please wait...");
+
+//     document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
 
        xmlhttp.open("GET", "backend.php?op=pref-labels", true);
        xmlhttp.onreadystatechange=labellist_callback;
        xmlhttp.send(null);
-
 }
 
+function updatePrefsList() {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       p_notify("Loading, please wait...");
 
-function expandPane(id) {
+       xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
+       xmlhttp.onreadystatechange=prefslist_callback;
+       xmlhttp.send(null);
 
-       var container;
+}
 
-       container = document.getElementById(id);
+function selectTab(id) {
 
-       if (id == "feedConfPane") {
+       if (id == "feedConfig") {
                updateFeedList();
-       } else if (id == "filterConfPane") {
+       } else if (id == "filterConfig") {
                updateFilterList();
-       } else if (id == "labelConfPane") {
+       } else if (id == "labelConfig") {
                updateLabelList();
+       } else if (id == "genConfig") {
+               updatePrefsList();
+       }
+
+       var tab = document.getElementById(active_tab + "Tab");
+
+       if (tab) {
+               if (tab.className.match("Selected")) {
+                       tab.className = "prefsTab";
+               }
        }
+
+       tab = document.getElementById(id + "Tab");
+
+       if (tab) {
+               if (!tab.className.match("Selected")) {
+                       tab.className = tab.className + "Selected";
+               }
+       }
+
+       active_tab = id;
+
 }
 
 function init() {
@@ -720,8 +788,33 @@ function init() {
                return;
        }
 
-//     updateFeedList();
+       selectTab("genConfig");
+
        document.onkeydown = hotkey_handler;
        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);
+
+} */
+