Fossil SCM

Include the login-group in the repository list of "fossil all ui".

drh 2021-06-07 17:48 trunk
Commit fe178faa44f3f97ef609ca6f9bb6ba57d9db9b4f73217bc97eb5a13192b0b4b3
1 file changed +19 -3
+19 -3
--- src/repolist.c
+++ src/repolist.c
@@ -31,10 +31,11 @@
3131
int isValid; /* True if zRepoName is a valid Fossil repository */
3232
int isRepolistSkin; /* 1 or 2 if this repository wants to be the skin
3333
** for the repository list. 2 means do use this
3434
** repository but do not display it in the list. */
3535
char *zProjName; /* Project Name. Memory from fossil_malloc() */
36
+ char *zLoginGroup; /* Name of login group, or NULL. Malloced() */
3637
double rMTime; /* Last update. Julian day number */
3738
};
3839
#endif
3940
4041
/*
@@ -48,10 +49,11 @@
4849
int rc;
4950
5051
pRepo->isRepolistSkin = 0;
5152
pRepo->isValid = 0;
5253
pRepo->zProjName = 0;
54
+ pRepo->zLoginGroup = 0;
5355
pRepo->rMTime = 0.0;
5456
5557
g.dbIgnoreErrors++;
5658
rc = sqlite3_open_v2(pRepo->zRepoName, &db, SQLITE_OPEN_READWRITE, 0);
5759
if( rc ) goto finish_repo_list;
@@ -69,10 +71,17 @@
6971
-1, &pStmt, 0);
7072
if( rc ) goto finish_repo_list;
7173
if( sqlite3_step(pStmt)==SQLITE_ROW ){
7274
pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
7375
}
76
+ sqlite3_finalize(pStmt);
77
+ rc = sqlite3_prepare_v2(db, "SELECT value FROM config"
78
+ " WHERE name='login-group-name'",
79
+ -1, &pStmt, 0);
80
+ if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
81
+ pRepo->zLoginGroup = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
82
+ }
7483
sqlite3_finalize(pStmt);
7584
rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0);
7685
if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
7786
pRepo->rMTime = sqlite3_column_double(pStmt,0);
7887
}
@@ -149,14 +158,15 @@
149158
}else{
150159
Stmt q;
151160
double rNow;
152161
blob_append_sql(&html,
153162
"<table border='0' class='sortable' data-init-sort='1'"
154
- " data-column-types='txtxk'><thead>\n"
163
+ " data-column-types='txtxkxt'><thead>\n"
155164
"<tr><th>Filename<th width='20'>"
156165
"<th>Project Name<th width='20'>"
157
- "<th>Last Modified</tr>\n"
166
+ "<th>Last Modified<th width='20'>"
167
+ "<th>Login Group</tr>\n"
158168
"</thead><tbody>\n");
159169
db_prepare(&q, "SELECT pathname"
160170
" FROM sfile ORDER BY pathname COLLATE nocase;");
161171
rNow = db_double(0, "SELECT julianday('now')");
162172
while( db_step(&q)==SQLITE_ROW ){
@@ -223,13 +233,19 @@
223233
fossil_free(x.zProjName);
224234
}else{
225235
blob_append_sql(&html, "<td></td><td></td>\n");
226236
}
227237
blob_append_sql(&html,
228
- "<td></td><td data-sortkey='%08x'>%h</tr>\n",
238
+ "<td></td><td data-sortkey='%08x'>%h</td>\n",
229239
iAge, zAge);
230240
fossil_free(zAge);
241
+ if( x.zLoginGroup ){
242
+ blob_append_sql(&html, "<td></td><td>%h</td></tr>\n", x.zLoginGroup);
243
+ fossil_free(x.zLoginGroup);
244
+ }else{
245
+ blob_append_sql(&html, "<td></td><td></td></tr>\n");
246
+ }
231247
sqlite3_free(zUrl);
232248
}
233249
db_finalize(&q);
234250
blob_append_sql(&html,"</tbody></table>\n");
235251
}
236252
--- src/repolist.c
+++ src/repolist.c
@@ -31,10 +31,11 @@
31 int isValid; /* True if zRepoName is a valid Fossil repository */
32 int isRepolistSkin; /* 1 or 2 if this repository wants to be the skin
33 ** for the repository list. 2 means do use this
34 ** repository but do not display it in the list. */
35 char *zProjName; /* Project Name. Memory from fossil_malloc() */
 
