]> git.wh0rd.org Git - tt-rss.git/commitdiff
user details for user manager
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 18 Nov 2005 12:02:38 +0000 (13:02 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 18 Nov 2005 12:02:38 +0000 (13:02 +0100)
backend.php
functions.php
prefs.js
tt-rss.css

index 9078a2043682cd6facb1705b33f0864ba88f499c..f7318ff4728c67e5eadaf0f3055a4a8b6195313e 100644 (file)
@@ -11,9 +11,6 @@
        require_once "functions.php";
        require_once "magpierss/rss_fetch.inc";
 
-//     $_SESSION["uid"] = PLACEHOLDER_UID; // FIXME: placeholder
-//     $_SESSION["name"] = PLACEHOLDER_NAME;
-
        $op = $_REQUEST["op"];
 
        if ($op == "rpc" || $op == "updateAllFeeds") {
                        print "
                                Selection:
                        <input type=\"submit\" class=\"button\" 
-                               onclick=\"javascript:resetSelectedUserPass()\" value=\"Reset password\">
+                               onclick=\"javascript:selectedUserDetails()\" value=\"User details\">
                        <input type=\"submit\" class=\"button\" 
                                onclick=\"javascript:editSelectedUser()\" value=\"Edit\">
                        <input type=\"submit\" class=\"button\" 
-                               onclick=\"javascript:removeSelectedUsers()\" value=\"Remove\">";
+                               onclick=\"javascript:removeSelectedUsers()\" value=\"Remove\">
+                       <input type=\"submit\" class=\"button\" 
+                               onclick=\"javascript:resetSelectedUserPass()\" value=\"Reset password\">";
+
+               }
+       }
+
+       if ($op == "user-details") {
+
+               if (WEB_DEMO_MODE || $_SESSION["access_level"] < 10) {
+                       return;
+               }
+                         
+               print "<html><head>
+                       <title>Tiny Tiny RSS : User Details</title>
+                       <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
+                       <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+                       </head><body>";
+
+               $uid = sprintf("%d", $_GET["id"]);
+
+               /* FIXME this badly needs real implementation */
+
+               print "<div class='userDetails'>";
+
+               $result = db_query($link, "SELECT login,last_login,access_level
+                       FROM ttrss_users 
+                       WHERE id = '$uid'");
+                       
+               if (db_num_rows($result) == 0) {
+                       print "<h1>User not found</h1>";
+                       return;
+               }
+               
+               print "<h1>User Details</h1>";
+
+               print "<table width='100%'>";
+
+               $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");
+
+               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>";
+
+               $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds
+                       WHERE owner_uid = '$uid'");
+
+               $num_feeds = db_fetch_result($result, 0, "num_feeds");
+
+               print "<tr><td>Subscribed feeds count</td><td>$num_feeds</td></tr>";
+
+               $result = db_query($link, "SELECT 
+                       SUM(LENGTH(content)+LENGTH(title)+LENGTH(link)+LENGTH(guid)) AS db_size 
+                       FROM ttrss_entries WHERE owner_uid = '$uid'");
+
+               $db_size = db_fetch_result($result, 0, "db_size");
+
+               print "<tr><td>Approx. DB size</td><td>$db_size bytes</td></tr>";
+
+               print "</table>";
+
+               print "<h1>Subscribed feeds</h1>";
+
+               $result = db_query($link, "SELECT id,title,feed_url FROM ttrss_feeds
+                       WHERE owner_uid = '$uid'");
+
+               print "<ul class=\"nomarks\">";
+
+               while ($line = db_fetch_assoc($result)) {
+
+                       $icon_file = ICONS_URL."/".$line["id"].".ico";
+
+                       if (file_exists($icon_file) && filesize($icon_file) > 0) {
+                               $feed_icon = "<img class=\"feedIcon\" src=\"$icon_file\">";
+                       } else {
+                               $feed_icon = "<img class=\"feedIcon\" src=\"images/blank_icon.gif\">";
+                       }
+
+                       print "<li>$feed_icon&nbsp;<a href=\"".$line["feed_url"]."\">".$line["title"]."</a></li>";
                }
+
+               print "</ul>";
+
+               print "<p align='center'>
+                       <a      href=\"javascript:window.close()\">(Close this window)</a></p>";
+
+               print "</div>";
+
+               print "</body></html>";
+
        }
 
 
index 9a6f70184d4b0e8f109a44a2d280f56b8ca3bd71..730b1fedd73b144c51901ca118cf22e10ec2f1de 100644 (file)
                                if (!rename($tmpfname, $icon_file)) {
                                        unlink($tmpfname);
                                }
+
+                               chmod($icon_file, 0644);
+                               
                                error_reporting (E_ERROR | E_WARNING | E_PARSE);
 
                        }       
index c18e5100f3706d391e6b87cfc0701db2a5f850cb..4333aac1849819b654c339e37cebdaee98a5771c 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -848,7 +848,27 @@ function resetSelectedUserPass() {
 
 }
 
+function selectedUserDetails() {
 
+       var rows = getSelectedUsers();
+
+       if (rows.length == 0) {
+               notify("No users are selected.");
+               return;
+       }
+
+       if (rows.length > 1) {
+               notify("Please select one user.");
+               return;
+       }
+
+       var id = rows[0];
+
+       var w = window.open("backend.php?op=user-details&id=" + id,
+               "User Details", 
+               "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
+
+}
 
 function editSelectedFilter() {
        var rows = getSelectedFilters();
index 3fb4961b0236856ea2594f14e03dac9238016d09..ca591c50ecfb8c304fb2724e62e1fd4f0a2153ef 100644 (file)
@@ -181,7 +181,7 @@ ul.feedList li.feed {
        display : block;
 }
 
-ul.feedList img {
+ul.feedList img, img.feedIcon {
        margin : 0px 3px 0px 0px;
        width : 16px;
        height : 16px;
@@ -411,7 +411,7 @@ a.helpLink:hover {
        color : #5050aa;
 }
 
-div.helpResponse {
+div.helpResponse, div.userDetails {
        margin : 10px;
        background-image : url("images/vgrad_light_rev2.png");
        background-position : top left;
@@ -420,17 +420,16 @@ div.helpResponse {
        border : 1px solid #f0f0f0;
 }
 
-div.helpResponse h1 {
+div.helpResponse h1, div.userDetails h1 {
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #c0c0c0;
        font-size : 16pt;
 }
 
-div.helpResponse h2 {
+div.helpResponse h2, div.userDetails h2 {
        border-width : 0px 0px 0px 0px;
        font-size : 12pt;
-
 }
 
 pre {