Hey,
I found reposstyle last friday and started to use it on my SVN repo.
As I can't create an account on your ticket system (https://
labs.repos.se/trac/report), I report my issue and the fixes via here.
There were some things I didn't get working, like:
- I've places my reposstyle directories a bit lower in the directory
structure. This didn't work because all paths where hard-coded in the
files.
- The logviewer didn't work because my svn repo has custom url's per
repo and I'm not using the SvnParentPath option
- The logviewer didn't use any svn login details, and my svn is only
accessible when logged in
So I created a patch that fixes everything above.
My Apache Config I use:
--------------------------------------
<Location /repository/project>
# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
SVNPath /srv/svn/project
AuthType Basic
AuthName "My Project Repository"
AuthUserFile /srv/svn/.dav/conf/my-project.passwd
# Disabling authorization per-path checks altogether
SVNPathAuthz off
Require valid-user
SVNIndexXSLT "/svnweb/repos-web/view/repos.xsl"
</Location>
# URL where the repo is accessible on via the web
<Location /svnweb/repos-web/open/log>
AuthType Basic
AuthName "My Project Repository"
AuthUserFile /srv/svn/.dav/conf/my-project.passwd
# Every user must authenticate before access is given
Require valid-user
</Location>
--------------------------------------
The directory patch based on the content of repos-style-with-
plugins-2.4.zip:
--------------------------------------
diff -rupN repostyle-2.4/repos-plugins/logrss/logrss.plugin.js
repostyle/repos-plugins/logrss/logrss.plugin.js
--- repostyle-2.4/repos-plugins/logrss/logrss.plugin.js 2010-07-18
08:29:16.000000000 +0200
+++ repostyle/repos-plugins/logrss/logrss.plugin.js 2011-07-18
15:36:13.266197429 +0200
@@ -1,42 +1,43 @@
// This is an alternative to editing the xslt body if you already
have javascript and jQuery running
// Instead of adding
-// <a id="logrss" class="command translate"
+// <a id="logrss" class="command translate"
// href="/repos-plugins/logrss/?base={/svn/index/@base}
&target={/svn/index/@path}"
// style="background-image:url('/repos-plugins/logrss/
feed.png')">rss</a>
// to #commandbar in repos.xsl add the following to head (works in
log.xsl too):
// <script type="text/javascript" src="/repos-plugins/logrss/
logrss.plugin.js"></script>
$(document).ready(function() {
-
- var pluginUrl = '/repos-plugins/logrss/';
+
+ var rssPluginUrl = pluginUrl + '/logrss';
var rssUrl = '';
-
+
var reposMeta = function(id) {
return $('meta[name=repos-' + id + ']').attr('content');
};
-
+
if ($('body').is('.repository')) {
var target = reposMeta('target');
if (target == '//') {
target = '/'; // fix for the inconsistency in svn index root
}
var base = reposMeta('base');
- rssUrl = pluginUrl + '?base=' + base + '&target=' +
encodeURIComponent(target);
+ rssUrl = rssPluginUrl + '?base=' + base + '&target=' +
encodeURIComponent(target);
} else if ($('body').is('.log')) {
- rssUrl = pluginUrl + location.search;
+ rssUrl = rssPluginUrl + location.search;
} else {
return;
}
-
+
var command = $('<a id="logrss"/>').attr('href', rssUrl)
// command bar
//command.text('rss').css('background-image', 'url(' + pluginUrl +
'feed-icon-16x16.png');
//command.appendTo('#commandbar');
// footer
- command.append($('<img/>').attr('src', pluginUrl + 'feed-
icon-14x14.png').css({border: 0, verticalAlign: 'text-top'}));
+ command.append($('<img/>').attr('src', rssPluginUrl + '/feed-
icon-14x14.png').css({border: 0, verticalAlign: 'text-top'}));
$('#footer').append('<span class="spacer"> </
span>').append(command);
-
+
// make the RSS show up in page info
var info = $('<link rel="alternate" type="application/rss+xml"/
>').attr('title', 'Subversion log RSS').attr('href',
rssUrl).appendTo('head');
-
-});
\ No newline at end of file
+
+});
+
diff -rupN repostyle-2.4/repos-web/open/log/index.php repostyle/repos-
web/open/log/index.php
--- repostyle-2.4/repos-web/open/log/index.php 2010-07-20
07:08:26.000000000 +0200
+++ repostyle/repos-web/open/log/index.php 2011-07-18
15:36:16.126197431 +0200
@@ -17,14 +17,18 @@
// === Print svn log --xml to response ===
-// Set the URL to the stylesheet, must be same host or absolute path
from root
-$xslt = '/repos-web/view/log.xsl';
+// Set the URL absolute url to webroot of the application
+$webRoot = '/svnweb';
+//$webRoot = '@@@WebRoot@';
+
+$xslt = $webRoot . '/repos-web/view/log.xsl';
// URL or path to repository, no trailing slash
// (note that the log viewer may bypass access control)
-$repo = '@@Repository@@';
+//$repo = '@@Repository@@';
+$repo = '
http://lppvdissel:8080';
// For SVNParentPath set $repo to parent and this to true
-$isParent = false;
+$isParent = true;
// limit log length for performance reasons (users should run svn
client for more entries)
$limit = 20;
@@ -35,32 +39,77 @@ $svn = 'svn';
// === configuration done, get parameters ===
isset($_REQUEST['target']) or die("Parameter 'target' is required");
-$target = $_REQUEST['target'];
+$svnTarget = $_REQUEST['target'];
// === validate and run svn ===
-if (strstr($repo,'@@')) die('The log script must be configured with a
root URL');
+if (strstr($webRoot, '@@')) die('The log script must be configured
with a webRoot path');
+if (strstr($repo, '@@')) die('The log script must be configured with
a root URL');
is_numeric($limit) or die('The log script must be configured with a
numeric limit');
if ($isParent) {
isset($_REQUEST['base']) && strlen($_REQUEST['base'])>0
or die("Parameter 'base' (Subversion 1.5 or later) required for
SVNParentPath");
- $repo = $repo.'/'.$_REQUEST['base'];
}
-$url = $repo . $target;
+$svnBase = null;
+if (array_key_exists('HTTP_REFERER', $_SERVER)) {
+ $refererUrl = $_SERVER['HTTP_REFERER'];
+ $refererUrl = parse_url($refererUrl, PHP_URL_PATH);
+ $svnBaseUrl = null;
+ if ($isParent) {
+ $svnBase = $_REQUEST['base'];
+ // Get the referer Url based on the "svnBase"
+ $svnBaseUrl = substr($refererUrl, 0, (strpos($refererUrl,
$svnBase) + strlen($svnBase)));
+ } else {
+ // Get the referer Url based on the "svnTarget"
+ $svnBaseUrl = substr($refererUrl, 0, (strpos($refererUrl,
$svnTarget) + strlen($svnTarget)));
+ }
+
+ $redirectUrl = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
+
+ $cleanRefererUrl = rtrim($refererUrl, '/');
+ $cleansvnBaseUrl = rtrim($svnBaseUrl, '/');
+ if (false === strpos($cleanSvnBase, $cleanRefererUrl)) {
+ $redirectUrlQueryOptions = array(
+ 'base' => $svnBaseUrl
+ , 'target' => $svnTarget
+ , 'redir' => 1
+ );
+ $redirectUrl = $redirectUrl . '?' .
http_build_query($redirectUrlQueryOptions);
+
+ if (!array_key_exists('redir', $_REQUEST)) {
+ header('location: ' . $redirectUrl);
+ exit();
+ }
+ }
+}
+
+if ($isParent) {
+ isset($_REQUEST['base']) && strlen($_REQUEST['base'])>0
+ or die("Parameter 'base' (Subversion 1.5 or later) required for
SVNParentPath");
+ $repo = $repo . '/' . $svnBase;
+}
+
+$url = $repo . $svnTarget;
// command line, injection safe, svn must be in path, assumes utf-8
shell
-$cmd = $svn.' log --xml --verbose --incremental --non-interactive';
+$cmd = $svn . ' log --xml --verbose --incremental --non-interactive';
+if (array_key_exists('PHP_AUTH_USER', $_SERVER)
+ && array_key_exists('PHP_AUTH_PW', $_SERVER)
+) {
+ $cmd .= sprintf(' --username %s --password %s',
escapeshellarg($_SERVER['PHP_AUTH_USER']),
escapeshellarg($_SERVER['PHP_AUTH_PW']));
+}
$cmd .= ' --limit '.escapeshellarg($limit);
$cmd .= ' '.escapeshellarg($url);
$cmd .= ' 2>&1';
header('Content-Type: text/xml');
echo('<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="'.$xslt.'"?>
-<log limit="'.$limit.'">
+<?xml-stylesheet type="text/xsl" href="' . $xslt . '"?>
+<log limit="' . $limit.'">
');
passthru($cmd);
echo('</log>
');
?>
+
diff -rupN repostyle-2.4/repos-web/view/header.xsl repostyle/repos-web/
view/header.xsl
--- repostyle-2.4/repos-web/view/header.xsl 1970-01-01
01:00:00.000000000 +0100
+++ repostyle/repos-web/view/header.xsl 2011-07-18 15:36:14.166197431
+0200
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<!--
+Repos Style (c) 2004-2007 Staffan Olsson
www.reposstyle.com
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+ ==== Repos Subversion log layout ====
+ Note that browser transformations only work if the
+ stylesheet is read from the same domain as the XML
+-->
+<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns="
http://www.w3.org/1999/xhtml" version="1.0">
+ <xsl:output method="html" encoding="UTF-8" omit-xml-declaration="no"
indent="no"
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
+ <xsl:param name="reposstyle-version">2.4</xsl:param>
+
+ <!-- === repos style configuration === -->
+ <!-- webroot: absolute url to webroot of the application -->
+ <xsl:param name="webroot">/svnweb</xsl:param>
+ <!-- static: absolute url to style application -->
+ <xsl:param name="static"><xsl:value-of select="$webroot"/>/repos-
web</xsl:param>
+ <!-- plugins: absolute url to plugins application -->
+ <xsl:param name="plugins"><xsl:value-of select="$webroot"/>/repos-
plugins</xsl:param>
+ <!-- cssUrl: absolute url to css folder -->
+ <xsl:param name="cssUrl"><xsl:value-of select="$static"/>/style</
xsl:param>
+ <!-- cssUrl: absolute url to css folder -->
+ <xsl:param name="pluginsUrl"><xsl:value-of select="$plugins"/></
xsl:param>
+
+ <!-- ===== end of configuration ===== -->
+
+ <xsl:param name="spacer" select="'   '"/>
+
+ <xsl:template name="linebreak">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="contains($text, ' ')">
+ <xsl:value-of select="substring-before($text, ' ')"/>
+ <br/>
+ <xsl:call-template name="linebreak">
+ <xsl:with-param name="text" select="substring-after($text,
' ')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="footer">
+ <div id="footer">
+ <xsl:if test="@rev>0">
+ <span>Revision <span class="revision"><xsl:value-of select="@rev"/
></span> - </span>
+ </xsl:if>
+ <span><a href="
http://www.reposstyle.com/"
target="_blank">Repos Style</a> <xsl:value-of
select="$reposstyle-version"/>
+ & <a href="
http://www.kde-look.org/content/show.php?
content=16479" target="_blank">Cezanne icons</a></span>
+ <span id="badges">
+ </span>
+ <span class="legal">
+ <xsl:text>Powered by </xsl:text>
+ <xsl:element name="a">
+ <xsl:attribute name="href"><xsl:value-of select="../@href"/></
xsl:attribute>
+ <xsl:attribute name="target"><xsl:value-of select="'_blank'"/></
xsl:attribute>
+ <xsl:text>Subversion</xsl:text>
+ </xsl:element>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="../@version"/>
+ <xsl:text> </xsl:text>
+ </span>
+ </div>
+ </xsl:template>
+</xsl:stylesheet>
+
diff -rupN repostyle-2.4/repos-web/view/log.xsl repostyle/repos-web/
view/log.xsl
--- repostyle-2.4/repos-web/view/log.xsl 2010-07-20 07:08:30.000000000
+0200
+++ repostyle/repos-web/view/log.xsl 2011-07-18 15:36:14.226197431
+0200
@@ -21,18 +21,15 @@ limitations under the License.
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns="
http://www.w3.org/1999/xhtml" version="1.0">
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="no"
indent="no"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
- <xsl:param name="reposstyle-version">2.4</xsl:param>
-
+
+ <xsl:include href="header.xsl"/>
+
<!-- === repos style configuration === -->
- <!-- static: absolute url to style application -->
- <xsl:param name="static">/repos-web/</xsl:param>
- <!-- cssUrl: absolute url to css folder -->
- <xsl:param name="cssUrl"><xsl:value-of select="$static"/>style/</
xsl:param>
<!-- log viewer does not know the repository URL -->
<xsl:param name="repoUrl">javascript:history.go(-1)</xsl:param>
<!-- ===== end of configuration ===== -->
-
- <xsl:param name="spacer" select="'   '"/>
+
+ <!-- <xsl:param name="spacer" select="'   '"/> -->
<xsl:template match="/">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
@@ -42,14 +39,14 @@ limitations under the License.
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<!-- if search crawlers have access, contents should not be
cached -->
<meta name="robots" content="noarchive"/>
- <link rel="shortcut icon" href="/favicon.ico"/>
- <link title="repos" rel="stylesheet" type="text/css"
href="{$cssUrl}global.css"/>
- <link title="repos" rel="stylesheet" type="text/css"
href="{$cssUrl}log/log.css"/>
- <!-- plugins -->
- <script type="text/javascript" src="/repos-plugins/
jquery.min.js"></script>
- <script type="text/javascript" src="/repos-plugins/dateformat/
dateformat.plugin.js"></script>
- <script type="text/javascript" src="/repos-plugins/logrss/
logrss.plugin.js"></script>
-
+ <!-- <link rel="shortcut icon" href="/favicon.ico"/> -->
+ <link title="repos" rel="stylesheet" type="text/css"
href="{$cssUrl}/global.css"/>
+ <link title="repos" rel="stylesheet" type="text/css"
href="{$cssUrl}/log/log.css"/>
+ <!-- plugins -->
+ <script type="text/javascript" src="{$pluginsUrl}/
jquery.min.js"></script>
+ <script type="text/javascript" src="{$pluginsUrl}/dateformat/
dateformat.plugin.js"></script>
+ <script type="text/javascript" src="{$pluginsUrl}/logrss/
logrss.plugin.js"></script>
+
</head>
<body class="log xml">
<xsl:apply-templates select="log"/>
@@ -85,15 +82,6 @@ limitations under the License.
</xsl:if>
</xsl:if>
</xsl:template>
- <xsl:template name="footer">
- <div id="footer">
- <span><a href="
http://www.reposstyle.com/"
target="_blank">Repos Style</a> <xsl:value-of
select="$reposstyle-version"/>
- & <a href="
http://www.kde-look.org/content/show.php?
content=16479" target="_blank">Cezanne icons</a></span>
- <span id="badges">
- </span>
- <span class="legal">Powered by Subversion</span>
- </div>
- </xsl:template>
<xsl:template match="logentry">
<xsl:param name="n" select="position() - 1"/>
<div id="rev{@revision}" class="logentry n{$n mod 4}">
@@ -175,23 +163,9 @@ limitations under the License.
</xsl:if>
</div>
</xsl:template>
- <xsl:template name="linebreak">
- <xsl:param name="text" select="text()"/>
- <xsl:choose>
- <xsl:when test="contains($text, ' ')">
- <xsl:value-of select="substring-before($text, ' ')"/>
- <br/>
- <xsl:call-template name="linebreak">
- <xsl:with-param name="text" select="substring-after($text,
' ')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
<xsl:template name="getFileID">
<xsl:param name="filename" select="@href"/>
<xsl:value-of select="translate($filename,'%/()@&+=,~$!
','_____________')"/>
</xsl:template>
</xsl:stylesheet>
+
diff -rupN repostyle-2.4/repos-web/view/repos.xsl repostyle/repos-web/
view/repos.xsl
--- repostyle-2.4/repos-web/view/repos.xsl 2010-07-20
07:08:30.000000000 +0200
+++ repostyle/repos-web/view/repos.xsl 2011-07-18 15:36:14.086197431
+0200
@@ -27,22 +27,19 @@ limitations under the License.
<xsl:output method="html" encoding="utf-8" omit-xml-declaration="no"
indent="no"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/
>
- <xsl:param name="reposstyle-version">2.4</xsl:param>
+
+ <xsl:include href="header.xsl"/>
<!-- === repos style configuration === -->
- <!-- static: absolute url to style application -->
- <xsl:param name="static">/repos-web/</xsl:param>
- <!-- cssUrl: absolute url to css folder -->
- <xsl:param name="cssUrl"><xsl:value-of select="$static"/>style/</
xsl:param>
<!-- logUrl: empty -> no log tool, absolute url -> enable 'history'
link. Must allow appended query param -->
- <xsl:param name="logUrl"><xsl:value-of select="$static"/>open/log/?
base=<xsl:value-of select="/svn/index/@base"/>&</xsl:param>
+ <xsl:param name="logUrl"><xsl:value-of select="$static"/>/open/log/?
base=<xsl:value-of select="/svn/index/@base"/>&</xsl:param>
<!-- startpage: empty -> standard behaviour, absolute url -> special
handling of 'up' from trunk -->
<xsl:param name="startpage">/</xsl:param>
<!-- tools: name of recognized top level folders to get css tool-
class -->
<xsl:param name="tools">/trunk/branches/tags/</xsl:param>
<!-- ===== end of configuration ===== -->
- <xsl:param name="spacer" select="'   '"/>
+ <!-- <xsl:param name="spacer" select="'   '"/> -->
<xsl:template match="/">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
@@ -53,17 +50,20 @@ limitations under the License.
</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<meta name="robots" content="noarchive"/>
- <link rel="shortcut icon" href="/favicon.ico"/>
+ <!-- <link rel="shortcut icon" href="/favicon.ico"/>-->
<xsl:call-template name="styletag"/>
<!-- repos metadata for use in plugins -->
<meta name="repos-service" content="index/" />
<meta name="repos-target" content="{/svn/index/@path}/" />
<meta name="repos-base" content="{/svn/index/@base}" />
- <!-- plugins -->
- <script type="text/javascript" src="/repos-plugins/
jquery.min.js"></script>
- <!--<script type="text/javascript" src="/repos-search/repos-
search.plugin.js"></script>-->
- <script type="text/javascript" src="/repos-plugins/logrss/
logrss.plugin.js"></script>
-
+ <!-- plugins -->
+ <script type="text/javascript" src="{$pluginsUrl}/
jquery.min.js"></script>
+ <!--<script type="text/javascript" src="/repos-search/repos-
search.plugin.js"></script>-->
+ <script type="text/javascript">
+ var pluginUrl = "<xsl:value-of select="$pluginsUrl"/>";
+ </script>
+ <script type="text/javascript" src="{$pluginsUrl}/logrss/
logrss.plugin.js"></script>
+
</head>
<body class="repository xml">
<xsl:apply-templates select="svn"/>
@@ -71,8 +71,8 @@ limitations under the License.
</html>
</xsl:template>
<xsl:template name="styletag">
- <link rel="stylesheet" type="text/css" media="screen,projection"
href="{$cssUrl}global.css"/>
- <link rel="stylesheet" type="text/css" media="screen,projection"
href="{$cssUrl}repository/repository.css"/>
+ <link rel="stylesheet" type="text/css" media="screen,projection"
href="{$cssUrl}/global.css"/>
+ <link rel="stylesheet" type="text/css" media="screen,projection"
href="{$cssUrl}/repository/repository.css"/>
</xsl:template>
<xsl:template match="svn">
<xsl:apply-templates select="index"/>
@@ -161,26 +161,6 @@ limitations under the License.
</a>
</li>
</xsl:template>
- <xsl:template name="footer">
- <div id="footer">
- <span>Revision <span class="revision"><xsl:value-of select="@rev"/
></span> - </span>
- <span><a href="
http://www.reposstyle.com/"
target="_blank">Repos Style</a> <xsl:value-of
select="$reposstyle-version"/>
- & <a href="
http://www.kde-look.org/content/show.php?
content=16479" target="_blank">Cezanne icons</a></span>
- <span id="badges">
- </span>
- <span class="legal">
- <xsl:text>Powered by </xsl:text>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="../@href"/></
xsl:attribute>
- <xsl:attribute name="target"><xsl:value-of select="'_blank'"/></
xsl:attribute>
- <xsl:text>Subversion</xsl:text>
- </xsl:element>
- <xsl:text> </xsl:text>
- <xsl:value-of select="../@version"/>
- <xsl:text> </xsl:text>
- </span>
- </div>
- </xsl:template>
<xsl:template name="getFolderPathLinks">
<xsl:param name="folders"/>
<xsl:param name="f" select="substring-before($folders, '/')"/>
@@ -260,19 +240,5 @@ limitations under the License.
<xsl:param name="filename" select="@href"/>
<xsl:value-of select="translate($filename,'%/','__')"/>
</xsl:template>
- <xsl:template name="linebreak">
- <xsl:param name="text"/>
- <xsl:choose>
- <xsl:when test="contains($text, ' ')">
- <xsl:value-of select="substring-before($text, ' ')"/>
- <br/>
- <xsl:call-template name="linebreak">
- <xsl:with-param name="text" select="substring-after($text,
' ')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
</xsl:stylesheet>
+
--------------------------------------