You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.0 KiB

  1. <?php
  2. /**
  3. * @package Widgets
  4. *
  5. * @file MediaUpload.php
  6. * This file is part of MOVIM.
  7. *
  8. * @brief The media upload.
  9. *
  10. * @author Timothée Jaussoin <edhelas@gmail.com>
  11. *
  12. * @version 1.0
  13. * @date 07 December 2011
  14. *
  15. * Copyright (C)2010 MOVIM project
  16. *
  17. * See COPYING for licensing information.
  18. */
  19. class MediaUpload extends WidgetBase {
  20. function load()
  21. {
  22. $this->addcss('mediaupload.css');
  23. }
  24. function build()
  25. {
  26. if($this->user->dirSize() < $this->user->sizelimit) {
  27. ?>
  28. <div class="tabelem padded" title="<?php echo t('Upload'); ?>" id="mediaupload">
  29. <form id="upload_form" enctype="multipart/form-data" method="post" action="upload.php">
  30. <fieldset>
  31. <div class="element">
  32. <label for="image_file"><?php echo t('Please select image file'); ?></label>
  33. <input type="file" name="image_file" id="image_file" onchange="fileSelected();" />
  34. </div>
  35. <img id="preview" />
  36. <div id="fileinfo">
  37. <div id="filename"></div>
  38. <div id="filesize"></div>
  39. <div id="filetype"></div>
  40. <div id="filedim"></div>
  41. </div>
  42. <div class="clear"></div>
  43. <div id="progress_info">
  44. <div id="progress"></div>
  45. <div id="progress_percent"></div>
  46. <div class="clear_both"></div>
  47. <div>
  48. <div id="speed"></div>
  49. <div id="remaining"></div>
  50. <div id="b_transfered"></div>
  51. <div class="clear_both"></div>
  52. </div>
  53. <div id="upload_response"></div>
  54. </div>
  55. </fieldset>
  56. <div class="clear"></div>
  57. <a id="uploadbutton" class="button icon color green upload" onclick="startUploading()" /><?php echo t('Upload'); ?></a>
  58. <div class="message info" id="error">
  59. <?php echo t('You should select valid image files only!'); ?>
  60. </div>
  61. <div class="message error" id="error2">
  62. <?php echo t('An error occurred while uploading the file'); ?>
  63. </div>
  64. <div class="message info" id="abort">
  65. <?php echo t('The upload has been canceled by the user or the browser dropped the connection'); ?>
  66. </div>
  67. <div class="message info" id="warnsize">
  68. <?php echo t("Your file is very big. We can't accept it. Please select a smaller file"); ?>
  69. </div>
  70. </form>
  71. </div>
  72. <?php
  73. }
  74. }
  75. }