part.list.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php foreach($_['files'] as $file):
  2. $write = ($file['writable']) ? 'true' : 'false';
  3. $simple_file_size = OCP\simple_file_size($file['size']);
  4. $simple_size_color = intval(200-$file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey; megabytes*2
  5. if($simple_size_color<0) $simple_size_color = 0;
  6. $relative_modified_date = OCP\relative_modified_date($file['mtime']);
  7. $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
  8. if($relative_date_color>200) $relative_date_color = 200;
  9. $name = str_replace('+','%20',urlencode($file['name']));
  10. $name = str_replace('%2F','/', $name);
  11. $directory = str_replace('+','%20',urlencode($file['directory']));
  12. $directory = str_replace('%2F','/', $directory); ?>
  13. <tr data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-write='<?php echo $write;?>'>
  14. <td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)">
  15. <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
  16. <a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$directory.'/'.$name; else echo $_['downloadURL'].$directory.'/'.$name; ?>" title="">
  17. <span class="nametext">
  18. <?php if($file['type'] == 'dir'):?>
  19. <?php echo htmlspecialchars($file['name']);?>
  20. <?php else:?>
  21. <?php echo htmlspecialchars($file['basename']);?><span class='extension'><?php echo $file['extension'];?></span>
  22. <?php endif;?>
  23. </span>
  24. <?php if($file['type'] == 'dir'):?>
  25. <span class="uploadtext" currentUploads="0">
  26. </span>
  27. <?php endif;?>
  28. </a>
  29. </td>
  30. <td class="filesize" title="<?php echo OCP\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>
  31. <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>
  32. </tr>
  33. <?php endforeach; ?>