PageRenderTime 20ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/history/share.mako

https://bitbucket.org/h_morita_dbcls/galaxy-central
Mako | 192 lines | 185 code | 1 blank | 6 comment | 2 complexity | a171b347d6171bee6911d6f04f5584a6 MD5 | raw file
  1<% _=n_ %>
  2<%inherit file="/base.mako"/>
  3<%def name="title()">Share histories</%def>
  4
  5<div class="toolForm">
  6    <div class="toolFormTitle">Share ${len( histories)} histories</div>
  7    <div class="toolFormBody">
  8        %if not can_change and not cannot_change and not no_change_needed:
  9            ## We are sharing histories that contain only public datasets
 10            <form name='share' id='share' action="${h.url_for( action='share' )}" method="post" >
 11                <div class="form-title-row"><b>Histories to be shared:</b></div>
 12                <div class="form-row" style="padding-left: 2em;">
 13                    <table width="100%">
 14                        <thead>
 15                            <th>${_('History Name')}</th>
 16                            <th>${_('Number of Datasets')}</th>
 17                        </thead>
 18                        <tbody>
 19                            %for history in histories:
 20                                <tr>
 21                                    <td>
 22                                        <input type="hidden" name="id" value="${trans.security.encode_id( history.id )}">
 23                                        ${history.name}
 24                                    </td>
 25                                    <td>
 26                                        %if len( history.datasets ) < 1:
 27                                            <div class="warningmark">${_('This history contains no data.')}</div>
 28                                        %else:
 29                                            ${len(history.datasets)}
 30                                        %endif
 31                                    </td>
 32                                </tr>
 33                            %endfor
 34                        </tbody>
 35                    </table>
 36                </div>
 37                <div style="clear: both"></div>
 38                <div class="form-row">
 39                    <label>Galaxy user emails with which to share histories</label>
 40                    <div style="float: left; width: 250px; margin-right: 10px;">
 41                        <input type="text" name="email" value="${email}" size="40">
 42                    </div>
 43                    <div class="toolParamHelp" style="clear: both;">
 44                        Enter a Galaxy user email address or a comma-separated list of addresses if sharing with multiple users
 45                    </div>
 46                </div>
 47                %if send_to_err:
 48                    <div style="clear: both"></div>
 49                    <div class="form-row">
 50                        <div class="errormessage">${send_to_err}</div>
 51                    </div>
 52                %endif
 53                <div style="clear: both"></div>
 54                <div class="form-row">
 55                    <input type="submit" name="share_button" value="Submit">
 56                </div>
 57            </form>
 58        %else:
 59            ## We are sharing restricted histories
 60            %if no_change_needed or can_change:
 61                <form name='share_restricted' id=share_restricted' action="${h.url_for( controller='history', action='share_restricted' )}" method="post">
 62                    %if send_to_err:
 63                        <div style="clear: both"></div>
 64                        <div class="form-row">
 65                            <div class="errormessage">${send_to_err}</div>
 66                        </div>
 67                    %endif
 68                    ## Needed for rebuilding dicts
 69                    <input type="hidden" name="email" value="${email}" size="40">
 70                    %for history in histories:
 71                        <input type="hidden" name="id" value="${trans.security.encode_id( history.id )}">
 72                    %endfor
 73                    %if no_change_needed:
 74                        ## no_change_needed looks like: {historyX : [hda, hda], historyY : [hda] }
 75                        <div style="clear: both"></div>
 76                        <div class="form-row">
 77                            <div class="donemessage">
 78                                The following datasets can be shared with ${email} with no changes
 79                            </div>
 80                        </div>                        
 81                        %for history, hdas in no_change_needed.items():
 82                            <div class="form-row">
 83                                <label>History</label>
 84                                ${history.name}
 85                            </div>
 86                            <div style="clear: both"></div>
 87                            <div class="form-row">
 88                                <label>Datasets</label>
 89                            </div>
 90                            %for hda in hdas:
 91                                <div class="form-row">
 92                                    ${hda.name}
 93                                    %if hda.deleted:
 94                                        (deleted)
 95                                    %endif
 96                                </div>
 97                            %endfor
 98                        %endfor
 99                    %endif
100                    %if can_change:
101                        ## can_change looks like: {historyX : [hda, hda], historyY : [hda] }
102                        <div style="clear: both"></div>
103                        <div class="form-row">
104                            <div class="warningmessage">
105                                The following datasets can be shared with ${email} by updating their permissions
106                            </div>
107                        </div>
108                        %for history, hdas in can_change.items():
109                            <div class="form-row">
110                                <label>History</label>
111                                ${history.name}
112                            </div>
113                            <div style="clear: both"></div>
114                            <div class="form-row">
115                                <label>Datasets</label>
116                            </div>
117                            %for hda in hdas:
118                                <div class="form-row">
119                                    ${hda.name}
120                                    %if hda.deleted:
121                                        (deleted)
122                                    %endif
123                                </div>
124                            %endfor
125                        %endfor
126                    %endif
127                    %if cannot_change:
128                        ## cannot_change looks like: {historyX : [hda, hda], historyY : [hda] }
129                        <div style="clear: both"></div>
130                        <div class="form-row">
131                            <div class="errormessage">
132                                The following datasets cannot be shared with ${email} because you are not authorized to 
133                                change the permissions on them
134                            </div>
135                        </div>
136                        %for history, hdas in cannot_change.items():
137                            <div class="form-row">
138                                <label>History</label>
139                                ${history.name}
140                            </div>
141                            <div style="clear: both"></div>
142                            <div class="form-row">
143                                <label>Datasets</label>
144                            </div>
145                            %for hda in hdas:
146                                <div class="form-row">
147                                    ${hda.name}
148                                    %if hda.deleted:
149                                        (deleted)
150                                    %endif
151                                </div>
152                            %endfor
153                        %endfor
154                    %endif
155                    <div class="toolFormTitle"></div>
156                    <div class="form-row">
157                        <label>How would you like to proceed?</label>
158                    </div>
159                    %if can_change:
160                        <div class="form-row">
161                            <input type="radio" name="action" value="public"> Make datasets public so anyone can access them 
162                            %if cannot_change:
163                                (where possible)
164                            %endif
165                        </div>
166                        <div class="form-row">
167                            %if no_change_needed:
168                                <input type="radio" name="action" value="private"> Make datasets private to me and the user(s) with whom I am sharing
169                            %else:
170                                <input type="radio" name="action" value="private" checked> Make datasets private to me and the user(s) with whom I am sharing
171                            %endif
172                            %if cannot_change:
173                                (where possible)
174                            %endif
175                        </div>
176                    %endif
177                    %if no_change_needed:
178                        <div class="form-row">
179                            <input type="radio" name="action" value="share_anyway" checked> Share anyway
180                            %if can_change:
181                                (don't change any permissions)
182                            %endif
183                        </div>
184                    %endif
185                    <div class="form-row">
186                        <input type="submit" name="share_restricted_button" value="Go"><br/>
187                    </div>
188                </form>
189            %endif
190        %endif
191    </div>
192</div>