Fossil SCM

Use the abbreviated object description by default. But provide a hyperlink to a detailed description (using the new /whatis web page) if details are omitted.

drh 2014-08-14 16:36 trunk
Commit 3c2d418b600a81d7234335063c8d5b8fc0f59d26
1 file changed +70 -55
+70 -55
--- src/info.c
+++ src/info.c
@@ -1116,11 +1116,11 @@
11161116
11171117
/*
11181118
** Possible flags for the second parameter to
11191119
** object_description()
11201120
*/
1121
-#define OBJDESC_BRIEF 0x0001 /* Less detail */
1121
+#define OBJDESC_DETAIL 0x0001 /* more detail */
11221122
#endif
11231123
11241124
/*
11251125
** Write a description of an object to the www reply.
11261126
**
@@ -1144,11 +1144,11 @@
11441144
Stmt q;
11451145
int cnt = 0;
11461146
int nWiki = 0;
11471147
int objType = 0;
11481148
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1149
- int isBrief = (objdescFlags & OBJDESC_BRIEF)!=0;
1149
+ int showDetail = (objdescFlags & OBJDESC_DETAIL)!=0;
11501150
char *prevName = 0;
11511151
11521152
db_prepare(&q,
11531153
"SELECT filename.name, datetime(event.mtime),"
11541154
" coalesce(event.ecomment,event.comment),"
@@ -1173,11 +1173,17 @@
11731173
const char *zUser = db_column_text(&q, 3);
11741174
const char *zVers = db_column_text(&q, 4);
11751175
int mPerm = db_column_int(&q, 5);
11761176
const char *zBr = db_column_text(&q, 6);
11771177
int sameFilename = prevName!=0 && fossil_strcmp(zName,prevName)==0;
1178
- if( sameFilename && isBrief ) continue;
1178
+ if( sameFilename && !showDetail ){
1179
+ if( cnt==1 ){
1180
+ @ %z(href("%R/whatis/%s",zUuid))[more...]</a>
1181
+ }
1182
+ cnt++;
1183
+ continue;
1184
+ }
11791185
if( !sameFilename ){
11801186
if( prevName ) {
11811187
@ </ul>
11821188
}
11831189
if( mPerm==PERM_LNK ){
@@ -1189,25 +1195,25 @@
11891195
}else{
11901196
@ <li>File
11911197
}
11921198
objType |= OBJTYPE_CONTENT;
11931199
@ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
1194
- if( !isBrief ){
1200
+ if( showDetail ){
11951201
@ <ul>
11961202
}
11971203
prevName = fossil_strdup(zName);
11981204
}
1199
- if( isBrief ){
1200
- @ &mdash; from checkin
1201
- hyperlink_to_uuid(zVers);
1202
- @ at
1203
- hyperlink_to_date(zDate,"");
1204
- }else{
1205
+ if( showDetail ){
12051206
@ <li>
12061207
hyperlink_to_date(zDate,"");
12071208
@ &mdash; part of check-in
12081209
hyperlink_to_uuid(zVers);
1210
+ }else{
1211
+ @ &mdash; part of checkin
1212
+ hyperlink_to_uuid(zVers);
1213
+ @ at
1214
+ hyperlink_to_date(zDate,"");
12091215
}
12101216
if( zBr && zBr[0] ){
12111217
@ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a>
12121218
}
12131219
@ &mdash; %!w(zCom) (user:
@@ -1222,11 +1228,11 @@
12221228
cnt++;
12231229
if( pDownloadName && blob_size(pDownloadName)==0 ){
12241230
blob_append(pDownloadName, zName, -1);
12251231
}
12261232
}
1227
- if( prevName && !isBrief ){
1233
+ if( prevName && showDetail ){
12281234
@ </ul>
12291235
}
12301236
@ </ul>
12311237
free(prevName);
12321238
db_finalize(&q);
@@ -1365,11 +1371,11 @@
13651371
** difference between the two artifacts. Show diff side by side unless sbs
13661372
** is 0. Generate plaintext if "patch" is present.
13671373
**
13681374
** Additional parameters:
13691375
**
1370
-** brief Show less detail when describing artifacts
1376
+** verbose Show more detail when describing artifacts
13711377
*/
13721378
void diff_page(void){
13731379
int v1, v2;
13741380
int isPatch;
13751381
int sideBySide;
@@ -1386,11 +1392,11 @@
13861392
v1 = name_to_rid_www("v1");
13871393
v2 = name_to_rid_www("v2");
13881394
if( v1==0 || v2==0 ) fossil_redirect_home();
13891395
zRe = P("regex");
13901396
if( zRe ) re_compile(&pRe, zRe, 0);
1391
- if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1397
+ if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
13921398
isPatch = P("patch")!=0;
13931399
if( isPatch ){
13941400
Blob c1, c2, *pOut;
13951401
pOut = cgi_output_blob();
13961402
cgi_set_content_type("text/plain");
@@ -1551,11 +1557,11 @@
15511557
** Show the complete content of a file identified by ARTIFACTID
15521558
** as preformatted text.
15531559
**
15541560
** Other parameters:
15551561
**
1556
-** brief Show less detail when describing the object
1562
+** verbose Show more detail when describing the object
15571563
*/
15581564
void hexdump_page(void){
15591565
int rid;
15601566
Blob content;
15611567
Blob downloadName;
@@ -1582,11 +1588,11 @@
15821588
@ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
15831589
}else{
15841590
@ <h2>Artifact %s(zUuid):</h2>
15851591
}
15861592
blob_zero(&downloadName);
1587
- if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1593
+ if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
15881594
object_description(rid, objdescFlags, &downloadName);
15891595
style_submenu_element("Download", "Download",
15901596
"%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
15911597
@ <hr />
15921598
content_get(rid, &content);
@@ -1708,23 +1714,27 @@
17081714
}
17091715
}
17101716
17111717
17121718
/*
1719
+** WEBPAGE: whatis
17131720
** WEBPAGE: artifact
1714
-** URL: /artifact/ARTIFACTID
1721
+**
1722
+** URL: /artifact/SHA1HASH
17151723
** URL: /artifact?ci=CHECKIN&filename=PATH
1724
+** URL: /whatis/SHA1HASH
17161725
**
17171726
** Additional query parameters:
17181727
**
17191728
** ln - show line numbers
17201729
** ln=N - highlight line number N
17211730
** ln=M-N - highlight lines M through N inclusive
1722
-** brief - show less detail in the description
1731
+** verbose - show more detail in the description
17231732
**
1724
-** Show the complete content of a file identified by ARTIFACTID
1725
-** as preformatted text.
1733
+** The /artifact page show the complete content of a file
1734
+** identified by SHA1HASH as preformatted text. The
1735
+** /whatis page shows only a description of the file.
17261736
*/
17271737
void artifact_page(void){
17281738
int rid = 0;
17291739
Blob content;
17301740
const char *zMime;
@@ -1733,10 +1743,11 @@
17331743
int renderAsHtml = 0;
17341744
int objType;
17351745
int asText;
17361746
const char *zUuid;
17371747
u32 objdescFlags = 0;
1748
+ int descOnly = fossil_strcmp(g.zPath,"whatis")==0;
17381749
17391750
if( P("ci") && P("filename") ){
17401751
rid = artifact_from_ci_and_filename_www();
17411752
}
17421753
if( rid==0 ){
@@ -1754,12 +1765,12 @@
17541765
}else{
17551766
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
17561767
g.zTop, zUuid);
17571768
}
17581769
}
1759
- if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1760
- style_header("Artifact Content");
1770
+ if( descOnly || P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
1771
+ style_header(descOnly ? "Artifact Description" : "Artifact Content");
17611772
zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
17621773
if( g.perm.Setup ){
17631774
@ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
17641775
}else{
17651776
@ <h2>Artifact %s(zUuid):</h2>
@@ -1797,44 +1808,48 @@
17971808
}
17981809
}
17991810
if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
18001811
style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
18011812
}
1802
- @ <hr />
1803
- content_get(rid, &content);
1804
- if( renderAsWiki ){
1805
- wiki_render_by_mimetype(&content, zMime);
1806
- }else if( renderAsHtml ){
1807
- @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1808
- @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1809
- @ sandbox="allow-same-origin"
1810
- @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
1811
- @ </iframe>
1812
- }else{
1813
- style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1814
- blob_to_utf8_no_bom(&content, 0);
1815
- zMime = mimetype_from_content(&content);
1816
- @ <blockquote>
1817
- if( zMime==0 ){
1818
- const char *zLn = P("ln");
1819
- const char *z;
1820
- z = blob_str(&content);
1821
- if( zLn ){
1822
- output_text_with_line_numbers(z, zLn);
1823
- }else{
1824
- @ <pre>
1825
- @ %h(z)
1826
- @ </pre>
1827
- }
1828
- }else if( strncmp(zMime, "image/", 6)==0 ){
1829
- @ <img src="%R/raw/%s(zUuid)?m=%s(zMime)" />
1830
- style_submenu_element("Image", "Image",
1831
- "%R/raw/%s?m=%s", zUuid, zMime);
1832
- }else{
1833
- @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
1834
- }
1835
- @ </blockquote>
1813
+ if( descOnly ){
1814
+ style_submenu_element("Content", "Content", "%R/artifact/%s", zUuid);
1815
+ }else{
1816
+ @ <hr />
1817
+ content_get(rid, &content);
1818
+ if( renderAsWiki ){
1819
+ wiki_render_by_mimetype(&content, zMime);
1820
+ }else if( renderAsHtml ){
1821
+ @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1822
+ @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1823
+ @ sandbox="allow-same-origin"
1824
+ @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
1825
+ @ </iframe>
1826
+ }else{
1827
+ style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1828
+ blob_to_utf8_no_bom(&content, 0);
1829
+ zMime = mimetype_from_content(&content);
1830
+ @ <blockquote>
1831
+ if( zMime==0 ){
1832
+ const char *zLn = P("ln");
1833
+ const char *z;
1834
+ z = blob_str(&content);
1835
+ if( zLn ){
1836
+ output_text_with_line_numbers(z, zLn);
1837
+ }else{
1838
+ @ <pre>
1839
+ @ %h(z)
1840
+ @ </pre>
1841
+ }
1842
+ }else if( strncmp(zMime, "image/", 6)==0 ){
1843
+ @ <img src="%R/raw/%s(zUuid)?m=%s(zMime)" />
1844
+ style_submenu_element("Image", "Image",
1845
+ "%R/raw/%s?m=%s", zUuid, zMime);
1846
+ }else{
1847
+ @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
1848
+ }
1849
+ @ </blockquote>
1850
+ }
18361851
}
18371852
style_footer();
18381853
}
18391854
18401855
/*
18411856
--- src/info.c
+++ src/info.c
@@ -1116,11 +1116,11 @@
1116
1117 /*
1118 ** Possible flags for the second parameter to
1119 ** object_description()
1120 */
1121 #define OBJDESC_BRIEF 0x0001 /* Less detail */
1122 #endif
1123
1124 /*
1125 ** Write a description of an object to the www reply.
1126 **
@@ -1144,11 +1144,11 @@
1144 Stmt q;
1145 int cnt = 0;
1146 int nWiki = 0;
1147 int objType = 0;
1148 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1149 int isBrief = (objdescFlags & OBJDESC_BRIEF)!=0;
1150 char *prevName = 0;
1151
1152 db_prepare(&q,
1153 "SELECT filename.name, datetime(event.mtime),"
1154 " coalesce(event.ecomment,event.comment),"
@@ -1173,11 +1173,17 @@
1173 const char *zUser = db_column_text(&q, 3);
1174 const char *zVers = db_column_text(&q, 4);
1175 int mPerm = db_column_int(&q, 5);
1176 const char *zBr = db_column_text(&q, 6);
1177 int sameFilename = prevName!=0 && fossil_strcmp(zName,prevName)==0;
1178 if( sameFilename && isBrief ) continue;
 
 
 
 
 
 
1179 if( !sameFilename ){
1180 if( prevName ) {
1181 @ </ul>
1182 }
1183 if( mPerm==PERM_LNK ){
@@ -1189,25 +1195,25 @@
1189 }else{
1190 @ <li>File
1191 }
1192 objType |= OBJTYPE_CONTENT;
1193 @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
1194 if( !isBrief ){
1195 @ <ul>
1196 }
1197 prevName = fossil_strdup(zName);
1198 }
1199 if( isBrief ){
1200 @ &mdash; from checkin
1201 hyperlink_to_uuid(zVers);
1202 @ at
1203 hyperlink_to_date(zDate,"");
1204 }else{
1205 @ <li>
1206 hyperlink_to_date(zDate,"");
1207 @ &mdash; part of check-in
1208 hyperlink_to_uuid(zVers);
 
 
 
 
 
1209 }
1210 if( zBr && zBr[0] ){
1211 @ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a>
1212 }
1213 @ &mdash; %!w(zCom) (user:
@@ -1222,11 +1228,11 @@
1222 cnt++;
1223 if( pDownloadName && blob_size(pDownloadName)==0 ){
1224 blob_append(pDownloadName, zName, -1);
1225 }
1226 }
1227 if( prevName && !isBrief ){
1228 @ </ul>
1229 }
1230 @ </ul>
1231 free(prevName);
1232 db_finalize(&q);
@@ -1365,11 +1371,11 @@
1365 ** difference between the two artifacts. Show diff side by side unless sbs
1366 ** is 0. Generate plaintext if "patch" is present.
1367 **
1368 ** Additional parameters:
1369 **
1370 ** brief Show less detail when describing artifacts
1371 */
1372 void diff_page(void){
1373 int v1, v2;
1374 int isPatch;
1375 int sideBySide;
@@ -1386,11 +1392,11 @@
1386 v1 = name_to_rid_www("v1");
1387 v2 = name_to_rid_www("v2");
1388 if( v1==0 || v2==0 ) fossil_redirect_home();
1389 zRe = P("regex");
1390 if( zRe ) re_compile(&pRe, zRe, 0);
1391 if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1392 isPatch = P("patch")!=0;
1393 if( isPatch ){
1394 Blob c1, c2, *pOut;
1395 pOut = cgi_output_blob();
1396 cgi_set_content_type("text/plain");
@@ -1551,11 +1557,11 @@
1551 ** Show the complete content of a file identified by ARTIFACTID
1552 ** as preformatted text.
1553 **
1554 ** Other parameters:
1555 **
1556 ** brief Show less detail when describing the object
1557 */
1558 void hexdump_page(void){
1559 int rid;
1560 Blob content;
1561 Blob downloadName;
@@ -1582,11 +1588,11 @@
1582 @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
1583 }else{
1584 @ <h2>Artifact %s(zUuid):</h2>
1585 }
1586 blob_zero(&downloadName);
1587 if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1588 object_description(rid, objdescFlags, &downloadName);
1589 style_submenu_element("Download", "Download",
1590 "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
1591 @ <hr />
1592 content_get(rid, &content);
@@ -1708,23 +1714,27 @@
1708 }
1709 }
1710
1711
1712 /*
 
1713 ** WEBPAGE: artifact
1714 ** URL: /artifact/ARTIFACTID
 
1715 ** URL: /artifact?ci=CHECKIN&filename=PATH
 
1716 **
1717 ** Additional query parameters:
1718 **
1719 ** ln - show line numbers
1720 ** ln=N - highlight line number N
1721 ** ln=M-N - highlight lines M through N inclusive
1722 ** brief - show less detail in the description
1723 **
1724 ** Show the complete content of a file identified by ARTIFACTID
1725 ** as preformatted text.
 
1726 */
1727 void artifact_page(void){
1728 int rid = 0;
1729 Blob content;
1730 const char *zMime;
@@ -1733,10 +1743,11 @@
1733 int renderAsHtml = 0;
1734 int objType;
1735 int asText;
1736 const char *zUuid;
1737 u32 objdescFlags = 0;
 
1738
1739 if( P("ci") && P("filename") ){
1740 rid = artifact_from_ci_and_filename_www();
1741 }
1742 if( rid==0 ){
@@ -1754,12 +1765,12 @@
1754 }else{
1755 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
1756 g.zTop, zUuid);
1757 }
1758 }
1759 if( P("brief")!=0 ) objdescFlags |= OBJDESC_BRIEF;
1760 style_header("Artifact Content");
1761 zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
1762 if( g.perm.Setup ){
1763 @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
1764 }else{
1765 @ <h2>Artifact %s(zUuid):</h2>
@@ -1797,44 +1808,48 @@
1797 }
1798 }
1799 if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
1800 style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
1801 }
1802 @ <hr />
1803 content_get(rid, &content);
1804 if( renderAsWiki ){
1805 wiki_render_by_mimetype(&content, zMime);
1806 }else if( renderAsHtml ){
1807 @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1808 @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1809 @ sandbox="allow-same-origin"
1810 @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
1811 @ </iframe>
1812 }else{
1813 style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1814 blob_to_utf8_no_bom(&content, 0);
1815 zMime = mimetype_from_content(&content);
1816 @ <blockquote>
1817 if( zMime==0 ){
1818 const char *zLn = P("ln");
1819 const char *z;
1820 z = blob_str(&content);
1821 if( zLn ){
1822 output_text_with_line_numbers(z, zLn);
1823 }else{
1824 @ <pre>
1825 @ %h(z)
1826 @ </pre>
1827 }
1828 }else if( strncmp(zMime, "image/", 6)==0 ){
1829 @ <img src="%R/raw/%s(zUuid)?m=%s(zMime)" />
1830 style_submenu_element("Image", "Image",
1831 "%R/raw/%s?m=%s", zUuid, zMime);
1832 }else{
1833 @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
1834 }
1835 @ </blockquote>
 
 
 
 
1836 }
1837 style_footer();
1838 }
1839
1840 /*
1841
--- src/info.c
+++ src/info.c
@@ -1116,11 +1116,11 @@
1116
1117 /*
1118 ** Possible flags for the second parameter to
1119 ** object_description()
1120 */
1121 #define OBJDESC_DETAIL 0x0001 /* more detail */
1122 #endif
1123
1124 /*
1125 ** Write a description of an object to the www reply.
1126 **
@@ -1144,11 +1144,11 @@
1144 Stmt q;
1145 int cnt = 0;
1146 int nWiki = 0;
1147 int objType = 0;
1148 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1149 int showDetail = (objdescFlags & OBJDESC_DETAIL)!=0;
1150 char *prevName = 0;
1151
1152 db_prepare(&q,
1153 "SELECT filename.name, datetime(event.mtime),"
1154 " coalesce(event.ecomment,event.comment),"
@@ -1173,11 +1173,17 @@
1173 const char *zUser = db_column_text(&q, 3);
1174 const char *zVers = db_column_text(&q, 4);
1175 int mPerm = db_column_int(&q, 5);
1176 const char *zBr = db_column_text(&q, 6);
1177 int sameFilename = prevName!=0 && fossil_strcmp(zName,prevName)==0;
1178 if( sameFilename && !showDetail ){
1179 if( cnt==1 ){
1180 @ %z(href("%R/whatis/%s",zUuid))[more...]</a>
1181 }
1182 cnt++;
1183 continue;
1184 }
1185 if( !sameFilename ){
1186 if( prevName ) {
1187 @ </ul>
1188 }
1189 if( mPerm==PERM_LNK ){
@@ -1189,25 +1195,25 @@
1195 }else{
1196 @ <li>File
1197 }
1198 objType |= OBJTYPE_CONTENT;
1199 @ %z(href("%R/finfo?name=%T",zName))%h(zName)</a>
1200 if( showDetail ){
1201 @ <ul>
1202 }
1203 prevName = fossil_strdup(zName);
1204 }
1205 if( showDetail ){
 
 
 
 
 
1206 @ <li>
1207 hyperlink_to_date(zDate,"");
1208 @ &mdash; part of check-in
1209 hyperlink_to_uuid(zVers);
1210 }else{
1211 @ &mdash; part of checkin
1212 hyperlink_to_uuid(zVers);
1213 @ at
1214 hyperlink_to_date(zDate,"");
1215 }
1216 if( zBr && zBr[0] ){
1217 @ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr)</a>
1218 }
1219 @ &mdash; %!w(zCom) (user:
@@ -1222,11 +1228,11 @@
1228 cnt++;
1229 if( pDownloadName && blob_size(pDownloadName)==0 ){
1230 blob_append(pDownloadName, zName, -1);
1231 }
1232 }
1233 if( prevName && showDetail ){
1234 @ </ul>
1235 }
1236 @ </ul>
1237 free(prevName);
1238 db_finalize(&q);
@@ -1365,11 +1371,11 @@
1371 ** difference between the two artifacts. Show diff side by side unless sbs
1372 ** is 0. Generate plaintext if "patch" is present.
1373 **
1374 ** Additional parameters:
1375 **
1376 ** verbose Show more detail when describing artifacts
1377 */
1378 void diff_page(void){
1379 int v1, v2;
1380 int isPatch;
1381 int sideBySide;
@@ -1386,11 +1392,11 @@
1392 v1 = name_to_rid_www("v1");
1393 v2 = name_to_rid_www("v2");
1394 if( v1==0 || v2==0 ) fossil_redirect_home();
1395 zRe = P("regex");
1396 if( zRe ) re_compile(&pRe, zRe, 0);
1397 if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
1398 isPatch = P("patch")!=0;
1399 if( isPatch ){
1400 Blob c1, c2, *pOut;
1401 pOut = cgi_output_blob();
1402 cgi_set_content_type("text/plain");
@@ -1551,11 +1557,11 @@
1557 ** Show the complete content of a file identified by ARTIFACTID
1558 ** as preformatted text.
1559 **
1560 ** Other parameters:
1561 **
1562 ** verbose Show more detail when describing the object
1563 */
1564 void hexdump_page(void){
1565 int rid;
1566 Blob content;
1567 Blob downloadName;
@@ -1582,11 +1588,11 @@
1588 @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
1589 }else{
1590 @ <h2>Artifact %s(zUuid):</h2>
1591 }
1592 blob_zero(&downloadName);
1593 if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
1594 object_description(rid, objdescFlags, &downloadName);
1595 style_submenu_element("Download", "Download",
1596 "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid);
1597 @ <hr />
1598 content_get(rid, &content);
@@ -1708,23 +1714,27 @@
1714 }
1715 }
1716
1717
1718 /*
1719 ** WEBPAGE: whatis
1720 ** WEBPAGE: artifact
1721 **
1722 ** URL: /artifact/SHA1HASH
1723 ** URL: /artifact?ci=CHECKIN&filename=PATH
1724 ** URL: /whatis/SHA1HASH
1725 **
1726 ** Additional query parameters:
1727 **
1728 ** ln - show line numbers
1729 ** ln=N - highlight line number N
1730 ** ln=M-N - highlight lines M through N inclusive
1731 ** verbose - show more detail in the description
1732 **
1733 ** The /artifact page show the complete content of a file
1734 ** identified by SHA1HASH as preformatted text. The
1735 ** /whatis page shows only a description of the file.
1736 */
1737 void artifact_page(void){
1738 int rid = 0;
1739 Blob content;
1740 const char *zMime;
@@ -1733,10 +1743,11 @@
1743 int renderAsHtml = 0;
1744 int objType;
1745 int asText;
1746 const char *zUuid;
1747 u32 objdescFlags = 0;
1748 int descOnly = fossil_strcmp(g.zPath,"whatis")==0;
1749
1750 if( P("ci") && P("filename") ){
1751 rid = artifact_from_ci_and_filename_www();
1752 }
1753 if( rid==0 ){
@@ -1754,12 +1765,12 @@
1765 }else{
1766 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
1767 g.zTop, zUuid);
1768 }
1769 }
1770 if( descOnly || P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
1771 style_header(descOnly ? "Artifact Description" : "Artifact Content");
1772 zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);
1773 if( g.perm.Setup ){
1774 @ <h2>Artifact %s(zUuid) (%d(rid)):</h2>
1775 }else{
1776 @ <h2>Artifact %s(zUuid):</h2>
@@ -1797,44 +1808,48 @@
1808 }
1809 }
1810 if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){
1811 style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
1812 }
1813 if( descOnly ){
1814 style_submenu_element("Content", "Content", "%R/artifact/%s", zUuid);
1815 }else{
1816 @ <hr />
1817 content_get(rid, &content);
1818 if( renderAsWiki ){
1819 wiki_render_by_mimetype(&content, zMime);
1820 }else if( renderAsHtml ){
1821 @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1822 @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1823 @ sandbox="allow-same-origin"
1824 @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
1825 @ </iframe>
1826 }else{
1827 style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid);
1828 blob_to_utf8_no_bom(&content, 0);
1829 zMime = mimetype_from_content(&content);
1830 @ <blockquote>
1831 if( zMime==0 ){
1832 const char *zLn = P("ln");
1833 const char *z;
1834 z = blob_str(&content);
1835 if( zLn ){
1836 output_text_with_line_numbers(z, zLn);
1837 }else{
1838 @ <pre>
1839 @ %h(z)
1840 @ </pre>
1841 }
1842 }else if( strncmp(zMime, "image/", 6)==0 ){
1843 @ <img src="%R/raw/%s(zUuid)?m=%s(zMime)" />
1844 style_submenu_element("Image", "Image",
1845 "%R/raw/%s?m=%s", zUuid, zMime);
1846 }else{
1847 @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i>
1848 }
1849 @ </blockquote>
1850 }
1851 }
1852 style_footer();
1853 }
1854
1855 /*
1856

Keyboard Shortcuts

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