Re: [viewvc-users] view=co for document, not view=log
"C. Michael Pilato" <[email protected]> Thu, 04 Dec 2014 10:06:28 -0500
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Organization | CollabNet, Inc. |
| Message-ID | <[email protected]> |
On 12/03/2014 06:21 PM, Miles O'Neal wrote:
> We have an instance of viewvc where users want much simpler behavior. When an item in a directory listing is a file, then instead of a link to the log view, they want to click on the file and display it. I assume this would just be a "view=co" instead of the current "view=log".
> Is there a way to do this (in 1.1.2[23])? I haven't done any python programming and would prefer not to modify the code to make it easier to upgrade.
> I have modified everything I can think of in viewvc.conf .
>
> allowed_views = co
> default_file_view = co
> show_logs = 0
> show_log_in_markup = 0
>
> I didn't expect the last two to matter but tried them, anyway.
>
> Ideally they would like the file displayed in an external viewer (a la the download link on the log view.
>
The "allowed_views" option doesn't permit toggling of the 'log' view.
As this is a version control browser, it is rather assumed that some
basic version control history viewing functionality is required. :-)
The "default_file_view" change is fine, but that only specifies the view
that ViewVC will use for a file whose URL doesn't otherwise dictate a
particular view. Since your users are clicking links rather than typing
in URLs, and since the links they click all carry the "view=SOMETHING"
parameter, the default_file_view isn't consulted.
And as you suspected, "show_logs" and "show_log_in_markup" have no
bearing here.
To accomplish what you want, you need to modify the ViewVC templates.
You needn't know Python -- this is all HTML and the EZT template syntax
(which is pretty easy to pick up on by inspection). You want to edit
the file "templates/directory.ezt". Therein, you'll find some template
logic starting around line 67 that looks like so:
[for entries]
<tr class="vc_row_[if-index entries even]even[else]odd[end]">
<td[if-any entries.graph_href][else] colspan="2"[end]>
[is entries.pathtype "dir"]
<a name="[entries.anchor]" href="[entries.view_href]" title="View
directory contents">
[else]
<a name="[entries.anchor]" href="[entries.log_href]" title="View
file revision log">
[end]
<img src="[docroot]/images/[is entries.pathtype
"dir"]dir[else][is entries.state "dead"]broken[else]text[end][end].png"
alt="" class="vc_icon" />
[entries.name][is entries.pathtype "dir"]/[end]</a>
[is entries.state "dead"](dead)[end]
</td>
[...]
The change you want to make is in the "else" branch of the [is
entries.pathtype "dir"] conditional. Instead of linking to the
"entries.log_href", you want to link instead to
"entries.download_href". That should be all that's required. For
completeness, also change the title="" attribute on that same tag to say
"Download file" instead of "View file revision log".
--
C. Michael Pilato <[email protected]>
CollabNet <> www.collab.net <> Enterprise Cloud Development
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=3092225
To unsubscribe from this discussion, e-mail: [[email protected]].