Fossil

Check-in [8d529a7a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tidy up the raw tags web page, and provide a way to get there, for admins only
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d529a7ae9b00d3cb39d4e7b56bfa1e089a18795
User & Date: eric 2008-11-26 21:59:42
Context
2008-11-26
22:24
Provide a "Revert to Default" button for editing CSS. Grammar fix on login page. check-in: adefb6c8 user: eric tags: trunk
21:59
Tidy up the raw tags web page, and provide a way to get there, for admins only check-in: 8d529a7a user: eric tags: trunk
03:26
Mention that check-in comments follow wiki formatting rules. If the check-in comment is blank, prompt the user to abort the check-in. check-in: 6f0a9f73 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
....
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
  sqlite3_value **argv       /* values of all function arguments */
){
  const char *zUuid;         /* The UUID to render */
  char *z;                   /* Rendered HTML text */

  zUuid = (const char*)sqlite3_value_text(argv[0]);
  if( g.okHistory && zUuid && strlen(zUuid)>=10 ){
    z = mprintf("<tt><a href='%s/vinfo/%t'><span style='font-size:1.5em'>"
                "%#h</span>%h</a></tt>",
                g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]);
    sqlite3_result_text(pCxt, z, -1, free);
  }else{
    sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT);
  }
}
................................................................................
  sqlite3_value **argv       /* values of all function arguments */
){
  const char *zTag;          /* The tag to render */
  char *z;                   /* rendered html text */

  zTag = (const char*)sqlite3_value_text(argv[0]);
  if( g.okHistory ){
    z = mprintf("<a href='%s/tagview?name=%T'>%h</a>", 
                  g.zBaseURL, zTag, zTag);
  }else{
    z = mprintf("%h", zTag);
  }
  sqlite3_result_text(pCxt, z, -1, free);
}








|







 







|







1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
....
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
  sqlite3_value **argv       /* values of all function arguments */
){
  const char *zUuid;         /* The UUID to render */
  char *z;                   /* Rendered HTML text */

  zUuid = (const char*)sqlite3_value_text(argv[0]);
  if( g.okHistory && zUuid && strlen(zUuid)>=10 ){
    z = mprintf("<tt><a href='%s/info/%t'><span style='font-size:1.5em'>"
                "%#h</span>%h</a></tt>",
                g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]);
    sqlite3_result_text(pCxt, z, -1, free);
  }else{
    sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT);
  }
}
................................................................................
  sqlite3_value **argv       /* values of all function arguments */
){
  const char *zTag;          /* The tag to render */
  char *z;                   /* rendered html text */

  zTag = (const char*)sqlite3_value_text(argv[0]);
  if( g.okHistory ){
    z = mprintf("<a href='%s/tagview?name=%T&raw=y'>%h</a>", 
                  g.zBaseURL, zTag, zTag);
  }else{
    z = mprintf("%h", zTag);
  }
  sqlite3_result_text(pCxt, z, -1, free);
}

Changes to src/style.c.

366
367
368
369
370
371
372





373
374
375
376
377
378
379
@    implemented" parts of a page. Whether or not to have
@    a 'border' attribute set is arguable. */
@ .achtung {
@   color: #ff0000;
@   background: #ffff00;
@   border: 1px solid #ff0000;
@ }





