]> git.wh0rd.org - tt-rss.git/blobdiff - modules/pref-feeds.php
implement (incomplete) batch feed editor
[tt-rss.git] / modules / pref-feeds.php
index f0081a097d7aac83da2e067e096b5416a30f84aa..7a3695da7bf75661004b5d2a00ecf44d03f1d200 100644 (file)
@@ -1,9 +1,15 @@
 <?php
 
+       function batch_edit_cbox($elem, $label = false) {
+               print "<input type=\"checkbox\" 
+                       onchange=\"batchFeedsToggleField(this, '$elem', '$label')\">";
+       }
+
        function module_pref_feeds($link) {
 
                global $update_intervals;
                global $purge_intervals;
+               global $update_methods;
 
                $subop = $_REQUEST["subop"];
                $quiet = $_REQUEST["quiet"];
 
                        print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
 
-#                      $result = db_query($link, "SELECT feed_url,count(id) AS subscribers 
-#                              FROM ttrss_feeds 
-#                              WHERE auth_login = '' AND auth_pass = '' AND private = false
-#                              GROUP BY feed_url ORDER BY subscribers DESC LIMIT 25");
-
                        $owner_uid = $_SESSION["uid"];
 
                        $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers
                        }
 
                        if ($feedctr == 0) {
-                               print "<li>".__('No feeds found to subscribe.')."</li>";
+                               print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
+                               $subscribe_btn_disabled = "disabled";
+                       } else {
+                               $subscribe_btn_disabled = "";
                        }
 
                        print "</ul>";
 
                        print "<div align='center'>
                                <input type=\"submit\" class=\"button\" 
+                               $subscribe_btn_disabled
                                onclick=\"feedBrowserSubscribe()\" value=\"".__('Subscribe')."\">
                                <input type='submit' class='button'                     
                                onclick=\"closeInfoBox()\" value=\"".__('Cancel')."\"></div>";
                                $feed_icon = "";
                        }
 
-                       print "<div id=\"infoBoxTitle\">".__('Feed editor')."</div>";
+                       print "<div id=\"infoBoxTitle\">".__('Feed Editor')."</div>";
 
                        print "<div class=\"infoBoxContents\">";
 
                        print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
                        print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">";
 
-                       print "<table width='100%'>";
+                       print "<div class=\"dlgSec\">".__("Feed")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       /* Title */
+
+                       print "<input style=\"font-size : 16px\" size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                                           name=\"title\" value=\"$title\">";
 
-                       print "<tr><td>".__('Title:')."</td>";
-                       print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\"
-                               name=\"title\" value=\"$title\"></td></tr>";
+                       /* Feed URL */
 
                        $feed_url = db_fetch_result($result, 0, "feed_url");
                        $feed_url = htmlspecialchars(db_fetch_result($result,
                                0, "feed_url"));
-                               
-                       print "<tr><td>".__('Feed URL:')."</td>";
-                       print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\"
-                               name=\"feed_url\" value=\"$feed_url\"></td></tr>";
+
+                       print "<br/>";
+
+                       print __('URL:') . " ";
+                       print "<input size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                               name=\"feed_url\" value=\"$feed_url\">";
+
+                       /* Category */
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
 
                                $cat_id = db_fetch_result($result, 0, "cat_id");
 
-                               print "<tr><td>".__('Category:')."</td>";
-                               print "<td>";
+                               print "<br/>";
+
+                               print __('Place in category:') . " ";
 
                                $parent_feed = db_fetch_result($result, 0, "parent_feed");
 
                                        $disabled = "";
                                }
 
-                               print_feed_cat_select($link, "cat_id", $cat_id, "class=\"iedit\" $disabled");
-
-                               print "</td>";
-                               print "</td></tr>";
-       
+                               print_feed_cat_select($link, "cat_id", $cat_id, $disabled);
                        }
 
-                       $update_interval = db_fetch_result($result, 0, "update_interval");
-
-                       print "<tr><td>".__('Update Interval:')."</td>";
+                       /* Link to */
 
-                       print "<td>";
+                       print "<br/>";
 
