implemented relative file size and coloring
This commit is contained in:
parent
c73dd86713
commit
f1616b0e62
|
@ -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; }
|
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; }
|
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 ------------------------------------------------------------ */
|
/* LOG IN & INSTALLATION ------------------------------------------------------------ */
|
||||||
#body-login { width:100%; background-image:none; background-color:#ddd; }
|
#body-login { width:100%; background-image:none; background-color:#ddd; }
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php foreach($_['files'] as $file):
|
<?php foreach($_['files'] as $file):
|
||||||
$simple_file_size = simple_file_size($file['size']);
|
$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'];?>'>
|
<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">
|
<td class="filename">
|
||||||
<input type="checkbox" />
|
<input type="checkbox" />
|
||||||
|
@ -15,6 +18,6 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</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="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>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
@ -75,6 +75,29 @@ function simple_file_size($bytes) {
|
||||||
else { return number_format($mbytes, 1); }
|
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.
|
* This class provides the templates for owncloud.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue