]> git.wh0rd.org Git - tt-rss.git/commitdiff
userDetails -> infoBox, feed infobox, user details improvements
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 19:06:42 +0000 (20:06 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 19:06:42 +0000 (20:06 +0100)
backend.php
prefs.js
tt-rss.css

index 3eca4eda7e99d4aff123f14876bafb138b781bc7..0333e11fd1ac867c860aa8921a3d474b5edbefd4 100644 (file)
                        FROM 
                                ttrss_feeds WHERE owner_uid = '".$_SESSION["uid"]."' ORDER by title");
 
+               print "<div id=\"infoBox\">PLACEHOLDER</div>";
+
                print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
                print "<tr class=\"title\">
                                        <td>&nbsp;</td><td>Select</td><td width=\"30%\">Title</td>
 
                        print "
                                Selection:&nbsp;
+                       <input type=\"submit\" class=\"button\" 
+                               onclick=\"javascript:selectedFeedDetails()\" value=\"Details\">
                        <input type=\"submit\" class=\"button\" 
                                onclick=\"javascript:editSelectedFeed()\" value=\"Edit\">
                        <input type=\"submit\" class=\"button\" 
                                ttrss_users
                        ORDER by login");
 
-               print "<div id=\"prefUserDetails\">PLACEHOLDER</div>";
+               print "<div id=\"infoBox\">PLACEHOLDER</div>";
 
                print "<p><table width=\"100%\" class=\"prefUserList\" id=\"prefUserList\">";
 
 
                $uid = sprintf("%d", $_GET["id"]);
 
-               print "<div class='userDetails'>";
+               print "<div class='infoBoxContents'>";
 
-               $result = db_query($link, "SELECT login,last_login,access_level
+               $result = db_query($link, "SELECT login,last_login,access_level,
+                       (SELECT COUNT(int_id) FROM ttrss_user_entries 
+                               WHERE owner_uid = id) AS stored_articles
                        FROM ttrss_users 
                        WHERE id = '$uid'");
                        
                $login = db_fetch_result($result, 0, "login");
                $last_login = db_fetch_result($result, 0, "last_login");
                $access_level = db_fetch_result($result, 0, "access_level");
+               $stored_articles = db_fetch_result($result, 0, "stored_articles");
 
                print "<tr><td>Username</td><td>$login</td></tr>";
                print "<tr><td>Access level</td><td>$access_level</td></tr>";
                print "<tr><td>Last logged in</td><td>$last_login</td></tr>";
+               print "<tr><td>Stored articles</td><td>$stored_articles</td></tr>";
 
                $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds
                        WHERE owner_uid = '$uid'");
 
 /*             $result = db_query($link, "SELECT 
                        SUM(LENGTH(content)+LENGTH(title)+LENGTH(link)+LENGTH(guid)) AS db_size 
-                       FROM ttrss_entries WHERE owner_uid = '$uid'");
+                       FROM ttrss_user_entries,ttrss_entries 
+                               WHERE owner_uid = '$uid' AND ref_id = id");
 
                $db_size = round(db_fetch_result($result, 0, "db_size") / 1024);
 
-               print "<tr><td>Approx. DB size</td><td>$db_size KBytes</td></tr>"; */
+               print "<tr><td>Approx. used DB size</td><td>$db_size KBytes</td></tr>";  */
 
                print "</table>";
 
 
                print "<div align='center'>
                        <input type='submit' class='button'                     
-                       onclick=\"closeUserDetails()\" value=\"Close this window\"></div>";
+                       onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
 
 //             print "</body></html>"; 
 
        }
 
+       if ($op == "feed-details") {
+
+               $feed_id = $_GET["id"];
+
+               $result = db_query($link, 
+                       "SELECT 
+                               title,feed_url,last_updated,
+                               (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_fetch_result($result, 0, "title");
+               $last_updated = db_fetch_result($result, 0, "last_updated");
+               $feed_url = db_fetch_result($result, 0, "feed_url");
+               $total = db_fetch_result($result, 0, "total");
+               $unread = db_fetch_result($result, 0, "unread");
+               $marked = db_fetch_result($result, 0, "marked");
+
+               print "<div class=\"infoBoxContents\"><h1>$title</h1>";
+
+               print "<table width='100%'>";
+
+               print "<tr><td>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 "</table>";
+
+               print "</div>";
+
+               print "<div align='center'>
+                       <input type='submit' class='button'                     
+                       onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
+
+       }
+
        db_close($link);
 ?>
 
index 83a55d0d51dad9a04ae36938b2a5331183bf6869..89c314faf124f34ca763d1efb0736f837d42bed6 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -119,11 +119,13 @@ function userlist_callback() {
        }
 }
 
-function userdetails_callback() {
-       var container = document.getElementById('prefUserDetails');
+function infobox_callback() {
+       var container = document.getElementById('infoBox');
        if (xmlhttp.readyState == 4) {
-               container.innerHTML=xmlhttp.responseText;
-               container.style.display = "block";
+               if (container) {
+                       container.innerHTML=xmlhttp.responseText;
+                       container.style.display = "block";
+               }
        }
 }
 
@@ -880,7 +882,34 @@ function selectedUserDetails() {
        var id = rows[0];
 
        xmlhttp.open("GET", "backend.php?op=user-details&id=" + id, true);
-       xmlhttp.onreadystatechange=userdetails_callback;
+       xmlhttp.onreadystatechange=infobox_callback;
+       xmlhttp.send(null);
+
+}
+
+function selectedFeedDetails() {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       var rows = getSelectedFeeds();
+
+       if (rows.length == 0) {
+               notify("No feeds are selected.");
+               return;
+       }
+
+       if (rows.length > 1) {
+               notify("Please select one feed.");
+               return;
+       }
+
+       var id = rows[0];
+
+       xmlhttp.open("GET", "backend.php?op=feed-details&id=" + id, true);
+       xmlhttp.onreadystatechange=infobox_callback;
        xmlhttp.send(null);
 
 }
@@ -993,6 +1022,11 @@ function updatePrefsList() {
 
 function selectTab(id) {
 
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
        if (id == "feedConfig") {
                updateFeedList();
        } else if (id == "filterConfig") {
@@ -1066,7 +1100,7 @@ function dispOptionHelp(event, sender) {
 
 } */
 
-function closeUserDetails() {
-       var d = document.getElementById('prefUserDetails');
+function closeInfoBox() {
+       var d = document.getElementById('infoBox');
        d.style.display = "none";
 }
index e6d8751b75cec98e2c1fb561f8bf0aecca14aa12..1a3e2031b1627fcaddb58aff4b30fd240c148106 100644 (file)
@@ -425,7 +425,7 @@ div.helpResponse {
        border : 1px solid #f0f0f0;
 }
 
-div.userDetails {
+div.infoBoxContents {
        background-image : url("images/vgrad_light_rev2.png");
        background-position : top left;
        background-repeat : repeat-x;
@@ -434,14 +434,14 @@ div.userDetails {
        border : 1px solid #f0f0f0;
 }
 
-div.helpResponse h1, div.userDetails h1 {
+div.helpResponse h1, div.infoBoxContents h1 {
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #c0c0c0;
        font-size : 16pt;
 }
 
-div.helpResponse h2, div.userDetails h2 {
+div.helpResponse h2, div.infoBoxContents h2 {
        border-width : 0px 0px 0px 0px;
        font-size : 12pt;
 }
@@ -581,13 +581,17 @@ table.innerLoginForm td {
        padding : 3px 3px 5px 3px;
 }
 
-#prefUserDetails {
+#infoBox {
        position : absolute;
        margin-left : 30%;
        background-color : white;
        width : 30%;
        z-index : 3;
        border : 1px solid #c0c0c0;
-       display : none;
        padding-bottom : 10px;
+       display : none;
+}
+
+div.small, p.small {
+       font-size : x-small;
 }