Re: [viewvc-users] Looking for a template variable

John Beranek <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization John@Home
Message-ID <4BAA33B8.5020902__28130.3259580911$1269445585$gmane$org@redux.org.uk>
On 24/03/10 03:05, C. Michael Pilato wrote:
> 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.

Thanks, your verbatim patch didn't work, but the following did:

    'request_uri' : request.get_url(),

On a similar topic, how easy would it be to add a variable to the
configuration and then pass that as a template variable. I ask because
using ViewVC on a master site and other mirror sites requires different
page elements. I'd like to be able to use the same code/templates
everywhere, but have conditional bits of the templates that show
different things on different sites.

The only further problem in this plan is that on one site I've modified
styles.css, and I'm guessing this isn't run through EZT, so can't have
template code in it. This could be worked around by HTML/CSS code in
header.ezt though, I think.

Cheers,

John.

-- 
John Beranek                         To generalise is to be an idiot.
http://redux.org.uk/                                 -- William Blake

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2464414

To unsubscribe from this discussion, e-mail: [[email protected]].
smime.p7s (application/pkcs7-signature, 5.5 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.