Re: [viewvc-users] Looking for a template variable
"C. Michael Pilato" <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Organization | CollabNet, Inc. |
| Message-ID | <[email protected]> |
John Beranek wrote:
> I'm looking to add an "inter-mirror" link to the top of a Subversion
> installation of ViewVC.
>
> My requirement is to link from one installation of ViewVC on a mirror
> server to the master ViewVC. I've figured where I want to make the
> changes (templates/include/header.ezt) but I can't seem to find a
> template variable to do what I need.
>
> Essentially what I'd really like is the whole ViewVC URL minus the
> protocol and host part, so, for example:
>
> /viewvc/my_repos/my_dir/my_file.txt?view=log
>
> Is this possible with the current template variables? If not, how would
> I go about adding another template variable to do it?
ViewVC doesn't expose this information today. Making this happen is pretty
easy, though. Just tweak the function lib/viewvc.py:common_template_data()
to populate a data dictionary variable (say, 'request_uri') with the value
of the 'REQUEST_URI' environment variable. Then in your template, just use
the [request_uri] EZT directive.
Here's a patch against the trunk code:
Index: lib/viewvc.py
===================================================================
--- lib/viewvc.py (revision 2346)
+++ lib/viewvc.py (working copy)
@@ -1363,6 +1363,7 @@
'view_href' : None,
'vsn' : __version__,
'where' : request.server.escape(request.where),
+ 'request_uri' : os.environ.get('REQUEST_URI'),
})
rev = revision
--
C. Michael Pilato <[email protected]>
CollabNet <> www.collab.net <> Distributed Development On Demand
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2464082
To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkupgXMACgkQokEGqRcG/W4eoACfX31UnjSr7lWJ8+GrjAvOr+DX 7vIAn3gO9LjSGQ3j5urgR+iUegdbxS3n =fikF -----END PGP SIGNATURE-----