]> git.wh0rd.org - tt-rss.git/blobdiff - modules/pref-filters.php
js: misc fixes, code cleanup
[tt-rss.git] / modules / pref-filters.php
index 98fc16ecd1a6e0ed4286355b311e3fb9bc617bc3..d11d0eb7e007cbc81a9a02404bb95a28f5e3129f 100644 (file)
@@ -63,9 +63,8 @@
                                         name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">";
 
                        print "<span id=\"filter_dlg_date_chk_box\" $date_ops_invisible>";                      
-                       print "&nbsp;<input class=\"button\"
-                               type=\"submit\" onclick=\"return filterDlgCheckDate()\" 
-                               value=\"".__('Check it')."\">";
+                       print "&nbsp;<button onclick=\"return filterDlgCheckDate()\">".
+                               __('Check it')."</button>";
                        print "</span>";
 
                        print "<br/> " . __("on field") . " ";
 
                if ($subop == "editSave") {
 
+                       global $memcache;
+
+                       if ($memcache) $memcache->flush();
+
                        $reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
                        $filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
                        $filter_id = db_escape_string($_REQUEST["id"]);
                }
 
                if ($subop == "remove") {
+                       
+                       if ($memcache) $memcache->flush();
 
                        $ids = split(",", db_escape_string($_REQUEST["ids"]));
 
                }
 
                if ($subop == "add") {
-               
+
+                       if ($memcache) $memcache->flush();
+
                        $regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
                        $filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
                        $feed_id = db_escape_string($_REQUEST["feed_id"]);
                        <button onclick=\"javascript:updateFilterList()\">".__('Search')."</button>
                        &nbsp;
                        <a class='helpLinkPic' href=\"javascript:displayHelpInfobox(2)\">
-                       <img src='images/sign_quest.gif'></a>
+                       <img style='vertical-align : top;' src='".theme_image($link, "images/sign_quest.png")."'></a>
                </div>";
 
-               print "<button onclick=\"return displayDlg('quickAddFilter', false)\">".
+               print "<button onclick=\"return quickAddFilter()\">".
                        __('Create filter')."</button> "; 
 
                print "<button onclick=\"return editSelectedFilter()\">".
                print "<button onclick=\"return removeSelectedFilters()\">".
                        __('Remove')."</button> ";
 
-               print "<button onclick=\"rescore_all_feeds()\">".
-                       __('Rescore articles')."</button> "; 
+               if (defined('_ENABLE_FEED_DEBUGGING')) {
+                       print "<button onclick=\"rescore_all_feeds()\">".
+                               __('Rescore articles')."</button> "; 
+               }
 
                if ($filter_search) {
                        $filter_search = split(' ', db_escape_string($filter_search));
 
                        print "<tr><td class=\"selectPrompt\" colspan=\"8\">
                                ".__('Select:')." 
-                                       <a href=\"javascript:selectPrefRows('filter', true)\">".__('All')."</a>,
-                                       <a href=\"javascript:selectPrefRows('filter', false)\">".__('None')."</a>
+                                       <a href=\"#\" onclick=\"selectTableRows('prefFilterList', 'all')\">".__('All')."</a>,
+                                       <a href=\"#\" onclick=\"selectTableRows('prefFilterList', 'none')\">".__('None')."</a>
                                </td</tr>";
 
                        $lnum = 0;
 
                        while ($line = db_fetch_assoc($result)) {
        
-                               $class = ($lnum % 2) ? "even" : "odd";
-       
                                $filter_id = $line["id"];
                                $edit_filter_id = $_REQUEST["id"];
 
                                $enabled = sql_bool_to_bool($line["enabled"]);
                                $inverse = sql_bool_to_bool($line["inverse"]);
 
-                               if ($subop == "edit" && $filter_id != $edit_filter_id) {
-                                       $class .= "Grayed";
-                                       $this_row_id = "";
-                               } else {
-                                       $this_row_id = "id=\"FILRR-$filter_id\"";
-                               }
+                               $this_row_id = "id=\"FILRR-$filter_id\"";
 
                                $line["filter_type_descr"] = __($line["filter_type_descr"]);
                                $line["action_description"] = __($line["action_description"]);
 
                                        print "<tr class=\"title\">
                                                <td align='center' width=\"5%\">&nbsp;</td>
-                                               <td width=\"20%\"><a href=\"javascript:updateFilterList('reg_exp')\">".__('Match')."</a></td>
-                                               <td width=\"\"><a href=\"javascript:updateFilterList('feed_title')\">".__('Feed')."</a></td>
-                                               <td width=\"20%\"><a href=\"javascript:updateFilterList('filter_type')\">".__('Field')."</a></td>
-                                               <td width=\"20%\"><a href=\"javascript:updateFilterList('action_param')\">".__('Params')."</a></td>"; 
+                                               <td width=\"20%\"><a href=\"#\" onclick=\"updateFilterList('reg_exp')\">".__('Match')."</a></td>
+                                               <td width=\"\"><a href=\"#\" onclick=\"updateFilterList('feed_title')\">".__('Feed')."</a></td>
+                                               <td width=\"20%\"><a href=\"#\" onclick=\"updateFilterList('filter_type')\">".__('Field')."</a></td>
+                                               <td width=\"20%\"><a href=\"#\" onclick=\"updateFilterList('action_param')\">".__('Params')."</a></td>"; 
 
+                                       $lnum = 0;
                                }
 
+                               $class = ($lnum % 2) ? "even" : "odd";
+
                                print "<tr class=\"$class\" $this_row_id>";
        
                                $line["reg_exp"] = htmlspecialchars($line["reg_exp"]);
        
                                if (!$line["feed_title"]) $line["feed_title"] = __("All feeds");
 
+                               if (array_search($line["action_name"], 
+                                       array("score", "tag", "label")) === false) {
+
+                                               $line["action_param"] = false;
+                               }
+
                                if (!$line["action_param"]) {
                                        $line["action_param"] = "&mdash;";
                                } else if ($line["action_name"] == "score") {
 
-                                       $score_pic = get_score_pic($line["action_param"]);
+                                       $score_pic = theme_image($link,
+                                               "images/" . get_score_pic($line["action_param"]));
 
-                                       $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\">";
+                                       $score_pic = "<img class='hlScorePic' src=\"$score_pic\">";
 
                                        $line["action_param"] = "$score_pic " . $line["action_param"];
 
 
                                $line["feed_title"] = htmlspecialchars($line["feed_title"]);
 
-                               print "<td align='center'><input onclick='toggleSelectPrefRow(this, \"filter\");' 
+                               print "<td align='center'><input onclick='toggleSelectRow(this);' 
                                        type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>";
 
                                $filter_params = array(
                                                $line["action_param"] . "</span>";
                                }       
 
-                               $onclick = "onclick='editFilter($filter_id)' title='".__('Click to edit')."'";
+                               $onclick = "onclick='editFilter($filter_id, event)' title='".__('Click to edit')."'";
 
                                $inverse_label = "";
 
                }
        }
 
-       function print_label_select($link, $name, $value, $style = "") {
-
-               $result = db_query($link, "SELECT caption FROM ttrss_labels2
-                       WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
-
-               print "<select name=\"$name\" style=\"$style\">";
-
-               while ($line = db_fetch_assoc($result)) {
-
-                       $issel = ($line["caption"] == $value) ? "selected" : "";
-
-                       print "<option $issel>" . $line["caption"] . "</option>";
-
-               }
-
-               print "</select>";
-
-
-       }
 ?>