diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index bfdbf9e..173010a 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -235,69 +235,6 @@ class IDF_Views_Source } /** - * Display tree of a specific SVN revision - * - */ - public function treeRev($request, $match) - { - $prj = $request->project; - - // Redirect to tree base if not svn - if ($request->conf->getVal('scm', 'git') != 'svn') { - $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase', - array($prj->shortname, $prj->getScmRoot())); - - return new Pluf_HTTP_Response_Redirect($url); - } - - // Get revision value - if (!isset($request->REQUEST['rev']) or trim($request->REQUEST['rev']) == '') { - $scmRoot = $prj->getScmRoot(); - } - else { - $scmRoot = $request->REQUEST['rev']; - } - - // Get source if not / - if (isset($request->REQUEST['sourcefile']) and trim($request->REQUEST['sourcefile']) != '') { - $scmRoot .= '/'.$request->REQUEST['sourcefile']; - } - - // Redirect - $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase', - array($prj->shortname, $scmRoot)); - return new Pluf_HTTP_Response_Redirect($url); - } - - /** - * Display SVN changelog from specific revision - * - */ - public function changelogRev($request, $match) - { - $prj = $request->project; - - // Redirect to tree base if not svn - if ($request->conf->getVal('scm', 'git') != 'svn') { - $scmRoot = $prj->getScmRoot(); - } - // Get revision value if svn - else { - if (!isset($request->REQUEST['rev']) or trim($request->REQUEST['rev']) == '') { - $scmRoot = $prj->getScmRoot(); - } - else { - $scmRoot = $request->REQUEST['rev']; - } - } - - // Redirect - $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::changeLog', - array($prj->shortname, $scmRoot)); - return new Pluf_HTTP_Response_Redirect($url); - } - - /** * Find the mime type of a file. * * Use /etc/mime.types to find the type. diff --git a/src/IDF/Views/Source/Svn.php b/src/IDF/Views/Source/Svn.php new file mode 100644 index 0000000..74ef8f4 --- /dev/null +++ b/src/IDF/Views/Source/Svn.php @@ -0,0 +1,93 @@ +project; + + // Redirect to tree base if not svn + if ($request->conf->getVal('scm', 'git') != 'svn') { + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase', + array($prj->shortname, $prj->getScmRoot())); + + return new Pluf_HTTP_Response_Redirect($url); + } + + // Get revision value + if (!isset($request->REQUEST['rev']) or trim($request->REQUEST['rev']) == '') { + $scmRoot = $prj->getScmRoot(); + } + else { + $scmRoot = $request->REQUEST['rev']; + } + + // Get source if not / + if (isset($request->REQUEST['sourcefile']) and trim($request->REQUEST['sourcefile']) != '') { + $scmRoot .= '/'.$request->REQUEST['sourcefile']; + } + + // Redirect + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase', + array($prj->shortname, $scmRoot)); + return new Pluf_HTTP_Response_Redirect($url); + } + + /** + * Display SVN changelog from specific revision + * + */ + public function changelogRev($request, $match) + { + $prj = $request->project; + + // Redirect to tree base if not svn + if ($request->conf->getVal('scm', 'git') != 'svn') { + $scmRoot = $prj->getScmRoot(); + } + // Get revision value if svn + else { + if (!isset($request->REQUEST['rev']) or trim($request->REQUEST['rev']) == '') { + $scmRoot = $prj->getScmRoot(); + } + else { + $scmRoot = $request->REQUEST['rev']; + } + } + + // Redirect + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::changeLog', + array($prj->shortname, $scmRoot)); + return new Pluf_HTTP_Response_Redirect($url); + } +} \ No newline at end of file diff --git a/src/IDF/conf/views.php b/src/IDF/conf/views.php index 2c62968..4a65b97 100644 --- a/src/IDF/conf/views.php +++ b/src/IDF/conf/views.php @@ -168,13 +168,13 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/source/download/(\w+)/$#', $ctl[] = array('regex' => '#^/p/([\-\w]+)/source/treerev/$#', 'base' => $base, 'priority' => 4, - 'model' => 'IDF_Views_Source', + 'model' => 'IDF_Views_Source_Svn', 'method' => 'treeRev'); $ctl[] = array('regex' => '#^/p/([\-\w]+)/source/changesrev/$#', 'base' => $base, 'priority' => 4, - 'model' => 'IDF_Views_Source', + 'model' => 'IDF_Views_Source_Svn', 'method' => 'changelogRev'); // ---------- Downloads ------------------------------------ diff --git a/src/IDF/templates/source/changelog.html b/src/IDF/templates/source/changelog.html index 904fc54..fb57bd8 100644 --- a/src/IDF/templates/source/changelog.html +++ b/src/IDF/templates/source/changelog.html @@ -37,7 +37,7 @@

{/if} {if $scm == 'svn'} -
+

{trans 'Revision:'} {$commit}

diff --git a/src/IDF/templates/source/svn/tree.html b/src/IDF/templates/source/svn/tree.html index 9e08b18..e1b39fc 100644 --- a/src/IDF/templates/source/svn/tree.html +++ b/src/IDF/templates/source/svn/tree.html @@ -61,7 +61,7 @@ {/block} {block context} - +

{trans 'Revision:'} {$commit}