/halogy/application/modules/files/views/admin/viewall.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 205 lines · 156 code · 49 blank · 0 comment · 19 complexity · 06a3997a6bc32abee66eed336a58d608 MD5 · raw file

  1. <style type="text/css">
  2. .ac_results { padding: 0px; border: 1px solid black; background-color: white; overflow: hidden; z-index: 99999; }
  3. .ac_results ul { width: 100%; list-style-position: outside; list-style: none; padding: 0; margin: 0; }
  4. .ac_results li { margin: 0px; padding: 2px 5px; cursor: default; display: block; font: menu; font-size: 12px; line-height: 16px; overflow: hidden; }
  5. .ac_results li span.email { font-size: 10px; }
  6. .ac_loading { background: white url('<?php echo $this->config->item('staticPath'); ?>/images/loader.gif') right center no-repeat; }
  7. .ac_odd { background-color: #eee; }
  8. .ac_over { background-color: #0A246A; color: white; }
  9. </style>
  10. <script language="javascript" type="text/javascript" src="<?php echo $this->config->item('staticPath'); ?>/js/jquery.fieldreplace.js"></script>
  11. <script type="text/javascript">
  12. $(function(){
  13. $('.toggle').click(function(event){
  14. event.preventDefault();
  15. $('div#upload-file').slideToggle('400');
  16. $('div#upload-zip:visible, div#loader:visible').slideToggle('400');
  17. });
  18. $('.toggle-zip').click(function(event){
  19. event.preventDefault();
  20. $('div#upload-zip').toggle('400');
  21. $('div#upload-file:visible, div#loader:visible').slideToggle('400');
  22. });
  23. $('.edit').click(function(event){
  24. event.preventDefault();
  25. $.scrollTo(0, '200');
  26. $('div#loader').load(this.href, function(){
  27. $('div#loader:hidden').toggle('400');
  28. $('div#upload-zip:visible, div#upload-file:visible').slideToggle('400');
  29. });
  30. });
  31. $('#searchbox').fieldreplace();
  32. function formatItem(row) {
  33. if (row[0].length) return row[1]+'<br /><span class="email">(#'+row[0]+')</span>';
  34. else return 'No results';
  35. }
  36. $('#searchbox').autocomplete("/admin/files/ac_files", { delay: "0", selectFirst: false, matchContains: true, formatItem: formatItem, minChars: 2 });
  37. $('#searchbox').result(function(event, data, formatted){
  38. $(this).parent('form').submit();
  39. });
  40. $('select#folderID').change(function(){
  41. var folderID = ($(this).val());
  42. window.location.href = '/admin/files/viewall/'+folderID;
  43. });
  44. });
  45. </script>
  46. <h1 class="headingleft">Files</h1>
  47. <div class="headingright">
  48. <form method="post" action="/admin/files/viewall" class="default" id="search">
  49. <input type="text" name="searchbox" id="searchbox" class="formelement inactive" title="Search Files..." />
  50. <input type="image" src="<?php echo $this->config->item('staticPath'); ?>/images/btn_search.gif" id="searchbutton" />
  51. </form>
  52. <label for="folderID">
  53. Folder
  54. </label>
  55. <?php
  56. $options = '';
  57. $options['me'] = 'My Files';
  58. if (@in_array('files_all', $this->permission->permissions)):
  59. $options['all'] = 'View All Files';
  60. if ($folders):
  61. foreach ($folders as $folder):
  62. $options[$folder['folderID']] = $folder['folderName'];
  63. endforeach;
  64. endif;
  65. endif;
  66. echo form_dropdown('folderID', $options, $folderID, 'id="folderID"');
  67. ?>
  68. <?php if ($this->site->config['plan'] = 0 || $this->site->config['plan'] = 6 || (($this->site->config['plan'] > 0 && $this->site->config['plan'] < 6) && $quota < $this->site->plans['storage'])): ?>
  69. <a href="#" class="button toggle blue">Upload File</a>
  70. <?php endif; ?>
  71. </div>
  72. <?php if ($errors = validation_errors()): ?>
  73. <div class="error clear">
  74. <?php echo $errors; ?>
  75. </div>
  76. <?php endif; ?>
  77. <div id="upload-file"class="hidden clear">
  78. <form method="post" action="<?php echo $this->uri->uri_string(); ?>" enctype="multipart/form-data" class="default">
  79. <label for="file">File:</label>
  80. <div class="uploadfile">
  81. <?php echo @form_upload('file',$this->validation->file, 'size="16" id="file"'); ?>
  82. </div>
  83. <br class="clear" />
  84. <label for="fileFolderID">Folder: <small>[<a href="/admin/files/folders" onclick="return confirm('You will lose any unsaved changes.\n\nContinue anyway?')">update</a>]</small></label>
  85. <?php
  86. $options = '';
  87. $options[0] = 'No Folder';
  88. if ($folders):
  89. foreach ($folders as $folderID):
  90. $options[$folderID['folderID']] = $folderID['folderName'];
  91. endforeach;
  92. endif;
  93. echo @form_dropdown('folderID',$options,set_value('folderID', $data['folderID']),'id="fileFolderID" class="formelement"');
  94. ?>
  95. <br class="clear" /><br />
  96. <input type="submit" value="Upload File" class="button nolabel" id="submit" />
  97. <a href="/admin/files" class="button cancel grey">Cancel</a>
  98. </form>
  99. </div>
  100. <div id="loader" class="hidden clear"></div>
  101. <?php if ($this->site->config['plan'] > 0 && $this->site->config['plan'] < 6): ?>
  102. <?php if ($quota > $this->site->plans['storage']): ?>
  103. <div class="error clear">
  104. <p>You have gone over your storage capacity, we will be contacting you soon.</p>
  105. </div>
  106. <div class="quota">
  107. <div class="over"><?php echo floor($quota / $this->site->plans['storage'] * 100); ?>%</div>
  108. </div>
  109. <?php else: ?>
  110. <div class="quota">
  111. <div class="used" style="width: <?php echo ($quota > 0) ? (floor($quota / $this->site->plans['storage'] * 100)) : 0; ?>%"><?php echo floor($quota / $this->site->plans['storage'] * 100); ?>%</div>
  112. </div>
  113. <?php endif; ?>
  114. <p><small>You have used <strong><?php echo number_format($quota); ?>kb</strong> out of your <strong><?php echo number_format($this->site->plans['storage']); ?> KB</strong> quota.</small></p>
  115. <?php endif; ?>
  116. <?php if ($files): ?>
  117. <?php echo $this->pagination->create_links(); ?>
  118. <table class="images files clear">
  119. <tr>
  120. <?php
  121. $numItems = sizeof($files);
  122. $itemsPerRow = 6;
  123. $i = 0;
  124. foreach ($files as $file)
  125. {
  126. if (($i % $itemsPerRow) == 0 && $i > 1)
  127. {
  128. echo '</tr><tr>'."\n";
  129. $i = 0;
  130. }
  131. echo '<td align="center" valign="top" width="'.floor(( 1 / $itemsPerRow) * 100).'%">';
  132. $extension = substr($file['filename'], strpos($file['filename'], '.')+1);
  133. $filePath = '/files/'.$file['fileRef'].'.'.$extension;
  134. ?>
  135. <div class="buttons">
  136. <?php echo anchor('/admin/files/edit/'.$file['fileID'].'/', '<img src="'.$this->config->item('staticPath').'/images/btn_edit.png" alt="Edit" />', 'class="edit"'); ?>
  137. <?php echo anchor('/admin/files/delete/'.$file['fileID'], '<img src="'.$this->config->item('staticPath').'/images/btn_delete.png" alt="Delete" />', 'onclick="return confirm(\'Are you sure you want to delete this file?\')"'); ?>
  138. </div>
  139. <a href="<?php echo $filePath; ?>" title="<?php echo $file['fileRef']; ?>"><img src="<?php echo $this->config->item('staticPath'); ?>/fileicons/<?php echo $extension; ?>.png" alt="<?php echo $file['fileRef']; ?>" class="file" /></a>
  140. <p><strong><?php echo $file['fileRef']; ?></strong></p>
  141. <?php
  142. echo '</td>'."\n";
  143. $i++;
  144. }
  145. for($x = 0; $x < ($itemsPerRow - $i); $x++)
  146. {
  147. echo '<td width="'.floor((1 / $itemsPerRow) * 100).'%">&nbsp;</td>';
  148. }
  149. ?>
  150. </tr>
  151. </table>
  152. <?php echo $this->pagination->create_links(); ?>
  153. <p style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
  154. <?php else: ?>
  155. <p class="clear">You have not yet uploaded any files.</p>
  156. <?php endif; ?>