-                       print_select_hash("update_interval", $update_interval, $update_intervals,
-                               "class=\"iedit\"");
-
-                       print "</td>";
-
-                       print "<tr><td>".__('Link to:')."</td><td>";
+                       print __('Link to feed:') . " ";
 
                        $tmp_result = db_query($link, "SELECT COUNT(id) AS count
                                FROM ttrss_feeds WHERE parent_feed = '$feed_id'");
                                $disabled = "";
                        }
 
-                       print "<select class=\"iedit\" $disabled name=\"parent_feed\">";
+                       print "<select $disabled name=\"parent_feed\">";
                        
                        print "<option value=\"0\">".__('Not linked')."</option>";
 
                                }
 
                        print "</select>";
-                       print "</td></tr>";
+
+
+                       print "</div>";
+
+                       print "<div class=\"dlgSec\">".__("Update")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       /* Update Interval */
+
+                       $update_interval = db_fetch_result($result, 0, "update_interval");
+
+                       print_select_hash("update_interval", $update_interval, $update_intervals);
+
+                       /* Update method */
+
+                       if (ALLOW_SELECT_UPDATE_METHOD) {
+                               $update_method = db_fetch_result($result, 0, "update_method");
+
+                               print " " . __('using') . " ";
+                               print_select_hash("update_method", $update_method, $update_methods);                    
+                       }
+
+                       /* Purge intl */
+
+                       print "<br/>";
 
                        $purge_interval = db_fetch_result($result, 0, "purge_interval");
 
-                       print "<tr><td>".__('Article purging:')."</td>";
+                       print __('Article purging:') . " ";
 
-                       print "<td>";
+                       print_select_hash("purge_interval", $purge_interval, $purge_intervals);
 
-                       print_select_hash("purge_interval", $purge_interval, $purge_intervals, 
-                               "class=\"iedit\"");
-                       
-                       print "</td>";
+                       print "</div>";
+                       print "<div class=\"dlgSec\">".__("Authentication")."</div>";
+                       print "<div class=\"dlgSecCont\">";
 
                        $auth_login = htmlspecialchars(db_fetch_result($result, 0, "auth_login"));
 
-                       print "<tr><td>".__('Login:')."</td>";
-                       print "<td><input class=\"iedit\" onkeypress=\"return filterCR(event, feedEditSave)\"
-                               name=\"auth_login\" value=\"$auth_login\"></td></tr>";
+                       print __('Login:') . " ";
+                       print "<input size=\"20\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                               name=\"auth_login\" value=\"$auth_login\">";
+
+                       print " " . __("Password:") . " ";
 
                        $auth_pass = htmlspecialchars(db_fetch_result($result, 0, "auth_pass"));
 
-                       print "<tr><td>".__('Password:')."</td>";
-                       print "<td><input class=\"iedit\" type=\"password\" name=\"auth_pass\" 
+                       print "<input size=\"20\" type=\"password\" name=\"auth_pass\" 
                                onkeypress=\"return filterCR(event, feedEditSave)\"
-                               value=\"$auth_pass\"></td></tr>";
+                               value=\"$auth_pass\">";
 
-                       $private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
+                       print "</div>";
+                       print "<div class=\"dlgSec\">".__("Options")."</div>";
+                       print "<div class=\"dlgSecCont\">";
 
-                       if ($private) {
-                               $checked = "checked";
-                       } else {
-                               $checked = "";
-                       }
+                       print "<div style=\"line-height : 100%\">";
 
-                       print "<tr><td valign='top'>".__('Options:')."</td>";
-                       print "<td><input type=\"checkbox\" name=\"private\" id=\"private\" 
-                               $checked><label for=\"private\">".__('Hide from "Other Feeds"')."</label>";
+                       print "<input type=\"checkbox\" name=\"private\" id=\"private\" 
+                               $checked>&nbsp;<label for=\"private\">".__('Hide from "Other Feeds"')."</label>";
 
                        $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
 
                                $checked = "";
                        }
 