@
@ table.fossil_db_generic_query_view {
@   border-spacing: 0px;
@   border: 1px solid black;
@ }
@ table.fossil_db_generic_query_view td {
@   padding: 2px 1em 2px 1em;







>
>
>
>
>







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
@    implemented" parts of a page. Whether or not to have
@    a 'border' attribute set is arguable. */
@ .achtung {
@   color: #ff0000;
@   background: #ffff00;
@   border: 1px solid #ff0000;
@ }
@
@ div.miniform {
@     font-size: smaller;
@     margin: 8px;
@ } 
@
@ table.fossil_db_generic_query_view {
@   border-spacing: 0px;
@   border: 1px solid black;
@ }
@ table.fossil_db_generic_query_view td {
@   padding: 2px 1em 2px 1em;

Changes to src/tagview.c.

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
122
123
124
125
126
127
128

129
130
131

132
133
134
135
136
137
138
139
140
141
142
...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
...
185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
202
203




204
205
206
207
208
209
210
211
212
213
214
215
216
217




218
219
220
221
222
223
224
...
253
254
255
256
257
258
259

260
261
262
263
264
265
266
267
268
269
270
271

272
273
}

/*
** A small search form which forwards to ?like=SEARCH_STRING
*/
static void tagview_page_search_miniform(void){
  char const * like = P("like");
  @ <div style='font-size:smaller'>
  @ <form action='tagview' method='post'>
  @ Search for tags: 
  @ <input type='text' name='like' value='%h((like?like:""))' size='10'/>
  @ <input type='submit'/>
  @ <input type='hidden' name='raw' value='y'/>
  @ </form>
  @ </div>
................................................................................
*/
static void tagview_page_tag_by_name( char const * tagname ){
  char *zSql;
  @ <h2>Tag '%s(tagname)':</h2>
  zSql = mprintf( 
    "SELECT DISTINCT"
    "       linktagid(t.tagid) AS 'Tag ID',"

    "       DATETIME(tx.mtime) AS 'Timestamp',"
    "       linkuuid(b.uuid) AS 'Version'"
    "  FROM tag t, tagxref tx, blob b "

    " WHERE t.tagname='%q' AND t.tagid=tx.tagid AND tx.rid=b.rid "
    TAGVIEW_DEFAULT_FILTER
    " ORDER BY tx.mtime DESC",
    tagname);
  db_generic_query_view(zSql, 1);
  free(zSql);
}

/*
** Internal view of tags
*/
................................................................................
void raw_tagview_page(void){
  char const * check = 0;
  login_check_credentials();
  /* if( !g.okRdWiki ){ */
  if( !g.okAdmin ){
    login_needed();
  }
  style_header("Tags");
  login_anonymous_available();
  tagview_page_search_miniform();
  @ <hr/>
  if( 0 != (check = P("tagid")) ){
    tagview_page_tag_by_id( atoi(check) );
  }else if( 0 != (check = P("like")) ){
    tagview_page_list_tags( check );
................................................................................
}

/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;

  int nTag = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  if ( P("tagid") || P("like") || P("raw") ) {
    raw_tagview_page();
    return;
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;




    style_header("Tagged Artifacts");
    @ <h2>%s(zName):</h2>
    if( sym_tag_to_uuid(zName, &uuid) > 0){
      tagview_print_timeline(zName, "sym-");
    }else if( tag_to_uuid(zName, &uuid, "") > 0){
      tagview_print_timeline(zName, "");
    }else{
      @ There is no artifact with this tag.
    }
  }else{
    Stmt q;
    const char *prefix = "sym-";
    int preflen = strlen(prefix);
    style_header("Tags");




    db_prepare(&q,
      "SELECT tagname"
      "  FROM tag"
      " WHERE EXISTS(SELECT 1 FROM tagxref"
      "               WHERE tagid=tag.tagid"
      "                 AND tagtype>0)"
      " AND tagid > %d"
................................................................................
    }
    @ </ul>
    if( nTag == 0) {
      @ There are no relevant tags.
    }
    db_finalize(&q);
  }

  /*
   * Put in dummy functions since www_print_timeline has generated calls to
   * them. Some browsers don't seem to care, but better to be safe.
   * Actually, it would be nice to use the functions on this page, but at
   * the moment it looks to be too difficult.
   */
  @ <script>
  @ function xin(id){
  @ }
  @ function xout(id){
  @ }
  @ </script>

  style_footer();
}







|







 







>



>
|


|







 







|







 







>












>
>
>
>
|












|
>
>
>
>







 







>












>


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
}

/*
** A small search form which forwards to ?like=SEARCH_STRING
*/
static void tagview_page_search_miniform(void){
  char const * like = P("like");
  @ <div class='miniform'>
  @ <form action='tagview' method='post'>
  @ Search for tags: 
  @ <input type='text' name='like' value='%h((like?like:""))' size='10'/>
  @ <input type='submit'/>
  @ <input type='hidden' name='raw' value='y'/>
  @ </form>
  @ </div>
................................................................................
*/
static void tagview_page_tag_by_name( char const * tagname ){
  char *zSql;
  @ <h2>Tag '%s(tagname)':</h2>
  zSql = mprintf( 
    "SELECT DISTINCT"
    "       linktagid(t.tagid) AS 'Tag ID',"
    "       linktagname(t.tagname) AS 'Name',"
    "       DATETIME(tx.mtime) AS 'Timestamp',"
    "       linkuuid(b.uuid) AS 'Version'"
    "  FROM tag t, tagxref tx, blob b "
    " WHERE ( t.tagname='%q' OR  t.tagname='sym-%q') "
    "   AND t.tagid=tx.tagid AND tx.rid=b.rid "
    TAGVIEW_DEFAULT_FILTER
    " ORDER BY tx.mtime DESC",
    tagname,tagname);
  db_generic_query_view(zSql, 1);
  free(zSql);
}

/*
** Internal view of tags
*/
................................................................................
void raw_tagview_page(void){
  char const * check = 0;
  login_check_credentials();
  /* if( !g.okRdWiki ){ */
  if( !g.okAdmin ){
    login_needed();
  }
  style_header("Raw Tags");
  login_anonymous_available();
  tagview_page_search_miniform();
  @ <hr/>
  if( 0 != (check = P("tagid")) ){
    tagview_page_tag_by_id( atoi(check) );
  }else if( 0 != (check = P("like")) ){
    tagview_page_list_tags( check );
................................................................................
}

/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;
  char const *zTitle = 0;
  int nTag = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  if ( P("tagid") || P("like") || P("raw") ) {
    raw_tagview_page();
    return;
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;
    if( g.okAdmin ){
      style_submenu_element("RawTags", "Internal Ticket View",
        "%s/tagview?name=%s&raw=y", g.zTop, zName);
    }
    zTitle = "Tagged Artifacts";
    @ <h2>%s(zName):</h2>
    if( sym_tag_to_uuid(zName, &uuid) > 0){
      tagview_print_timeline(zName, "sym-");
    }else if( tag_to_uuid(zName, &uuid, "") > 0){
      tagview_print_timeline(zName, "");
    }else{
      @ There is no artifact with this tag.
    }
  }else{
    Stmt q;
    const char *prefix = "sym-";
    int preflen = strlen(prefix);
    if( g.okAdmin ){
      style_submenu_element("RawTags", "Internal Ticket View",
        "%s/tagview?raw=y", g.zTop);
    }
    zTitle = "Tags";
    db_prepare(&q,
      "SELECT tagname"
      "  FROM tag"
      " WHERE EXISTS(SELECT 1 FROM tagxref"
      "               WHERE tagid=tag.tagid"
      "                 AND tagtype>0)"
      " AND tagid > %d"
................................................................................
    }
    @ </ul>
    if( nTag == 0) {
      @ There are no relevant tags.
    }
    db_finalize(&q);
  }
  style_header(zTitle);
  /*
   * Put in dummy functions since www_print_timeline has generated calls to
   * them. Some browsers don't seem to care, but better to be safe.
   * Actually, it would be nice to use the functions on this page, but at
   * the moment it looks to be too difficult.
   */
  @ <script>
  @ function xin(id){
  @ }
  @ function xout(id){
  @ }
  @ </script>

  style_footer();
}