Fossil SCM

Tidy up the raw tags web page, and provide a way to get there, for admins only

eric 2008-11-26 21:59 trunk
Commit 8d529a7ae9b00d3cb39d4e7b56bfa1e089a18795
3 files changed +2 -2 +5 +19 -6
+2 -2
--- src/db.c
+++ src/db.c
@@ -1395,11 +1395,11 @@
13951395
const char *zUuid; /* The UUID to render */
13961396
char *z; /* Rendered HTML text */
13971397
13981398
zUuid = (const char*)sqlite3_value_text(argv[0]);
13991399
if( g.okHistory && zUuid && strlen(zUuid)>=10 ){
1400
- z = mprintf("<tt><a href='%s/vinfo/%t'><span style='font-size:1.5em'>"
1400
+ z = mprintf("<tt><a href='%s/info/%t'><span style='font-size:1.5em'>"
14011401
"%#h</span>%h</a></tt>",
14021402
g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]);
14031403
sqlite3_result_text(pCxt, z, -1, free);
14041404
}else{
14051405
sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT);
@@ -1440,11 +1440,11 @@
14401440
const char *zTag; /* The tag to render */
14411441
char *z; /* rendered html text */
14421442
14431443
zTag = (const char*)sqlite3_value_text(argv[0]);
14441444
if( g.okHistory ){
1445
- z = mprintf("<a href='%s/tagview?name=%T'>%h</a>",
1445
+ z = mprintf("<a href='%s/tagview?name=%T&raw=y'>%h</a>",
14461446
g.zBaseURL, zTag, zTag);
14471447
}else{
14481448
z = mprintf("%h", zTag);
14491449
}
14501450
sqlite3_result_text(pCxt, z, -1, free);
14511451
--- src/db.c
+++ src/db.c
@@ -1395,11 +1395,11 @@
1395 const char *zUuid; /* The UUID to render */
1396 char *z; /* Rendered HTML text */
1397
1398 zUuid = (const char*)sqlite3_value_text(argv[0]);
1399 if( g.okHistory && zUuid && strlen(zUuid)>=10 ){
1400 z = mprintf("<tt><a href='%s/vinfo/%t'><span style='font-size:1.5em'>"
1401 "%#h</span>%h</a></tt>",
1402 g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]);
1403 sqlite3_result_text(pCxt, z, -1, free);
1404 }else{
1405 sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT);
@@ -1440,11 +1440,11 @@
1440 const char *zTag; /* The tag to render */
1441 char *z; /* rendered html text */
1442
1443 zTag = (const char*)sqlite3_value_text(argv[0]);
1444 if( g.okHistory ){
1445 z = mprintf("<a href='%s/tagview?name=%T'>%h</a>",
1446 g.zBaseURL, zTag, zTag);
1447 }else{
1448 z = mprintf("%h", zTag);
1449 }
1450 sqlite3_result_text(pCxt, z, -1, free);
1451
--- src/db.c
+++ src/db.c
@@ -1395,11 +1395,11 @@
1395 const char *zUuid; /* The UUID to render */
1396 char *z; /* Rendered HTML text */
1397
1398 zUuid = (const char*)sqlite3_value_text(argv[0]);
1399 if( g.okHistory && zUuid && strlen(zUuid)>=10 ){
1400 z = mprintf("<tt><a href='%s/info/%t'><span style='font-size:1.5em'>"
1401 "%#h</span>%h</a></tt>",
1402 g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]);
1403 sqlite3_result_text(pCxt, z, -1, free);
1404 }else{
1405 sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT);
@@ -1440,11 +1440,11 @@
1440 const char *zTag; /* The tag to render */
1441 char *z; /* rendered html text */
1442
1443 zTag = (const char*)sqlite3_value_text(argv[0]);
1444 if( g.okHistory ){
1445 z = mprintf("<a href='%s/tagview?name=%T&raw=y'>%h</a>",
1446 g.zBaseURL, zTag, zTag);
1447 }else{
1448 z = mprintf("%h", zTag);
1449 }
1450 sqlite3_result_text(pCxt, z, -1, free);
1451
--- src/style.c
+++ src/style.c
@@ -368,10 +368,15 @@
368368
@ .achtung {
369369
@ color: #ff0000;
370370
@ background: #ffff00;
371371
@ border: 1px solid #ff0000;
372372
@ }
373
+@
374
+@ div.miniform {
375
+@ font-size: smaller;
376
+@ margin: 8px;
377
+@ }
373378
@
374379
@ table.fossil_db_generic_query_view {
375380
@ border-spacing: 0px;
376381
@ border: 1px solid black;
377382
@ }
378383
--- src/style.c
+++ src/style.c
@@ -368,10 +368,15 @@
368 @ .achtung {
369 @ color: #ff0000;
370 @ background: #ffff00;
371 @ border: 1px solid #ff0000;
372 @ }
 
 
 
 
 
