part.list.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php $totalfiles = 0;
  2. $totaldirs = 0;
  3. $totalsize = 0; ?>
  4. <?php foreach($_['files'] as $file):
  5. // the bigger the file, the darker the shade of grey; megabytes*2
  6. $simple_size_color = intval(160-$file['size']/(1024*1024)*2);
  7. if($simple_size_color<0) $simple_size_color = 0;
  8. $relative_modified_date = OCP\relative_modified_date($file['mtime']);
  9. // the older the file, the brighter the shade of grey; days*14
  10. $relative_date_color = round((time()-$file['mtime'])/60/60/24*14);
  11. if($relative_date_color>160) $relative_date_color = 160;
  12. $name = \OCP\Util::encodePath($file['name']);
  13. $directory = \OCP\Util::encodePath($file['directory']); ?>
  14. <tr data-id="<?php p($file['fileid']); ?>"
  15. data-file="<?php p($name);?>"
  16. data-type="<?php ($file['type'] == 'dir')?p('dir'):p('file')?>"
  17. data-mime="<?php p($file['mimetype'])?>"
  18. data-size="<?php p($file['size']);?>"
  19. data-etag="<?php p($file['etag']);?>"
  20. data-permissions="<?php p($file['permissions']); ?>">
  21. <?php if(isset($file['isPreviewAvailable']) and $file['isPreviewAvailable']): ?>
  22. <td class="filename svg preview-icon"
  23. <?php else: ?>
  24. <td class="filename svg"
  25. <?php endif; ?>
  26. style="background-image:url(<?php print_unescaped($file['icon']); ?>)"
  27. >
  28. <?php if(!isset($_['readonly']) || !$_['readonly']): ?>
  29. <input id="select-<?php p($file['fileid']); ?>" type="checkbox" />
  30. <label for="select-<?php p($file['fileid']); ?>"></label>
  31. <?php endif; ?>
  32. <?php if($file['type'] == 'dir'): ?>
  33. <a class="name" href="<?php p(rtrim($_['baseURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title="">
  34. <span class="nametext">
  35. <?php print_unescaped(htmlspecialchars($file['name']));?>
  36. </span>
  37. <?php else: ?>
  38. <a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>">
  39. <label class="filetext" title="" for="select-<?php p($file['fileid']); ?>"></label>
  40. <span class="nametext"><?php print_unescaped(htmlspecialchars($file['basename']));?><span class='extension'><?php p($file['extension']);?></span></span>
  41. </a>
  42. <?php endif; ?>
  43. <?php if($file['type'] == 'dir'):?>
  44. <span class="uploadtext" currentUploads="0">
  45. </span>
  46. <?php endif;?>
  47. </a>
  48. </td>
  49. <td class="filesize"
  50. style="color:rgb(<?php p($simple_size_color.','.$simple_size_color.','.$simple_size_color) ?>)">
  51. <?php print_unescaped(OCP\human_file_size($file['size'])); ?>
  52. </td>
  53. <td class="date">
  54. <span class="modified"
  55. title="<?php p($file['date']); ?>"
  56. style="color:rgb(<?php p($relative_date_color.','
  57. .$relative_date_color.','
  58. .$relative_date_color) ?>)">
  59. <?php p($relative_modified_date); ?>
  60. </span>
  61. </td>
  62. </tr>
  63. <?php endforeach;