]> git.wh0rd.org - tt-rss.git/commitdiff
unify create filter interface
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 18 May 2006 02:48:33 +0000 (03:48 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 18 May 2006 02:48:33 +0000 (03:48 +0100)
backend.php
functions.js
tt-rss.js
tt-rss.php

index 3a62fe68404ece76f6facffa2c846a76daf7e313..c9d86ee0b214655b169d7b7e54bca016a796ca91 100644 (file)
 
                if ($quiet) return;
 
+               print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
+
                $result = db_query($link, "SELECT description 
                        FROM ttrss_filter_types ORDER BY description");
 
                        array_push($filter_types, $line["description"]);
                }
 
-               print "<div class=\"prefGenericAddBox\">
+/*             print "<div class=\"prefGenericAddBox\">
                <input id=\"fadd_regexp\" size=\"40\">&nbsp;";
                
                print_select("fadd_match", "Title", $filter_types);     
                        class=\"button\" onclick=\"javascript:testFilter()\" 
                        value=\"Test filter\"> "; */
 
-               print "<input type=\"submit\" 
+/*             print "<input type=\"submit\" 
                        class=\"button\" onclick=\"javascript:addFilter()\" 
-                       value=\"Create filter\">";
+                       value=\"Create filter\">"; */
 
-               print "</div>";
+               print "<input type=\"submit\" 
+                       class=\"button\" 
+                       onclick=\"javascript:displayDlg('quickAddFilter', false)\" 
+                       value=\"Create filter\">"; 
+
+//             print "</div>";
 
                $result = db_query($link, "SELECT 
                                ttrss_filters.id AS id,reg_exp,
                $id = $_GET["id"];
                $param = $_GET["param"];
 
+               print "<div class=\"infoBoxContents\">";
+
                if ($id == "quickAddFeed") {
                        print "
                        Feed URL: <input 
 
                        print "</td></tr></table>";
                }
+
+               print "</div>";
+
        }
 
        // update feeds of all users, may be used anonymously
index 7e7b395fde5cdf5f701ccc03a32fa38e2f71e96e..5d010c6e3a15149273a32a05117e44277e7edc1f 100644 (file)
@@ -917,3 +917,83 @@ function center_element(e) {
                exception_error("center_element", e);
        }
 }
+
+function displayDlg(id, param) {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       notify("");
+
+       xmlhttp.open("GET", "backend.php?op=dlg&id=" +
+               param_escape(id) + "&param=" + param_escape(param), true);
+       xmlhttp.onreadystatechange=dlg_display_callback;
+       xmlhttp.send(null);
+
+       disableHotkeys();
+}
+
+function closeDlg() {
+       var dlg = document.getElementById("infoBoxShadow");
+       dlg.style.display = "none";
+       enableHotkeys();
+}
+
+function dlg_submit_callback() {
+       if (xmlhttp.readyState == 4) {
+               notify(xmlhttp.responseText);
+               closeDlg();
+
+               // called from prefs, reload tab
+               if (active_tab) {
+                       selectTab(active_tab, false);
+               }
+       } 
+}
+
+function dlg_display_callback() {
+       if (xmlhttp.readyState == 4) {
+               var dlg = document.getElementById("infoBox");
+               var dlg_s = document.getElementById("infoBoxShadow");
+
+               dlg.innerHTML = xmlhttp.responseText;
+               dlg_s.style.display = "block";
+       } 
+}
+
+function qaddFilter() {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       var regexp = document.getElementById("fadd_regexp");
+       var match = document.getElementById("fadd_match");
+       var feed = document.getElementById("fadd_feed");
+       var action = document.getElementById("fadd_action");
+
+       if (regexp.value.length == 0) {
+               notify("Missing filter expression.");
+       } else {
+               notify("Adding filter...");
+
+               var v_match = match[match.selectedIndex].text;
+               var feed_id = feed[feed.selectedIndex].id;
+               var action_id = action[action.selectedIndex].id;
+
+               xmlhttp.open("GET", "backend.php?op=pref-filters&quiet=1&subop=add&regexp=" +
+                       param_escape(regexp.value) + "&match=" + v_match +
+                       "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
+                       
+               xmlhttp.onreadystatechange=dlg_submit_callback;
+               xmlhttp.send(null);
+
+               regexp.value = "";
+       }
+
+}
+
+
index 81c1c40fee90c5b87cf9f54275a776d562bc6355..31ad8a96220a29d5b6142a8764af9b75a2c77c83 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -58,23 +58,6 @@ function dlg_frefresh_callback() {
        } 
 }
 
