Cleanup the new dead file handling code to be more template-friendly

(and honest).

* lib/viewcvs.py
  (view_directory): Always calculate the num_dead variable with
    truth.  Just because we aren't showing dead files doesn't mean they
    don't exist.

* templates/include/dir_header.ezt
  Provide a single place for reporting the number of, and toggling the
  display of, dead files.

* templates/directory.ezt
* templates/dir_alternate.ezt
  Stop handling dead file display toggling on what appears (and yet
  isn't) a per-item basis.  Also, use Apache's broken.gif as the icon
  for dead files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@911 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
cmpilato 2004-08-11 14:35:44 +00:00
parent 4f1e9a7ce7
commit 2f0a5efaf1
5 changed files with 16 additions and 25 deletions

View File

@ -1350,7 +1350,8 @@ def view_directory(request):
rows = [ ]
num_files = 0
num_displayed = 0
num_dead = 0
# set some values to be used inside loop
where = request.where
where_prefix = where and where + '/'
@ -1408,8 +1409,10 @@ def view_directory(request):
elif file.kind == vclib.FILE:
num_files = num_files + 1
if request.roottype == 'cvs' and hideattic and file.dead:
continue
if request.roottype == 'cvs' and file.dead:
num_dead = num_dead + 1
if hideattic:
continue
num_displayed = num_displayed + 1
file_where = where_prefix + file.name
@ -1461,7 +1464,7 @@ def view_directory(request):
'sortdir': None}),
'num_files' : num_files,
'files_shown' : num_displayed,
'num_dead' : num_files - num_displayed,
'num_dead' : num_dead,
### in the future, it might be nice to break this path up into
### a list of elements, allowing the template to display it in

View File

@ -54,13 +54,9 @@
<td>&nbsp;[if-any rows.rev]<a href="[is rows.type "dir"][rows.rev_href][else][rows.href][end]"><b>[rows.rev]</b></a>[end]</td>
<td[if-any rows.graph_href][else] colspan=2[end]>
<a name="[rows.anchor]" href="[is rows.type "dir"][rows.href][else][rows.rev_href][end]">
<img src="[icons]/small/[is rows.type "dir"]dir[else]text[end].gif" alt="" border=0 width=16 height=16>
<img src="[icons]/small/[is rows.type "dir"]dir[else][is rows.state "dead"]broken[else]text[end][end].gif" alt="" border=0 width=16 height=16>
[rows.name][is rows.type "dir"]/[end]</a>
[is roottype "cvs"]
[is rows.state "dead"]
[# don't let this phrase/link be wrapped ]
(dead)&nbsp;<a href="[hide_attic_href]#dirlist">[[]hide]</a>
[end]
[is rows.state "dead"](dead)[end]
[end]
</td>
[if-any rows.graph_href]

View File

@ -53,14 +53,9 @@
<tr class="vc_row_[if-index rows even]even[else]odd[end]">
<td[if-any rows.graph_href][else] colspan=2[end]>
<a name="[rows.anchor]" href="[rows.href]">
<img src="[icons]/small/[is rows.type "dir"]dir[else]text[end].gif" alt="" border=0 width=16 height=16>
<img src="[icons]/small/[is rows.type "dir"]dir[else][is rows.state "dead"]broken[else]text[end][end].gif" alt="" border=0 width=16 height=16>
[rows.name][is rows.type "dir"]/[end]</a>
[is roottype "cvs"]
[is rows.state "dead"]
[# don't let this phrase/link be wrapped ]
(dead)&nbsp;<a href="[hide_attic_href]#dirlist">[[]hide]</a>
[end]
[end]
[is rows.state "dead"](dead)[end]
</td>
[if-any rows.graph_href]
<td width="1%"><a href="[rows.graph_href]"><img

View File

@ -1,11 +1,3 @@
[is num_dead "0"]
[else]
<p><b>NOTE:</b> There are [num_dead] dead files not displayed in this
listing, click <a href="[show_attic_href]#dirlist">here</a> to display
them[if-any view_tag], or <a href="[main_href]#dirlist">here</a>
to view files on the default branch[end].
[end]
[if-any selection_form]
<hr size=1 noshade>
<form method=get action="[search_tag_action]">

View File

@ -39,6 +39,11 @@
[if-any num_files]
<tr><td>Files shown:</td><td><b>[files_shown]</b></td></tr>
[end]
[is num_dead "0"]
[else]
<tr><td>Dead files:</td><td><b>[num_dead]</b>, [if-any attic_showing]showing[else]hidden[end]
([if-any attic_showing]<a href="[hide_attic_href]">hide</a>[else]<a href="[show_attic_href]">show</a>[end])</td></tr>
[end]
[if-any queryform_href]
<tr>
<td>Query:</td>