part.list.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>">
  2. <?php $totalfiles = 0;
  3. $totaldirs = 0;
  4. $totalsize = 0; ?>
  5. <?php foreach($_['files'] as $file):
  6. $totalsize += $file['size'];
  7. if ($file['type'] === 'dir') {
  8. $totaldirs++;
  9. } else {
  10. $totalfiles++;
  11. }
  12. // the bigger the file, the darker the shade of grey; megabytes*2
  13. $simple_size_color = intval(160-$file['size']/(1024*1024)*2);
  14. if($simple_size_color<0) $simple_size_color = 0;
  15. $relative_modified_date = OCP\relative_modified_date($file['mtime']);
  16. // the older the file, the brighter the shade of grey; days*14
  17. $relative_date_color = round((time()-$file['mtime'])/60/60/24*14);
  18. if($relative_date_color>160) $relative_date_color = 160;
  19. $name = \OCP\Util::encodePath($file['name']);
  20. $directory = \OCP\Util::encodePath($file['directory']); ?>
  21. <tr data-id="<?php p($file['fileid']); ?>"
  22. data-file="<?php p($name);?>"
  23. data-type="<?php ($file['type'] == 'dir')?p('dir'):p('file')?>"
  24. data-mime="<?php p($file['mimetype'])?>"
  25. data-size='<?php p($file['size']);?>'
  26. data-permissions='<?php p($file['permissions']); ?>'>
  27. <td class="filename svg"
  28. <?php if($file['type'] == 'dir'): ?>
  29. style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
  30. <?php else: ?>
  31. style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
  32. <?php endif; ?>
  33. >
  34. <?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
  35. <?php if($file['type'] == 'dir'): ?>
  36. <a class="name" href="<?php p(rtrim($_['baseURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title="">
  37. <?php else: ?>
  38. <a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title="">
  39. <?php endif; ?>
  40. <span class="nametext">
  41. <?php if($file['type'] == 'dir'):?>
  42. <?php print_unescaped(htmlspecialchars($file['name']));?>
  43. <?php else:?>
  44. <?php print_unescaped(htmlspecialchars($file['basename']));?><span class='extension'><?php p($file['extension']);?></span>
  45. <?php endif;?>
  46. </span>
  47. <?php if($file['type'] == 'dir'):?>
  48. <span class="uploadtext" currentUploads="0">
  49. </span>
  50. <?php endif;?>
  51. </a>
  52. </td>
  53. <td class="filesize"
  54. style="color:rgb(<?php p($simple_size_color.','.$simple_size_color.','.$simple_size_color) ?>)">
  55. <?php print_unescaped(OCP\human_file_size($file['size'])); ?>
  56. </td>
  57. <td class="date">
  58. <span class="modified"
  59. title="<?php p($file['date']); ?>"
  60. style="color:rgb(<?php p($relative_date_color.','
  61. .$relative_date_color.','
  62. .$relative_date_color) ?>)">
  63. <?php p($relative_modified_date); ?>
  64. </span>
  65. </td>
  66. </tr>
  67. <?php endforeach; ?>
  68. <?php if ($totaldirs !== 0 || $totalfiles !== 0): ?>
  69. <tr class="summary">
  70. <td><span class="info">
  71. <?php if ($totaldirs !== 0) {
  72. p($totaldirs.' ');
  73. if ($totaldirs === 1) {
  74. p($l->t('directory'));
  75. } else {
  76. p($l->t('directories'));
  77. }
  78. }
  79. if ($totaldirs !== 0 && $totalfiles !== 0) {
  80. p(' & ');
  81. }
  82. if ($totalfiles !== 0) {
  83. p($totalfiles.' ');
  84. if ($totalfiles === 1) {
  85. p($l->t('file'));
  86. } else {
  87. p($l->t('files'));
  88. }
  89. } ?>
  90. </span></td>
  91. <td class="filesize">
  92. <?php print_unescaped(OCP\human_file_size($totalsize)); ?>
  93. </td>
  94. <td></td>
  95. </tr>
  96. <?php endif;