Fossil SCM

Add the /download page, with a configuration option to define what tag to be downloaded.

drh 2017-10-17 21:06 trunk
Commit c5fea125d9405c1ae2492529db31927436356701724ce2bfde514cb32670589f
2 files changed +45 +11 -1
+45
--- src/clone.c
+++ src/clone.c
@@ -293,5 +293,50 @@
293293
void clone_ssh_db_set_options(void){
294294
if( g.zSshCmd && g.zSshCmd[0] ){
295295
db_set("ssh-command", g.zSshCmd, 0);
296296
}
297297
}
298
+
299
+/*
300
+** WEBPAGE: download
301
+**
302
+** Provide a simple page that newbies to download the latest tarball or
303
+** ZIP archive, and to provide instructions on how to clone.
304
+*/
305
+void download_page(void){
306
+ login_check_credentials();
307
+ style_header("Download Page");
308
+ if( !g.perm.Zip ){
309
+ @ <p>Bummer. You do not have permission to download.
310
+ if( g.zLogin==0 || g.zLogin[0]==0 ){
311
+ @ Maybe it would work better if you
312
+ @ <a href="../login">logged in</a>.
313
+ }else{
314
+ @ Contact the site administrator and ask them to give
315
+ @ you "Download Zip" privileges.
316
+ }
317
+ }else{
318
+ const char *zDLTag = db_get("download-tag","trunk");
319
+ const char *zNm = db_get("short-project-name","download");
320
+ char *zUrl = href("%R/zip/%t.zip?uuid=%t", zNm, zDLTag);
321
+ @ <p>ZIP Archive: %z(zUrl)%h(zNm).zip</a>
322
+ zUrl = href("%R/tarball/%t.tar.gz?uuid=%t", zNm, zDLTag);
323
+ @ <p>Tarball: %z(zUrl)%h(zNm).tar.gz</a>
324
+ }
325
+ if( !g.perm.Clone ){
326
+ @ <p>You are not authorized to clone this repository.
327
+ if( g.zLogin==0 || g.zLogin[0]==0 ){
328
+ @ Maybe you would be able to clone if you
329
+ @ <a href="../login">logged in</a>.
330
+ }else{
331
+ @ Contact the site administrator and ask them to give
332
+ @ you "Clone" privileges in order to clone.
333
+ }
334
+ }else{
335
+ const char *zNm = db_get("short-project-name","clone");
336
+ @ <p>Clone the repository using this command:
337
+ @ <blockquote><pre>
338
+ @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
339
+ @ </pre></blockquote>
340
+ }
341
+ style_footer();
342
+}
298343
--- src/clone.c
+++ src/clone.c
@@ -293,5 +293,50 @@
293 void clone_ssh_db_set_options(void){
294 if( g.zSshCmd && g.zSshCmd[0] ){
295 db_set("ssh-command", g.zSshCmd, 0);
296 }
297 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
--- src/clone.c
+++ src/clone.c
@@ -293,5 +293,50 @@
293 void clone_ssh_db_set_options(void){
294 if( g.zSshCmd && g.zSshCmd[0] ){
295 db_set("ssh-command", g.zSshCmd, 0);
296 }
297 }
298
299 /*
300 ** WEBPAGE: download
301 **
302 ** Provide a simple page that newbies to download the latest tarball or
303 ** ZIP archive, and to provide instructions on how to clone.
304 */
305 void download_page(void){
306 login_check_credentials();
307 style_header("Download Page");
308 if( !g.perm.Zip ){
309 @ <p>Bummer. You do not have permission to download.
310 if( g.zLogin==0 || g.zLogin[0]==0 ){
311 @ Maybe it would work better if you
312 @ <a href="../login">logged in</a>.
313 }else{
314 @ Contact the site administrator and ask them to give
315 @ you "Download Zip" privileges.
316 }
317 }else{
318 const char *zDLTag = db_get("download-tag","trunk");
319 const char *zNm = db_get("short-project-name","download");
320 char *zUrl = href("%R/zip/%t.zip?uuid=%t", zNm, zDLTag);
321 @ <p>ZIP Archive: %z(zUrl)%h(zNm).zip</a>
322 zUrl = href("%R/tarball/%t.tar.gz?uuid=%t", zNm, zDLTag);
323 @ <p>Tarball: %z(zUrl)%h(zNm).tar.gz</a>
324 }
325 if( !g.perm.Clone ){
326 @ <p>You are not authorized to clone this repository.
327 if( g.zLogin==0 || g.zLogin[0]==0 ){
328 @ Maybe you would be able to clone if you
329 @ <a href="../login">logged in</a>.
330 }else{
331 @ Contact the site administrator and ask them to give
332 @ you "Clone" privileges in order to clone.
333 }
334 }else{
335 const char *zNm = db_get("short-project-name","clone");
336 @ <p>Clone the repository using this command:
337 @ <blockquote><pre>
338 @ fossil clone %s(g.zBaseURL) %h(zNm).fossil
339 @ </pre></blockquote>
340 }
341 style_footer();
342 }
343
+11 -1
--- src/setup.c
+++ src/setup.c
@@ -1650,17 +1650,27 @@
16501650
"project-description", "pd", "", 0);
16511651
@ <p>Describe your project. This will be used in page headers for search
16521652
@ engines as well as a short RSS description.
16531653
@ (Property: "project-description")</p>
16541654
@ <hr />
1655
- entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name", "spn", "", 0);
1655
+ entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name",
1656
+ "spn", "", 0);
16561657
@ <p>This is used as a prefix on the names of generated tarballs and ZIP archive.
16571658
@ For best results, keep this prefix brief and avoid special characters such
16581659
@ as "/" and "\".
16591660
@ If no tarball prefix is specified, then the full Project Name above is used.
16601661
@ (Property: "short-project-name")
16611662
@ </p>
1663
+ @ <hr />
1664
+ entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0);
1665
+ @ <p>The <a href='%R/download'>/download</a> page is designed to provide
1666
+ @ a convenient place for newbies
1667
+ @ to download a ZIP archive or a tarball of the project. By default, the latest
1668
+ @ trunk check-in is downloaded. Change this tag to something else (ex: release)
1669
+ @ to alter the behavior of the /download page.
1670
+ @ (Property: "download-tag")
1671
+ @ </p>
16621672
@ <hr />
16631673
onoff_attribute("Enable WYSIWYG Wiki Editing",
16641674
"wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
16651675
@ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
16661676
@ The WYSIWYG editor generates HTML instead of markup, which makes
16671677
--- src/setup.c
+++ src/setup.c
@@ -1650,17 +1650,27 @@
1650 "project-description", "pd", "", 0);
1651 @ <p>Describe your project. This will be used in page headers for search
1652 @ engines as well as a short RSS description.
1653 @ (Property: "project-description")</p>
1654 @ <hr />
1655 entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name", "spn", "", 0);
 
