Fossil SCM
The /ci_tags page now adapts its header label based on the type of artifact hash passed to it (since it works as-is with hashes other than checkins).
Commit
41f0838cbeacb51da0de4643fb789abf23c690a2359e36b81d1df39cae343f4e
Parent
efb602b7de15115…
2 files changed
+4
-1
+31
+4
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -496,10 +496,11 @@ | ||
| 496 | 496 | const char *zHash; |
| 497 | 497 | int rid; |
| 498 | 498 | Stmt q; |
| 499 | 499 | int cnt = 0; |
| 500 | 500 | Blob sql; |
| 501 | + char const *zType; | |
| 501 | 502 | |
| 502 | 503 | login_check_credentials(); |
| 503 | 504 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 504 | 505 | rid = name_to_rid_www("name"); |
| 505 | 506 | if( rid==0 ){ |
| @@ -508,11 +509,13 @@ | ||
| 508 | 509 | style_finish_page(); |
| 509 | 510 | return; |
| 510 | 511 | } |
| 511 | 512 | zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 512 | 513 | style_header("Tags and Properties"); |
| 513 | - @ <h1>Tags and Properties for Check-In \ | |
| 514 | + zType = whatis_rid_type(rid); | |
| 515 | + if(!zType) zType = "Artifact"; | |
| 516 | + @ <h1>Tags and Properties for %s(zType) \ | |
| 514 | 517 | @ %z(href("%R/ci/%!S",zHash))%S(zHash)</a></h1> |
| 515 | 518 | db_prepare(&q, |
| 516 | 519 | "SELECT tag.tagid, tagname, " |
| 517 | 520 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 518 | 521 | " value, datetime(tagxref.mtime,toLocal()), tagtype," |
| 519 | 522 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -496,10 +496,11 @@ | |
| 496 | const char *zHash; |
| 497 | int rid; |
| 498 | Stmt q; |
| 499 | int cnt = 0; |
| 500 | Blob sql; |
| 501 | |
| 502 | login_check_credentials(); |
| 503 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 504 | rid = name_to_rid_www("name"); |
| 505 | if( rid==0 ){ |
| @@ -508,11 +509,13 @@ | |
| 508 | style_finish_page(); |
| 509 | return; |
| 510 | } |
| 511 | zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 512 | style_header("Tags and Properties"); |
| 513 | @ <h1>Tags and Properties for Check-In \ |
| 514 | @ %z(href("%R/ci/%!S",zHash))%S(zHash)</a></h1> |
| 515 | db_prepare(&q, |
| 516 | "SELECT tag.tagid, tagname, " |
| 517 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 518 | " value, datetime(tagxref.mtime,toLocal()), tagtype," |
| 519 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -496,10 +496,11 @@ | |
| 496 | const char *zHash; |
| 497 | int rid; |
| 498 | Stmt q; |
| 499 | int cnt = 0; |
| 500 | Blob sql; |
| 501 | char const *zType; |
| 502 | |
| 503 | login_check_credentials(); |
| 504 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 505 | rid = name_to_rid_www("name"); |
| 506 | if( rid==0 ){ |
| @@ -508,11 +509,13 @@ | |
| 509 | style_finish_page(); |
| 510 | return; |
| 511 | } |
| 512 | zHash = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 513 | style_header("Tags and Properties"); |
| 514 | zType = whatis_rid_type(rid); |
| 515 | if(!zType) zType = "Artifact"; |
| 516 | @ <h1>Tags and Properties for %s(zType) \ |
| 517 | @ %z(href("%R/ci/%!S",zHash))%S(zHash)</a></h1> |
| 518 | db_prepare(&q, |
| 519 | "SELECT tag.tagid, tagname, " |
| 520 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 521 | " value, datetime(tagxref.mtime,toLocal()), tagtype," |
| 522 |
+31
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -737,10 +737,41 @@ | ||
| 737 | 737 | cgi_redirectf("%R/ambiguous/%T?src=%t", zName, g.zPath); |
| 738 | 738 | rid = 0; |
| 739 | 739 | } |
| 740 | 740 | return rid; |
| 741 | 741 | } |
| 742 | + | |
| 743 | +/* | |
| 744 | +** Given an RID of a structural artifact, which is assumed to be | |
| 745 | +** valid, this function returns a brief string (in static memory) | |
| 746 | +** describing the record type. Returns NULL if rid does not refer to | |
| 747 | +** an artifact record (as determined by reading the event table). The | |
| 748 | +** returned string is intended to be used in headers which can refer | |
| 749 | +** to different artifact types. It is not "definitive," in that it | |
| 750 | +** does not distinguish between closely-related types like wiki | |
| 751 | +** creation, edit, and removal. | |
| 752 | +*/ | |
| 753 | +char const * whatis_rid_type(int rid){ | |
| 754 | + Stmt q = empty_Stmt; | |
| 755 | + char const * zType = 0; | |
| 756 | + /* Check for entries on the timeline that reference this object */ | |
| 757 | + db_prepare(&q, | |
| 758 | + "SELECT type FROM event WHERE objid=%d", rid); | |
| 759 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 760 | + switch( db_column_text(&q,0)[0] ){ | |
| 761 | + case 'c': zType = "Check-in"; break; | |
| 762 | + case 'w': zType = "Wiki-edit"; break; | |
| 763 | + case 'e': zType = "Technote"; break; | |
| 764 | + case 'f': zType = "Forum-post"; break; | |
| 765 | + case 't': zType = "Ticket-change"; break; | |
| 766 | + case 'g': zType = "Tag-change"; break; | |
| 767 | + default: break; | |
| 768 | + } | |
| 769 | + } | |
| 770 | + db_finalize(&q); | |
| 771 | + return zType; | |
| 772 | +} | |
| 742 | 773 | |
| 743 | 774 | /* |
| 744 | 775 | ** Generate a description of artifact "rid" |
| 745 | 776 | */ |
| 746 | 777 | void whatis_rid(int rid, int verboseFlag){ |
| 747 | 778 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -737,10 +737,41 @@ | |
| 737 | cgi_redirectf("%R/ambiguous/%T?src=%t", zName, g.zPath); |
| 738 | rid = 0; |
| 739 | } |
| 740 | return rid; |
| 741 | } |
| 742 | |
| 743 | /* |
| 744 | ** Generate a description of artifact "rid" |
| 745 | */ |
| 746 | void whatis_rid(int rid, int verboseFlag){ |
| 747 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -737,10 +737,41 @@ | |
| 737 | cgi_redirectf("%R/ambiguous/%T?src=%t", zName, g.zPath); |
| 738 | rid = 0; |
| 739 | } |
| 740 | return rid; |
| 741 | } |
| 742 | |
| 743 | /* |
| 744 | ** Given an RID of a structural artifact, which is assumed to be |
| 745 | ** valid, this function returns a brief string (in static memory) |
| 746 | ** describing the record type. Returns NULL if rid does not refer to |
| 747 | ** an artifact record (as determined by reading the event table). The |
| 748 | ** returned string is intended to be used in headers which can refer |
| 749 | ** to different artifact types. It is not "definitive," in that it |
| 750 | ** does not distinguish between closely-related types like wiki |
| 751 | ** creation, edit, and removal. |
| 752 | */ |
| 753 | char const * whatis_rid_type(int rid){ |
| 754 | Stmt q = empty_Stmt; |
| 755 | char const * zType = 0; |
| 756 | /* Check for entries on the timeline that reference this object */ |
| 757 | db_prepare(&q, |
| 758 | "SELECT type FROM event WHERE objid=%d", rid); |
| 759 | if( db_step(&q)==SQLITE_ROW ){ |
| 760 | switch( db_column_text(&q,0)[0] ){ |
| 761 | case 'c': zType = "Check-in"; break; |
| 762 | case 'w': zType = "Wiki-edit"; break; |
| 763 | case 'e': zType = "Technote"; break; |
| 764 | case 'f': zType = "Forum-post"; break; |
| 765 | case 't': zType = "Ticket-change"; break; |
| 766 | case 'g': zType = "Tag-change"; break; |
| 767 | default: break; |
| 768 | } |
| 769 | } |
| 770 | db_finalize(&q); |
| 771 | return zType; |
| 772 | } |
| 773 | |
| 774 | /* |
| 775 | ** Generate a description of artifact "rid" |
| 776 | */ |
| 777 | void whatis_rid(int rid, int verboseFlag){ |
| 778 |