]> git.wh0rd.org - tt-rss.git/commitdiff
implement search in pref-filters
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 29 Jun 2012 09:11:39 +0000 (13:11 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 29 Jun 2012 09:11:39 +0000 (13:11 +0400)
classes/pref_filters.php
digest.php
index.php
js/prefs.js
mobile/login_form.php

index 78189fcb1154d0d9bc40994f90353ad2392d6939..c7aa54e2129b882df80fc691b88caf71edd09fd5 100644 (file)
@@ -105,6 +105,13 @@ class Pref_Filters extends Protected_Handler {
                $root['name'] = __('Filters');
                $root['items'] = array();
 
+               $search = $_SESSION["prefs_filter_search"];
+
+               if ($search) $search_qpart = " (LOWER(reg_exp) LIKE LOWER('%$search%')
+                       OR LOWER(ttrss_feeds.title) LIKE LOWER('%$search%')
+                       OR LOWER(COALESCE(ttrss_feed_categories.title, '".__('Uncategorized')."'))
+                               LIKE LOWER('%$search%') AND cat_filter = true) AND ";
+
                $result = db_query($this->link, "SELECT
                                ttrss_filters.id AS id,reg_exp,
                                ttrss_filter_types.name AS filter_type_name,
@@ -119,7 +126,7 @@ class Pref_Filters extends Protected_Handler {
                                filter_type,
                                ttrss_filter_actions.description AS action_description,
                                ttrss_feeds.title AS feed_title,
-                               ttrss_feed_categories.title AS cat_title,
+                               COALESCE(ttrss_feed_categories.title, '".__('Uncategorized')."') AS cat_title,
                                ttrss_filter_actions.name AS action_name,
                                ttrss_filters.action_param AS action_param
                        FROM
@@ -129,6 +136,7 @@ class Pref_Filters extends Protected_Handler {
                        WHERE
                                filter_type = ttrss_filter_types.id AND
                                ttrss_filter_actions.id = action_id AND
+                               $search_qpart
                                ttrss_filters.owner_uid = ".$_SESSION["uid"]."
                        ORDER by action_description, reg_exp");
 
@@ -580,6 +588,21 @@ class Pref_Filters extends Protected_Handler {
                print "<div id=\"pref-filter-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
                print "<div id=\"pref-filter-toolbar\" dojoType=\"dijit.Toolbar\">";
 
+               $filter_search = db_escape_string($_REQUEST["search"]);
+
+               if (array_key_exists("search", $_REQUEST)) {
+                       $_SESSION["prefs_filter_search"] = $filter_search;
+               } else {
+                       $filter_search = $_SESSION["prefs_filter_search"];
+               }
+
+               print "<div style='float : right; padding-right : 4px;'>
+                       <input dojoType=\"dijit.form.TextBox\" id=\"filter_search\" size=\"20\" type=\"search\"
+                               value=\"$filter_search\">
+                       <button dojoType=\"dijit.form.Button\" onclick=\"updateFilterList()\">".
+                               __('Search')."</button>
+                       </div>";
+
                print "<div dojoType=\"dijit.form.DropDownButton\">".
                                "<span>" . __('Select')."</span>";
                print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
index c5b3c34c69b8719ed7ac7d44b63c9e49dda8cd02..805e074886fbbbe23652d13c607e3a2db51e7366 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-       set_include_path(get_include_path() . PATH_SEPARATOR . 
+       set_include_path(get_include_path() . PATH_SEPARATOR .
                dirname(__FILE__) . "/include");
 
        require_once "functions.php";
                        <?php echo __('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b> |
        <?php } ?>
        <?php if (!SINGLE_USER_MODE) { ?>
-                       <a href="backend.php?op=logout"><?php echo __('Logout') ?></a>
+                       <a href="backend.php?op=logout"><?php echo __('Logout') ?></a> |
        <?php } ?>
+                       <a href='<?php echo get_self_url_prefix() ?>/index.php?mobile=false'>
+                       <?php echo __("Regular version") ?></a>
+
        </div>
 
        <span class="title">Tiny Tiny RSS</span>
index 1ecf1f9f57787b07d7f8bfc51e5833e67e3a40a9..53901ec6e2008657a220bd9b4ab2a110fb465f38 100644 (file)
--- a/index.php
+++ b/index.php
 
        $mobile = new Mobile_Detect();
 
-       if ($mobile->isMobile() && !$mobile->isTablet() && !$_REQUEST['mobile']) {
-               header('Location: mobile/index.php');
-               exit;
+       if (!$_REQUEST['mobile']) {
+               if ($mobile->isTablet()) {
+                       header('Location: digest.php');
+                       exit;
+               } else if ($mobile->isMobile()) {
+                       header('Location: mobile/index.php');
+                       exit;
+               }
        }
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
index e9ae891f474dfe732be728e314cd175b6280f9ab..2a2f359ebd47d232ba521a41a5c0c814c837d1f1 100644 (file)
@@ -824,8 +824,12 @@ function importData() {
 
 
 function updateFilterList() {
+       var user_search = $("filter_search");
+       var search = "";
+       if (user_search) { search = user_search.value; }
+
        new Ajax.Request("backend.php", {
-               parameters: "?op=pref-filters",
+               parameters: "?op=pref-filters&search=" + param_escape(search),
                onComplete: function(transport) {
                        dijit.byId('filterConfigTab').attr('content', transport.responseText);
                        notify("");
index 937c71f8aae602f81a32763a6bc839645b082b8f..21710c229d5e89c39bf4cfc2371e91f521a96a9e 100644 (file)
@@ -45,7 +45,10 @@ function do_login() {
                </div>
 
                </fieldset>
-       
+
+               <div align='center'><a target='_self' href='<?php echo get_self_url_prefix() ?>/index.php?mobile=false'>
+                       <?php echo __("Open regular version") ?></a>
+
        </form>
 
 </body>