]> git.wh0rd.org Git - tt-rss.git/commitdiff
easier user privilege editor, misc js cleanups
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 14:12:41 +0000 (15:12 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 14:12:41 +0000 (15:12 +0100)
backend.php
functions.js
prefs.js
tt-rss.css

index 9dae91381c238b2c54a5fe2ffbf37d5ff73b5768..ba73e1a0f7f8dd4f4d52de2a7138d4a9325ed6e0 100644 (file)
                        $line["last_login"] = date(get_pref($link, 'SHORT_DATE_FORMAT'),
                                strtotime($line["last_login"]));
 
+                       $access_level_names = array(0 => "User", 10 => "Administrator");
+
 /*                     if ($uid == $_SESSION["uid"]) {
 
                                print "<td align='center'><input disabled=\"true\" type=\"checkbox\" 
                                        $line["email"] . "</td>";                       
 
                                print "<td><a href=\"javascript:editUser($uid);\">" . 
-                                       $line["access_level"] . "</td>";                        
+                                       $access_level_names[$line["access_level"]] . "</td>";                   
 
                        } else if ($uid != $edit_uid) {
 
 
                                print "<td>".$line["login"]."</td>";            
                                print "<td>".$line["email"]."</td>";            
-                               print "<td>".$line["access_level"]."</td>";             
+                               print "<td>".$access_level_names[$line["access_level"]]."</td>";
 
                        } else {
 
                                print "<td><input id=\"iedit_email\" value=\"".$line["email"].
                                        "\"></td>";
 
-                               print "<td><input id=\"iedit_ulevel\" value=\"".$line["access_level"].
-                                       "\"></td>";
-                                               
+//                             print "<td><input id=\"iedit_ulevel\" value=\"".$line["access_level"].
+//                                     "\"></td>";
+
+                               print "<td>";
+                               print "<select id=\"iedit_ulevel\">";
+                               foreach (array_keys($access_level_names) as $al) {
+                                       if ($al == $line["access_level"]) {
+                                               $selected = "selected";
+                                       } else {
+                                               $selected = "";
+                                       }                                       
+                                       print "<option $selected id=\"$al\">" . 
+                                               $access_level_names[$al] . "</option>";
+                               }
+                               print "</select>";
+                               print "</td>";
+
                        }
                                
                        print "<td>".$line["last_login"]."</td>";               
index 92bcc3bf9940c12fad455c6fe48014dde32db2fc..1d45b1cbf8b03c1f568e5c68719273193439d69f 100644 (file)
@@ -870,18 +870,22 @@ function leading_zero(p) {
 }
 
 function center_element(e) {
-       var c_width = document.body.clientWidth;
-       var c_height = document.body.clientHeight;
 
-       var c_scroll = document.body.scrollTop;
-
-       var e_width = e.clientWidth;
-       var e_height = e.clientHeight;
-
-       var set_y = (c_height / 2) + c_scroll - (e_height / 2);
-       var set_x = (c_width / 2) - (e_width / 2);
-
-       e.style.top = set_y + "px";
-       e.style.left = set_x + "px";
+       try {
+               var c_width = document.body.clientWidth;
+               var c_height = document.body.clientHeight;
+       
+               var c_scroll = document.body.scrollTop;
        
+               var e_width = e.clientWidth;
+               var e_height = e.clientHeight;
+       
+               var set_y = (c_height / 2) + c_scroll - (e_height / 2);
+               var set_x = (c_width / 2) - (e_width / 2);
+       
+               e.style.top = set_y + "px";
+               e.style.left = set_x + "px";
+       } catch (e) {
+               exception_error("center_element", e);
+       }
 }
index 1f74ae83d41bf7a9c83a630fdf908d15d75f4e74..8d15d5c22439f4efda902880f204ed50130169ba 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -153,7 +153,6 @@ function infobox_callback() {
                        box.innerHTML=xmlhttp.responseText;                     
                        if (shadow) {
                                shadow.style.display = "block";
-                               center_element(shadow);
                        } else {
                                box.style.display = "block";                            
                        }
@@ -899,7 +898,10 @@ function userEditSave() {
        }
 
        var login = document.getElementById("iedit_ulogin").value;
-       var level = document.getElementById("iedit_ulevel").value;
+       var level = document.getElementById("iedit_ulevel");
+
+       level = level[level.selectedIndex].id;
+       
        var email = document.getElementById("iedit_email").value;
 
        if (login.length == 0) {
index 6c85c713c48bc09635c4593a964ca28b906e9efe..ed320a0c20a48a5d5db3faebcd702a9256c69f1a 100644 (file)
@@ -555,6 +555,8 @@ div.helpResponse {
        background-image : url("images/shadow.png");
        position : absolute;
        width : 30%;
+       left : 35%;
+       top : 30%;
        z-index : 3;
        display : none;
 }