]> git.wh0rd.org - tt-rss.git/commitdiff
various interface improvements/fixes
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 20 May 2006 09:41:47 +0000 (10:41 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 20 May 2006 09:41:47 +0000 (10:41 +0100)
backend.php
functions.php
prefs.js
tt-rss.css

index bb418044937bdffa97e74d80e223838377465daa..6a3f7ecf3aeb92ca555898a933f8b0e1fb12a7b6 100644 (file)
 
                                print "<tr class='$row_class'><td>Category:</td>";
                                print "<td>";
-                               print "<select id=\"iedit_fcat\">";
-                               print "<option id=\"0\">Uncategorized</option>";
-
-                               $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feed_categories
-                                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
 
-                               if (db_num_rows($tmp_result) > 0) {
-                                       print "<option disabled>--------</option>";
-                               }
+                               print_feed_cat_select($link, "iedit_fcat", $cat_id);
 
-                               while ($tmp_line = db_fetch_assoc($tmp_result)) {
-                                       if ($tmp_line["id"] == $cat_id) {
-                                               $is_selected = "selected";
-                                       } else {
-                                               $is_selected = "";
-                                       }
-                                       printf("<option $is_selected id='%d'>%s</option>", 
-                                               $tmp_line["id"], $tmp_line["title"]);
-                               }
-
-                               print "</select></td>";
+                               print "</td>";
                                print "</td></tr>";
        
                        }
 #                      $row_class = toggleEvenOdd($row_class);
 
                        print "<tr class='$row_class'><td>Update Interval:</td>";
-//                     print "<td><input id=\"iedit_updintl\" 
-//                             value=\"$update_interval\"></td></tr>";
 
                        print "<td>";
 
 
                                        print "&nbsp;|&nbsp;";                          
 
-                                       $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories
-                                               WHERE owner_uid = ".$_SESSION["uid"]."
-                                               ORDER BY title");
-
-                                       print "<select id=\"sfeed_set_fcat\" disabled=\"true\">";
-                                       print "<option id=\"0\">Uncategorized</option>";
-
-                                       if (db_num_rows($result) != 0) {
-               
-                                               print "<option disabled>--------</option>";
-
-                                               while ($line = db_fetch_assoc($result)) {
-                                                       printf("<option id='%d'>%s</option>", 
-                                                               $line["id"], $line["title"]);
-                                               }               
-                                       }
-
-                                       print "</select>";
+                                       print_feed_cat_select($link, "sfeed_set_fcat", "", "disabled");
 
                                        print " <input type=\"submit\" class=\"button\" disabled=\"true\"
                                        onclick=\"javascript:categorizeSelectedFeeds()\" value=\"Recategorize\">";
 
                        print "<h3>Edit Categories</h3>";
 
-       //              print "<h3>Categories</h3>";
-
                        print "<div class=\"prefGenericAddBox\">
                                <input id=\"fadd_cat\" 
                                        onkeyup=\"toggleSubmitNotEmpty(this, 'catadd_submit_btn')\"
                        array_push($filter_types, $line["description"]);
                }
 
-/*             print "<div class=\"prefGenericAddBox\">
-               <input id=\"fadd_regexp\" size=\"40\">&nbsp;";
-               
-               print_select("fadd_match", "Title", $filter_types);     
-
-               print "&nbsp;<select id=\"fadd_feed\">";
-
-               print "<option selected id=\"0\">All feeds</option>";
-
-               $result = db_query($link, "SELECT id,title FROM ttrss_feeds
-                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
-
-               if (db_num_rows($result) > 0) {
-                       print "<option disabled>--------</option>";
-               }
-
-               while ($line = db_fetch_assoc($result)) {
-                       printf("<option id='%d'>%s</option>", $line["id"], 
-                               db_unescape_string($line["title"]));
-               }
-
-               print "</select>&nbsp;";
-
-               print "&nbsp;Action: ";
-
-               print "<select id=\"fadd_action\">";
-
-               $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions 
-                       ORDER BY name");
-
-               while ($line = db_fetch_assoc($result)) {                       
-                       printf("<option id='%d'>%s</option>", $line["id"], $line["description"]);
-               }
-
-               print "</select>&nbsp;";
-
-/*             print "<input type=\"submit\" 
-                       class=\"button\" onclick=\"javascript:testFilter()\" 
-                       value=\"Test filter\"> "; */
-
-/*             print "<input type=\"submit\" 
-                       class=\"button\" onclick=\"javascript:addFilter()\" 
-                       value=\"Create filter\">"; */
-
                print "<input type=\"submit\" 
                        class=\"button\" 
                        onclick=\"javascript:displayDlg('quickAddFilter', false)\" 
                        value=\"Create filter\">"; 
 