1656 @ <p>This is used as a prefix on the names of generated tarballs and ZIP archive.
1657 @ For best results, keep this prefix brief and avoid special characters such
1658 @ as "/" and "\".
1659 @ If no tarball prefix is specified, then the full Project Name above is used.
1660 @ (Property: "short-project-name")
1661 @ </p>
 
 
 
 
 
 
 
 
 
1662 @ <hr />
1663 onoff_attribute("Enable WYSIWYG Wiki Editing",
1664 "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
1665 @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
1666 @ The WYSIWYG editor generates HTML instead of markup, which makes
1667
--- src/setup.c
+++ src/setup.c
@@ -1650,17 +1650,27 @@
1650 "project-description", "pd", "", 0);
1651 @ <p>Describe your project. This will be used in page headers for search
1652 @ engines as well as a short RSS description.
1653 @ (Property: "project-description")</p>
1654 @ <hr />
1655 entry_attribute("Tarball and ZIP-archive Prefix", 20, "short-project-name",
1656 "spn", "", 0);
1657 @ <p>This is used as a prefix on the names of generated tarballs and ZIP archive.
1658 @ For best results, keep this prefix brief and avoid special characters such
1659 @ as "/" and "\".
1660 @ If no tarball prefix is specified, then the full Project Name above is used.
1661 @ (Property: "short-project-name")
1662 @ </p>
1663 @ <hr />
1664 entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0);
1665 @ <p>The <a href='%R/download'>/download</a> page is designed to provide
1666 @ a convenient place for newbies
1667 @ to download a ZIP archive or a tarball of the project. By default, the latest
1668 @ trunk check-in is downloaded. Change this tag to something else (ex: release)
1669 @ to alter the behavior of the /download page.
1670 @ (Property: "download-tag")
1671 @ </p>
1672 @ <hr />
1673 onoff_attribute("Enable WYSIWYG Wiki Editing",
1674 "wysiwyg-wiki", "wysiwyg-wiki", 0, 0);
1675 @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages.
1676 @ The WYSIWYG editor generates HTML instead of markup, which makes
1677

Keyboard Shortcuts

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