-                       print "<br><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
-                               $checked><label for=\"rtl_content\">".__('Right-to-left content')."</label>";
+                       print "<br/><input type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
+                               $checked>&nbsp;<label for=\"rtl_content\">".__('Right-to-left content')."</label>";
 
                        $hidden = sql_bool_to_bool(db_fetch_result($result, 0, "hidden"));
 
                                $checked = "";
                        }
 
-                       print "<br><input type=\"checkbox\" id=\"hidden\" name=\"hidden\"
-                               $checked><label for=\"hidden\">".__('Hide from my feed list')."</label>";
+                       print "<br/><input type=\"checkbox\" id=\"hidden\" name=\"hidden\"
+                               $checked>&nbsp;<label for=\"hidden\">".__('Hide from my feed list')."</label>";
 
                        $include_in_digest = sql_bool_to_bool(db_fetch_result($result, 0, "include_in_digest"));
 
                                $checked = "";
                        }
 
-                       print "<br><input type=\"checkbox\" id=\"include_in_digest\" 
+                       print "<br/><input type=\"checkbox\" id=\"include_in_digest\" 
                                name=\"include_in_digest\"
-                               $checked><label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
+                               $checked>&nbsp;<label for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
 
                        $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
 
                                $label_class = "class='insensitive'";
                        }
 
-                       print "<br><input type=\"checkbox\" id=\"cache_images\" 
+                       print "<br/><input type=\"checkbox\" id=\"cache_images\" 
                                name=\"cache_images\" $disabled
-                               $checked><label $label_class for=\"cache_images\">".
+                               $checked>&nbsp;<label $label_class for=\"cache_images\">".
                                __('Cache images locally')."</label>";
 
-                       print "</td></tr>";
 
-                       print "</table>";
+                       print "</div>";
+                       print "</div>";
 
                        print "</form>";
 
-                       print "<div align='right'>
+                       print "<div class='dlgButtons'>
+                               <div style=\"float : left\">
+                                       <input type='submit' class='button'                     
+                                       onclick='return unsubscribeFeed($feed_id, \"$title\")' value=\"".__('Unsubscribe')."\">
+                               </div>
                                <input type=\"submit\" class=\"button\" 
                                onclick=\"return feedEditSave()\" value=\"".__('Save')."\">
                                <input type='submit' class='button'                     
