Fossil SCM
The "artifact" webpage renders wiki as wiki and html as html but gives submenu items to convert the rendering back to plain text (and hexdump).
Commit
c7fe01fe8ee4e2323157a26da0c3c6522113a21e
Parent
0a2a1b4dde3783d…
1 file changed
+65
-54
+65
-54
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -599,17 +599,16 @@ | ||
| 599 | 599 | login_anonymous_available(); |
| 600 | 600 | |
| 601 | 601 | zPrevDate[0] = 0; |
| 602 | 602 | zFilename = PD("name",""); |
| 603 | 603 | db_prepare(&q, |
| 604 | - "SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime')," | |
| 604 | + "SELECT substr(b.uuid,1,10), datetime(event.mtime,'localtime')," | |
| 605 | 605 | " coalesce(event.ecomment, event.comment)," |
| 606 | 606 | " coalesce(event.euser, event.user)," |
| 607 | 607 | " mlink.pid, mlink.fid, mlink.mid, mlink.fnid" |
| 608 | - " FROM mlink, blob a, blob b, event" | |
| 608 | + " FROM mlink, blob b, event" | |
| 609 | 609 | " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)" |
| 610 | - " AND a.rid=mlink.mid" | |
| 611 | 610 | " AND b.rid=mlink.fid" |
| 612 | 611 | " AND event.objid=mlink.mid" |
| 613 | 612 | " ORDER BY event.mtime DESC", |
| 614 | 613 | zFilename |
| 615 | 614 | ); |
| @@ -618,19 +617,19 @@ | ||
| 618 | 617 | hyperlinked_path(zFilename, &title); |
| 619 | 618 | @ <h2>%b(&title)</h2> |
| 620 | 619 | blob_reset(&title); |
| 621 | 620 | @ <table cellspacing=0 border=0 cellpadding=0> |
| 622 | 621 | while( db_step(&q)==SQLITE_ROW ){ |
| 623 | - const char *zVers = db_column_text(&q, 0); | |
| 624 | - const char *zUuid = db_column_text(&q, 1); | |
| 625 | - const char *zDate = db_column_text(&q, 2); | |
| 626 | - const char *zCom = db_column_text(&q, 3); | |
| 627 | - const char *zUser = db_column_text(&q, 4); | |
| 628 | - int fpid = db_column_int(&q, 5); | |
| 629 | - int frid = db_column_int(&q, 6); | |
| 630 | - int mid = db_column_int(&q, 7); | |
| 631 | - int fnid = db_column_int(&q, 8); | |
| 622 | + const char *zUuid = db_column_text(&q, 0); | |
| 623 | + const char *zDate = db_column_text(&q, 1); | |
| 624 | + const char *zCom = db_column_text(&q, 2); | |
| 625 | + const char *zUser = db_column_text(&q, 3); | |
| 626 | + int fpid = db_column_int(&q, 4); | |
| 627 | + int frid = db_column_int(&q, 5); | |
| 628 | + int mid = db_column_int(&q, 6); | |
| 629 | + int fnid = db_column_int(&q, 7); | |
| 630 | + char zShort[20]; | |
| 632 | 631 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 633 | 632 | sprintf(zPrevDate, "%.10s", zDate); |
| 634 | 633 | @ <tr><td colspan=3> |
| 635 | 634 | @ <table cellpadding=2 border=0> |
| 636 | 635 | @ <tr><td bgcolor="#a0b5f4" class="border1"> |
| @@ -641,15 +640,18 @@ | ||
| 641 | 640 | @ </td></tr> |
| 642 | 641 | } |
| 643 | 642 | @ <tr><td valign="top">%s(&zDate[11])</td> |
| 644 | 643 | @ <td width="20"></td> |
| 645 | 644 | @ <td valign="top" align="left"> |
| 646 | - hyperlink_to_uuid(zVers); | |
| 647 | - @ %h(zCom) (By: %h(zUser)) | |
| 648 | - @ Id: %s(zUuid)/%d(frid) | |
| 645 | + sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid); | |
| 649 | 646 | if( g.okHistory ){ |
| 650 | - @ <a href="%s(g.zBaseURL)/artifact/%d(frid)">[view]</a> | |
| 647 | + @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%s(zShort)]</a> | |
| 648 | + }else{ | |
| 649 | + @ [%s(zShort)] | |
| 650 | + } | |
| 651 | + @ %h(zCom) (By: %h(zUser)) | |
| 652 | + if( g.okHistory ){ | |
| 651 | 653 | if( fpid ){ |
| 652 | 654 | @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&v2=%d(frid)">[diff]</a> |
| 653 | 655 | } |
| 654 | 656 | @ <a href="%s(g.zBaseURL)/annotate?mid=%d(mid)&fnid=%d(fnid)"> |
| 655 | 657 | @ [annotate]</a> |
| @@ -726,17 +728,17 @@ | ||
| 726 | 728 | /* |
| 727 | 729 | ** Write a description of an object to the www reply. |
| 728 | 730 | ** |
| 729 | 731 | ** If the object is a file then mention: |
| 730 | 732 | ** |
| 731 | -** * It's uuid | |
| 733 | +** * It's artifact ID | |
| 732 | 734 | ** * All its filenames |
| 733 | 735 | ** * The baselines it was checked-in on, with times and users |
| 734 | 736 | ** |
| 735 | 737 | ** If the object is a manifest, then mention: |
| 736 | 738 | ** |
| 737 | -** * It's uuid | |
| 739 | +** * It's artifact ID | |
| 738 | 740 | ** * date of check-in |
| 739 | 741 | ** * Comment & user |
| 740 | 742 | */ |
| 741 | 743 | static void object_description( |
| 742 | 744 | int rid, /* The artifact ID */ |
| @@ -770,13 +772,13 @@ | ||
| 770 | 772 | @ Also file |
| 771 | 773 | }else{ |
| 772 | 774 | @ File |
| 773 | 775 | } |
| 774 | 776 | @ <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 775 | - @ uuid %s(zFuuid) part of check-in | |
| 777 | + @ artifact %s(zFuuid) part of check-in | |
| 776 | 778 | hyperlink_to_uuid(zVers); |
| 777 | - @ %w(zCom) by %h(zUser) on %s(zDate). | |
| 779 | + @ - %w(zCom) by %h(zUser) on %s(zDate). | |
| 778 | 780 | cnt++; |
| 779 | 781 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 780 | 782 | blob_append(pDownloadName, zName, -1); |
| 781 | 783 | } |
| 782 | 784 | } |
| @@ -801,11 +803,11 @@ | ||
| 801 | 803 | @ Also wiki page |
| 802 | 804 | }else{ |
| 803 | 805 | @ Wiki page |
| 804 | 806 | } |
| 805 | 807 | @ [<a href="%s(g.zBaseURL)/wiki?name=%t(zPagename)">%h(zPagename)</a>] |
| 806 | - @ uuid %s(zUuid) by %h(zUser) on %s(zDate). | |
| 808 | + @ artifact %s(zUuid) by %h(zUser) on %s(zDate). | |
| 807 | 809 | nWiki++; |
| 808 | 810 | cnt++; |
| 809 | 811 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 810 | 812 | blob_append(pDownloadName, zPagename, -1); |
| 811 | 813 | } |
| @@ -836,11 +838,11 @@ | ||
| 836 | 838 | @ Manifest of baseline |
| 837 | 839 | }else{ |
| 838 | 840 | @ Control file referencing |
| 839 | 841 | } |
| 840 | 842 | hyperlink_to_uuid(zUuid); |
| 841 | - @ %w(zCom) by %h(zUser) on %s(zDate). | |
| 843 | + @ - %w(zCom) by %h(zUser) on %s(zDate). | |
| 842 | 844 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 843 | 845 | blob_append(pDownloadName, zUuid, -1); |
| 844 | 846 | } |
| 845 | 847 | cnt++; |
| 846 | 848 | } |
| @@ -1018,10 +1020,12 @@ | ||
| 1018 | 1020 | void artifact_page(void){ |
| 1019 | 1021 | int rid; |
| 1020 | 1022 | Blob content; |
| 1021 | 1023 | const char *zMime; |
| 1022 | 1024 | Blob downloadName; |
| 1025 | + int renderAsWiki = 0; | |
| 1026 | + int renderAsHtml = 0; | |
| 1023 | 1027 | |
| 1024 | 1028 | rid = name_to_rid(PD("name","0")); |
| 1025 | 1029 | login_check_credentials(); |
| 1026 | 1030 | if( !g.okRead ){ login_needed(); return; } |
| 1027 | 1031 | if( rid==0 ){ cgi_redirect("/home"); } |
| @@ -1043,51 +1047,58 @@ | ||
| 1043 | 1047 | style_submenu_element("Download", "Download", |
| 1044 | 1048 | "%s/raw/%T?name=%d", g.zTop, blob_str(&downloadName), rid); |
| 1045 | 1049 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1046 | 1050 | if( zMime ){ |
| 1047 | 1051 | if( strcmp(zMime, "text/html")==0 ){ |
| 1048 | - style_submenu_element("View", "View", | |
| 1049 | - "%s/raw?name=%d&m=text/html", g.zTop, rid); | |
| 1052 | + if( P("txt") ){ | |
| 1053 | + style_submenu_element("Html", "Html", | |
| 1054 | + "%s/artifact?name=%d", g.zTop, rid); | |
| 1055 | + }else{ | |
| 1056 | + renderAsHtml = 1; | |
| 1057 | + style_submenu_element("Text", "Text", | |
| 1058 | + "%s/artifact?name=%d&txt=1", g.zTop, rid); | |
| 1059 | + } | |
| 1050 | 1060 | }else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1051 | - Stmt q; | |
| 1052 | - db_prepare(&q, | |
| 1053 | - "SELECT blob.uuid || '/' || filename.name" | |
| 1054 | - " FROM mlink, filename, blob" | |
| 1055 | - " WHERE mlink.fid=%d" | |
| 1056 | - " AND filename.fnid=mlink.fnid" | |
| 1057 | - " AND filename.name GLOB '*.wiki'" | |
| 1058 | - " AND blob.rid=mlink.mid", | |
| 1059 | - rid | |
| 1060 | - ); | |
| 1061 | - if( db_step(&q)==SQLITE_ROW ){ | |
| 1062 | - const char *zCI = db_column_text(&q, 0); | |
| 1063 | - style_submenu_element("View", "View", "%s/doc/%s", g.zTop, zCI); | |
| 1064 | - } | |
| 1065 | - db_finalize(&q); | |
| 1061 | + if( P("txt") ){ | |
| 1062 | + style_submenu_element("Wiki", "Wiki", | |
| 1063 | + "%s/artifact?name=%d", g.zTop, rid); | |
| 1064 | + }else{ | |
| 1065 | + renderAsWiki = 1; | |
| 1066 | + style_submenu_element("Text", "Text", | |
| 1067 | + "%s/artifact?name=%d&txt=1", g.zTop, rid); | |
| 1068 | + } | |
| 1066 | 1069 | } |
| 1067 | 1070 | } |
| 1068 | 1071 | @ </blockquote> |
| 1069 | 1072 | @ <hr> |
| 1070 | - @ <blockquote> | |
| 1071 | 1073 | content_get(rid, &content); |
| 1072 | - zMime = mimetype_from_content(&content); | |
| 1073 | - if( zMime==0 ){ | |
| 1074 | - @ <pre> | |
| 1075 | - @ %h(blob_str(&content)) | |
| 1076 | - @ </pre> | |
| 1077 | - style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); | |
| 1078 | - }else if( strncmp(zMime, "image/", 6)==0 ){ | |
| 1079 | - @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img> | |
| 1080 | - style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); | |
| 1074 | + if( renderAsWiki ){ | |
| 1075 | + wiki_convert(&content, 0, 0); | |
| 1076 | + }else if( renderAsHtml ){ | |
| 1077 | + @ <div> | |
| 1078 | + cgi_append_content(blob_buffer(&content), blob_size(&content)); | |
| 1079 | + @ </div> | |
| 1081 | 1080 | }else{ |
| 1082 | - @ <pre> | |
| 1083 | - hexdump(&content); | |
| 1084 | - @ </pre> | |
| 1081 | + zMime = mimetype_from_content(&content); | |
| 1082 | + @ <blockquote> | |
| 1083 | + if( zMime==0 ){ | |
| 1084 | + @ <pre> | |
| 1085 | + @ %h(blob_str(&content)) | |
| 1086 | + @ </pre> | |
| 1087 | + style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); | |
| 1088 | + }else if( strncmp(zMime, "image/", 6)==0 ){ | |
| 1089 | + @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img> | |
| 1090 | + style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); | |
| 1091 | + }else{ | |
| 1092 | + @ <pre> | |
| 1093 | + hexdump(&content); | |
| 1094 | + @ </pre> | |
| 1095 | + } | |
| 1096 | + @ </blockquote> | |
| 1085 | 1097 | } |
| 1086 | - @ </blockquote> | |
| 1087 | 1098 | style_footer(); |
| 1088 | -} | |
| 1099 | +} | |
| 1089 | 1100 | |
| 1090 | 1101 | /* |
| 1091 | 1102 | ** WEBPAGE: tinfo |
| 1092 | 1103 | ** URL: /tinfo?name=ARTIFACTID |
| 1093 | 1104 | ** |
| 1094 | 1105 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -599,17 +599,16 @@ | |
| 599 | login_anonymous_available(); |
| 600 | |
| 601 | zPrevDate[0] = 0; |
| 602 | zFilename = PD("name",""); |
| 603 | db_prepare(&q, |
| 604 | "SELECT a.uuid, substr(b.uuid,1,10), datetime(event.mtime,'localtime')," |
| 605 | " coalesce(event.ecomment, event.comment)," |
| 606 | " coalesce(event.euser, event.user)," |
| 607 | " mlink.pid, mlink.fid, mlink.mid, mlink.fnid" |
| 608 | " FROM mlink, blob a, blob b, event" |
| 609 | " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)" |
| 610 | " AND a.rid=mlink.mid" |
| 611 | " AND b.rid=mlink.fid" |
| 612 | " AND event.objid=mlink.mid" |
| 613 | " ORDER BY event.mtime DESC", |
| 614 | zFilename |
| 615 | ); |
| @@ -618,19 +617,19 @@ | |
| 618 | hyperlinked_path(zFilename, &title); |
| 619 | @ <h2>%b(&title)</h2> |
| 620 | blob_reset(&title); |
| 621 | @ <table cellspacing=0 border=0 cellpadding=0> |
| 622 | while( db_step(&q)==SQLITE_ROW ){ |
| 623 | const char *zVers = db_column_text(&q, 0); |
| 624 | const char *zUuid = db_column_text(&q, 1); |
| 625 | const char *zDate = db_column_text(&q, 2); |
| 626 | const char *zCom = db_column_text(&q, 3); |
| 627 | const char *zUser = db_column_text(&q, 4); |
| 628 | int fpid = db_column_int(&q, 5); |
| 629 | int frid = db_column_int(&q, 6); |
| 630 | int mid = db_column_int(&q, 7); |
| 631 | int fnid = db_column_int(&q, 8); |
| 632 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 633 | sprintf(zPrevDate, "%.10s", zDate); |
| 634 | @ <tr><td colspan=3> |
| 635 | @ <table cellpadding=2 border=0> |
| 636 | @ <tr><td bgcolor="#a0b5f4" class="border1"> |
| @@ -641,15 +640,18 @@ | |
| 641 | @ </td></tr> |
| 642 | } |
| 643 | @ <tr><td valign="top">%s(&zDate[11])</td> |
| 644 | @ <td width="20"></td> |
| 645 | @ <td valign="top" align="left"> |
| 646 | hyperlink_to_uuid(zVers); |
| 647 | @ %h(zCom) (By: %h(zUser)) |
| 648 | @ Id: %s(zUuid)/%d(frid) |
| 649 | if( g.okHistory ){ |
| 650 | @ <a href="%s(g.zBaseURL)/artifact/%d(frid)">[view]</a> |
| 651 | if( fpid ){ |
| 652 | @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&v2=%d(frid)">[diff]</a> |
| 653 | } |
| 654 | @ <a href="%s(g.zBaseURL)/annotate?mid=%d(mid)&fnid=%d(fnid)"> |
| 655 | @ [annotate]</a> |
| @@ -726,17 +728,17 @@ | |
| 726 | /* |
| 727 | ** Write a description of an object to the www reply. |
| 728 | ** |
| 729 | ** If the object is a file then mention: |
| 730 | ** |
| 731 | ** * It's uuid |
| 732 | ** * All its filenames |
| 733 | ** * The baselines it was checked-in on, with times and users |
| 734 | ** |
| 735 | ** If the object is a manifest, then mention: |
| 736 | ** |
| 737 | ** * It's uuid |
| 738 | ** * date of check-in |
| 739 | ** * Comment & user |
| 740 | */ |
| 741 | static void object_description( |
| 742 | int rid, /* The artifact ID */ |
| @@ -770,13 +772,13 @@ | |
| 770 | @ Also file |
| 771 | }else{ |
| 772 | @ File |
| 773 | } |
| 774 | @ <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 775 | @ uuid %s(zFuuid) part of check-in |
| 776 | hyperlink_to_uuid(zVers); |
| 777 | @ %w(zCom) by %h(zUser) on %s(zDate). |
| 778 | cnt++; |
| 779 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 780 | blob_append(pDownloadName, zName, -1); |
| 781 | } |
| 782 | } |
| @@ -801,11 +803,11 @@ | |
| 801 | @ Also wiki page |
| 802 | }else{ |
| 803 | @ Wiki page |
| 804 | } |
| 805 | @ [<a href="%s(g.zBaseURL)/wiki?name=%t(zPagename)">%h(zPagename)</a>] |
| 806 | @ uuid %s(zUuid) by %h(zUser) on %s(zDate). |
| 807 | nWiki++; |
| 808 | cnt++; |
| 809 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 810 | blob_append(pDownloadName, zPagename, -1); |
| 811 | } |
| @@ -836,11 +838,11 @@ | |
| 836 | @ Manifest of baseline |
| 837 | }else{ |
| 838 | @ Control file referencing |
| 839 | } |
| 840 | hyperlink_to_uuid(zUuid); |
| 841 | @ %w(zCom) by %h(zUser) on %s(zDate). |
| 842 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 843 | blob_append(pDownloadName, zUuid, -1); |
| 844 | } |
| 845 | cnt++; |
| 846 | } |
| @@ -1018,10 +1020,12 @@ | |
| 1018 | void artifact_page(void){ |
| 1019 | int rid; |
| 1020 | Blob content; |
| 1021 | const char *zMime; |
| 1022 | Blob downloadName; |
| 1023 | |
| 1024 | rid = name_to_rid(PD("name","0")); |
| 1025 | login_check_credentials(); |
| 1026 | if( !g.okRead ){ login_needed(); return; } |
| 1027 | if( rid==0 ){ cgi_redirect("/home"); } |
| @@ -1043,51 +1047,58 @@ | |
| 1043 | style_submenu_element("Download", "Download", |
| 1044 | "%s/raw/%T?name=%d", g.zTop, blob_str(&downloadName), rid); |
| 1045 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1046 | if( zMime ){ |
| 1047 | if( strcmp(zMime, "text/html")==0 ){ |
| 1048 | style_submenu_element("View", "View", |
| 1049 | "%s/raw?name=%d&m=text/html", g.zTop, rid); |
| 1050 | }else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1051 | Stmt q; |
| 1052 | db_prepare(&q, |
| 1053 | "SELECT blob.uuid || '/' || filename.name" |
| 1054 | " FROM mlink, filename, blob" |
| 1055 | " WHERE mlink.fid=%d" |
| 1056 | " AND filename.fnid=mlink.fnid" |
| 1057 | " AND filename.name GLOB '*.wiki'" |
| 1058 | " AND blob.rid=mlink.mid", |
| 1059 | rid |
| 1060 | ); |
| 1061 | if( db_step(&q)==SQLITE_ROW ){ |
| 1062 | const char *zCI = db_column_text(&q, 0); |
| 1063 | style_submenu_element("View", "View", "%s/doc/%s", g.zTop, zCI); |
| 1064 | } |
| 1065 | db_finalize(&q); |
| 1066 | } |
| 1067 | } |
| 1068 | @ </blockquote> |
| 1069 | @ <hr> |
| 1070 | @ <blockquote> |
| 1071 | content_get(rid, &content); |
| 1072 | zMime = mimetype_from_content(&content); |
| 1073 | if( zMime==0 ){ |
| 1074 | @ <pre> |
| 1075 | @ %h(blob_str(&content)) |
| 1076 | @ </pre> |
| 1077 | style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); |
| 1078 | }else if( strncmp(zMime, "image/", 6)==0 ){ |
| 1079 | @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img> |
| 1080 | style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); |
| 1081 | }else{ |
| 1082 | @ <pre> |
| 1083 | hexdump(&content); |
| 1084 | @ </pre> |
| 1085 | } |
| 1086 | @ </blockquote> |
| 1087 | style_footer(); |
| 1088 | } |
| 1089 | |
| 1090 | /* |
| 1091 | ** WEBPAGE: tinfo |
| 1092 | ** URL: /tinfo?name=ARTIFACTID |
| 1093 | ** |
| 1094 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -599,17 +599,16 @@ | |
| 599 | login_anonymous_available(); |
| 600 | |
| 601 | zPrevDate[0] = 0; |
| 602 | zFilename = PD("name",""); |
| 603 | db_prepare(&q, |
| 604 | "SELECT substr(b.uuid,1,10), datetime(event.mtime,'localtime')," |
| 605 | " coalesce(event.ecomment, event.comment)," |
| 606 | " coalesce(event.euser, event.user)," |
| 607 | " mlink.pid, mlink.fid, mlink.mid, mlink.fnid" |
| 608 | " FROM mlink, blob b, event" |
| 609 | " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)" |
| 610 | " AND b.rid=mlink.fid" |
| 611 | " AND event.objid=mlink.mid" |
| 612 | " ORDER BY event.mtime DESC", |
| 613 | zFilename |
| 614 | ); |
| @@ -618,19 +617,19 @@ | |
| 617 | hyperlinked_path(zFilename, &title); |
| 618 | @ <h2>%b(&title)</h2> |
| 619 | blob_reset(&title); |
| 620 | @ <table cellspacing=0 border=0 cellpadding=0> |
| 621 | while( db_step(&q)==SQLITE_ROW ){ |
| 622 | const char *zUuid = db_column_text(&q, 0); |
| 623 | const char *zDate = db_column_text(&q, 1); |
| 624 | const char *zCom = db_column_text(&q, 2); |
| 625 | const char *zUser = db_column_text(&q, 3); |
| 626 | int fpid = db_column_int(&q, 4); |
| 627 | int frid = db_column_int(&q, 5); |
| 628 | int mid = db_column_int(&q, 6); |
| 629 | int fnid = db_column_int(&q, 7); |
| 630 | char zShort[20]; |
| 631 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 632 | sprintf(zPrevDate, "%.10s", zDate); |
| 633 | @ <tr><td colspan=3> |
| 634 | @ <table cellpadding=2 border=0> |
| 635 | @ <tr><td bgcolor="#a0b5f4" class="border1"> |
| @@ -641,15 +640,18 @@ | |
| 640 | @ </td></tr> |
| 641 | } |
| 642 | @ <tr><td valign="top">%s(&zDate[11])</td> |
| 643 | @ <td width="20"></td> |
| 644 | @ <td valign="top" align="left"> |
| 645 | sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid); |
| 646 | if( g.okHistory ){ |
| 647 | @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%s(zShort)]</a> |
| 648 | }else{ |
| 649 | @ [%s(zShort)] |
| 650 | } |
| 651 | @ %h(zCom) (By: %h(zUser)) |
| 652 | if( g.okHistory ){ |
| 653 | if( fpid ){ |
| 654 | @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(fpid)&v2=%d(frid)">[diff]</a> |
| 655 | } |
| 656 | @ <a href="%s(g.zBaseURL)/annotate?mid=%d(mid)&fnid=%d(fnid)"> |
| 657 | @ [annotate]</a> |
| @@ -726,17 +728,17 @@ | |
| 728 | /* |
| 729 | ** Write a description of an object to the www reply. |
| 730 | ** |
| 731 | ** If the object is a file then mention: |
| 732 | ** |
| 733 | ** * It's artifact ID |
| 734 | ** * All its filenames |
| 735 | ** * The baselines it was checked-in on, with times and users |
| 736 | ** |
| 737 | ** If the object is a manifest, then mention: |
| 738 | ** |
| 739 | ** * It's artifact ID |
| 740 | ** * date of check-in |
| 741 | ** * Comment & user |
| 742 | */ |
| 743 | static void object_description( |
| 744 | int rid, /* The artifact ID */ |
| @@ -770,13 +772,13 @@ | |
| 772 | @ Also file |
| 773 | }else{ |
| 774 | @ File |
| 775 | } |
| 776 | @ <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 777 | @ artifact %s(zFuuid) part of check-in |
| 778 | hyperlink_to_uuid(zVers); |
| 779 | @ - %w(zCom) by %h(zUser) on %s(zDate). |
| 780 | cnt++; |
| 781 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 782 | blob_append(pDownloadName, zName, -1); |
| 783 | } |
| 784 | } |
| @@ -801,11 +803,11 @@ | |
| 803 | @ Also wiki page |
| 804 | }else{ |
| 805 | @ Wiki page |
| 806 | } |
| 807 | @ [<a href="%s(g.zBaseURL)/wiki?name=%t(zPagename)">%h(zPagename)</a>] |
| 808 | @ artifact %s(zUuid) by %h(zUser) on %s(zDate). |
| 809 | nWiki++; |
| 810 | cnt++; |
| 811 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 812 | blob_append(pDownloadName, zPagename, -1); |
| 813 | } |
| @@ -836,11 +838,11 @@ | |
| 838 | @ Manifest of baseline |
| 839 | }else{ |
| 840 | @ Control file referencing |
| 841 | } |
| 842 | hyperlink_to_uuid(zUuid); |
| 843 | @ - %w(zCom) by %h(zUser) on %s(zDate). |
| 844 | if( pDownloadName && blob_size(pDownloadName)==0 ){ |
| 845 | blob_append(pDownloadName, zUuid, -1); |
| 846 | } |
| 847 | cnt++; |
| 848 | } |
| @@ -1018,10 +1020,12 @@ | |
| 1020 | void artifact_page(void){ |
| 1021 | int rid; |
| 1022 | Blob content; |
| 1023 | const char *zMime; |
| 1024 | Blob downloadName; |
| 1025 | int renderAsWiki = 0; |
| 1026 | int renderAsHtml = 0; |
| 1027 | |
| 1028 | rid = name_to_rid(PD("name","0")); |
| 1029 | login_check_credentials(); |
| 1030 | if( !g.okRead ){ login_needed(); return; } |
| 1031 | if( rid==0 ){ cgi_redirect("/home"); } |
| @@ -1043,51 +1047,58 @@ | |
| 1047 | style_submenu_element("Download", "Download", |
| 1048 | "%s/raw/%T?name=%d", g.zTop, blob_str(&downloadName), rid); |
| 1049 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1050 | if( zMime ){ |
| 1051 | if( strcmp(zMime, "text/html")==0 ){ |
| 1052 | if( P("txt") ){ |
| 1053 | style_submenu_element("Html", "Html", |
| 1054 | "%s/artifact?name=%d", g.zTop, rid); |
| 1055 | }else{ |
| 1056 | renderAsHtml = 1; |
| 1057 | style_submenu_element("Text", "Text", |
| 1058 | "%s/artifact?name=%d&txt=1", g.zTop, rid); |
| 1059 | } |
| 1060 | }else if( strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1061 | if( P("txt") ){ |
| 1062 | style_submenu_element("Wiki", "Wiki", |
| 1063 | "%s/artifact?name=%d", g.zTop, rid); |
| 1064 | }else{ |
| 1065 | renderAsWiki = 1; |
| 1066 | style_submenu_element("Text", "Text", |
| 1067 | "%s/artifact?name=%d&txt=1", g.zTop, rid); |
| 1068 | } |
| 1069 | } |
| 1070 | } |
| 1071 | @ </blockquote> |
| 1072 | @ <hr> |
| 1073 | content_get(rid, &content); |
| 1074 | if( renderAsWiki ){ |
| 1075 | wiki_convert(&content, 0, 0); |
| 1076 | }else if( renderAsHtml ){ |
| 1077 | @ <div> |
| 1078 | cgi_append_content(blob_buffer(&content), blob_size(&content)); |
| 1079 | @ </div> |
| 1080 | }else{ |
| 1081 | zMime = mimetype_from_content(&content); |
| 1082 | @ <blockquote> |
| 1083 | if( zMime==0 ){ |
| 1084 | @ <pre> |
| 1085 | @ %h(blob_str(&content)) |
| 1086 | @ </pre> |
| 1087 | style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); |
| 1088 | }else if( strncmp(zMime, "image/", 6)==0 ){ |
| 1089 | @ <img src="%s(g.zBaseURL)/raw?name=%d(rid)&m=%s(zMime)"></img> |
| 1090 | style_submenu_element("Hex","Hex", "%s/hexdump?name=%d", g.zTop, rid); |
| 1091 | }else{ |
| 1092 | @ <pre> |
| 1093 | hexdump(&content); |
| 1094 | @ </pre> |
| 1095 | } |
| 1096 | @ </blockquote> |
| 1097 | } |
| 1098 | style_footer(); |
| 1099 | } |
| 1100 | |
| 1101 | /* |
| 1102 | ** WEBPAGE: tinfo |
| 1103 | ** URL: /tinfo?name=ARTIFACTID |
| 1104 | ** |
| 1105 |