[PATCH] Restructured the "source views" file hierarchy.
Svn specifics Views are now in a Source subfolder.
This commit is contained in:
		
				
					committed by
					
						
						Loic d'Anterroches
					
				
			
			
				
	
			
			
			
						parent
						
							bd15328758
						
					
				
				
					commit
					b881ad1c8f
				
			@@ -234,69 +234,6 @@ class IDF_Views_Source
 | 
			
		||||
        return $rep;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 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.
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										93
									
								
								src/IDF/Views/Source/Svn.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								src/IDF/Views/Source/Svn.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
<?php
 | 
			
		||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 | 
			
		||||
/*
 | 
			
		||||
# ***** BEGIN LICENSE BLOCK *****
 | 
			
		||||
# This file is part of InDefero, an open source project management application.
 | 
			
		||||
# Copyright (C) 2008 Céondo Ltd and contributors.
 | 
			
		||||
#
 | 
			
		||||
# InDefero is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# InDefero is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software
 | 
			
		||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 | 
			
		||||
#
 | 
			
		||||
# ***** END LICENSE BLOCK ***** */
 | 
			
		||||
 | 
			
		||||
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * View git repository.
 | 
			
		||||
 */
 | 
			
		||||
class IDF_Views_Source_Svn
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * 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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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 ------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
</p>
 | 
			
		||||
{/if}
 | 
			
		||||
{if $scm == 'svn'}
 | 
			
		||||
<form class="star" action="{url 'IDF_Views_Source::changelogRev', array($project.shortname)}" method="get">
 | 
			
		||||
<form class="star" action="{url 'IDF_Views_Source_Svn::changelogRev', array($project.shortname)}" method="get">
 | 
			
		||||
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
 | 
			
		||||
<p>
 | 
			
		||||
    <input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@
 | 
			
		||||
 | 
			
		||||
{/block}
 | 
			
		||||
{block context}
 | 
			
		||||
<form class="star" action="{url 'IDF_Views_Source::treeRev', array($project.shortname)}" method="get">
 | 
			
		||||
<form class="star" action="{url 'IDF_Views_Source_Svn::treeRev', array($project.shortname)}" method="get">
 | 
			
		||||
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
 | 
			
		||||
<p>
 | 
			
		||||
    <input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user