Fossil SCM

On the "setup_ulist" (list of users) webpage, group the special category users ("anonoymous", "nobody", "reader", "developer") together at the top of the screen, rather than interspersing them among the regular users.

drh 2012-04-28 15:00 trunk
Commit 2079981fd6b9c11a6e7a06fdcba4d4c7705786ed
1 file changed +40 -8
+40 -8
--- src/setup.c
+++ src/setup.c
@@ -106,10 +106,11 @@
106106
** Show a list of users. Clicking on any user jumps to the edit
107107
** screen for that user.
108108
*/
109109
void setup_ulist(void){
110110
Stmt s;
111
+ int prevLevel = 0;
111112
112113
login_check_credentials();
113114
if( !g.perm.Admin ){
114115
login_needed();
115116
return;
@@ -119,24 +120,55 @@
119120
style_header("User List");
120121
@ <table class="usetupLayoutTable">
121122
@ <tr><td class="usetupColumnLayout">
122123
@ <span class="note">Users:</span>
123124
@ <table class="usetupUserList">
124
- @ <tr>
125
- @ <th class="usetupListUser" style="text-align: right;padding-right: 20px;">User&nbsp;ID</th>
126
- @ <th class="usetupListCap" style="text-align: center;padding-right: 15px;">Capabilities</th>
127
- @ <th class="usetupListCon" style="text-align: left;">Contact&nbsp;Info</th>
128
- @ </tr>
129
- db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
125
+ prevLevel = 0;
126
+ db_prepare(&s,
127
+ "SELECT uid, login, cap, info, 1 FROM user"
128
+ " WHERE login IN ('anonymous','nobody','developer','reader') "
129
+ " UNION ALL "
130
+ "SELECT uid, login, cap, info, 2 FROM user"
131
+ " WHERE login NOT IN ('anonymous','nobody','developer','reader') "
132
+ "ORDER BY 5, 2"
133
+ );
130134
while( db_step(&s)==SQLITE_ROW ){
135
+ int iLevel = db_column_int(&s, 4);
131136
const char *zCap = db_column_text(&s, 2);
137
+ const char *zLogin = db_column_text(&s, 1);
138
+ if( iLevel>prevLevel ){
139
+ if( prevLevel>0 ){
140
+ @ <tr><td colspan="3"><hr></td></tr>
141
+ }
142
+ if( iLevel==1 ){
143
+ @ <tr>
144
+ @ <th class="usetupListUser"
145
+ @ style="text-align: right;padding-right: 20px;">Category</th>
146
+ @ <th class="usetupListCap"
147
+ @ style="text-align: center;padding-right: 15px;">Capabilities</th>
148
+ @ <th class="usetupListCon"
149
+ @ style="text-align: left;">Notes</th>
150
+ @ </tr>
151
+ }else{
152
+ @ <tr>
153
+ @ <th class="usetupListUser"
154
+ @ style="text-align: right;padding-right: 20px;">User&nbsp;ID</th>
155
+ @ <th class="usetupListCap"
156
+ @ style="text-align: center;padding-right: 15px;">Capabilities</th>
157
+ @ <th class="usetupListCon"
158
+ @ style="text-align: left;">Contact&nbsp;Info</th>
159
+ @ </tr>
160
+ }
161
+ prevLevel = iLevel;
162
+ }
132163
@ <tr>
133
- @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
164
+ @ <td class="usetupListUser"
165
+ @ style="text-align: right;padding-right: 20px;white-space:nowrap;">
134166
if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
135167
@ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
136168
}
137
- @ %h(db_column_text(&s,1))
169
+ @ %h(zLogin)
138170
if( g.perm.Admin ){
139171
@ </a>
140172
}
141173
@ </td>
142174
@ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
143175
--- src/setup.c
+++ src/setup.c
@@ -106,10 +106,11 @@
106 ** Show a list of users. Clicking on any user jumps to the edit
107 ** screen for that user.
108 */
109 void setup_ulist(void){
110 Stmt s;
 
111
112 login_check_credentials();
113 if( !g.perm.Admin ){
114 login_needed();
115 return;
@@ -119,24 +120,55 @@
119 style_header("User List");
120 @ <table class="usetupLayoutTable">
121 @ <tr><td class="usetupColumnLayout">
122 @ <span class="note">Users:</span>
123 @ <table class="usetupUserList">
124 @ <tr>
125 @ <th class="usetupListUser" style="text-align: right;padding-right: 20px;">User&nbsp;ID</th>
126 @ <th class="usetupListCap" style="text-align: center;padding-right: 15px;">Capabilities</th>
127 @ <th class="usetupListCon" style="text-align: left;">Contact&nbsp;Info</th>
128 @ </tr>
129 db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
 
 
 
130 while( db_step(&s)==SQLITE_ROW ){
 
131 const char *zCap = db_column_text(&s, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132 @ <tr>
133 @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
 
134 if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
135 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
136 }
137 @ %h(db_column_text(&s,1))
138 if( g.perm.Admin ){
139 @ </a>
140 }
141 @ </td>
142 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
143
--- src/setup.c
+++ src/setup.c
@@ -106,10 +106,11 @@
106 ** Show a list of users. Clicking on any user jumps to the edit
107 ** screen for that user.
108 */
109 void setup_ulist(void){
110 Stmt s;
111 int prevLevel = 0;
112
113 login_check_credentials();
114 if( !g.perm.Admin ){
115 login_needed();
116 return;
@@ -119,24 +120,55 @@
120 style_header("User List");
121 @ <table class="usetupLayoutTable">
122 @ <tr><td class="usetupColumnLayout">
123 @ <span class="note">Users:</span>
124 @ <table class="usetupUserList">
125 prevLevel = 0;
126 db_prepare(&s,
127 "SELECT uid, login, cap, info, 1 FROM user"
128 " WHERE login IN ('anonymous','nobody','developer','reader') "
129 " UNION ALL "
130 "SELECT uid, login, cap, info, 2 FROM user"
131 " WHERE login NOT IN ('anonymous','nobody','developer','reader') "
132 "ORDER BY 5, 2"
133 );
134 while( db_step(&s)==SQLITE_ROW ){
135 int iLevel = db_column_int(&s, 4);
136 const char *zCap = db_column_text(&s, 2);
137 const char *zLogin = db_column_text(&s, 1);
138 if( iLevel>prevLevel ){
139 if( prevLevel>0 ){
140 @ <tr><td colspan="3"><hr></td></tr>
141 }
142 if( iLevel==1 ){
143 @ <tr>
144 @ <th class="usetupListUser"
145 @ style="text-align: right;padding-right: 20px;">Category</th>
146 @ <th class="usetupListCap"
147 @ style="text-align: center;padding-right: 15px;">Capabilities</th>
148 @ <th class="usetupListCon"
149 @ style="text-align: left;">Notes</th>
150 @ </tr>
151 }else{
152 @ <tr>
153 @ <th class="usetupListUser"
154 @ style="text-align: right;padding-right: 20px;">User&nbsp;ID</th>
155 @ <th class="usetupListCap"
156 @ style="text-align: center;padding-right: 15px;">Capabilities</th>
157 @ <th class="usetupListCon"
158 @ style="text-align: left;">Contact&nbsp;Info</th>
159 @ </tr>
160 }
161 prevLevel = iLevel;
162 }
163 @ <tr>
164 @ <td class="usetupListUser"
165 @ style="text-align: right;padding-right: 20px;white-space:nowrap;">
166 if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
167 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
168 }
169 @ %h(zLogin)
170 if( g.perm.Admin ){
171 @ </a>
172 }
173 @ </td>
174 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
175

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button