diff options
-rw-r--r-- | core/css/styles.css | 2 | ||||
-rw-r--r-- | files/templates/part.list.php | 7 | ||||
-rw-r--r-- | lib/template.php | 23 |
3 files changed, 29 insertions, 3 deletions
diff --git a/core/css/styles.css b/core/css/styles.css index 33c1af44362..35b65f9480d 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -24,7 +24,7 @@ form input[type="button"], form input[type="text"] { font-size:0.9em; } fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; max-width:600px; margin:2em 2em 2em 3em; } legend { padding:0.5em; font-size:1.2em; } -div.controls { width:100%; margin:0px; background-color:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:0; } +div.controls { width:100%; margin:0px; background-color:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:2; } /* LOG IN & INSTALLATION ------------------------------------------------------------ */ #body-login { width:100%; background-image:none; background-color:#ddd; } diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 1d78b77ae3e..a0ffb4b6073 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,6 +1,9 @@ <?php foreach($_['files'] as $file): $simple_file_size = simple_file_size($file['size']); - $simple_size_color = 200-intval(pow(($file['size']/(1024*1024)),2)); ?> + $simple_size_color = 200-intval(pow(($file['size']/(1024*1024)),2)); + $relative_modified_date = relative_modified_date($file['mtime']); + $relative_date_color = round((time()-$file['mtime'])/60/60/24*5); //days ago + if($relative_date_color>200) $relative_date_color = 200; ?> <tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'> <td class="filename"> <input type="checkbox" /> @@ -15,6 +18,6 @@ </a> </td> <td class="filesize" title="<?php echo human_file_size($file['size']); ?>" style="color:rgb(<?php echo $simple_size_color.','.$simple_size_color.','.$simple_size_color ?>)"><?php echo $simple_file_size; ?></td> - <td class="date"><span class="modified"><?php echo $file['date']; ?></span></td> + <td class="date"><span class="modified" title="<?php echo $file['date']; ?>" style="color:rgb(<?php echo $relative_date_color.','.$relative_date_color.','.$relative_date_color ?>)"><?php echo $relative_modified_date; ?></span></td> </tr> <?php endforeach; ?> diff --git a/lib/template.php b/lib/template.php index 3c0cdf7e161..99099d49d0f 100644 --- a/lib/template.php +++ b/lib/template.php @@ -75,6 +75,29 @@ function simple_file_size($bytes) { else { return number_format($mbytes, 1); } } +function relative_modified_date($timestamp) { + $timediff = time() - $timestamp; + $diffminutes = round($timediff/60); + $diffhours = round($diffminutes/60); + $diffdays = round($diffhours/24); + $diffmonths = round($diffdays/31); + $diffyears = round($diffdays/365); + if($timediff < 60) { return 'seconds ago'; } + else if($timediff < 120) { return '1 minute ago'; } + else if($timediff < 3600) { return $diffminutes.' minutes ago'; } + //else if($timediff < 7200) { return '1 hour ago'; } + //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if($timediff < 86400) { return 'today'; } + else if($timediff < 172800) { return 'yesterday'; } + else if($timediff < 2678400) { return $diffdays.' days ago'; } + else if($timediff < 5184000) { return 'last month'; } + //else if($timediff < 31556926) { return $diffmonths.' months ago'; } + else if($timediff < 31556926) { return 'months ago'; } + else if($timediff < 63113852) { return 'last year'; } + else { return $diffyears.' years ago'; } +} + + /** * This class provides the templates for owncloud. */ |