Skip to content

Commit

Permalink
added separate template variables 'projectname' and 'projecturl' in a…
Browse files Browse the repository at this point in the history
…ddition to (now obsolete) 'projectlink'
  • Loading branch information
dirk-thomas committed Aug 7, 2011
1 parent e83d00f commit 8bcf42e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion doc/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ <h4>Variables defined within [websvn-startlisting] ... [websvn-endlisting]</h4>

<table>
<tr><th>projectlink</th><td>HTML link to a project (not set for group headers)</td></tr>
<tr><th>projectname</th><td>Name of the project (not set for group headers)</td></tr>
<tr><th>projecturl</th><td>URL of the project (not set for group headers)</td></tr>
<tr><th>clientrooturl</th><td>The root URL for SVN clients to use for a repository (only if provided in <code>config.php</code>)</td></tr>
<tr><th>rowparity</th><td>Parity of the row (0 or 1), used to generate striped tables. Group headers do no have a row parity, only projects</td></tr>
<tr><th>groupparity</th><td>Similar to row parity, but the first entry in each group restarts at 0</td></tr>
Expand Down Expand Up @@ -547,4 +549,4 @@ <h3>Organization</h3>
<p>Although WebSVN only cares how you organize the <code>.tmpl</code> files, good organization scheme makes it easier to understand and maintain your template. For example, it's pretty standard to place images in an <code>images/</code> subdirectory. If you have a lot of JavaScript or other assets, consider grouping them in a subdirectory as well.</p>

</body>
</html>
</html>
9 changes: 7 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@
$listvar['groupname'] = $curgroup; // Applies until next group is set.
$listvar['groupid'] = strtr(base64_encode('grp'.$curgroup), array('+' => '-', '/' => '_', '=' => ''));

$listvar['projectlink'] = null; // Because template.php won't unset this
// setting to null because template.php won't unset them
$listvar['projectlink'] = null;
$listvar['projectname'] = null;
$listvar['projecturl'] = null;
$i++; // Causes the subsequent lines to store data in the next array slot.
$listvar = &$listing[$i];
$listvar['groupid'] = null; // Because template.php won't unset this
$listvar['groupid'] = null;
}
$listvar['clientrooturl'] = $project->clientRootURL;

Expand All @@ -90,6 +93,8 @@
$url = str_replace('&amp;', '', $config->getURL($project, '', 'dir'));
$name = ($config->flatIndex) ? $project->getDisplayName() : $project->name;
$listvar['projectlink'] = '<a href="'.$url.'">'.escape($name).'</a>';
$listvar['projectname'] = escape($name);
$listvar['projecturl'] = $url;
$listvar['rowparity'] = $parity % 2;
$parity++;
$listvar['groupparity'] = $groupparity % 2;
Expand Down
6 changes: 3 additions & 3 deletions templates/BlueGrey/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[websvn-test:groupid]
[websvn-else]
<tr class="row[websvn:rowparity]">
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
[websvn-test:showageinsteadofdate]
Expand All @@ -36,9 +36,9 @@
[websvn-else]
<tr title="[websvn:groupname]" class="row[websvn:groupparity]">
[websvn-test:groupname]
<td class="project group">[websvn:projectlink]</td>
<td class="project group"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-else]
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-endtest]
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
Expand Down
6 changes: 3 additions & 3 deletions templates/Elegant/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[websvn-else]
<tr>
[websvn-endtest]
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
[websvn-test:showageinsteadofdate]
Expand Down Expand Up @@ -54,9 +54,9 @@
<tr title="[websvn:groupname]">
[websvn-endtest]
[websvn-test:groupname]
<td class="project group">[websvn:projectlink]</td>
<td class="project group"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-else]
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-endtest]
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
Expand Down
6 changes: 3 additions & 3 deletions templates/calm/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[websvn-test:groupid]
[websvn-else]
<tr>
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
[websvn-test:showageinsteadofdate]
Expand Down Expand Up @@ -47,9 +47,9 @@
[websvn-else]
<tr title="[websvn:groupname]">
[websvn-test:groupname]
<td class="project group">[websvn:projectlink]</td>
<td class="project group"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-else]
<td class="project">[websvn:projectlink]</td>
<td class="project"><a href="[websvn:projecturl]">[websvn:projectname]</a></td>
[websvn-endtest]
[websvn-test:showlastmod]
<td>[lang:REV] [websvn:revision]</td>
Expand Down

0 comments on commit 8bcf42e

Please sign in to comment.