Clean up on log page
authorJean-Michel Vourgère <jvourger@greenpeace.org>
Tue, 7 Mar 2017 18:57:50 +0000 (18:57 +0000)
committerJean-Michel Vourgère <jvourger@greenpeace.org>
Thu, 9 Mar 2017 18:06:30 +0000 (18:06 +0000)
templates/logs.tpl
webroot/css/squasher.css

index cf74d476962d1eb802eeeab4ae9f6392d83aa7ee..589f146d872682432cb43358ef4e581c36e77370 100644 (file)
 </div>
 {/block}
 
-{block content}
-<table class="log">
-
-       <tr class="logentry_header">
-               <td width='*' colspan="5">Today
-
-       {foreach item=entry from=$logs.today key=id}
-       <tr class="logentry_{$entry.action|escape}" align="left">
-               <td width='160px'>&nbsp;{$entry.date|escape}
-               <td width='40px' >&nbsp;{$entry.user_name|escape}
-               <td width='120px' title="{$entry.users_from_ip|escape}">&nbsp;{$entry.ip|escape}
-               <td width='80px' >&nbsp;{$entry.action|escape}
-               <td width='*' title="{$entry.file|substr:10|escape}{if $entry.ip eq 'retry'}\n : This file did not pass validation. A request was mailed to the RO to restart the upload.{/if}{if $entry.ip eq 'cleanup'}\n : This file entry was missing all chunks. This entry was removed.{/if}">&nbsp;{$entry.file|substr:10:64|escape}
-       {foreachelse}
-       <tr class="logentry_empty">
-               <td width='*' colspan="3"><hr>
-               <td width='120px'>Log is empty
-               <td width='*'><hr>
-       {/foreach}
 
-       <tr class="logentry_header">
-               <td width='*' colspan="5">Yesterday
+{block content}
 
-       {foreach item=entry from=$logs.yesterday key=id}   <tr class="logentry_{$entry.action|escape}" align="left">
-               <td width='160px'>&nbsp;{$entry.date|escape}
-               <td width='40px' >&nbsp;{$entry.user_name|escape}
-               <td width='120px' title="{$entry.users_from_ip|escape}">&nbsp;{$entry.ip|escape}
-               <td width='80px'>&nbsp;{$entry.action|escape}
-               <td width='*' title="{$entry.file|substr:10|escape}{if $entry.ip eq 'retry'}\n : This file did not pass validation. A request was mailed to the RO to restart the upload.{/if}{if $entry.ip eq 'cleanup'}\n : This file entry was missing all chunks. This entry was removed.{/if}">&nbsp;{$entry.file|substr:10:64|escape}
+{function logheader}
+       <tr>
+               <th colspan=5>{$text|escape}
+{/function}
+
+{function loglines}
+       {foreach item=entry from=$logentries key=id}
+       <tr class="logentry_{$entry.action|escape}">
+               <td>{$entry.date|escape}
+               <td>{$entry.user_name|escape}
+               <td title="{$entry.users_from_ip|escape}">{$entry.ip|escape}
+               <td>{$entry.action|escape}
+               <td title="{$entry.file|substr:10|escape}{if $entry.ip eq 'retry'}\n : This file did not pass validation. A request was mailed to the RO to restart the upload.{/if}{if $entry.ip eq 'cleanup'}\n : This file entry was missing all chunks. This entry was removed.{/if}">{$entry.file|substr:10:64|escape}
        {foreachelse}
        <tr class="logentry_empty">
-               <td width='*' colspan="3"><hr>
-               <td width='120px'>Log is empty
-               <td width='*'><hr>
+               <td colspan=3><hr>
+               <td>Log is empty
+               <td><hr>
        {/foreach}
+{/function}
 
-       <tr class="logentry_header">
-               <td width='*' colspan="5">Last week
+<table class="log">
+       <col width=160>
+       <col width=40>
+       <col width=120>
+       <col width=80>
+       <col>
 
