]> git.wh0rd.org Git - tt-rss.git/commitdiff
pref-feeds: add checkbox to toggle last article times info
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 May 2007 06:12:17 +0000 (07:12 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 18 May 2007 06:12:17 +0000 (07:12 +0100)
modules/pref-feeds.php
prefs.js

index 9292ae40c9e4a8a8291dc952393e5757bed5dc87..3f5e2f61f3c75e6f98fcc04e0b5587f049bf79b2 100644 (file)
                        $order_by_qpart = "$feeds_sort,title";
                }
 
+               $show_last_article_info = false;
+               $show_last_article_checked = "";
+               $show_last_article_qpart = "";
+
+               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,
+                               ttrss_entries WHERE ref_id = ttrss_entries.id
+                               AND feed_id = F1.id) AS last_article";
+               }
+
                $result = db_query($link, "SELECT 
                                F1.id,
                                F1.title,
                                F2.title AS parent_title,
                                C1.title AS category,
                                F1.hidden,
-                               F1.include_in_digest,
-                               (SELECT SUBSTRING(MAX(updated),1,16) FROM ttrss_user_entries, 
-                                       ttrss_entries WHERE ref_id = ttrss_entries.id 
-                                       AND feed_id = F1.id) AS last_article
+                               F1.include_in_digest
+                               $show_last_article_qpart
                        FROM 
                                ttrss_feeds AS F1 
                                LEFT JOIN ttrss_feeds AS F2
 
                        print "<p><table width=\"100%\" cellspacing=\"0\" 
                                class=\"prefFeedList\" id=\"prefFeedList\">";
-                       print "<tr><td class=\"selectPrompt\" colspan=\"8\">
-                               ".__('Select:')." 
+                       print "<tr><td class=\"selectPrompt\" colspan=\"8\">".
+                               "<div style='float : right'>".
+                               "<input id='show_last_article_times' type='checkbox' onchange='feedlistToggleSLAT()'
+                               $show_last_article_checked><label 
+                                       for='show_last_article_times'>".__('Show last article times')."</label></div>".
+                               __('Select:')."
                                        <a href=\"javascript:selectPrefRows('feed', true)\">".__('All')."</a>,
                                        <a href=\"javascript:selectPrefRows('feed', false)\">".__('None')."</a>
                                </td</tr>";
                                                print "<td width='3%'>&nbsp;</td>";
                                        }
 
-                                       print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>
-                                               <td width='20%' align='right'><a href=\"javascript:updateFeedList('last_article')\">".__('Last&nbsp;Article')."</a></td>
-                                               <td width='20%' align='right'><a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>";
+                                       print "<td width='60%'><a href=\"javascript:updateFeedList('title')\">".__('Title')."</a></td>";
+
+                                       if ($show_last_article_info) {
+                                               print "<td width='20%' align='right'>
+                                                       <a href=\"javascript:updateFeedList('last_article')\">".__('Last&nbsp;Article')."</a></td>";
+                                       }
+
+                                       print "<td width='20%' align='right'>
+                                               <a href=\"javascript:updateFeedList('last_updated')\">".__('Updated')."</a></td>";
 
                                        $cur_cat_id = $cat_id;
                                }
                                print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
                                        "$edit_title $parent_title" . "</a></td>";              
 
-                               print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       "$last_article</a></td>";
+                               if ($show_last_article_info) {
+                                       print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . 
+                                               "$last_article</a></td>";
+                               }
 
                                print "<td align='right'><a href=\"javascript:editFeed($feed_id);\">" . 
                                        "$last_updated</a></td>";
index 30a8928d796ff11528f7bb8dabcf38f3791ace32..33b9cc71b6a5bcbda69cef14d3a1e81e658df33c 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -205,8 +205,16 @@ function updateFeedList(sort_key) {
        var search = "";
        if (feed_search) { search = feed_search.value; }
 
+       var slat = document.getElementById("show_last_article_times");
+
+       var slat_checked = false;
+       if (slat) {
+               slat_checked = slat.checked;
+       }
+
        xmlhttp.open("GET", "backend.php?op=pref-feeds" +
                "&sort=" + param_escape(sort_key) + 
+               "&slat=" + param_escape(slat_checked) +
                "&search=" + param_escape(search), true);
        xmlhttp.onreadystatechange=feedlist_callback;
        xmlhttp.send(null);
@@ -1716,3 +1724,8 @@ function changeUserEmail() {
        return false;
 
 }
+
+function feedlistToggleSLAT() {
+       notify_progress("Loading, please wait...");
+       updateFeedList()
+}