-function dlg_submit_callback() {
-       if (xmlhttp.readyState == 4) {
-               notify(xmlhttp.responseText);
-               closeDlg();
-       } 
-}
-
-function dlg_display_callback() {
-       if (xmlhttp.readyState == 4) {
-               var dlg = document.getElementById("userDlg");
-               var dlg_s = document.getElementById("userDlgShadow");
-
-               dlg.innerHTML = xmlhttp.responseText;
-               dlg_s.style.display = "block";
-       } 
-}
-
 function hide_unread_callback() {
        if (xmlhttp.readyState == 4) {
 
@@ -578,63 +561,6 @@ function qafAdd() {
        }
 }
 
-function qaddFilter() {
-
-       if (!xmlhttp_ready(xmlhttp)) {
-               printLockingError();
-               return
-       }
-
-       var regexp = document.getElementById("fadd_regexp");
-       var match = document.getElementById("fadd_match");
-       var feed = document.getElementById("fadd_feed");
-       var action = document.getElementById("fadd_action");
-
-       if (regexp.value.length == 0) {
-               notify("Missing filter expression.");
-       } else {
-               notify("Adding filter...");
-
-               var v_match = match[match.selectedIndex].text;
-               var feed_id = feed[feed.selectedIndex].id;
-               var action_id = action[action.selectedIndex].id;
-
-               xmlhttp.open("GET", "backend.php?op=pref-filters&quiet=1&subop=add&regexp=" +
-                       param_escape(regexp.value) + "&match=" + v_match +
-                       "&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
-                       
-               xmlhttp.onreadystatechange=dlg_submit_callback;
-               xmlhttp.send(null);
-
-               regexp.value = "";
-       }
-
-}
-
-
-function displayDlg(id, param) {
-
-       if (!xmlhttp_ready(xmlhttp)) {
-               printLockingError();
-               return
-       }
-
-       notify("");
-
-       xmlhttp.open("GET", "backend.php?op=dlg&id=" +
-               param_escape(id) + "&param=" + param_escape(param), true);
-       xmlhttp.onreadystatechange=dlg_display_callback;
-       xmlhttp.send(null);
-
-       disableHotkeys();
-}
-
-function closeDlg() {
-       var dlg = document.getElementById("userDlgShadow");
-       dlg.style.display = "none";
-       enableHotkeys();
-}
-
 function qfdDelete(feed_id) {
 
        notify("Removing feed...");
index 4828e2a4db1f153b6463050b75ee15c66e091327..ef8f6c45a6f1e4b265d50e493444d40037349784 100644 (file)
@@ -96,7 +96,7 @@ window.onload = init;
                                <div id="notify"><span id="notify_body">&nbsp;</span></div>
                        </td>
 
-                       <div id="userDlgShadow"><div id="userDlg">&nbsp;</div></div>
+                       <div id="infoBoxShadow"><div id="infoBox">&nbsp;</div></div>
 
                </tr><tr><td class="welcomePrompt">
                        <? if (!SINGLE_USER_MODE) { ?>
@@ -240,7 +240,7 @@ window.onload = init;
                                <option id="qmcShowOnlyUnread">&nbsp;&nbsp;Show only unread</option>
                                <option disabled>--------</option>
                                <option style="color : #5050aa" disabled>Other actions:</option>                                
-                               <option id="qmcAddFilter">&nbsp;&nbsp;Add filter</option>
+                               <option id="qmcAddFilter">&nbsp;&nbsp;Create filter</option>
                        </select>
                </td>
                </tr>