SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/file_add.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16. use Sprout\Helpers\Enc;
  17. use Sprout\Helpers\Form;
  18. use Sprout\Helpers\Needs;
  19. use Sprout\Helpers\Pdb;
  20. use Sprout\Helpers\Sprout;
  21.  
  22.  
  23. if (!Sprout::browserDragdropUploads() and empty($_GET['force'])) {
  24. echo '<p>Your browser doesn\'t support drag-and-drop file uploads.</p>';
  25. echo '<p>&nbsp;</p>';
  26. echo '<p>To enable this feature, you must use a supported browser:</p>';
  27. echo '<ul>';
  28. echo '<li>Firefox 4+';
  29. echo '<li>Internet Explorer 10+';
  30. echo '<li>Chrome 13+';
  31. echo '<li>Safari 6+';
  32. echo '</ul>';
  33. echo '<p>&nbsp;</p>';
  34. echo '<p><a href="admin/add/file?force=1">Ignore this warning and let me upload anyway</a></p>';
  35. return;
  36. }
  37.  
  38. Needs::fileGroup('moment');
  39. Needs::fileGroup('daterangepicker');
  40. Needs::fileGroup('fb');
  41. Needs::fileGroup('drag_drop_upload');
  42. ?>
  43.  
  44.  
  45. <!-- Don't hide the "drop files here" message on this specific view.
  46. It's a on-page important style because most other calls to drag_drop_upload.js do want the message hidden -->
  47. <style>
  48. .file-upload__helptext--hidden { display: block !important; }
  49. </style>
  50.  
  51.  
  52. <h3>Settings</h3>
  53. <div class="drag-drop__form">
  54.  
  55. <?php
  56. Form::nextFieldDetails('Category', false);
  57. echo Form::dropdown('category_id', ['-dropdown-top' => 'Choose per file'], Pdb::lookup('files_cat_list'));
  58. ?>
  59.  
  60. </div>
  61.  
  62.  
  63. <div class="field-element field-element--chunkedupload field-element--chunkedupload--form">
  64. <div class="field-label"><label for="field5">Upload files</label></div>
  65. <div class="field-input">
  66. <div class="fb-chunked-upload" data-opts="<?= Enc::html(json_encode($opts)); ?>">
  67. <input class="file-upload__input upload" id="field5" type="file" name="uploader_upload" value="" multiple>
  68. <div class="file-upload__area textbox">
  69. <div class="file-upload__helptext">
  70. <p>Drop file here <span class="file-upload__helptext__line2">or click to upload</span></p>
  71. </div>
  72. <div class="file-upload__uploads">
  73. <div class="save_all" style="display: none;"><button type="button" class="button button-green">Save all</button></div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79.