-       {foreach item=entry from=$logs.lastweek key=id}
-       <tr class="logentry_{$entry.action|escape}" align="left">
-               <td width='160px'>&nbsp;{$entry.date|escape}
-               <td width='40px' >&nbsp;{$entry.user_name|escape}
-               <td width='120px' title="{$entry.users_from_ip|escape}">&nbsp;{$entry.ip|escape}
-               <td width='80px'>&nbsp;{$entry.action|escape}
-               <td width='*' title="{$entry.file|substr:10|escape}{if $entry.ip eq 'retry'}\n : This file did not pass validation. A request was mailed to the RO to restart the upload.{/if}{if $entry.ip eq 'cleanup'}\n : This file entry was missing all chunks. This entry was removed.{/if}">&nbsp;{$entry.file|substr:10:64|escape}
-       {foreachelse}
-       <tr class="logentry_empty">
-               <td width='*' colspan="3"><hr>
-               <td width='120px'>Log is empty
-               <td width='*'><hr>
-       {/foreach}
+       {logheader text="Today"}
+       {loglines logentries=$logs.today}
 
-       <tr class="logentry_header">
-               <td width='*' colspan="5">Older
+       {logheader text="Yesterday"}
+       {loglines logentries=$logs.yesterday}
 
-       {foreach item=entry from=$logs.older key=id}
-       <tr class="logentry_{$entry.action|escape}" align="left">
-               <td width='160px'>&nbsp;{$entry.date|escape}
-               <td width='40px' >&nbsp;{$entry.user_name|escape}
-               <td width='120px' title="{$entry.users_from_ip|escape}">&nbsp;{$entry.ip|escape}
-               <td width='80px'>&nbsp;{$entry.action|escape}
-               <td width='*' title="{$entry.file|substr:10|escape}{if $entry.ip eq 'retry'}\n : This file did not pass validation. A request was mailed to the RO to restart the upload.{/if}{if $entry.ip eq 'cleanup'}\n : This file entry was missing all chunks. This entry was removed.{/if}">&nbsp;{$entry.file|substr:10:64|escape}
-       {foreachelse}
-       <tr class="logentry_empty">
-               <td width='*' colspan="3"><hr>
-               <td width='120px'>Log is empty
-               <td width='*'><hr>
-       {/foreach}
+       {logheader text="Last week"}
+       {loglines logentries=$logs.lastweek}
 
+       {logheader text="Older"}
+       {loglines logentries=$logs.older}
 </table>
 {/block}
 
index f993ea713058bf4db9fd9199963207245fe86c75..bc069216a6552509bd4d27d003b7a8f64ea881a9 100644 (file)
@@ -123,30 +123,25 @@ a:hover {
 /* These are used by logs : */
 table.log {
        border-spacing:0;
-       spacing:0;
        padding:0;
        width:1000px;
        background-color:#C7F09E;
 }
 
-tr.logentry_header {
+table.log th {
        background-color:#339900;
        color:#FFFFFF;
-       border:1px solid;
-       border-color:#C7F09E;
        text-align:center;
 }
 
 tr.logentry_download, tr.logentry_delete, tr.logentry_login, tr.logentry_empty {
        background-color:#C7F09E;
        color:#003300;
-       margin:1px;
-       border:1px solid;
-       border-color:#C7F09E;
 }
 
 tr.logentry_empty {
        text-align:center;
+       white-space: nowrap;
 }
 
 tr.logentry_download:hover, tr.logentry_delete:hover, tr.logentry_login:hover {
@@ -154,6 +149,11 @@ tr.logentry_download:hover, tr.logentry_delete:hover, tr.logentry_login:hover {
        color:#FFFFFF;
 }
 
+table.log td {
+       padding-left: .7ex;
+       padding-right: .7ex;
+}
+
 /* there are used on index, for each file block : */
 .item, .status1, .status2, .status3 {
        position:relative;