]> git.wh0rd.org Git - tt-rss.git/commitdiff
new style labels (bump schema)
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 18 Jan 2009 08:28:42 +0000 (09:28 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 18 Jan 2009 08:28:42 +0000 (09:28 +0100)
17 files changed:
backend.php
config.php-dist
functions.js
functions.php
help/4.php
mobile/functions.php
modules/popup-dialog.php
modules/pref-filters.php
modules/pref-labels.php
prefs.js
prefs.php
sanity_check.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/versions/mysql/51.sql [new file with mode: 0644]
schema/versions/pgsql/51.sql [new file with mode: 0644]
viewfeed.js

index 3e6eea662f2bc46995d5e763e75fcb4a9db23697..3ce3f4b9030ac3df86c139829077f55586ded983 100644 (file)
                        }
                break; // rss
 
-               case "labelFromSearch":
-                       $search = db_escape_string($_GET["search"]);
-                       $search_mode = db_escape_string($_GET["smode"]);
-                       $match_on = db_escape_string($_GET["match"]);
-                       $is_cat = db_escape_string($_GET["is_cat"]);
-                       $title = db_escape_string($_GET["title"]);
-                       $feed = sprintf("%d", $_GET["feed"]);
-
-                       $label_qparts = array();
-
-                       $search_expr = getSearchSql($search, $match_on);
-
-                       if ($is_cat) {
-                               if ($feed != 0) {
-                                       $search_expr .= " AND ttrss_feeds.cat_id = $feed ";
-                               } else {
-                                       $search_expr .= " AND ttrss_feeds.cat_id IS NULL ";
-                               }
-                       } else {
-                               if ($search_mode == "all_feeds") {
-                                       // NOOP
-                               } else if ($search_mode == "this_cat") {
-
-                                       $tmp_result = db_query($link, "SELECT cat_id
-                                               FROM ttrss_feeds WHERE id = '$feed'");
-
-                                       $cat_id = db_fetch_result($tmp_result, 0, "cat_id");
-
-                                       if ($cat_id > 0) {
-                                               $search_expr .= " AND ttrss_feeds.cat_id = $cat_id ";
-                                       } else {
-                                               $search_expr .= " AND ttrss_feeds.cat_id IS NULL ";
-                                       }
-                               } else {
-                                       $search_expr .= " AND ttrss_feeds.id = $feed ";
-                               }
-
-                       }
-
-                       $search_expr = db_escape_string($search_expr);
-
-                       print $search_expr;
-
-                       if ($title) {
-                               $result = db_query($link,
-                                       "INSERT INTO ttrss_labels (sql_exp,description,owner_uid) 
-                                       VALUES ('$search_expr', '$title', '".$_SESSION["uid"]."')");
-                       }
-               break; // labelFromSearch
-
                case "getUnread":
                        $login = db_escape_string($_GET["login"]);
 
index 982bcb7aa4b69950061f4412586a923770c043c6..81d04d0b718cf6dd31bc2963cee404d081e43bb1 100644 (file)
@@ -43,9 +43,6 @@
        // some use-cases (if you have more than one tt-rss window open, for example)
        // so it is disabled by default.
 
-       define('GLOBAL_ENABLE_LABELS', false);
-       // Labels are a security risk, so this option can globally disable them for all users.
-
        define('MAIL_RESET_PASS', true);
        // Send mail to user on password reset
        
index 034e463d1933105e5cffdc06d9f916bb407f2759..cb38ff37d8f37b18be4de64a0ce8e40c3999463e 100644 (file)
@@ -1557,8 +1557,15 @@ function filterDlgCheckAction(sender) {
                }
 
                // if selected action supports parameters, enable params field
-               if (action == 4 || action == 6) {
+               if (action == 4 || action == 6 || action == 7) {
                        Element.show(action_param);
+                       if (action != 7) {
+                               Element.show(form.action_param);
+                               Element.hide(form.action_param_label);
+                       } else {
+                               Element.show(form.action_param_label);
+                               Element.hide(form.action_param);
+                       }
                } else {
                        Element.hide(action_param);
                }
index a47e0218ee15cb152eec249d52cb837d4ab5f79a..2a3472902a9c6c55f5a106ecd44e074617435929 100644 (file)
 
                                db_query($link, "COMMIT");
 
+                               if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
+                                       _debug("update_rss_feed: assigning labels...");
+                               }
+
+                               assign_article_to_labels($link, $entry_ref_id, $article_filters,
+                                       $owner_uid);
+
                                if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
                                        _debug("update_rss_feed: looking for enclosures...");
                                }
                return $score;
        }
 