-                               onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\"></div>";
+                               onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\">
+                               </div>";
+
+                       return;
+               }
+
+               if ($subop == "editfeeds") {
+
+                       $feed_ids = db_escape_string($_REQUEST["ids"]);
+
+                       print "<div id=\"infoBoxTitle\">".__('Batch Feed Editor')."</div>";
+
+                       print "<div class=\"infoBoxContents\">";
+
+                       print "[$feed_ids]<br/>";
+
+                       print "<form id=\"batch_edit_feed_form\" onsubmit=\"return false\">";   
+
+                       print "<input type=\"hidden\" name=\"ids\" value=\"$feed_ids\">";
+                       print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
+                       print "<input type=\"hidden\" name=\"subop\" value=\"batchEditSave\">";
+
+                       print "<div class=\"dlgSec\">".__("Feed")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       /* Title */
+
+                       print "<input disabled style=\"font-size : 16px\" size=\"35\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                                           name=\"title\" value=\"$title\">";
+
+                       batch_edit_cbox("title");
+
+                       /* Feed URL */
+
+                       print "<br/>";
+
+                       print __('URL:') . " ";
+                       print "<input disabled size=\"40\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                               name=\"feed_url\" value=\"$feed_url\">";
+
+                       batch_edit_cbox("feed_url");
+
+                       /* Category */
+
+                       if (get_pref($link, 'ENABLE_FEED_CATS')) {
+
+                               print "<br/>";
+
+                               print __('Place in category:') . " ";
+
+                               print_feed_cat_select($link, "cat_id", $cat_id, "disabled");
+
+                               batch_edit_cbox("cat_id");
+
+                       }
+
+                       print "</div>";
+
+                       print "<div class=\"dlgSec\">".__("Update")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       /* Update Interval */
+
+                       print_select_hash("update_interval", $update_interval, $update_intervals, 
+                               "disabled");
+
+                       batch_edit_cbox("update_interval");
+
+                       /* Update method */
+
+                       if (ALLOW_SELECT_UPDATE_METHOD) {
+                               print " " . __('using') . " ";
+                               print_select_hash("update_method", $update_method, $update_methods, 
+                                       "disabled");                    
+                               batch_edit_cbox("update_method");
+                       }
+
+                       /* Purge intl */
+
+                       print "<br/>";
+
+                       print __('Article purging:') . " ";
+
+                       print_select_hash("purge_interval", $purge_interval, $purge_intervals,
+                               "disabled");
+
+                       batch_edit_cbox("purge_interval");
+
+                       print "</div>";
+                       print "<div class=\"dlgSec\">".__("Authentication")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       print __('Login:') . " ";
+                       print "<input disabled size=\"15\" onkeypress=\"return filterCR(event, feedEditSave)\"
+                               name=\"auth_login\" value=\"$auth_login\">";
+
+                       batch_edit_cbox("auth_login");
+
+                       print " " . __("Password:") . " ";
+
+                       print "<input disabled size=\"15\" type=\"password\" name=\"auth_pass\" 
+                               onkeypress=\"return filterCR(event, feedEditSave)\"
+                               value=\"$auth_pass\">";
+
+                       batch_edit_cbox("auth_pass");
 
                        print "</div>";
+                       print "<div class=\"dlgSec\">".__("Options")."</div>";
+                       print "<div class=\"dlgSecCont\">";
+
+                       print "<div style=\"line-height : 100%\">";
+
+                       print "<input disabled type=\"checkbox\" name=\"private\" id=\"private\" 
+                               $checked>&nbsp;<label id=\"private_l\" class='insensitive' for=\"private\">".__('Hide from "Other Feeds"')."</label>";
+
+                       print "&nbsp;"; batch_edit_cbox("private", "private_l");
+
+                       print "<br/><input disabled type=\"checkbox\" id=\"rtl_content\" name=\"rtl_content\"
+                               $checked>&nbsp;<label class='insensitive' id=\"rtl_content_l\" for=\"rtl_content\">".__('Right-to-left content')."</label>";
+
+                       print "&nbsp;"; batch_edit_cbox("rtl_content", "rtl_content_l");
+
+                       print "<br/><input disabled type=\"checkbox\" id=\"hidden\" name=\"hidden\"
+                               $checked>&nbsp;<label class='insensitive' id=\"hidden_l\" for=\"hidden\">".__('Hide from my feed list')."</label>";
+
+                       print "&nbsp;"; batch_edit_cbox("hidden", "hidden_l");
+
+                       print "<br/><input disabled type=\"checkbox\" id=\"include_in_digest\" 
+                               name=\"include_in_digest\" 
+                               $checked>&nbsp;<label id=\"include_in_digest_l\" class='insensitive' for=\"include_in_digest\">".__('Include in e-mail digest')."</label>";
+
+                       print "&nbsp;"; batch_edit_cbox("include_in_digest", "include_in_digest_l");
+
+                       print "<br/><input disabled type=\"checkbox\" id=\"cache_images\" 
+                               name=\"cache_images\" 
+                               $checked>&nbsp;<label class='insensitive' id=\"cache_images_l\" 
+                                       for=\"cache_images\">".
+                               __('Cache images locally')."</label>";
+
+
+                       if (ENABLE_SIMPLEPIE && SIMPLEPIE_CACHE_IMAGES) {
+                               print "&nbsp;"; batch_edit_cbox("cache_images", "cache_images_l");
+                       }
+
+                       print "</div>";
+                       print "</div>";
+
+                       print "</form>";
+
+                       print "<div class='dlgButtons'>
+                               <input type=\"submit\" class=\"button\" 
+                               onclick=\"return feedsEditSave()\" value=\"".__('Save')."\">
+                               <input type='submit' class='button'                     
+                               onclick=\"return feedEditCancel()\" value=\"".__('Cancel')."\">
+                               </div>";
 
                        return;
                }
                                db_escape_string($_POST["include_in_digest"]));
                        $cache_images = checkbox_to_sql_bool(
                                db_escape_string($_POST["cache_images"]));