373 @
374 @ table.fossil_db_generic_query_view {
375 @ border-spacing: 0px;
376 @ border: 1px solid black;
377 @ }
378
--- src/style.c
+++ src/style.c
@@ -368,10 +368,15 @@
368 @ .achtung {
369 @ color: #ff0000;
370 @ background: #ffff00;
371 @ border: 1px solid #ff0000;
372 @ }
373 @
374 @ div.miniform {
375 @ font-size: smaller;
376 @ margin: 8px;
377 @ }
378 @
379 @ table.fossil_db_generic_query_view {
380 @ border-spacing: 0px;
381 @ border: 1px solid black;
382 @ }
383
+19 -6
--- src/tagview.c
+++ src/tagview.c
@@ -77,11 +77,11 @@
7777
/*
7878
** A small search form which forwards to ?like=SEARCH_STRING
7979
*/
8080
static void tagview_page_search_miniform(void){
8181
char const * like = P("like");
82
- @ <div style='font-size:smaller'>
82
+ @ <div class='miniform'>
8383
@ <form action='tagview' method='post'>
8484
@ Search for tags:
8585
@ <input type='text' name='like' value='%h((like?like:""))' size='10'/>
8686
@ <input type='submit'/>
8787
@ <input type='hidden' name='raw' value='y'/>
@@ -124,17 +124,19 @@
124124
char *zSql;
125125
@ <h2>Tag '%s(tagname)':</h2>
126126
zSql = mprintf(
127127
"SELECT DISTINCT"
128128
" linktagid(t.tagid) AS 'Tag ID',"
129
+ " linktagname(t.tagname) AS 'Name',"
129130
" DATETIME(tx.mtime) AS 'Timestamp',"
130131
" linkuuid(b.uuid) AS 'Version'"
131132
" FROM tag t, tagxref tx, blob b "
132
- " WHERE t.tagname='%q' AND t.tagid=tx.tagid AND tx.rid=b.rid "
133
+ " WHERE ( t.tagname='%q' OR t.tagname='sym-%q') "
134
+ " AND t.tagid=tx.tagid AND tx.rid=b.rid "
133135
TAGVIEW_DEFAULT_FILTER
134136
" ORDER BY tx.mtime DESC",
135
- tagname);
137
+ tagname,tagname);
136138
db_generic_query_view(zSql, 1);
137139
free(zSql);
138140
}
139141
140142
/*
@@ -145,11 +147,11 @@
145147
login_check_credentials();
146148
/* if( !g.okRdWiki ){ */
147149
if( !g.okAdmin ){
148150
login_needed();
149151
}
150
- style_header("Tags");
152
+ style_header("Raw Tags");
151153
login_anonymous_available();
152154
tagview_page_search_miniform();
153155
@ <hr/>
154156
if( 0 != (check = P("tagid")) ){
155157
tagview_page_tag_by_id( atoi(check) );
@@ -187,10 +189,11 @@
187189
/*
188190
** WEBPAGE: /tagview
189191
*/
190192
void tagview_page(void){
191193
char const *zName = 0;
194
+ char const *zTitle = 0;
192195
int nTag = 0;
193196
login_check_credentials();
194197
if( !g.okRead ){
195198
login_needed();
196199
}
@@ -199,11 +202,15 @@
199202
return;
200203
}
201204
login_anonymous_available();
202205
if( 0 != (zName = P("name")) ){
203206
Blob uuid;
204
- style_header("Tagged Artifacts");
207
+ if( g.okAdmin ){
208
+ style_submenu_element("RawTags", "Internal Ticket View",
209
+ "%s/tagview?name=%s&raw=y", g.zTop, zName);
210
+ }
211
+ zTitle = "Tagged Artifacts";
205212
@ <h2>%s(zName):</h2>
206213
if( sym_tag_to_uuid(zName, &uuid) > 0){
207214
tagview_print_timeline(zName, "sym-");
208215
}else if( tag_to_uuid(zName, &uuid, "") > 0){
209216
tagview_print_timeline(zName, "");
@@ -212,11 +219,15 @@
212219
}
213220
}else{
214221
Stmt q;
215222
const char *prefix = "sym-";
216223
int preflen = strlen(prefix);
217
- style_header("Tags");
224
+ if( g.okAdmin ){
225
+ style_submenu_element("RawTags", "Internal Ticket View",
226
+ "%s/tagview?raw=y", g.zTop);
227
+ }
228
+ zTitle = "Tags";
218229
db_prepare(&q,
219230
"SELECT tagname"
220231
" FROM tag"
221232
" WHERE EXISTS(SELECT 1 FROM tagxref"
222233
" WHERE tagid=tag.tagid"
@@ -255,10 +266,11 @@
255266
if( nTag == 0) {
256267
@ There are no relevant tags.
257268
}
258269
db_finalize(&q);
259270
}
271
+ style_header(zTitle);
260272
/*
261273
* Put in dummy functions since www_print_timeline has generated calls to
262274
* them. Some browsers don't seem to care, but better to be safe.
263275
* Actually, it would be nice to use the functions on this page, but at
264276
* the moment it looks to be too difficult.
@@ -267,7 +279,8 @@
267279
@ function xin(id){
268280
@ }
269281
@ function xout(id){
270282
@ }
271283
@ </script>
284
+
272285
style_footer();
273286
}
274287
--- src/tagview.c
+++ src/tagview.c
@@ -77,11 +77,11 @@
77 /*
78 ** A small search form which forwards to ?like=SEARCH_STRING
79 */
80 static void tagview_page_search_miniform(void){
81 char const * like = P("like");
82 @ <div style='font-size:smaller'>
83 @ <form action='tagview' method='post'>
84 @ Search for tags:
85 @ <input type='text' name='like' value='%h((like?like:""))' size='10'/>
86 @ <input type='submit'/>
87 @ <input type='hidden' name='raw' value='y'/>
@@ -124,17 +124,19 @@
124 char *zSql;
125 @ <h2>Tag '%s(tagname)':</h2>
126 zSql = mprintf(
127 "SELECT DISTINCT"
128 " linktagid(t.tagid) AS 'Tag ID',"
 
129 " DATETIME(tx.mtime) AS 'Timestamp',"
130 " linkuuid(b.uuid) AS 'Version'"
131 " FROM tag t, tagxref tx, blob b "
132 " WHERE t.tagname='%q' AND t.tagid=tx.tagid AND tx.rid=b.rid "
 
133 TAGVIEW_DEFAULT_FILTER
134 " ORDER BY tx.mtime DESC",
135 tagname);
136 db_generic_query_view(zSql, 1);
137 free(zSql);
138 }
139
140 /*
@@ -145,11 +147,11 @@
145 login_check_credentials();
146 /* if( !g.okRdWiki ){ */
147 if( !g.okAdmin ){
148 login_needed();
149 }
150 style_header("Tags");
151 login_anonymous_available();
152 tagview_page_search_miniform();
153 @ <hr/>
154 if( 0 != (check = P("tagid")) ){
155 tagview_page_tag_by_id( atoi(check) );
@@ -187,10 +189,11 @@
187 /*
188 ** WEBPAGE: /tagview
189 */
190 void tagview_page(void){
191 char const *zName = 0;
 
192 int nTag = 0;
193 login_check_credentials();
194 if( !g.okRead ){
195 login_needed();
196 }
@@ -199,11 +202,15 @@
199 return;
200 }
201 login_anonymous_available();
202 if( 0 != (zName = P("name")) ){
203 Blob uuid;
204 style_header("Tagged Artifacts");
 
 
 
 
205 @ <h2>%s(zName):</h2>
206 if( sym_tag_to_uuid(zName, &uuid) > 0){
207 tagview_print_timeline(zName, "sym-");
208 }else if( tag_to_uuid(zName, &uuid, "") > 0){
209 tagview_print_timeline(zName, "");
@@ -212,11 +219,15 @@
212 }
213 }else{
214 Stmt q;
215 const char *prefix = "sym-";
216 int preflen = strlen(prefix);
217 style_header("Tags");
 
 
 
 
218 db_prepare(&q,
219 "SELECT tagname"
220 " FROM tag"
221 " WHERE EXISTS(SELECT 1 FROM tagxref"
222 " WHERE tagid=tag.tagid"
@@ -255,10 +266,11 @@
255 if( nTag == 0) {
256 @ There are no relevant tags.
257 }
258 db_finalize(&q);
259 }
 
260 /*
261 * Put in dummy functions since www_print_timeline has generated calls to
262 * them. Some browsers don't seem to care, but better to be safe.
263 * Actually, it would be nice to use the functions on this page, but at
264 * the moment it looks to be too difficult.
@@ -267,7 +279,8 @@
267 @ function xin(id){
268 @ }
269 @ function xout(id){
270 @ }
271 @ </script>
 
272 style_footer();
273 }
274
--- src/tagview.c
+++ src/tagview.c
@@ -77,11 +77,11 @@
77 /*
78 ** A small search form which forwards to ?like=SEARCH_STRING
79 */
80 static void tagview_page_search_miniform(void){
81 char const * like = P("like");
82 @ <div class='miniform'>
83 @ <form action='tagview' method='post'>
84 @ Search for tags:
85 @ <input type='text' name='like' value='%h((like?like:""))' size='10'/>
86 @ <input type='submit'/>
87 @ <input type='hidden' name='raw' value='y'/>
@@ -124,17 +124,19 @@
124 char *zSql;
125 @ <h2>Tag '%s(tagname)':</h2>
126 zSql = mprintf(
127 "SELECT DISTINCT"
128 " linktagid(t.tagid) AS 'Tag ID',"
129 " linktagname(t.tagname) AS 'Name',"
130 " DATETIME(tx.mtime) AS 'Timestamp',"
131 " linkuuid(b.uuid) AS 'Version'"
132 " FROM tag t, tagxref tx, blob b "
133 " WHERE ( t.tagname='%q' OR t.tagname='sym-%q') "
134 " AND t.tagid=tx.tagid AND tx.rid=b.rid "
135 TAGVIEW_DEFAULT_FILTER
136 " ORDER BY tx.mtime DESC",
137 tagname,tagname);
138 db_generic_query_view(zSql, 1);
139 free(zSql);
140 }
141
142 /*
@@ -145,11 +147,11 @@
147 login_check_credentials();
148 /* if( !g.okRdWiki ){ */
149 if( !g.okAdmin ){
150 login_needed();
151 }
152 style_header("Raw Tags");
153 login_anonymous_available();
154 tagview_page_search_miniform();
155 @ <hr/>
156 if( 0 != (check = P("tagid")) ){
157 tagview_page_tag_by_id( atoi(check) );
@@ -187,10 +189,11 @@
189 /*
190 ** WEBPAGE: /tagview
191 */
192 void tagview_page(void){
193 char const *zName = 0;
194 char const *zTitle = 0;
195 int nTag = 0;
196 login_check_credentials();
197 if( !g.okRead ){
198 login_needed();
199 }
@@ -199,11 +202,15 @@
202 return;
203 }
204 login_anonymous_available();
205 if( 0 != (zName = P("name")) ){
206 Blob uuid;
207 if( g.okAdmin ){
208 style_submenu_element("RawTags", "Internal Ticket View",
209 "%s/tagview?name=%s&raw=y", g.zTop, zName);
210 }
211 zTitle = "Tagged Artifacts";
212 @ <h2>%s(zName):</h2>
213 if( sym_tag_to_uuid(zName, &uuid) > 0){
214 tagview_print_timeline(zName, "sym-");
215 }else if( tag_to_uuid(zName, &uuid, "") > 0){
216 tagview_print_timeline(zName, "");
@@ -212,11 +219,15 @@
219 }
220 }else{
221 Stmt q;
222 const char *prefix = "sym-";
223 int preflen = strlen(prefix);
224 if( g.okAdmin ){
225 style_submenu_element("RawTags", "Internal Ticket View",
226 "%s/tagview?raw=y", g.zTop);
227 }
228 zTitle = "Tags";
229 db_prepare(&q,
230 "SELECT tagname"
231 " FROM tag"
232 " WHERE EXISTS(SELECT 1 FROM tagxref"
233 " WHERE tagid=tag.tagid"
@@ -255,10 +266,11 @@
266 if( nTag == 0) {
267 @ There are no relevant tags.
268 }
269 db_finalize(&q);
270 }
271 style_header(zTitle);
272 /*
273 * Put in dummy functions since www_print_timeline has generated calls to
274 * them. Some browsers don't seem to care, but better to be safe.
275 * Actually, it would be nice to use the functions on this page, but at
276 * the moment it looks to be too difficult.
@@ -267,7 +279,8 @@
279 @ function xin(id){
280 @ }
281 @ function xout(id){
282 @ }
283 @ </script>
284
285 style_footer();
286 }
287

Keyboard Shortcuts

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