+       function assign_article_to_labels($link, $id, $filters, $owner_uid) {
+               foreach ($filters as $f) {
+                       if ($f[0] == "label") {
+                               label_add_article($link, $id, $f[1], $owner_uid);
+                       };
+               }
+       }
 
        function printFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link,
                $rtl_content = false, $last_updated = false, $last_error = false) {
 
        function initialize_user($link, $uid) {
 
-               db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description) 
+/*             db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description) 
                        values ('$uid','unread = true', 'Unread articles')");
 
                db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description) 
-                       values ('$uid','last_read is null and unread = false', 'Updated articles')");
+                       values ('$uid','last_read is null and unread = false', 'Updated articles')"); */
 
                db_query($link, "insert into ttrss_feeds (owner_uid,title,feed_url)
                        values ('$uid', 'Tiny Tiny RSS: New Releases',
                        return getFeedUnread($link, -1) + getFeedUnread($link, -2) + getFeedUnread($link, -3);
                } else if ($cat == -2) {
 
-                       $rv = getLabelCounters($link, false, true);
+                       // FIXME: NEW_LABELS
+
+/*                     $rv = getLabelCounters($link, false, true);
                        $ctr = 0;
 
                        foreach (array_keys($rv) as $k) {
                                }
                        }
 
-                       return $ctr;
-               }
+                       return $ctr; */
+               } 
        }
 
        function getMaxAgeSubquery($days = COUNTERS_MAX_AGE) {
                return getFeedArticles($link, $feed, $is_cat, true, $_SESSION["uid"]);
        }
 
+       function getLabelUnread($link, $label_id, $owner_uid = false) {
+               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
+
+               $result = db_query($link, "
+                       SELECT SUM(unread) AS unread FROM 
+                               ttrss_user_entries, ttrss_labels2, ttrss_user_labels2 
+                       WHERE label_id = id AND article_id = ref_id AND 
+                               ttrss_labels2.owner_uid = '$owner_uid' AND id = '$label_id'");
+
+               if (db_num_rows($result) != 0) {
+                       return db_fetch_result($result, 0, "unread");
+               } else {
+                       return 0;
+               }
+       }
+
        function getFeedArticles($link, $feed, $is_cat = false, $unread_only = false,
                $owner_uid = false) {
 
 
                        $label_id = -$feed - 11;
 
-                       $result = db_query($link, "SELECT sql_exp FROM ttrss_labels WHERE
-                               id = '$label_id' AND owner_uid = " . $owner_uid);
+                       return getLabelUnread($link, $label_id, $owner_uid);
 
-                       $match_part = db_fetch_result($result, 0, "sql_exp");
                }
 
                if ($match_part) {
                }
 
                $ret_arr = array();
-               
-               $old_counters = $_SESSION["lctr_last_value"];
-               $lctrs_modified = false;
-
-               $count = getFeedUnread($link, -1);
-
-               if (!$ret_mode) {
 
-                       if (get_pref($link, 'EXTENDED_FEEDLIST')) {
-                               $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
-                       } else {
-                               $xmsg_part = "";
-                       }
+               for ($i = -1; $i >= -3; $i--) {
 
-                       print "<counter type=\"label\" id=\"-1\" counter=\"$count\" $xmsg_part/>";
-               } else {
-                       $ret_arr["-1"]["counter"] = $count;
-                       $ret_arr["-1"]["description"] = __("Starred articles");
-               }
-
-               $count = getFeedUnread($link, -2);
-
-               if (!$ret_mode) {
+                       $count = getFeedUnread($link, $i);
+       
+                       if (!$ret_mode) {
+       
+                               if (get_pref($link, 'EXTENDED_FEEDLIST')) {
+                                       $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $i) . " total)\"";
+                               } else {
+                                       $xmsg_part = "";
+                               }
 
-                       if (get_pref($link, 'EXTENDED_FEEDLIST')) {
-                               $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
+                               print "<counter type=\"label\" id=\"$i\" counter=\"$count\" $xmsg_part/>";
                        } else {
-                               $xmsg_part = "";
+                               $ret_arr[$i]["counter"] = $count;
+                               $ret_arr[$i]["description"] = getFeedTitle($link, $i);
                        }
-
-                       print "<counter type=\"label\" id=\"-2\" counter=\"$count\" $xmsg_part/>";
-               } else {
-                       $ret_arr["-2"]["counter"] = $count;
-                       $ret_arr["-2"]["description"] = __("Published articles");
+       
                }
 
-               $count = getFeedUnread($link, -3);
-
-               if (!$ret_mode) {
-
-                       if (get_pref($link, 'EXTENDED_FEEDLIST')) {
-                               $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
-                       } else {
-                               $xmsg_part = "";
-                       }
+               $old_counters = $_SESSION["lctr_last_value"];
+               $lctrs_modified = false;
 
-                       print "<counter type=\"label\" id=\"-3\" counter=\"$count\" $xmsg_part/>";
-               } else {
-                       $ret_arr["-3"]["counter"] = $count;
-                       $ret_arr["-3"]["description"] = __("Fresh articles");
-               }
 
-               if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
+                       $owner_uid = $_SESSION["uid"];
 
-                       $result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM
-                               ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description");
+                       $result = db_query($link,
+                               "SELECT id, caption, SUM(unread) AS unread FROM ttrss_labels2 
+                                       LEFT JOIN ttrss_user_labels2 ON (label_id = id) 
+                                               LEFT JOIN ttrss_user_entries ON (ref_id = article_id)
+                                                       WHERE ttrss_labels2.owner_uid = '$owner_uid'
+                                       GROUP BY id");
                
                        while ($line = db_fetch_assoc($result)) {
        
                                $id = -$line["id"] - 11;
        
-                               $label_name = $line["description"];
-       
-                               error_reporting (0);
-       
-                               $tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_user_entries,ttrss_entries,ttrss_feeds
-                                       WHERE (" . $line["sql_exp"] . ") AND unread = true AND 
-                                       ttrss_feeds.hidden = false AND
-                                       $age_qpart AND
-                                       ttrss_user_entries.feed_id = ttrss_feeds.id AND
-                                       ttrss_user_entries.ref_id = ttrss_entries.id AND 
-                                       ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
-       
-                               $count = db_fetch_result($tmp_result, 0, "count");
-       
+                               $label_name = $line["caption"];
+                               $count = $line["unread"];
+               
                                if (!$smart_mode || $old_counters[$id] != $count) {     
                                        $old_counters[$id] = $count;
                                        $lctrs_modified = true;
        
                                error_reporting (DEFAULT_ERROR_LEVEL);
                        }
-               }
 
                if ($smart_mode && $lctrs_modified) {
                        $_SESSION["lctr_last_value"] = $old_counters;
                        return __("Fresh articles");
                } else if ($id < -10) {
                        $label_id = -$id - 11;
-                       $result = db_query($link, "SELECT description FROM ttrss_labels WHERE id = '$label_id'");
+                       $result = db_query($link, "SELECT caption FROM ttrss_labels2 WHERE id = '$label_id'");
                        if (db_num_rows($result) == 1) {
-                               return db_fetch_result($result, 0, "description");
+                               return db_fetch_result($result, 0, "caption");
                        } else {
                                return "Unknown label ($label_id)";
                        }
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                        } else if ($feed <= -10) { // labels
                                $label_id = -$feed - 11;
-       
-                               $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
-                                       WHERE id = '$label_id'");
-                       
-                               $query_strategy_part = "(" . db_fetch_result($tmp_result, 0, "sql_exp") . ")";
 
-                               if (!$query_strategy_part) {
-                                       return false;
-                               }
+                               $query_strategy_part = "label_id = '$label_id' AND
+                                       ttrss_labels2.id = ttrss_user_labels2.label_id AND
+                                       ttrss_user_labels2.article_id = ref_id";
 
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
+                               $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
                        } else {
                                $query_strategy_part = "id > 0"; // dumb
                        }
                                if ($search) {  $feed_title = __("Searched for") . " $search ($feed_title)"; }
                        } else if ($feed < -10) {
                                $label_id = -$feed - 11;
-                               $result = db_query($link, "SELECT description FROM ttrss_labels
+                               $result = db_query($link, "SELECT caption FROM ttrss_labels2
                                        WHERE id = '$label_id'");
-                               $feed_title = db_fetch_result($result, 0, "description");
+                               $feed_title = db_fetch_result($result, 0, "caption");
 
                                if ($search) {
                                        $feed_title = __("Searched for") . " $search ($feed_title)";
                                                ".SUBSTRING_FOR_DATE."(updated,1,19) as updated_noms,
                                                author,score
                                        FROM
-                                               ttrss_entries,ttrss_user_entries,ttrss_feeds
+                                               ttrss_entries,ttrss_user_entries,ttrss_feeds$ext_tables_part
                                        WHERE
                                        $group_limit_part
                                        ttrss_feeds.hidden = false AND 
 
                                print "<li><span class=\"insensitive\">--------</span></li>";
                                print "<li><span class=\"insensitive\">".__('Other actions:')."</span></li>";
-               
-
-                               if ($search && $feed_id >= 0 && get_pref($link, 'ENABLE_LABELS') && GLOBAL_ENABLE_LABELS) {
-                                       print "
-                                               <li onclick=\"javascript:labelFromSearch('$search', '$search_mode',
-                                                       '$match_on', '$feed_id', '$is_cat');\">&nbsp;&nbsp;
-                                                       ".__('Search to label')."</li>";
-                               } else {
-                                       print "<li><span class=\"insensitive\">&nbsp;&nbsp;".__('Search to label')."</li>";
-
-                               }
                                
                                print   "</ul></li></ul>";
                                print "</td>"; 
                                                        __('Mark as read:')."
                                                                <a href=\"#\" onclick=\"$catchup_page_link\">".__('Page')."</a>,
                                                                <a href=\"#\" onclick=\"$catchup_feed_link\">".__('Feed')."</a>";
-       
-                                       if ($search && $feed_id >= 0 && get_pref($link, 'ENABLE_LABELS') && GLOBAL_ENABLE_LABELS) {
-       
-                                               print "&nbsp;&nbsp;
-                                                               <a href=\"javascript:labelFromSearch('$search', '$search_mode',
-                                                                       '$match_on', '$feed_id', '$is_cat');\">
-                                                               ".__('Convert to label')."</a>";
-                                       }
-       
+
                                        print "</td>";  
        
                                }
 
                if (!$tags) {
 
-                       if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
-       
-                               $result = db_query($link, "SELECT id,sql_exp,description FROM
-                                       ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description");
+
+                               $result = db_query($link, "SELECT id,caption FROM                                       
+                                       ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
                
                                if (db_num_rows($result) > 0) {
                                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                
                                while ($line = db_fetch_assoc($result)) {
        
-                                       error_reporting (0);
-
                                        $label_id = -$line['id'] - 11;
                                        $count = getFeedUnread($link, $label_id);
 
                                        if ($count > 0) {
                                                $class .= "Unread";
                                        }
-                                       
-                                       error_reporting (DEFAULT_ERROR_LEVEL);
        
                                        printFeedEntry($label_id, 
-                                               $class, $line["description"], 
+                                               $class, $line["caption"], 
                                                $count, "images/label.png", $link);
                
                                }
                                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                                print "</ul>";
                                        }
-                               }
+                               } 
 
-                       }
 
                        if (!get_pref($link, 'ENABLE_FEED_CATS')) {
                                print "<li><hr></li>";
 
                return $unread;
        }
+
+       function label_find_id($link, $label, $owner_uid) {
+               $result = db_query($link, 
+                       "SELECT id FROM ttrss_labels2 WHERE caption = '$label' 
+                               AND owner_uid = '$owner_uid' LIMIT 1");
+
+               if (db_num_rows($result) == 1) {
+                       return db_fetch_result($result, 0, "id");
+               } else {
+                       return 0;
+               }
+       }
+
+       function label_add_article($link, $id, $label, $owner_uid) {
+
+               $label_id = label_find_id($link, $label, $owner_uid);
+
+               if (!$label_id) return;
+
+               $result = db_query($link, 
+                       "SELECT 
+                               article_id FROM ttrss_labels2, ttrss_user_labels2
+                       WHERE 
+                               label_id = id AND 
+                               label_id = '$label_id' AND
+                               article_id = '$id' AND owner_uid = '$owner_uid'
+                       LIMIT 1");
+
+               if (db_num_rows($result) == 0) {
+                       db_query($link, "INSERT INTO ttrss_user_labels2 
+                               (label_id, article_id) VALUES ('$label_id', '$id')");
+               }
+       }
 ?>
index fbf6c8f0aa5e66cbeddc279d6168e9f40af2c8d2..33879eb24e5c31cdea39e6294a1f00bd263bf7b5 100644 (file)
@@ -23,7 +23,7 @@
                <tr><td class='n'>c T</td><td><?php echo __("Top 25 feeds") ?></td></tr>
                <tr><td class='n'>c c</td><td><?php echo __("Edit feed categories") ?></td></tr>
                <tr><td class='n'>c f</td><td><?php echo __("Create filter") ?></td></tr>
-               <tr><td class='n'>c l</td><td><?php echo __("Create label") ?></td></tr>
+               <!-- <tr><td class='n'>c l</td><td><?php echo __("Create label") ?></td></tr> -->
                <!-- <tr><td class='n'>c u</td><td><?php echo __("Create user") ?></td></tr> -->
        </table>
 
index a37bc02073f46182a363f34ad3adf789110065c3..db8e2947b199aac2b43f14b2b565f6624d017ce8 100644 (file)
                                print "</ul>";
                        }
 
-                       if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) {
        
-                               $result = db_query($link, "SELECT id,description FROM
-                                       ttrss_labels WHERE owner_uid = '$owner_uid' ORDER by description");
-               
+                               $result = db_query($link, "SELECT id,caption FROM                                       
+                                       ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
+
                                if (db_num_rows($result) > 0) {
                                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                                print "<li class=\"feedCat\">".__("Labels")."</li>";
@@ -81,8 +80,6 @@
                
                                while ($line = db_fetch_assoc($result)) {
        
-                                       error_reporting (0);
-               
                                        $count = getFeedUnread($link, -$line["id"]-11);
        
                                        $class = "label";
                                        if ($count > 0) {
                                                $class .= "Unread";
                                        }
-                                       
-                                       error_reporting (DEFAULT_ERROR_LEVEL);
-       
+                       
                                        printMobileFeedEntry(-$line["id"]-11, 
-                                               $class, $line["description"], $count, "../images/label.png", $link);
+                                               $class, $line["caption"], $count, "../images/label.png", $link);
                
                                }
 
                                        }
                                }
 
-                       }
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                $order_by_qpart = "category,title";
index fe8bf5e01ca6cce7b6a833de323a27ff02b0081e..30211d4d8254a74f71663106728e48f6f0abaa9a 100644 (file)
 
                }
 
-               if ($id == "quickAddLabel") {
+/*             if ($id == "quickAddLabel") {
                        print "<div id=\"infoBoxTitle\">".__('Create Label')."</div>";
                        print "<div class=\"infoBoxContents\">";
 
                                value=\"".__('Cancel')."\">";
 
                        return;
-               }
+               } */
 
                if ($id == "quickAddFilter") {
 
index d0b4c7fe0e8c5581d063cceac20d1ead4b8f7294..ca469d504ea40a54b3362c6476f16ac00c65fd73 100644 (file)
        
                        print "</select>";
 
-                       $param_hidden = ($action_id == 4 || $action_id == 6) ? "" : "display : none";
+                       $param_hidden = ($action_id == 4 || $action_id == 6 || $action_id == 7) ? "" : "display : none";
 
                        print "<span id=\"filter_dlg_param_box\" style=\"$param_hidden\">";
                        print " " . __("with parameters:") . " ";
-                       print "<input size=\"20\"
+
+                       $param_int_hidden = ($action_id != 7) ? "" : "display : none";
+
+                       print "<input size=\"20\" style=\"$param_int_hidden\"
                                        onkeypress=\"return filterCR(event, filterEditSave)\"           
                                        name=\"action_param\" value=\"$action_param\">";
+
+                       $param_int_hidden = ($action_id == 7) ? "" : "display : none";
+
+                       print_label_select($link, "action_param_label", $action_param, 
+                               $param_int_hidden);
+
                        print "</span>";
 
                        print "&nbsp;"; // tiny layout hack
                        $feed_id = db_escape_string($_GET["feed_id"]);
                        $action_id = db_escape_string($_GET["action_id"]); 
                        $action_param = db_escape_string($_GET["action_param"]); 
+                       $action_param_label = db_escape_string($_GET["action_param_label"]); 
                        $enabled = checkbox_to_sql_bool(db_escape_string($_GET["enabled"]));
                        $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"]));
 
                        } else {
                                $feed_id = sprintf("'%s'", db_escape_string($feed_id));
                        }
-                       
+
+                       /* When processing 'assign label' filters, action_param_label dropbox
+                        * overrides action_param */
+
+                       if ($action_id == 7) {
+                               $action_param = $action_param_label;
+                       }
+
                        $result = db_query($link, "UPDATE ttrss_filters SET 
                                        reg_exp = '$reg_exp', 
                                        feed_id = $feed_id,
 
                }
        }
+
+       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>";
+
+
+       }
 ?>
index e5455003428732efdd42c475105923ab855e538d..d9208c44497fd9b6314621f6ef8e88444964a3e1 100644 (file)
 <?php
-       // We need to accept raw SQL data in label queries, so not everything is escaped
-       // here, this is by design. If you don't like it, disable labels
-       // altogether with GLOBAL_ENABLE_LABELS = false
-
        function module_pref_labels($link) {
-               if (!GLOBAL_ENABLE_LABELS) { 
-
-                       print __("Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.");
-                       return; 
-               }
 
                $subop = $_GET["subop"];
 
-               if ($subop == "edit") {
-
-                       $label_id = db_escape_string($_GET["id"]);
-
-                       $result = db_query($link, "SELECT sql_exp,description   FROM ttrss_labels WHERE 
-                               owner_uid = ".$_SESSION["uid"]." AND id = '$label_id' ORDER by description");
-
-                       $line = db_fetch_assoc($result);
-
-                       $sql_exp = htmlspecialchars($line["sql_exp"]);
-                       $description = htmlspecialchars($line["description"]);
-
-                       print "<div id=\"infoBoxTitle\">Label Editor</div>";
-                       print "<div class=\"infoBoxContents\">";
-
-                       print "<form id=\"label_edit_form\" onsubmit='return false'>";
-
-                       print "<input type=\"hidden\" name=\"op\" value=\"pref-labels\">";
-                       print "<input type=\"hidden\" name=\"id\" value=\"$label_id\">";
-                       print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; 
-
-                       print "<div class=\"dlgSec\">".__("Caption")."</div>";
-
-                       print "<div class=\"dlgSecCont\">";
-
-                       print "<input onkeypress=\"return filterCR(event, labelEditSave)\"
-                                       onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
-                                       onchange=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
-                                        name=\"description\" size=\"30\" value=\"$description\">";
-                       print "</div>";
-
-                       print "<div class=\"dlgSec\">".__("Match SQL")."</div>";
-
-                       print "<div class=\"dlgSecCont\">";
-
-                       print "<textarea onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
-                               rows=\"6\" name=\"sql_exp\" class=\"labelSQL\" cols=\"50\">$sql_exp</textarea>";
+               if ($subop == "save") {
 
-                       print "<br/>";
+                       $id = db_escape_string($_REQUEST["id"]);
+                       $caption = trim(db_escape_string($_REQUEST["value"]));
 
-                       print_label_dlg_common_examples();
+                       db_query($link, "BEGIN");
 
-                       print "</div>";
+                       $result = db_query($link, "SELECT caption FROM ttrss_labels2
+                               WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]);
 
-                       print "</form>";
-
-                       print "<div style=\"display : none\" id=\"label_test_result\"></div>";
-
-                       print "<div class=\"dlgButtons\">";
-
-                       print "<div style='float : left'>";
-                       print "<input type=\"submit\" 
-                               class=\"button\" onclick=\"return displayHelpInfobox(1)\" 
-                               value=\"".__('Help')."\"> ";
-                       print "</div>";
-
-                       $is_disabled = (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE) ? "disabled" : "";
-
-                       print "<input $is_disabled type=\"submit\" onclick=\"return labelTest()\" value=\"Test\">
-                               ";
-
-                       print "<input type=\"submit\" 
-                               id=\"infobox_submit\"
-                               class=\"button\" onclick=\"return labelEditSave()\" 
-                               value=\"Save\"> ";
-
-                       print "<input class=\"button\"
-                               type=\"submit\" onclick=\"return labelEditCancel()\" 
-                               value=\"Cancel\">";
-
-                       print "</div>";
-
-                       return;
-               }
-
-               if ($subop == "test") {
-
-                       // no escaping here on purpose
-                       $expr = trim($_GET["expr"]);
-                       $descr = db_escape_string(trim($_GET["descr"]));
-
-                       $expr = str_replace(";", "", $expr);
-
-                       if (!$expr) {
-                               print "<p>".__("Error: SQL expression is blank.")."</p>";
-                               return;
-                       }
+                       if (db_num_rows($result) != 0) {
+                               $old_caption = db_fetch_result($result, 0, "caption");
 
-                       print "<div>";
+                               $result = db_query($link, "SELECT id FROM ttrss_labels2
+                                       WHERE caption = '$caption' AND owner_uid = ". $_SESSION["uid"]);
 
-                       error_reporting(0);
+                               if (db_num_rows($result) == 0) {
+                                       if ($caption) {
+                                               $result = db_query($link, "UPDATE ttrss_labels2 SET
+                                                       caption = '$caption' WHERE id = '$id' AND
+                                                       owner_uid = " . $_SESSION["uid"]);
 
+                                               /* Update filters that reference label being renamed */
 
-                       $result = db_query($link, 
-                               "SELECT count(ttrss_entries.id) AS num_matches
-                                       FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
-                                       WHERE ($expr) AND 
-                                               ttrss_user_entries.ref_id = ttrss_entries.id AND
-                                               ttrss_user_entries.feed_id = ttrss_feeds.id AND
-                                               ttrss_user_entries.owner_uid = " . $_SESSION["uid"], false);
+                                               db_query($link, "UPDATE ttrss_filters SET
+                                                       action_param = '$caption' WHERE action_param = '$old_caption'
+                                                       AND action_id = 7
+                                                       AND owner_uid = " . $_SESSION["uid"]);
 
-                       error_reporting (DEFAULT_ERROR_LEVEL);
-
-                       if (!$result) {
-                               print "<div class=\"labelTestError\">" . db_last_error($link) . "</div>";
-                               print "</div>";
-                               return;
-                       }
-
-                       $num_matches = db_fetch_result($result, 0, "num_matches");;
-                       
-                       if ($num_matches > 0) { 
-
-                               if ($num_matches > 10) {
-                                       $showing_msg = ", showing first 10";
-                               }
-
-                               print "<p>Query returned <b>$num_matches</b> matches$showing_msg:</p>";
-
-                               $result = db_query($link, 
-                                       "SELECT ttrss_entries.title, 
-                                               (SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title
-                                       FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
-                                                       WHERE ($expr) AND 
-                                                       ttrss_user_entries.ref_id = ttrss_entries.id
-                                                       AND ttrss_user_entries.feed_id = ttrss_feeds.id
-                                                       AND ttrss_user_entries.owner_uid = " . $_SESSION["uid"] . " 
-                                                       ORDER BY date_entered LIMIT 10", false);
-
-                               print "<ul class=\"labelTestResults\">";
-
-                               $row_class = "even";
-                               
-                               while ($line = db_fetch_assoc($result)) {
-                                       $row_class = toggleEvenOdd($row_class);
-                                       
-                                       print "<li class=\"$row_class\">".$line["title"].
-                                               " <span class=\"insensitive\">(".$line["feed_title"].")</span></li>";
+                                               print $caption;
+                                       }
+                               } else {
+                                       print $old_caption;
                                }
-                               print "</ul>";
-
-                       } else {
-                               print "<p>Query didn't return any matches.</p>";
                        }
 
-                       print "</div>";
+                       db_query($link, "COMMIT");
 
                        return;
                }
 
-               if ($subop == "editSave") {
-
-                       $sql_exp = db_escape_string(trim($_GET["sql_exp"]));
-                       $descr = db_escape_string(trim($_GET["description"]));
-                       $label_id = db_escape_string($_GET["id"]);
-
-                       $sql_exp = str_replace(";", "", $sql_exp);
-
-                       $result = db_query($link, "UPDATE ttrss_labels SET 
-                               sql_exp = '$sql_exp', 
-                               description = '$descr'
-                               WHERE id = '$label_id'");
-
-                       if (db_affected_rows($link, $result) != 0) {
-                               print_notice(T_sprintf("Saved label <b>%s</b>", htmlspecialchars($descr)));
-                       }
-
-               }
-
                if ($subop == "remove") {
 
-                       if (!WEB_DEMO_MODE) {
-
-                               $ids = split(",", db_escape_string($_GET["ids"]));
+                       $ids = split(",", db_escape_string($_GET["ids"]));
 
                                foreach ($ids as $id) {
-                                       db_query($link, "DELETE FROM ttrss_labels WHERE id = '$id'");
-                                       
-                               }
+                                       db_query($link, "DELETE FROM ttrss_labels2 WHERE id = '$id'
+                                               AND owner_uid = " . $_SESSION["uid"]);
                        }
                }
 
                if ($subop == "add") {
 
-                       $sql_exp = db_escape_string(trim($_GET["sql_exp"]));
-                       $description = db_escape_string($_GET["description"]);
+                       $caption = db_escape_string($_GET["caption"]);
 
-                       $sql_exp = str_replace(";", "", $sql_exp);
+                       if ($caption) {
 
-                       if (!$sql_exp || !$description) return;
+                               $result = db_query($link, "SELECT id FROM ttrss_labels2
+                                       WHERE caption = '$caption' AND owner_uid =  ". $_SESSION["uid"]);
 
-                       $result = db_query($link,
-                               "INSERT INTO ttrss_labels (sql_exp,description,owner_uid) 
-                               VALUES ('$sql_exp', '$description', '".$_SESSION["uid"]."')");
+                               if (db_num_rows($result) == 0) {
 
-                       if (db_affected_rows($link, $result) != 0) {
-                               print T_sprintf("Created label <b>%s</b>", htmlspecialchars($description));
+                                       $result = db_query($link,
+                                               "INSERT INTO ttrss_labels2 (caption,owner_uid) 
+                                               VALUES ('$caption', '".$_SESSION["uid"]."')");
+
+                                       if (db_affected_rows($link, $result) != 0) {
+                                               print T_sprintf("Created label <b>%s</b>", htmlspecialchars($caption));
+                                       }
+                               }
                        }
 
                        return;
                $sort = db_escape_string($_GET["sort"]);
 
                if (!$sort || $sort == "undefined") {
-                       $sort = "description";
+                       $sort = "caption";
                }
 
                $label_search = db_escape_string($_GET["search"]);
                                onchange=\"javascript:updateLabelList()\" value=\"$label_search\">
                        <input type=\"submit\" class=\"button\" 
                                onclick=\"javascript:updateLabelList()\" value=\"".__('Search')."\">
-                       <p><a class='helpLinkPic' href=\"javascript:displayHelpInfobox(1)\">
-                       <img src='images/sign_quest.gif'></a></p>
                        </div>";
 
                print "<div class=\"prefGenericAddBox\">";
 
                print"<input type=\"submit\" class=\"button\" 
                        id=\"label_create_btn\"
-                       onclick=\"return displayDlg('quickAddLabel', false)\" 
+                       onclick=\"return addLabel()\" 
                        value=\"".__('Create label')."\"></div>";
 
                if ($label_search) {
-                       $label_search_query = "(sql_exp LIKE '%$label_search%' OR 
-                               description LIKE '%$label_search%') AND";
+                       $label_search_query = "caption LIKE '%$label_search%' AND";
                } else {
                        $label_search_query = "";
                }
 
                $result = db_query($link, "SELECT 
-                               id,sql_exp,description
+                               id,caption
                        FROM 
-                               ttrss_labels 
+                               ttrss_labels2
                        WHERE 
                                $label_search_query
                                owner_uid = ".$_SESSION["uid"]."
 
                        print "<tr class=\"title\">
                                                <td width=\"5%\">&nbsp;</td>
-                                               <td width=\"30%\"><a href=\"javascript:updateLabelList('description')\">".__('Caption')."</a></td>
-                                               <td width=\"\"><a href=\"javascript:updateLabelList('sql_exp')\">".__('SQL Expression')."</a>
+                                               <td width=\"95%\"><a href=\"javascript:updateLabelList('description')\">".__('Caption')."</a></td>
                                                </td>
                                                </tr>";
                        
                                $class = ($lnum % 2) ? "even" : "odd";
        
                                $label_id = $line["id"];
-                               $edit_label_id = $_GET["id"];
-       
-                               if ($subop == "edit" && $label_id != $edit_label_id) {
-                                       $class .= "Grayed";
-                                       $this_row_id = "";
-                               } else {
-                                       $this_row_id = "id=\"LILRR-$label_id\"";
-                               }
-       
+                               $this_row_id = "id=\"LILRR-$label_id\"";
+
                                print "<tr class=\"$class\" $this_row_id>";
        
-                               $line["sql_exp"] = htmlspecialchars($line["sql_exp"]);
-                               $line["description"] = htmlspecialchars($line["description"]);
+                               $line["caption"] = htmlspecialchars($line["caption"]);
        
-                               if (!$line["description"]) $line["description"] = __("[No caption]");
-
-                               $onclick = "onclick='editLabel($label_id)' title='".__('Click to edit')."'";
-       
-                               print "<td align='center'><input onclick='toggleSelectPrefRow(this, \"label\");' 
+                               print "<td align='center'><input 
+                                       onclick='toggleSelectPrefRow(this, \"label\");' 
                                        type=\"checkbox\" id=\"LICHK-".$line["id"]."\"></td>";
        
-                               print "<td $onclick>" . $line["description"] . "</td>";                 
-                               print "<td $onclick>" . $line["sql_exp"] . "</td>";             
+                               print "<td><span id=\"LILT-".$line["id"]."\">" . $line["caption"] . 
+                                       "</span></td>";
 
                                print "</tr>";
        
                        print "</table>";
        
                        print "<p id=\"labelOpToolbar\">";
-       
                        print "<input type=\"submit\" class=\"button\" disabled=\"true\"
-                                       onclick=\"javascript:editSelectedLabel()\" value=\"".__('Edit')."\">
-                               <input type=\"submit\" class=\"button\" disabled=\"true\"
                                onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
+                       print "</p>";
 
                } else {
                        print "<p>";
index 88ebc3ee3bed6c21dcc0e673519f3dffc1d4df1b..d78e3b9d77a3bbe251eda68df6a424c2fc238d2e 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -135,28 +135,36 @@ function filterlist_callback() {
 }
 
 function labellist_callback() {
-       var container = document.getElementById('prefContent');
-       if (xmlhttp.readyState == 4) {
-               closeInfoBox();
-               container.innerHTML=xmlhttp.responseText;
-               if (active_label) {
-                       var row = document.getElementById("LILRR-" + active_label);
-                       if (row) {
-                               if (!row.className.match("Selected")) {
-                                       row.className = row.className + "Selected";
-                               }               
+
+       try {
+
+               var container = document.getElementById('prefContent');
+               if (xmlhttp.readyState == 4) {
+                       closeInfoBox();
+                       container.innerHTML=xmlhttp.responseText;
+       
+                       if (document.getElementById("prefLabelList")) {
+                               var elems = document.getElementById("prefLabelList").getElementsByTagName("SPAN");
+
+                               for (var i = 0; i < elems.length; i++) {
+                                       if (elems[i].id && elems[i].id.match("LILT-")) {
+
+                                               var id = elems[i].id.replace("LILT-", "");
+                                                       new Ajax.InPlaceEditor(elems[i],
+                                                       'backend.php?op=pref-labels&subop=save&id=' + id);
+                                       }
+                               }
                        }
-                       var checkbox = document.getElementById("LICHK-" + active_label);
-                       
-                       if (checkbox) {
-                               checkbox.checked = true;
+       
+                       if (typeof correctPNG != 'undefined') {
+                               correctPNG();
                        }
+                       notify("");
+                       remove_splash();
                }
-               if (typeof correctPNG != 'undefined') {
-                       correctPNG();
-               }
-               notify("");
-               remove_splash();
+
+       } catch (e) {
+               exception_error("labellist_callback", e);
        }
 }
 
@@ -304,34 +312,32 @@ function updateUsersList(sort_key) {
 
 function addLabel() {
 
+       try {
+
        if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
 
-       var form = document.forms['label_edit_form'];
+       var caption = prompt(__("Please enter label caption:"), "");
 
-       var sql_exp = form.sql_exp.value;
-       var description = form.description.value;
-
-       if (sql_exp == "") {
-               alert(__("Can't create label: missing SQL expression."));
-               return false;
-       }
-
-       if (description == "") {
+       if (caption == "") {
                alert(__("Can't create label: missing caption."));
                return false;
        }
 
-       var query = Form.serialize("label_edit_form");
-
        // we can be called from some other tab
        active_tab = "labelConfig";
 
+       var query = "caption=" + param_escape(caption);
+
        xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);                     
        xmlhttp.onreadystatechange=infobox_submit_callback;
        xmlhttp.send(null);
+
+       } catch (e) {
+               exception_error("addLabel", e);
+       }
 }
 
 function addFeed() {
@@ -1834,10 +1840,10 @@ function pref_hotkey_handler(e) {
                                return false;
                        }
 
-                       if (keycode == 76) { // l
+/*                     if (keycode == 76) { // l
                                displayDlg("quickAddLabel");
                                return false;
-                       }
+                       } */
 
                        if (keycode == 85) { // u
                                // no-op
index 68beff4c2dbb3e0c9734ec3eca9dc00c65b9bf1e..72500d87a5544de01b9ff26de5a2034824c1e49b 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -140,10 +140,8 @@ window.onload = init;
                        onclick="selectTab('pubItems')"><?php echo __('Published Articles') ?></div> -->
                <div id="filterConfigTab" class="prefsTab" 
                        onclick="selectTab('filterConfig')"><?php echo __('Content Filtering') ?></div>
-               <?php if (get_pref($link, 'ENABLE_LABELS')) { ?>
                <div id="labelConfigTab" class="prefsTab" 
                        onclick="selectTab('labelConfig')"><?php echo __('Label Editor') ?></div>
-               <?php } ?>
                <?php if ($_SESSION["access_level"] >= 10) { ?>
                <div id="userConfigTab" class="prefsTab" 
                        onclick="selectTab('userConfig')"><?php echo __('User Manager') ?></div>
index 0ba47b064fb28772d3ef6fb696f2345ae476ced6..b9c8c333fc02e018e99ea4615e428bf909fe2168 100644 (file)
@@ -2,7 +2,7 @@
        require_once "functions.php";
 
        define('EXPECTED_CONFIG_VERSION', 17);
-       define('SCHEMA_VERSION', 50);
+       define('SCHEMA_VERSION', 51);
 
        if (!file_exists("config.php")) {
                print __("<b>Fatal Error</b>: You forgot to copy 
index 4d081db0f644eaa4e8fa91ca97bc2c186c729fe9..9bfb0a075f0bb457852316575d0c8e917b3ea90f 100644 (file)
@@ -189,6 +189,9 @@ insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
 insert into ttrss_filter_actions (id,name,description) values (6, 'score', 
        'Modify score');
 
+insert into ttrss_filter_actions (id,name,description) values (7, 'label', 
+       'Assign label');
+
 create table ttrss_filters (id integer not null primary key auto_increment,
        owner_uid integer not null, 
        feed_id integer default null,
@@ -232,7 +235,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) TYPE=InnoDB;
 
-insert into ttrss_version values (50);
+insert into ttrss_version values (51);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -389,4 +392,16 @@ create table ttrss_feedbrowser_cache (
        feed_url text not null,
        subscribers integer not null);  
 
+create table ttrss_labels2 (id integer not null primary key auto_increment, 
+       owner_uid integer not null,
+       caption varchar(250) not null,
+       foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
+) TYPE=InnoDB;
+
+create table ttrss_user_labels2 (label_id integer not null,
+       article_id integer not null,
+       foreign key (label_id) references ttrss_labels2(id) ON DELETE CASCADE,
+       foreign key (article_id) references ttrss_entries(id) ON DELETE CASCADE
+) TYPE=InnoDB;
+
 commit;
index 319e642114b68a72f466fe4696bdde95f01fc7a2..9778a044f860d2931a3b7513bb19e6f684434625 100644 (file)
@@ -1,3 +1,5 @@
+drop table ttrss_user_labels2;
+drop table ttrss_labels2;
 drop table ttrss_feedbrowser_cache;
 drop table ttrss_version;
 drop table ttrss_labels;
@@ -175,6 +177,9 @@ insert into ttrss_filter_actions (id,name,description) values (5, 'publish',
 insert into ttrss_filter_actions (id,name,description) values (6, 'score', 
        'Modify score');
 
+insert into ttrss_filter_actions (id,name,description) values (7, 'label', 
+       'Assign label');
+
 create table ttrss_filters (id serial not null primary key,    
        owner_uid integer not null references ttrss_users(id) on delete cascade,
        feed_id integer references ttrss_feeds(id) on delete cascade default null,
@@ -208,7 +213,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (50);
+insert into ttrss_version values (51);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -358,4 +363,14 @@ create table ttrss_feedbrowser_cache (
        feed_url text not null primary key,
        subscribers integer not null);  
 
+create table ttrss_labels2 (id serial not null primary key, 
+       owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
+       caption varchar(250) not null
+);
+
+create table ttrss_user_labels2 (
+       label_id integer not null references ttrss_labels2(id) ON DELETE CASCADE,
+       article_id integer not null references ttrss_entries(id) ON DELETE CASCADE
+);
+
 commit;
diff --git a/schema/versions/mysql/51.sql b/schema/versions/mysql/51.sql
new file mode 100644 (file)
index 0000000..46d0543
--- /dev/null
@@ -0,0 +1,16 @@
+create table ttrss_labels2 (id integer not null primary key auto_increment, 
+       owner_uid integer not null,
+       caption varchar(250) not null,
+       foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE
+) TYPE=InnoDB;
+
+create table ttrss_user_labels2 (label_id integer not null,
+       article_id integer not null,
+       foreign key (label_id) references ttrss_labels2(id) ON DELETE CASCADE,
+       foreign key (article_id) references ttrss_entries(id) ON DELETE CASCADE
+) TYPE=InnoDB;
+
+insert into ttrss_filter_actions (id,name,description) values (7, 'label', 
+       'Assign label');
+
+update ttrss_version set schema_version = 51;
diff --git a/schema/versions/pgsql/51.sql b/schema/versions/pgsql/51.sql
new file mode 100644 (file)
index 0000000..dd56607
--- /dev/null
@@ -0,0 +1,18 @@
+begin;
+
+create table ttrss_labels2 (id serial not null primary key, 
+       owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
+       caption varchar(250) not null
+);
+
+create table ttrss_user_labels2 (
+       label_id integer not null references ttrss_labels2(id) ON DELETE CASCADE,
+       article_id integer not null references ttrss_entries(id) ON DELETE CASCADE
+);
+
+insert into ttrss_filter_actions (id,name,description) values (7, 'label', 
+       'Assign label');
+
+update ttrss_version set schema_version = 51;
+
+commit;
index c7194ab1b1d1213a0df24d62bb3c2db2b717bde7..a93f886deb1024f6c41c7fbe449eca4a28bdab2f 100644 (file)
@@ -1159,31 +1159,6 @@ function catchupSelection() {
        }
 }
 
-
-function labelFromSearch(search, search_mode, match_on, feed_id, is_cat) {
-
-       if (!xmlhttp_ready(xmlhttp_rpc)) {
-               printLockingError();
-       }
-
-       var title = prompt(__("Please enter label title:"), "");
-
-       if (title) {
-
-               var query = "backend.php?op=labelFromSearch&search=" + param_escape(search) +
-                       "&smode=" + param_escape(search_mode) + "&match=" + param_escape(match_on) +
-                       "&feed=" + param_escape(feed_id) + "&is_cat=" + param_escape(is_cat) + 
-                       "&title=" + param_escape(title);
-
-               debug("LFS: " + query);
-
-               new Ajax.Request(query, {
-                       onComplete: function(transport) {
-                                       dlg_frefresh_callback(transport);
-                               } });
-       }
-}
-
 function editArticleTags(id, feed_id, cdm_enabled) {
        _tag_active_post_id = id;
        _tag_active_feed_id = feed_id;