36 double rMTime; /* Last update. Julian day number */
37 };
38 #endif
39
40 /*
@@ -48,10 +49,11 @@
48 int rc;
49
50 pRepo->isRepolistSkin = 0;
51 pRepo->isValid = 0;
52 pRepo->zProjName = 0;
 
53 pRepo->rMTime = 0.0;
54
55 g.dbIgnoreErrors++;
56 rc = sqlite3_open_v2(pRepo->zRepoName, &db, SQLITE_OPEN_READWRITE, 0);
57 if( rc ) goto finish_repo_list;
@@ -69,10 +71,17 @@
69 -1, &pStmt, 0);
70 if( rc ) goto finish_repo_list;
71 if( sqlite3_step(pStmt)==SQLITE_ROW ){
72 pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
73 }
 
 
 
 
 
 
 
74 sqlite3_finalize(pStmt);
75 rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0);
76 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
77 pRepo->rMTime = sqlite3_column_double(pStmt,0);
78 }
@@ -149,14 +158,15 @@
149 }else{
150 Stmt q;
151 double rNow;
152 blob_append_sql(&html,
153 "<table border='0' class='sortable' data-init-sort='1'"
154 " data-column-types='txtxk'><thead>\n"
155 "<tr><th>Filename<th width='20'>"
156 "<th>Project Name<th width='20'>"
157 "<th>Last Modified</tr>\n"
 
158 "</thead><tbody>\n");
159 db_prepare(&q, "SELECT pathname"
160 " FROM sfile ORDER BY pathname COLLATE nocase;");
161 rNow = db_double(0, "SELECT julianday('now')");
162 while( db_step(&q)==SQLITE_ROW ){
@@ -223,13 +233,19 @@
223 fossil_free(x.zProjName);
224 }else{
225 blob_append_sql(&html, "<td></td><td></td>\n");
226 }
227 blob_append_sql(&html,
228 "<td></td><td data-sortkey='%08x'>%h</tr>\n",
229 iAge, zAge);
230 fossil_free(zAge);
 
 
 
 
 
 
231 sqlite3_free(zUrl);
232 }
233 db_finalize(&q);
234 blob_append_sql(&html,"</tbody></table>\n");
235 }
236
--- src/repolist.c
+++ src/repolist.c
@@ -31,10 +31,11 @@
31 int isValid; /* True if zRepoName is a valid Fossil repository */
32 int isRepolistSkin; /* 1 or 2 if this repository wants to be the skin
33 ** for the repository list. 2 means do use this
34 ** repository but do not display it in the list. */
35 char *zProjName; /* Project Name. Memory from fossil_malloc() */
36 char *zLoginGroup; /* Name of login group, or NULL. Malloced() */
37 double rMTime; /* Last update. Julian day number */
38 };
39 #endif
40
41 /*
@@ -48,10 +49,11 @@
49 int rc;
50
51 pRepo->isRepolistSkin = 0;
52 pRepo->isValid = 0;
53 pRepo->zProjName = 0;
54 pRepo->zLoginGroup = 0;
55 pRepo->rMTime = 0.0;
56
57 g.dbIgnoreErrors++;
58 rc = sqlite3_open_v2(pRepo->zRepoName, &db, SQLITE_OPEN_READWRITE, 0);
59 if( rc ) goto finish_repo_list;
@@ -69,10 +71,17 @@
71 -1, &pStmt, 0);
72 if( rc ) goto finish_repo_list;
73 if( sqlite3_step(pStmt)==SQLITE_ROW ){
74 pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
75 }
76 sqlite3_finalize(pStmt);
77 rc = sqlite3_prepare_v2(db, "SELECT value FROM config"
78 " WHERE name='login-group-name'",
79 -1, &pStmt, 0);
80 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
81 pRepo->zLoginGroup = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
82 }
83 sqlite3_finalize(pStmt);
84 rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0);
85 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
86 pRepo->rMTime = sqlite3_column_double(pStmt,0);
87 }
@@ -149,14 +158,15 @@
158 }else{
159 Stmt q;
160 double rNow;
161 blob_append_sql(&html,
162 "<table border='0' class='sortable' data-init-sort='1'"
163 " data-column-types='txtxkxt'><thead>\n"
164 "<tr><th>Filename<th width='20'>"
165 "<th>Project Name<th width='20'>"
166 "<th>Last Modified<th width='20'>"
167 "<th>Login Group</tr>\n"
168 "</thead><tbody>\n");
169 db_prepare(&q, "SELECT pathname"
170 " FROM sfile ORDER BY pathname COLLATE nocase;");
171 rNow = db_double(0, "SELECT julianday('now')");
172 while( db_step(&q)==SQLITE_ROW ){
@@ -223,13 +233,19 @@
233 fossil_free(x.zProjName);
234 }else{
235 blob_append_sql(&html, "<td></td><td></td>\n");
236 }
237 blob_append_sql(&html,
238 "<td></td><td data-sortkey='%08x'>%h</td>\n",
239 iAge, zAge);
240 fossil_free(zAge);
241 if( x.zLoginGroup ){
242 blob_append_sql(&html, "<td></td><td>%h</td></tr>\n", x.zLoginGroup);
243 fossil_free(x.zLoginGroup);
244 }else{
245 blob_append_sql(&html, "<td></td><td></td></tr>\n");
246 }
247 sqlite3_free(zUrl);
248 }
249 db_finalize(&q);
250 blob_append_sql(&html,"</tbody></table>\n");
251 }
252

Keyboard Shortcuts

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