/templates/webapps/community/repository/upload.mako

https://bitbucket.org/cistrome/cistrome-harvard/ · Mako · 159 lines · 149 code · 9 blank · 1 comment · 5 complexity · a6fedeffdb6a7f3dc53376c52f4da208 MD5 · raw file

  1. <%namespace file="/message.mako" import="render_msg" />
  2. <%namespace file="/webapps/community/repository/common.mako" import="*" />
  3. <%
  4. is_admin = trans.user_is_admin()
  5. is_new = repository.is_new
  6. can_browse_contents = not is_new
  7. can_browse_contents = not is_new
  8. can_rate = repository.user != trans.user
  9. can_manage = is_admin or repository.user == trans.user
  10. can_view_change_log = not is_new
  11. %>
  12. <%!
  13. def inherit(context):
  14. if context.get('use_panels'):
  15. return '/webapps/community/base_panels.mako'
  16. else:
  17. return '/base.mako'
  18. %>
  19. <%inherit file="${inherit(context)}"/>
  20. <%def name="stylesheets()">
  21. ${parent.stylesheets()}
  22. ${h.css( "jquery.rating", "dynatree_skin/ui.dynatree" )}
  23. </%def>
  24. <%def name="javascripts()">
  25. ${parent.javascripts()}
  26. ${h.js( "ui.core", "jquery.cookie", "jquery.dynatree" )}
  27. ${common_javascripts(repository)}
  28. <script type="text/javascript">
  29. $( function() {
  30. $( "select[refresh_on_change='true']").change( function() {
  31. $( "#upload_form" ).submit();
  32. });
  33. });
  34. </script>
  35. </%def>
  36. %if message:
  37. ${render_msg( message, status )}
  38. %endif
  39. <br/><br/>
  40. <ul class="manage-table-actions">
  41. <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
  42. <div popupmenu="repository-${repository.id}-popup">
  43. %if can_manage:
  44. <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
  45. %else:
  46. <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
  47. %endif
  48. %if can_view_change_log:
  49. <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
  50. %endif
  51. %if can_browse_contents:
  52. <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
  53. %endif
  54. </div>
  55. </ul>
  56. <div class="toolForm">
  57. <div class="toolFormTitle">Upload a single file or a tarball</div>
  58. <div class="toolFormBody">
  59. ## TODO: nginx
  60. <form id="upload_form" name="upload_form" action="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}" enctype="multipart/form-data" method="post">
  61. <div class="form-row">
  62. <label>File:</label>
  63. <div class="form-row-input">
  64. <input type="file" name="file_data"/>
  65. </div>
  66. <div style="clear: both"></div>
  67. </div>
  68. <div class="form-row">
  69. <%
  70. if uncompress_file:
  71. yes_selected = 'selected'
  72. no_selected = ''
  73. else:
  74. yes_selected = ''
  75. no_selected = 'selected'
  76. %>
  77. <label>Uncompress files?</label>
  78. <div class="form-row-input">
  79. <select name="uncompress_file">
  80. <option value="true" ${yes_selected}>Yes
  81. <option value="false" ${no_selected}>No
  82. </select>
  83. </div>
  84. <div class="toolParamHelp" style="clear: both;">
  85. Supported compression types are gz and bz2. If <b>Yes</b> is selected, the uploaded file will be uncompressed. However,
  86. if the uploaded file is an archive that contains compressed files, the contained files will not be uncompressed. For
  87. example, if the uploaded compressed file is some_file.tar.gz, some_file.tar will be uncompressed and extracted, but if
  88. some_file.tar contains some_contained_file.gz, the contained file will not be uncompressed.
  89. </div>
  90. </div>
  91. %if not is_new:
  92. <div class="form-row">
  93. <%
  94. if remove_repo_files_not_in_tar:
  95. yes_selected = 'selected'
  96. no_selected = ''
  97. else:
  98. yes_selected = ''
  99. no_selected = 'selected'
  100. %>
  101. <label>Remove files in the repository (relative to the root or selected upload point) that are not in the uploaded archive?</label>
  102. <div class="form-row-input">
  103. <select name="remove_repo_files_not_in_tar">
  104. <option value="true" ${yes_selected}>Yes
  105. <option value="false" ${no_selected}>No
  106. </select>
  107. </div>
  108. <div class="toolParamHelp" style="clear: both;">
  109. This selection pertains only to uploaded tar archives, not to single file uploads. If <b>Yes</b> is selected, files
  110. that exist in the repository (relative to the root or selected upload point) but that are not in the uploaded archive
  111. will be removed from the repository. Otherwise, all existing repository files will remain and the uploaded archive
  112. files will be added to the repository.
  113. </div>
  114. </div>
  115. %endif
  116. <div class="form-row">
  117. <label>Change set commit message:</label>
  118. <div class="form-row-input">
  119. %if commit_message:
  120. <pre><textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea></pre>
  121. %else:
  122. <textarea name="commit_message" rows="3" cols="35"></textarea>
  123. %endif
  124. </div>
  125. <div class="toolParamHelp" style="clear: both;">
  126. This is the commit message for the mercurial change set that will be created by this upload.
  127. </div>
  128. <div style="clear: both"></div>
  129. </div>
  130. %if not repository.is_new:
  131. <div class="form-row" >
  132. <label>Contents:</label>
  133. <div id="tree" >
  134. Loading...
  135. </div>
  136. <input type="hidden" id="upload_point" name="upload_point" value=""/>
  137. <div class="toolParamHelp" style="clear: both;">
  138. Select a location within the repository to upload your files by clicking a check box next to the location. The
  139. selected location is considered the upload point. If a location is not selected, the upload point will be the
  140. repository root.
  141. </div>
  142. <div style="clear: both"></div>
  143. </div>
  144. %endif
  145. <div class="form-row">
  146. <input type="submit" class="primary-button" name="upload_button" value="Upload">
  147. </div>
  148. </form>
  149. </div>
  150. </div>