diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 85f21e2..73ac571 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -37,6 +37,24 @@ class IDF_Views_Source 'pl', 'pm', 'rb', 'js', 'html', 'html', 'xhtml', 'xml', 'xsl'); + /** + * Display help on how to checkout etc. + */ + public $help_precond = array('IDF_Precondition::accessSource'); + public function help($request, $match) + { + $title = sprintf(__('%s Source Help'), (string) $request->project); + $scm = IDF_Scm::get($request->project); + $scmConf = $request->conf->getVal('scm', 'git'); + $params = array( + 'page_title' => $title, + 'title' => $title, + 'scm' => $scmConf, + ); + return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/help.html', + $params, $request); + } + public $changeLog_precond = array('IDF_Precondition::accessSource'); public function changeLog($request, $match) { @@ -82,7 +100,7 @@ class IDF_Views_Source $branches = $scm->getBranches(); if (count($branches) == 0) { // Redirect to the project home - $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::home', + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help', array($request->project->shortname)); return new Pluf_HTTP_Response_Redirect($url); } diff --git a/src/IDF/conf/urls.php b/src/IDF/conf/urls.php index 969151f..07e8bce 100644 --- a/src/IDF/conf/urls.php +++ b/src/IDF/conf/urls.php @@ -164,6 +164,12 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/view/attachment/(\d+)/(.*)$#', // ---------- SCM ---------------------------------------- +$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#', + 'base' => $base, + 'priority' => 4, + 'model' => 'IDF_Views_Source', + 'method' => 'help'); + $ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([^/]+)/$#', 'base' => $base, 'priority' => 4, diff --git a/src/IDF/templates/idf/source/git/help.html b/src/IDF/templates/idf/source/git/help.html new file mode 100644 index 0000000..c6f2146 --- /dev/null +++ b/src/IDF/templates/idf/source/git/help.html @@ -0,0 +1,36 @@ +{extends "idf/source/base.html"} +{block docclass}yui-t2{/block} +{block body} + +

{blocktrans}The team behind {$project} is using +the git software to manage the source +code.{/blocktrans}

+ +

{trans 'Command-Line Access'}

+ +

git clone {$project.getRemoteAccessUrl()}

+ + +{if $isOwner or $isMember} +

{trans 'First Commit'}

+ +

{blocktrans}To make a first commit in the repository, perform the following steps:{/blocktrans}

+ +
+git init
+git add .
+git commit -m "initial import"
+git remote add repo {$project.getRemoteAccessUrl()}
+git push repo master
+
+ +{/if} + +{/block} +{block context} +
+

{blocktrans}Find here more details on how to access {$project} source code.{/blocktrans}

+
+{/block} + + diff --git a/src/IDF/templates/idf/source/git/tree.html b/src/IDF/templates/idf/source/git/tree.html index ec9fb21..a8b664d 100644 --- a/src/IDF/templates/idf/source/git/tree.html +++ b/src/IDF/templates/idf/source/git/tree.html @@ -43,7 +43,7 @@ {aurl 'url', 'IDF_Views_Source::download', array($project.shortname, $commit)} -

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} git clone {$project.getRemoteAccessUrl()}

+

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} git clone {$project.getRemoteAccessUrl()} {trans 'Help'}

{/block} diff --git a/src/IDF/templates/idf/source/mercurial/help.html b/src/IDF/templates/idf/source/mercurial/help.html new file mode 100644 index 0000000..d8108c3 --- /dev/null +++ b/src/IDF/templates/idf/source/mercurial/help.html @@ -0,0 +1,31 @@ +{extends "idf/source/base.html"} +{block docclass}yui-t2{/block} +{block body} + +

{blocktrans}The team behind {$project} is using +the Mercurial software to manage the source +code.{/blocktrans}

+ +

{trans 'Command-Line Access'}

+ +

hg clone {$project.getRemoteAccessUrl()}

+ + +{if $isOwner or $isMember} +

{trans 'Write Access Authentication'}

+ +{aurl 'url', 'IDF_Views_User::myAccount'} +

{blocktrans}To get write access to the repository, you need to use your username and your extra password.{/blocktrans}

+ +

hg clone {$project.getRemoteAccessUrl()}

+ +{/if} + +{/block} +{block context} +
+

{blocktrans}Find here more details on how to access {$project} source code.{/blocktrans}

+
+{/block} + + diff --git a/src/IDF/templates/idf/source/mercurial/tree.html b/src/IDF/templates/idf/source/mercurial/tree.html index 9d0ba7a..6077f33 100644 --- a/src/IDF/templates/idf/source/mercurial/tree.html +++ b/src/IDF/templates/idf/source/mercurial/tree.html @@ -43,7 +43,7 @@ {aurl 'url', 'IDF_Views_Source::download', array($project.shortname, $commit)} -

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} hg clone {$project.getRemoteAccessUrl()}

+

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} hg clone {$project.getRemoteAccessUrl()} {trans 'Help'}

{/block} {block context} diff --git a/src/IDF/templates/idf/source/svn/help.html b/src/IDF/templates/idf/source/svn/help.html new file mode 100644 index 0000000..bb54f68 --- /dev/null +++ b/src/IDF/templates/idf/source/svn/help.html @@ -0,0 +1,31 @@ +{extends "idf/source/base.html"} +{block docclass}yui-t2{/block} +{block body} + +

{blocktrans}The team behind {$project} is using +the subversion software to manage the source +code.{/blocktrans}

+ +

{trans 'Command-Line Access'}

+ +

svn co {$project.getRemoteAccessUrl()}

+ + +{if $isOwner or $isMember} +

{trans 'Write Access Authentication'}

+ +{aurl 'url', 'IDF_Views_User::myAccount'} +

{blocktrans}To get write access to the repository, you need to use your username and your extra password.{/blocktrans}

+ +

svn co {$project.getRemoteAccessUrl()} --username {$user.login}

+ +{/if} + +{/block} +{block context} +
+

{blocktrans}Find here more details on how to access {$project} source code.{/blocktrans}

+
+{/block} + + diff --git a/src/IDF/templates/idf/source/svn/tree.html b/src/IDF/templates/idf/source/svn/tree.html index fa5cc24..3ce66c3 100644 --- a/src/IDF/templates/idf/source/svn/tree.html +++ b/src/IDF/templates/idf/source/svn/tree.html @@ -56,7 +56,7 @@ {/foreach} -

svn co -r {$commit} {$project.getRemoteAccessUrl()}

+

svn co -r {$commit} {$project.getRemoteAccessUrl()} {trans 'Help'}

{/block} diff --git a/www/media/idf/img/help.png b/www/media/idf/img/help.png new file mode 100644 index 0000000..f25fc3f Binary files /dev/null and b/www/media/idf/img/help.png differ