diff options
author | Lennart Poettering <lennart@poettering.net> | 2003-11-12 22:15:56 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2003-11-12 22:15:56 +0000 |
commit | 50b012103fd006275a1ee11c58697f2623877f7b (patch) | |
tree | 79ac5372b39d89cfc8eda25f0d098a3c14cde951 | |
parent | e22d4e46bfac0d37815114ea61644ec2fd8903b0 (diff) |
add file size to listing
git-svn-id: file:///home/lennart/svn/public/syrep-chub/trunk@7 4c8cc7d0-f3cb-0310-ad32-ddc431b48844
-rwxr-xr-x | list.cgi | 15 | ||||
-rw-r--r-- | style.css | 1 |
2 files changed, 13 insertions, 3 deletions
@@ -3,6 +3,14 @@ import cgi, cgitb, os, time, urllib, sch, stat cgitb.enable() +def bsize(s): + if s > 1024*1024: + return "%lu MB" % s/1024/1024 + elif s > 1024: + return "%lu KB" % s/1024 + else: + return "%lu B" % s + def list_files(): d = os.listdir(sch.repository_directory) @@ -18,16 +26,17 @@ def list_files(): print '<tr><td class="checkbox"><input type="checkbox" name="fname" value="%s"></td>' % cgi.escape(f) print '<td class="filename"><a href="info.cgi?fname=%s">%s</a></td>' % (urllib.quote_plus(f), cgi.escape(f)) - print '<td class="filedate">%s</td></tr>' % time.strftime("%c", time.localtime(st.st_mtime)) + print '<td class="filedate">%s</td>' % time.strftime("%c", time.localtime(st.st_mtime)) + print '<td class="filesize">%s</td></tr>' % bsize(st.st_size) sch.print_header("File Listing") -print '<form action="diff.cgi" method="get"><table><tr><th></th><th>File name</th><th>Modification date</th></tr>' +print '<form action="diff.cgi" method="get"><table><tr><th></th><th>File name</th><th>Modification date</th><th>Size</th></tr>' list_files() -print '<tr><td colspan="3" class="buttons">' +print '<tr><td colspan="4" class="buttons">' print '<input name="diff" type="submit" value="SYREP Diff"/>' @@ -3,6 +3,7 @@ td { padding: 5px; } td.filename { width: 50ex; } td.filedate { color: darkgray; font-size: small; text-align: right; } +td.filedate { color: darkgray; font-size: small; text-align: right; } th { text-align: left; background: #f0f0f0; border-bottom-width: 1px; border-bottom-style:solid; border-bottom-color: darkblue; padding: 5px;} table { border-width: 1px; border-style:solid; border-color: darkblue; border-spacing: 0; empty-cells:show; } td.buttons { border-top-width: 1px; border-top-style:solid; border-top-color: darkblue; background: #f0f0f0; padding: 5px; text-align: center; } |