PageRenderTime 28ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

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