Fossil SCM
Add the /download page, with a configuration option to define what tag to be downloaded.
Commit
c5fea125d9405c1ae2492529db31927436356701724ce2bfde514cb32670589f
Parent
f014e1566042c3a…
2 files changed
+45
+11
-1
+45
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -293,5 +293,50 @@ | ||
| 293 | 293 | void clone_ssh_db_set_options(void){ |
| 294 | 294 | if( g.zSshCmd && g.zSshCmd[0] ){ |
| 295 | 295 | db_set("ssh-command", g.zSshCmd, 0); |
| 296 | 296 | } |
| 297 | 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 | +} | |
| 298 | 343 |
| --- 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 @@ | ||
| 1650 | 1650 | "project-description", "pd", "", 0); |
| 1651 | 1651 | @ <p>Describe your project. This will be used in page headers for search |
| 1652 | 1652 | @ engines as well as a short RSS description. |
| 1653 | 1653 | @ (Property: "project-description")</p> |
| 1654 | 1654 | @ <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); | |
| 1656 | 1657 | @ <p>This is used as a prefix on the names of generated tarballs and ZIP archive. |
| 1657 | 1658 | @ For best results, keep this prefix brief and avoid special characters such |
| 1658 | 1659 | @ as "/" and "\". |
| 1659 | 1660 | @ If no tarball prefix is specified, then the full Project Name above is used. |
| 1660 | 1661 | @ (Property: "short-project-name") |
| 1661 | 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> | |
| 1662 | 1672 | @ <hr /> |
| 1663 | 1673 | onoff_attribute("Enable WYSIWYG Wiki Editing", |
| 1664 | 1674 | "wysiwyg-wiki", "wysiwyg-wiki", 0, 0); |
| 1665 | 1675 | @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages. |
| 1666 | 1676 | @ The WYSIWYG editor generates HTML instead of markup, which makes |
| 1667 | 1677 |
| --- 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 |