-//             print "</div>";
-
                $result = db_query($link, "SELECT 
                                ttrss_filters.id AS id,reg_exp,
                                ttrss_filter_types.name AS filter_type_name,
                                        print "<td><input id=\"iedit_regexp\" value=\"".$line["reg_exp"].
                                                "\"></td>";
        
-                                       print "<td>";
-                                       print "<select id=\"iedit_feed\">";
-                                       print "<option id=\"0\">All feeds</option>";
-       
-                                       $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds
-                                               WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
-
-                                       if (db_num_rows($tmp_result) > 0) {
-                                               print "<option disabled>--------</option>";
-                                       }
-
-                                       while ($tmp_line = db_fetch_assoc($tmp_result)) {
-                                               if ($tmp_line["id"] == $line["feed_id"]) {
-                                                       $is_selected = "selected";
-                                               } else {
-                                                       $is_selected = "";
-                                               }
-                                               printf("<option $is_selected id='%d'>%s</option>", 
-                                                       $tmp_line["id"], db_unescape_string($tmp_line["title"]));
-                                       }
-       
-                                       print "</select></td>";
-       
+                                       print "<td>";   
+                                       print_feed_select($link, "iedit_feed", $line["feed_id"]);                                       
+                                       print "</td>";
+                                       
                                        print "<td>";
                                        print_select("iedit_match", $line["filter_type_descr"], $filter_types);
                                        print "</td>";
                        
                        if ($num_matches > 0) { 
 
-                               print "<p>Query returned <b>$num_matches</b> matches, first 5 follow:</p>";
+                               print "<p>Query returned <b>$num_matches</b> matches, showing first 15:</p>";
 
                                $result = db_query($link, 
                                        "SELECT title, 
                                                        WHERE ($expr) AND 
                                                        ttrss_user_entries.ref_id = ttrss_entries.id
                                                        AND owner_uid = " . $_SESSION["uid"] . " 
-                                                       ORDER BY date_entered DESC LIMIT 5");
+                                                       ORDER BY date_entered DESC LIMIT 15");
 
-                               print "<ul class=\"nomarks\">";
+                               print "<ul class=\"filterTestResults\">";
+
+                               $row_class = "even";
+                               
                                while ($line = db_fetch_assoc($result)) {
-                                       print "<li>".$line["title"].
+                                       $row_class = toggleEvenOdd($row_class);
+                                       
+                                       print "<li class=\"$row_class\">".$line["title"].
                                                " <span class=\"insensitive\">(".$line["feed_title"].")</span></li>";
                                }
                                print "</ul>";
                                </td</tr>";
 
                        print "<tr class=\"title\">
-                                               <td align='center' width=\"5%\">&nbsp;</td>
+                                               <td width=\"5%\">&nbsp;</td>
                                                <td width=\"40%\">SQL expression
                                                <a class=\"helpLink\" href=\"javascript:displayHelpInfobox(1)\">(?)</a>
                                                </td>
        
                                        if (!$line["description"]) $line["description"] = "[No description]";
        
-                                       print "<td><input disabled=\"true\" type=\"checkbox\" 
+                                       print "<td align='center'><input disabled=\"true\" type=\"checkbox\" 
                                                id=\"LICHK-".$line["id"]."\"></td>";
        
                                        print "<td>".$line["sql_exp"]."</td>";          
        
                                } else {
        
-                                       print "<td><input disabled=\"true\" type=\"checkbox\" checked></td>";
+                                       print "<td align='center'><input disabled=\"true\" type=\"checkbox\" checked></td>";
        
                                        print "<td><input id=\"iedit_expr\" value=\"".$line["sql_exp"].
                                                "\"></td>";
                        print_select("fadd_match", "Title", $filter_types);     
        
                        print "</td></tr>";
-                       print "<tr><td>Feed:</td><td><select id=\"fadd_feed\">";
-       
-                       print "<option selected id=\"0\">All feeds</option>";
-       
-                       $result = db_query($link, "SELECT id,title FROM ttrss_feeds
-                               WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
-       
-                       if (db_num_rows($result) > 0) {
-                               print "<option disabled>--------</option>";
-                       }
-       
-                       while ($line = db_fetch_assoc($result)) {
-                               if ($param == $line["id"]) {
-                                       $selected = "selected";
-                               } else {
-                                       $selected = "";
-                               }
-                               printf("<option id='%d' %s>%s</option>", $line["id"], $selected, $line["title"]);
-                       }
-       
-                       print "</select></td></tr>";
+                       print "<tr><td>Feed:</td><td>";
+
+                       print_feed_select($link, "fadd_feed");
+                       
+                       print "</td></tr>";
        
                        print "<tr><td>Action:</td>";
        
 
        }
 
-       if ($op == "feed-details") {
-
-//             $feed_id = $_GET["id"];
-
-               $feed_ids = split(",", db_escape_string($_GET["id"]));
-
-               print "<div id=\"infoBoxTitle\">Feed details</div>";
-               print "<div class=\"infoBoxContents\">";
-
-               foreach ($feed_ids as $feed_id) {
-
-                       $result = db_query($link, 
-                               "SELECT 
-                                       title,feed_url,
-                                       SUBSTRING(last_updated,1,16) as last_updated,
-                                       icon_url,site_url,
-                                       (SELECT COUNT(int_id) FROM ttrss_user_entries 
-                                               WHERE feed_id = id) AS total,
-                                       (SELECT COUNT(int_id) FROM ttrss_user_entries 
-                                               WHERE feed_id = id AND unread = true) AS unread,
-                                       (SELECT COUNT(int_id) FROM ttrss_user_entries 
-                                               WHERE feed_id = id AND marked = true) AS marked
-                               FROM ttrss_feeds
-                               WHERE id = '$feed_id' AND owner_uid = ".$_SESSION["uid"]);
-       
-                       if (db_num_rows($result) == 0) return;
-       
-                       $title = db_unescape_string(db_fetch_result($result, 0, "title"));
-                       $last_updated = date(get_pref($link, 'LONG_DATE_FORMAT'),
-                               strtotime(db_fetch_result($result, 0, "last_updated")));
-                       $feed_url = db_fetch_result($result, 0, "feed_url");
-                       $icon_url = db_fetch_result($result, 0, "icon_url");
-                       $total = db_fetch_result($result, 0, "total");
-                       $unread = db_fetch_result($result, 0, "unread");
-                       $marked = db_fetch_result($result, 0, "marked");
-                       $site_url = db_fetch_result($result, 0, "site_url");
-       
-                       $result = db_query($link, "SELECT COUNT(id) AS subscribed
-                                               FROM ttrss_feeds WHERE feed_url = '$feed_url' AND private = false");
-       
-                       $subscribed = db_fetch_result($result, 0, "subscribed");
-       
-                       $icon_file = ICONS_DIR . "/$feed_id.ico";
-       
-                       if (file_exists($icon_file) && filesize($icon_file) > 0) {
-                                       $feed_icon = "<img width=\"16\" height=\"16\"
-                                               src=\"" . ICONS_URL . "/$feed_id.ico\">";
-                       } else {
-                               $feed_icon = "";
-                       }
-       
-                       print "<h1>$feed_icon $title</h1>";
-       
-                       print "<table width='100%'>";
-       
-                       if ($site_url) {
-                               print "<tr><td width='30%'>Link</td>
-                                       <td><a href=\"$site_url\">$site_url</a>
-                                       <a href=\"$feed_url\">(feed)</a></td>
-                                       </td></tr>";
-                       } else {
-                               print "<tr><td width='30%'>Feed URL</td>
-                                       <td><a href=\"$feed_url\">$feed_url</a></td></tr>";
-                       }
-                       print "<tr><td>Last updated</td><td>$last_updated</td></tr>";
-                       print "<tr><td>Total articles</td><td>$total</td></tr>";
-                       print "<tr><td>Unread articles</td><td>$unread</td></tr>";
-                       print "<tr><td>Starred articles</td><td>$marked</td></tr>";
-                       print "<tr><td>Subscribed users</td><td>$subscribed</td></tr>";
-       
-                       print "</table>";
-       
-/*                     $result = db_query($link, "SELECT title,
-                               SUBSTRING(updated,1,16) AS updated,unread
-                               FROM ttrss_entries,ttrss_user_entries
-                               WHERE ref_id = id AND feed_id = '$feed_id' 
-                               ORDER BY date_entered DESC LIMIT 5");
-       
-                       if (db_num_rows($result) > 0) {
-       
-                               print "<h1>Latest headlines</h1>";
-       
-                               print "<ul class=\"nomarks\">";
-               
-                               while ($line = db_fetch_assoc($result)) {
-                                       if ($line["unread"] == "t" || $line["unread"] == "1") {
-                                               $line["title"] = "<b>" . $line["title"] . "</b>";
-                                       }                               
-                                       print "<li>" . $line["title"].
-                                       "&nbsp;<span class=\"insensitive\">(" .
-                                               date(get_pref($link, 'SHORT_DATE_FORMAT'), 
-                                                       strtotime($line["updated"])).
-                                       ")</span></li>";
-                               }
-               
-                               print "</ul>";
-               
-                       } */
-               }
-
-               print "</div>";
-       
-               print "<div align='center'>
-                       <input type='submit' class='button'                     
-                       onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
-       }       
-
        if ($op == "pref-feed-browser") {
 
                if (!ENABLE_FEED_BROWSER) {
index 06b142d73fb5fe3f12a02ee3618d82642e9fab07..343315eb175d0aa1f0a7adc9eec4933210e1ae8d 100644 (file)
                print "</select>";
        }
 
+       function print_select_hash($id, $values, $default, $attributes = "") {
+               print "<select id='$id' $attributes>";
+               foreach (array_keys($values) as $v) {
+                       if ($v == $default)
+                               $sel = "selected";
+                        else
+                               $sel = "";
+                       
+                       print "<option $sel value=\"$v\">".$values[$v]."</option>";
+               }
+
+               print "</select>";
+       }
+
        function get_filter_name($title, $content, $link, $filters) {
 
                if ($filters["title"]) {
                }
        }
 
+       function print_feed_select($link, $id, $default_id = "", 
+               $attributes = "", $include_all_feeds = true) {
+
+               print "<select id=\"$id\" $attributes>";
+               if ($include_all_feeds) { 
+                       print "<option id=\"0\">All feeds</option>";
+               }
+       
+               $result = db_query($link, "SELECT id,title FROM ttrss_feeds
+                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
+
+               if (db_num_rows($result) > 0 && $include_all_feeds) {
+                       print "<option disabled>--------</option>";
+               }
+
+               while ($line = db_fetch_assoc($result)) {
+                       if ($line["id"] == $default_id) {
+                               $is_selected = "selected";
+                       } else {
+                               $is_selected = "";
+                       }
+                       printf("<option $is_selected id='%d'>%s</option>", 
+                               $line["id"], db_unescape_string($line["title"]));
+               }
+       
+               print "</select>";
+       }
+
+       function print_feed_cat_select($link, $id, $default_id = "", 
+               $attributes = "", $include_all_cats = true) {
+               
+               print "<select id=\"$id\" $attributes>";
+
+               if ($include_all_cats) {
+                       print "<option id=\"0\">Uncategorized</option>";
+               }
+
+               $result = db_query($link, "SELECT id,title FROM ttrss_feed_categories
+                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
+
+               if (db_num_rows($result) > 0 && $include_all_cats) {
+                       print "<option disabled>--------</option>";
+               }
+
+               while ($line = db_fetch_assoc($result)) {
+                       if ($line["id"] == $default_id) {
+                               $is_selected = "selected";
+                       } else {
+                               $is_selected = "";
+                       }
+                       printf("<option $is_selected id='%d'>%s</option>", 
+                               $line["id"], $line["title"]);
+               }
+
+               print "</select>";
+       }
+       
 ?>
index 04c5266b6755c6c6107d27961bcf5180f7e9fa47..699095ba778a27312b0c1b898dc7f1aa75379277 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -405,15 +405,8 @@ function editFeed(feed) {
 
        active_feed = feed;
 
-/*     xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=edit&id=" +
-               param_escape(feed), true);
-       xmlhttp.onreadystatechange=feedlist_callback;
-       xmlhttp.send(null); */
-
+       // clean selection from all rows & select row being edited
        selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
-//     selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-'+feed, 'FRCHK-'+feed, 
-//             true, false);
-
        selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
 
        xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
@@ -665,14 +658,9 @@ function feedEditCancel() {
 
        closeInfoBox();
 
-       active_feed = false;
-
-//     notify("Operation cancelled.");
-
-/*     xmlhttp.open("GET", "backend.php?op=pref-feeds", true);
-       xmlhttp.onreadystatechange=feedlist_callback;
-       xmlhttp.send(null); */
+       selectPrefRows('feed', false); // cleanup feed selection
 
+       active_feed = false;
 }
 
 function feedCatEditCancel() {
@@ -764,6 +752,8 @@ function feedEditSave() {
                        "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) +
                        "&is_pvt=" + param_escape(is_pvt) + "&is_rtl=" + param_escape(is_rtl);
 
+               selectPrefRows('feed', false); // cleanup feed selection
+
                xmlhttp.open("POST", "backend.php", true);
                xmlhttp.onreadystatechange=feedlist_callback;
                xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
@@ -1298,6 +1288,13 @@ function selectTab(id, noupdate) {
 
                notify("Loading, please wait...", true);
 
+               // clean up all current selections, just in case
+               active_feed = false;
+               active_feed_cat = false;
+               active_filter = false;
+               active_label = false;
+               active_user = false;
+
                if (id == "feedConfig") {
                        updateFeedList();
                } else if (id == "filterConfig") {
index 3c93b7ff6b93683ad27dec92b21532b45c528318..43128a7ecd6f7aad1dc7f80e3bc958cf76cfb945 100644 (file)
@@ -807,30 +807,6 @@ table.headlinesList tr td {
        padding : 2px 0px 2px 0px;
 }
 
-/*
-tr.even td.headlineContent, tr.evenUnread td.headlineContent {
-       display : block;
-       overflow : hidden;
-       height : 1em;   
-       background-color : #f0f0f0;
-}
-
-tr.odd td.headlineContent, tr.oddUnread td.headlineContent {
-       display : block;
-       overflow : hidden;
-       height : 1em;
-}
-
-tr.oddSelected td.headlineContent,
-tr.evenSelected td.headlineContent,
-tr.oddUnreadSelected td.headlineContent,
-tr.evenUnreadSelected td.headlineContent {
-       display : block;
-       overflow : hidden;
-       height : 1em;
-       background-color : #e0e0ff;
-} */
-
 div.postHeader td.postDate {
        font-size : x-small;
        text-align : right;
@@ -952,6 +928,16 @@ ul.userFeedList {
        -moz-border-radius : 5px;
 } */
 
+ul.filterTestResults {
+       height : 300px;
+       overflow : auto;
+       list-style-type : none;
+       margin : 0px 0px 5px 0px;
+       padding : 0px;
+       border : 1px solid #88b0f0;
+       background-color : white;
+}
+
 ul.browseFeedList {
        height : 300px;
        overflow : auto;