+                       $update_method = (int) db_escape_string($_POST["update_method"]);
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {                      
                                if ($cat_id && $cat_id != 0) {
                                rtl_content = $rtl_content,
                                hidden = $hidden,
                                $cache_images_qpart
-                               include_in_digest = $include_in_digest
+                               include_in_digest = $include_in_digest,
+                               update_method = '$update_method'
                                WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                        }
                }
 
+               if ($subop == "clear") {
+                       $id = db_escape_string($_GET["id"]);
+                       clear_feed_articles($link, $id);
+               }
+
+               if ($subop == "rescore") {
+                       $ids = split(",", db_escape_string($_GET["ids"]));
+
+                       foreach ($ids as $id) {
+
+                               $filters = load_filters($link, $id, $_SESSION["uid"], 6);
+
+                               $result = db_query($link, "SELECT title, content, link, ref_id FROM
+                                               ttrss_user_entries, ttrss_entries 
+                                               WHERE ref_id = id AND feed_id = '$id' AND 
+                                                       owner_uid = " .$_SESSION['uid']."
+                                               ");
+
+                               $scores = array();
+
+                               while ($line = db_fetch_assoc($result)) {
+
+                                       $article_filters = get_article_filters($filters, $line['title'], 
+                                               $line['content'], $line['link']);
+                                       
+                                       $new_score = calculate_article_score($article_filters);
+
+                                       if (!$scores[$new_score]) $scores[$new_score] = array();
+
+                                       array_push($scores[$new_score], $line['ref_id']);
+                               }
+
+                               foreach (array_keys($scores) as $s) {
+                                       if ($s > 1000) {
+                                               db_query($link, "UPDATE ttrss_user_entries SET score = '$s', 
+                                                       marked = true WHERE
+                                                       ref_id IN (" . join(',', $scores[$s]) . ")");
+                                       } else if ($s < -500) {
+                                               db_query($link, "UPDATE ttrss_user_entries SET score = '$s', 
+                                                       unread = false WHERE
+                                                       ref_id IN (" . join(',', $scores[$s]) . ")");
+                                       } else {
+                                               db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
+                                                       ref_id IN (" . join(',', $scores[$s]) . ")");
+                                       }
+                               }
+                       }
+
+                       print __("All done.");
+
+               }
+
+               if ($subop == "rescoreAll") {
+
+                       $result = db_query($link, 
+                               "SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
+
+                       while ($feed_line = db_fetch_assoc($result)) {
+
+                               $id = $feed_line["id"];
+
+                               $filters = load_filters($link, $id, $_SESSION["uid"], 6);
+
+                               $tmp_result = db_query($link, "SELECT title, content, link, ref_id FROM
+                                               ttrss_user_entries, ttrss_entries 
+                                               WHERE ref_id = id AND feed_id = '$id' AND 
+                                                       owner_uid = " .$_SESSION['uid']."
+                                               ");
+
+                               $scores = array();
+
+                               while ($line = db_fetch_assoc($tmp_result)) {
+
+                                       $article_filters = get_article_filters($filters, $line['title'], 
+                                               $line['content'], $line['link']);
+                                       
+                                       $new_score = calculate_article_score($article_filters);
+
+                                       if (!$scores[$new_score]) $scores[$new_score] = array();
+
+                                       array_push($scores[$new_score], $line['ref_id']);
+                               }
+
+                               foreach (array_keys($scores) as $s) {
+                                       if ($s > 1000) {
+                                               db_query($link, "UPDATE ttrss_user_entries SET score = '$s', 
+                                                       marked = true WHERE
+                                                       ref_id IN (" . join(',', $scores[$s]) . ")");
+                                       } else {
+                                               db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
+                                                       ref_id IN (" . join(',', $scores[$s]) . ")");
+                                       }
+                               }
+                       }
+
+                       print __("All done.");
+
+               }
+
                if ($subop == "add") {
                
                        if (!WEB_DEMO_MODE) {
                                }
 
                                if ($p_from != 'tt-rss') {
-                                       $tt_uri = 'http://' . $_SERVER['SERVER_NAME'] . 
-                                               preg_replace('/backend\.php.*$/', 
-                                                       'tt-rss.php', $_SERVER["REQUEST_URI"]);
+                                       $tt_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'tt-rss.php', $_SERVER["REQUEST_URI"]);
 
-                                       $tp_uri = 'http://' . $_SERVER['SERVER_NAME'] . 
-                                               preg_replace('/backend\.php.*$/', 
-                                                       'prefs.php', $_SERVER["REQUEST_URI"]);
+
+                                       $tp_uri = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . preg_replace('/backend\.php.*$/', 'prefs.php', $_SERVER["REQUEST_URI"]);
 
                                        print "<p><a href='$tt_uri'>Return to Tiny Tiny RSS</a> |";
 
                }
 
                print "<div class=\"feedEditSearch\">
-                       <input id=\"feed_search\" size=\"20\"  
+                       <input id=\"feed_search\" size=\"20\" type=\"search\"
+                               onfocus=\"javascript:disableHotkeys();\" 
+                               onblur=\"javascript:enableHotkeys();\"
                                onchange=\"javascript:updateFeedList()\" value=\"$feed_search\">
                        <input type=\"submit\" class=\"button\" 
                                onclick=\"javascript:updateFeedList()\" value=\"".__('Search')."\">
                        </div>";
                
-/*             print "<input id=\"fadd_link\" 
-                               onkeyup=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
-                               onchange=\"toggleSubmitNotEmpty(this, 'fadd_submit_btn')\"
-                               size=\"40\">
-                       <input type=\"submit\" class=\"button\"
-                               disabled=\"true\" id=\"fadd_submit_btn\"
-                               onclick=\"addFeed()\" value=\"".__('Subscribe')."\">"; */
-
                print "<input onclick=\"javascript:displayDlg('quickAddFeed')\"
                        type=\"submit\" id=\"subscribe_to_feed_btn\" 
                        class=\"button\" value=\"".__('Subscribe to feed')."\">"; 
                if ($_GET["slat"] == "true") {
                        $show_last_article_info = true;
                        $show_last_article_checked = "checked";
-                       $show_last_article_qpart = ", (SELECT SUBSTRING(MAX(updated),1,16) FROM ttrss_user_entries,
+                       $show_last_article_qpart = ", (SELECT ".SUBSTRING_FOR_DATE."(MAX(updated),1,16) FROM ttrss_user_entries,
                                ttrss_entries WHERE ref_id = ttrss_entries.id
                                AND feed_id = F1.id) AS last_article";
                } else if ($feeds_sort == "last_article") {
                                F1.id,
                                F1.title,
                                F1.feed_url,
-                               substring(F1.last_updated,1,16) AS last_updated,
+                               ".SUBSTRING_FOR_DATE."(F1.last_updated,1,16) AS last_updated,
                                F1.parent_feed,
                                F1.update_interval,
                                F1.last_error,
                                print "<td class='feedSelect'><input onclick='toggleSelectPrefRow(this, \"feed\");' 
                                type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
 
+                               $onclick = "onclick='editFeed($feed_id)' title='".__('Click to edit')."'";
+
                                if (get_pref($link, 'ENABLE_FEED_ICONS')) {
-                                       print "<td class='feedIcon'>$feed_icon</td>";           
+                                       print "<td $onclick class='feedIcon'>$feed_icon</td>";          
                                }
 
                                if ($hidden) {
                                                $parent_title)</span>";
                                }
 
-                               print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       "$edit_title $parent_title" . "</a></td>";              
+                               print "<td $onclick>" . "$edit_title $parent_title" . "</td>";
 
                                if ($show_last_article_info) {
-                                       print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . 
-                                               "$last_article</a></td>";
+                                       print "<td align='right' $onclick>" . 
+                                               "$last_article</td>";
                                }
 
-                               print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       "$last_updated</a></td>";
+                               print "<td $onclick align='right'>$last_updated</td>";
 
                                print "</tr>";
        
        
                        print "</table>";
 
-                       print "<p><span id=\"feedOpToolbar\">";
-       
-                       print "<input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"javascript:editSelectedFeed()\" value=\"".__('Edit')."\">
-                       <input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"javascript:removeSelectedFeeds()\" 
-                               value=\"".__('Unsubscribe')."\">";
+                       print "<p>";
+
+                       print "<div id=\"feedOpToolbar\">";
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
 
-                               print "&nbsp;|&nbsp;";                          
+                               print __('Selection:') . " ";
 
                                print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled");
 
                                        __('Recategorize')."\">";
                        }
                                
-                       print "</span>";
-
-                       if (get_pref($link, 'ENABLE_FEED_CATS')) {
-
-                               print " <input type=\"submit\" class=\"button\"
-                                       onclick=\"javascript:editFeedCats()\" value=\"".
-                                       __("Edit categories")."\">";
-
-#                              print "&nbsp;|&nbsp;";                          
+                       print "</div>";
 
+                       print "<select id=\"feedActionChooser\" onchange=\"feedActionChange()\">
+                               <option value=\"facDefault\" selected>".__('Actions...')."</option>
+                               <option disabled>--------</option>
+                               <option style=\"color : #5050aa\" disabled>".__('Selection:')."</option>
+                               <option value=\"facEdit\">&nbsp;&nbsp;".__('Edit')."</option>
+                               <option value=\"facBatchEdit\">&nbsp;&nbsp;".__('Edit multiple feeds')."</option>
+                               <option value=\"facPurge\">&nbsp;&nbsp;".__('Manual purge')."</option>
+                               <option value=\"facClear\">&nbsp;&nbsp;".__('Clear feed data')."</option>
+                               <option value=\"facRescore\">&nbsp;&nbsp;".__('Rescore articles')."</option>
+                               <option value=\"facUnsubscribe\">&nbsp;&nbsp;".__('Unsubscribe')."</option>";
+
+                               if (get_pref($link, 'ENABLE_FEED_CATS')) {
+
+                                       print "<option disabled>--------</option>
+                                       <option style=\"color : #5050aa\" disabled>".__('Other:')."</option>
+                                       <option value=\"facEditCats\">&nbsp;&nbsp;".__('Edit categories')."
+                                       </option>";
                                }
-               } else {
-
-//                     print "<p>No feeds defined.</p>";
 
+                       print "</select>";
                }
 
                print "<h3>".__('OPML')."</h3>
                                value=\"".__('Export OPML')."\">";                      
 
 
+               print "<h3>" . __("Firefox Integration") . "</h3>";
+                
+                print "<p>" . __('This Tiny Tiny RSS site can be used as a Firefox Feed Reader by clicking the link below.');
+               print "</p><p> <a class='visibleLink' href='javascript:window.navigator.registerContentHandler(" .
+                      "\"application/vnd.mozilla.maybe.feed\", " .
+                      "\"" . add_feed_url() . "\", " . " \"Tiny Tiny RSS\")'>" .
+                      __('Click here to register this site as a feed reader.') . "</a></p>";
+
+
                print "<h3>".__("Published articles")."</h3>";
 
                if (!get_pref($link, "_PREFS_PUBLISH_KEY")) {
                        set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key());
                }
                
-               print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the address specified below.')."</p>";
+               print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the URL specified below.')."</p>";
 
                $url_path = article_publish_url($link);
 
-               print "<p class=\"small\"><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>";
+               print "<p><a class=\"visibleLink\" id=\"pubGenAddress\" target=\"_blank\" href=\"$url_path\">Link to published articles feed.</a></p>";         
 
-               print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\" 
-                       value=\"".__('Generate another address')."\"></p>";
+               print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\" class=\"button\"
+                       value=\"".__('Generate another link')."\">";
+               /* print " <input type=\"submit\" onclick=\"return pubToClipboard()\" class=\"button\"
+                       value=\"".__('Copy link to clipboard')."\">"; */
+               print "</p>";
 
        }
 ?>