Fossil SCM

Use full UUID's in more hyperlinks, e.g. regarding attachments. Remove unused function.

jan.nijtmans 2014-03-28 08:18 trunk
Commit ec03c3149a6dea407b4e5862ba48727a0b3bd2b6
+4 -4
--- src/attach.c
+++ src/attach.c
@@ -258,11 +258,11 @@
258258
zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
259259
" WHERE tagname GLOB 'tkt-%q*'", zTkt);
260260
if( zTkt==0 ) fossil_redirect_home();
261261
}
262262
zTarget = zTkt;
263
- zTargetType = mprintf("Ticket <a href=\"%s/tktview/%S\">%S</a>",
263
+ zTargetType = mprintf("Ticket <a href=\"%s/tktview/%s\">%S</a>",
264264
g.zTop, zTkt, zTkt);
265265
}
266266
if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
267267
if( P("cancel") ){
268268
cgi_redirect(zFrom);
@@ -463,11 +463,11 @@
463463
if( strcmp(zModAction,"approve")==0 ){
464464
moderation_approve(rid);
465465
}
466466
}
467467
style_header("Attachment Details");
468
- style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid);
468
+ style_submenu_element("Raw", "Raw", "%R/artifact/%s", zUuid);
469469
470470
@ <div class="section">Overview</div>
471471
@ <p><table class="label-value">
472472
@ <tr><th>Artifact&nbsp;ID:</th>
473473
@ <td>%z(href("%R/artifact/%s",zUuid))%s(zUuid)</a>
@@ -531,12 +531,12 @@
531531
@ <pre>
532532
@ %h(z)
533533
@ </pre>
534534
}
535535
}else if( strncmp(zMime, "image/", 6)==0 ){
536
- @ <img src="%R/raw/%S(zSrc)?m=%s(zMime)"></img>
537
- style_submenu_element("Image", "Image", "%R/raw/%S?m=%s", zSrc, zMime);
536
+ @ <img src="%R/raw/%s(zSrc)?m=%s(zMime)"></img>
537
+ style_submenu_element("Image", "Image", "%R/raw/%s?m=%s", zSrc, zMime);
538538
}else{
539539
int sz = db_int(0, "SELECT size FROM blob WHERE rid=%d", ridSrc);
540540
@ <i>(file is %d(sz) bytes of binary data)</i>
541541
}
542542
@ </blockquote>
543543
--- src/attach.c
+++ src/attach.c
@@ -258,11 +258,11 @@
258 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
259 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
260 if( zTkt==0 ) fossil_redirect_home();
261 }
262 zTarget = zTkt;
263 zTargetType = mprintf("Ticket <a href=\"%s/tktview/%S\">%S</a>",
264 g.zTop, zTkt, zTkt);
265 }
266 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
267 if( P("cancel") ){
268 cgi_redirect(zFrom);
@@ -463,11 +463,11 @@
463 if( strcmp(zModAction,"approve")==0 ){
464 moderation_approve(rid);
465 }
466 }
467 style_header("Attachment Details");
468 style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid);
469
470 @ <div class="section">Overview</div>
471 @ <p><table class="label-value">
472 @ <tr><th>Artifact&nbsp;ID:</th>
473 @ <td>%z(href("%R/artifact/%s",zUuid))%s(zUuid)</a>
@@ -531,12 +531,12 @@
531 @ <pre>
532 @ %h(z)
533 @ </pre>
534 }
535 }else if( strncmp(zMime, "image/", 6)==0 ){
536 @ <img src="%R/raw/%S(zSrc)?m=%s(zMime)"></img>
537 style_submenu_element("Image", "Image", "%R/raw/%S?m=%s", zSrc, zMime);
538 }else{
539 int sz = db_int(0, "SELECT size FROM blob WHERE rid=%d", ridSrc);
540 @ <i>(file is %d(sz) bytes of binary data)</i>
541 }
542 @ </blockquote>
543
--- src/attach.c
+++ src/attach.c
@@ -258,11 +258,11 @@
258 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
259 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
260 if( zTkt==0 ) fossil_redirect_home();
261 }
262 zTarget = zTkt;
263 zTargetType = mprintf("Ticket <a href=\"%s/tktview/%s\">%S</a>",
264 g.zTop, zTkt, zTkt);
265 }
266 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
267 if( P("cancel") ){
268 cgi_redirect(zFrom);
@@ -463,11 +463,11 @@
463 if( strcmp(zModAction,"approve")==0 ){
464 moderation_approve(rid);
465 }
466 }
467 style_header("Attachment Details");
468 style_submenu_element("Raw", "Raw", "%R/artifact/%s", zUuid);
469
470 @ <div class="section">Overview</div>
471 @ <p><table class="label-value">
472 @ <tr><th>Artifact&nbsp;ID:</th>
473 @ <td>%z(href("%R/artifact/%s",zUuid))%s(zUuid)</a>
@@ -531,12 +531,12 @@
531 @ <pre>
532 @ %h(z)
533 @ </pre>
534 }
535 }else if( strncmp(zMime, "image/", 6)==0 ){
536 @ <img src="%R/raw/%s(zSrc)?m=%s(zMime)"></img>
537 style_submenu_element("Image", "Image", "%R/raw/%s?m=%s", zSrc, zMime);
538 }else{
539 int sz = db_int(0, "SELECT size FROM blob WHERE rid=%d", ridSrc);
540 @ <i>(file is %d(sz) bytes of binary data)</i>
541 }
542 @ </blockquote>
543
+2 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1931,11 +1931,11 @@
19311931
|| !validate16(p->zAttachTarget, UUID_SIZE)
19321932
){
19331933
char *zComment;
19341934
if( p->zAttachSrc && p->zAttachSrc[0] ){
19351935
zComment = mprintf(
1936
- "Add attachment [/artifact/%S|%h] to wiki page [%h]",
1936
+ "Add attachment [/artifact/%s|%h] to wiki page [%h]",
19371937
p->zAttachSrc, p->zAttachName, p->zAttachTarget);
19381938
}else{
19391939
zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",
19401940
p->zAttachName, p->zAttachTarget);
19411941
}
@@ -1947,11 +1947,11 @@
19471947
free(zComment);
19481948
}else{
19491949
char *zComment;
19501950
if( p->zAttachSrc && p->zAttachSrc[0] ){
19511951
zComment = mprintf(
1952
- "Add attachment [/artifact/%S|%h] to ticket [%s|%.10s]",
1952
+ "Add attachment [/artifact/%s|%h] to ticket [%s|%.10s]",
19531953
p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
19541954
}else{
19551955
zComment = mprintf("Delete attachment \"%h\" from ticket [%s|%.10s]",
19561956
p->zAttachName, p->zAttachTarget, p->zAttachTarget);
19571957
}
19581958
--- src/manifest.c
+++ src/manifest.c
@@ -1931,11 +1931,11 @@
1931 || !validate16(p->zAttachTarget, UUID_SIZE)
1932 ){
1933 char *zComment;
1934 if( p->zAttachSrc && p->zAttachSrc[0] ){
1935 zComment = mprintf(
1936 "Add attachment [/artifact/%S|%h] to wiki page [%h]",
1937 p->zAttachSrc, p->zAttachName, p->zAttachTarget);
1938 }else{
1939 zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",
1940 p->zAttachName, p->zAttachTarget);
1941 }
@@ -1947,11 +1947,11 @@
1947 free(zComment);
1948 }else{
1949 char *zComment;
1950 if( p->zAttachSrc && p->zAttachSrc[0] ){
1951 zComment = mprintf(
1952 "Add attachment [/artifact/%S|%h] to ticket [%s|%.10s]",
1953 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
1954 }else{
1955 zComment = mprintf("Delete attachment \"%h\" from ticket [%s|%.10s]",
1956 p->zAttachName, p->zAttachTarget, p->zAttachTarget);
1957 }
1958
--- src/manifest.c
+++ src/manifest.c
@@ -1931,11 +1931,11 @@
1931 || !validate16(p->zAttachTarget, UUID_SIZE)
1932 ){
1933 char *zComment;
1934 if( p->zAttachSrc && p->zAttachSrc[0] ){
1935 zComment = mprintf(
1936 "Add attachment [/artifact/%s|%h] to wiki page [%h]",
1937 p->zAttachSrc, p->zAttachName, p->zAttachTarget);
1938 }else{
1939 zComment = mprintf("Delete attachment \"%h\" from wiki page [%h]",
1940 p->zAttachName, p->zAttachTarget);
1941 }
@@ -1947,11 +1947,11 @@
1947 free(zComment);
1948 }else{
1949 char *zComment;
1950 if( p->zAttachSrc && p->zAttachSrc[0] ){
1951 zComment = mprintf(
1952 "Add attachment [/artifact/%s|%h] to ticket [%s|%.10s]",
1953 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
1954 }else{
1955 zComment = mprintf("Delete attachment \"%h\" from ticket [%s|%.10s]",
1956 p->zAttachName, p->zAttachTarget, p->zAttachTarget);
1957 }
1958
+6 -22
--- src/timeline.c
+++ src/timeline.c
@@ -54,26 +54,10 @@
5454
}else{
5555
@ <span class="timelineHistDsp">[%s(z)]</span>
5656
}
5757
}
5858
59
-/*
60
-** Generate a hyperlink to a diff between two versions.
61
-*/
62
-void hyperlink_to_diff(const char *zV1, const char *zV2){
63
- if( g.perm.Hyperlink ){
64
- if( zV2==0 ){
65
- @ %z(href("%R/diff?v2=%s",zV1))[diff]</a>
66
- }else{
67
- @ %z(href("%R/diff?v1=%s&v2=%s",zV1,zV2))[diff]</a>
68
- }
69
- }
70
-}
71
-
72
-/*
73
-** Generate a hyperlink to a date & time.
74
-*/
7559
void hyperlink_to_date(const char *zDate, const char *zSuffix){
7660
if( zSuffix==0 ) zSuffix = "";
7761
if( g.perm.Hyperlink ){
7862
@ %z(href("%R/timeline?c=%T",zDate))%s(zDate)</a>%s(zSuffix)
7963
}else{
@@ -448,11 +432,11 @@
448432
@ (user: %h(zDispUser)%s(zTagList?",":"\051")
449433
}
450434
451435
/* Generate a "detail" link for tags. */
452436
if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
453
- @ [%z(href("%R/info/%S",zUuid))details</a>]
437
+ @ [%z(href("%R/info/%s",zUuid))details</a>]
454438
}
455439
456440
/* Generate the "tags: TAGLIST" at the end of the comment, together
457441
** with hyperlinks to the tag list.
458442
*/
@@ -527,23 +511,23 @@
527511
}
528512
continue;
529513
}
530514
if( isNew ){
531515
@ <li> %h(zFilename) (new file) &nbsp;
532
- @ %z(href("%R/artifact/%S",zNew))[view]</a></li>
516
+ @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
533517
}else if( isDel ){
534518
@ <li> %h(zFilename) (deleted)</li>
535519
}else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
536520
@ <li> %h(zOldName) &rarr; %h(zFilename)
537
- @ %z(href("%R/artifact/%S",zNew))[view]</a></li>
521
+ @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
538522
}else{
539523
if( zOldName!=0 ){
540524
@ <li> %h(zOldName) &rarr; %h(zFilename)
541525
}else{
542526
@ <li> %h(zFilename) &nbsp;
543527
}
544
- @ %z(href("%R/fdiff?v1=%S&v2=%S&sbs=1",zOld,zNew))[diff]</a></li>
528
+ @ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
545529
}
546530
}
547531
db_reset(&fchngQuery);
548532
if( inUl ){
549533
@ </ul>
@@ -1442,11 +1426,11 @@
14421426
blob_appendf(&desc, "%d %ss", n, zEType);
14431427
}
14441428
if( zUses ){
14451429
char *zFilenames = names_of_file(zUses);
14461430
blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames,
1447
- href("%R/artifact/%S",zUses), zUses);
1431
+ href("%R/artifact/%s",zUses), zUses);
14481432
tmFlags |= TIMELINE_DISJOINT;
14491433
}
14501434
if( renameOnly ){
14511435
blob_appendf(&desc, " that contain filename changes");
14521436
tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES;
@@ -1963,11 +1947,11 @@
19631947
" AND blob.rid=c.cid"
19641948
);
19651949
while( db_step(&q)==SQLITE_ROW ){
19661950
const char *zUuid = db_column_text(&q, 0);
19671951
@ <li>
1968
- @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)&amp;unhide">%S(zUuid)</a>
1952
+ @ <a href="%s(g.zTop)/timeline?p=%s(zUuid)&amp;d=%s(zUuid)&amp;unhide">%S(zUuid)</a>
19691953
}
19701954
db_finalize(&q);
19711955
style_footer();
19721956
}
19731957
19741958
--- src/timeline.c
+++ src/timeline.c
@@ -54,26 +54,10 @@
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
58
59 /*
60 ** Generate a hyperlink to a diff between two versions.
61 */
62 void hyperlink_to_diff(const char *zV1, const char *zV2){
63 if( g.perm.Hyperlink ){
64 if( zV2==0 ){
65 @ %z(href("%R/diff?v2=%s",zV1))[diff]</a>
66 }else{
67 @ %z(href("%R/diff?v1=%s&v2=%s",zV1,zV2))[diff]</a>
68 }
69 }
70 }
71
72 /*
73 ** Generate a hyperlink to a date & time.
74 */
75 void hyperlink_to_date(const char *zDate, const char *zSuffix){
76 if( zSuffix==0 ) zSuffix = "";
77 if( g.perm.Hyperlink ){
78 @ %z(href("%R/timeline?c=%T",zDate))%s(zDate)</a>%s(zSuffix)
79 }else{
@@ -448,11 +432,11 @@
448 @ (user: %h(zDispUser)%s(zTagList?",":"\051")
449 }
450
451 /* Generate a "detail" link for tags. */
452 if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
453 @ [%z(href("%R/info/%S",zUuid))details</a>]
454 }
455
456 /* Generate the "tags: TAGLIST" at the end of the comment, together
457 ** with hyperlinks to the tag list.
458 */
@@ -527,23 +511,23 @@
527 }
528 continue;
529 }
530 if( isNew ){
531 @ <li> %h(zFilename) (new file) &nbsp;
532 @ %z(href("%R/artifact/%S",zNew))[view]</a></li>
533 }else if( isDel ){
534 @ <li> %h(zFilename) (deleted)</li>
535 }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
536 @ <li> %h(zOldName) &rarr; %h(zFilename)
537 @ %z(href("%R/artifact/%S",zNew))[view]</a></li>
538 }else{
539 if( zOldName!=0 ){
540 @ <li> %h(zOldName) &rarr; %h(zFilename)
541 }else{
542 @ <li> %h(zFilename) &nbsp;
543 }
544 @ %z(href("%R/fdiff?v1=%S&v2=%S&sbs=1",zOld,zNew))[diff]</a></li>
545 }
546 }
547 db_reset(&fchngQuery);
548 if( inUl ){
549 @ </ul>
@@ -1442,11 +1426,11 @@
1442 blob_appendf(&desc, "%d %ss", n, zEType);
1443 }
1444 if( zUses ){
1445 char *zFilenames = names_of_file(zUses);
1446 blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames,
1447 href("%R/artifact/%S",zUses), zUses);
1448 tmFlags |= TIMELINE_DISJOINT;
1449 }
1450 if( renameOnly ){
1451 blob_appendf(&desc, " that contain filename changes");
1452 tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES;
@@ -1963,11 +1947,11 @@
1963 " AND blob.rid=c.cid"
1964 );
1965 while( db_step(&q)==SQLITE_ROW ){
1966 const char *zUuid = db_column_text(&q, 0);
1967 @ <li>
1968 @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)&amp;unhide">%S(zUuid)</a>
1969 }
1970 db_finalize(&q);
1971 style_footer();
1972 }
1973
1974
--- src/timeline.c
+++ src/timeline.c
@@ -54,26 +54,10 @@
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59 void hyperlink_to_date(const char *zDate, const char *zSuffix){
60 if( zSuffix==0 ) zSuffix = "";
61 if( g.perm.Hyperlink ){
62 @ %z(href("%R/timeline?c=%T",zDate))%s(zDate)</a>%s(zSuffix)
63 }else{
@@ -448,11 +432,11 @@
432 @ (user: %h(zDispUser)%s(zTagList?",":"\051")
433 }
434
435 /* Generate a "detail" link for tags. */
436 if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
437 @ [%z(href("%R/info/%s",zUuid))details</a>]
438 }
439
440 /* Generate the "tags: TAGLIST" at the end of the comment, together
441 ** with hyperlinks to the tag list.
442 */
@@ -527,23 +511,23 @@
511 }
512 continue;
513 }
514 if( isNew ){
515 @ <li> %h(zFilename) (new file) &nbsp;
516 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
517 }else if( isDel ){
518 @ <li> %h(zFilename) (deleted)</li>
519 }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){
520 @ <li> %h(zOldName) &rarr; %h(zFilename)
521 @ %z(href("%R/artifact/%s",zNew))[view]</a></li>
522 }else{
523 if( zOldName!=0 ){
524 @ <li> %h(zOldName) &rarr; %h(zFilename)
525 }else{
526 @ <li> %h(zFilename) &nbsp;
527 }
528 @ %z(href("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))[diff]</a></li>
529 }
530 }
531 db_reset(&fchngQuery);
532 if( inUl ){
533 @ </ul>
@@ -1442,11 +1426,11 @@
1426 blob_appendf(&desc, "%d %ss", n, zEType);
1427 }
1428 if( zUses ){
1429 char *zFilenames = names_of_file(zUses);
1430 blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames,
1431 href("%R/artifact/%s",zUses), zUses);
1432 tmFlags |= TIMELINE_DISJOINT;
1433 }
1434 if( renameOnly ){
1435 blob_appendf(&desc, " that contain filename changes");
1436 tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES;
@@ -1963,11 +1947,11 @@
1947 " AND blob.rid=c.cid"
1948 );
1949 while( db_step(&q)==SQLITE_ROW ){
1950 const char *zUuid = db_column_text(&q, 0);
1951 @ <li>
1952 @ <a href="%s(g.zTop)/timeline?p=%s(zUuid)&amp;d=%s(zUuid)&amp;unhide">%S(zUuid)</a>
1953 }
1954 db_finalize(&q);
1955 style_footer();
1956 }
1957
1958

Keyboard Shortcuts

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