[2] | 1 | <%namespace file="/message.mako" import="render_msg" /> |
---|
| 2 | <%namespace file="/webapps/community/common/common.mako" import="*" /> |
---|
| 3 | |
---|
| 4 | <% |
---|
| 5 | from galaxy.web.framework.helpers import time_ago |
---|
| 6 | from urllib import quote_plus |
---|
| 7 | |
---|
| 8 | if cntrller in [ 'tool' ] and can_edit: |
---|
| 9 | menu_label = 'Edit information or submit for approval' |
---|
| 10 | else: |
---|
| 11 | menu_label = 'Edit information' |
---|
| 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 | <%inherit file="${inherit(context)}"/> |
---|
| 22 | |
---|
| 23 | <%def name="stylesheets()"> |
---|
| 24 | ${parent.stylesheets()} |
---|
| 25 | ${h.css( "jquery.rating" )} |
---|
| 26 | <style type="text/css"> |
---|
| 27 | ul.fileBrowser, |
---|
| 28 | ul.toolFile { |
---|
| 29 | margin-left: 0; |
---|
| 30 | padding-left: 0; |
---|
| 31 | list-style: none; |
---|
| 32 | } |
---|
| 33 | ul.fileBrowser { |
---|
| 34 | margin-left: 20px; |
---|
| 35 | } |
---|
| 36 | .fileBrowser li, |
---|
| 37 | .toolFile li { |
---|
| 38 | padding-left: 20px; |
---|
| 39 | background-repeat: no-repeat; |
---|
| 40 | background-position: 0; |
---|
| 41 | min-height: 20px; |
---|
| 42 | } |
---|
| 43 | .toolFile li { |
---|
| 44 | background-image: url( ${h.url_for( '/static/images/silk/page_white_compressed.png' )} ); |
---|
| 45 | } |
---|
| 46 | .fileBrowser li { |
---|
| 47 | background-image: url( ${h.url_for( '/static/images/silk/page_white.png' )} ); |
---|
| 48 | } |
---|
| 49 | </style> |
---|
| 50 | </%def> |
---|
| 51 | |
---|
| 52 | <%def name="javascripts()"> |
---|
| 53 | ${parent.javascripts()} |
---|
| 54 | ${h.js( "jquery.rating" )} |
---|
| 55 | </%def> |
---|
| 56 | |
---|
| 57 | <%def name="title()">View Tool</%def> |
---|
| 58 | |
---|
| 59 | <h2>View Tool</h2> |
---|
| 60 | |
---|
| 61 | ${tool.get_state_message()} |
---|
| 62 | <p/> |
---|
| 63 | |
---|
| 64 | <ul class="manage-table-actions"> |
---|
| 65 | %if can_approve_or_reject: |
---|
| 66 | <li><a class="action-button" href="${h.url_for( controller='admin', action='set_tool_state', state=trans.model.Tool.states.APPROVED, id=trans.security.encode_id( tool.id ), cntrller=cntrller )}">Approve</a></li> |
---|
| 67 | <li><a class="action-button" href="${h.url_for( controller='admin', action='set_tool_state', state=trans.model.Tool.states.REJECTED, id=trans.security.encode_id( tool.id ), cntrller=cntrller )}">Reject</a></li> |
---|
| 68 | %endif |
---|
| 69 | <li><a class="action-button" id="tool-${tool.id}-popup" class="menubutton">Tool Actions</a></li> |
---|
| 70 | <div popupmenu="tool-${tool.id}-popup"> |
---|
| 71 | %if can_edit: |
---|
| 72 | <a class="action-button" href="${h.url_for( controller='common', action='edit_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">${menu_label}</a> |
---|
| 73 | %endif |
---|
| 74 | <a class="action-button" href="${h.url_for( controller='common', action='view_tool_history', id=trans.security.encode_id( tool.id ), cntrller=cntrller )}">Tool history</a> |
---|
| 75 | %if can_download: |
---|
| 76 | <a class="action-button" href="${h.url_for( controller='common', action='download_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Download tool</a> |
---|
| 77 | %endif |
---|
| 78 | %if can_rate: |
---|
| 79 | <a class="action-button" href="${h.url_for( controller='common', action='rate_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Rate tool</a> |
---|
| 80 | %endif |
---|
| 81 | %if can_delete: |
---|
| 82 | <a class="action-button" href="${h.url_for( controller='common', action='delete_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}" confirm="Are you sure you want to delete this tool?">Delete tool</a> |
---|
| 83 | %endif |
---|
| 84 | %if can_upload_new_version: |
---|
| 85 | <a class="action-button" href="${h.url_for( controller='common', action='upload_new_tool_version', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Upload a new version</a> |
---|
| 86 | %endif |
---|
| 87 | %if can_purge: |
---|
| 88 | <li><a class="action-button" href="${h.url_for( controller='admin', action='purge_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller )}" confirm="Purging removes records from the database, are you sure you want to purge this tool?">Purge tool</a></li> |
---|
| 89 | %endif |
---|
| 90 | </div> |
---|
| 91 | </ul> |
---|
| 92 | |
---|
| 93 | %if message: |
---|
| 94 | ${render_msg( message, status )} |
---|
| 95 | %endif |
---|
| 96 | |
---|
| 97 | %if can_view: |
---|
| 98 | %if tool.is_rejected: |
---|
| 99 | <div class="toolForm"> |
---|
| 100 | <div class="toolFormTitle">Reason for rejection</div> |
---|
| 101 | <div class="toolFormBody"> |
---|
| 102 | <div class="form-row"> |
---|
| 103 | ${reason_for_rejection} |
---|
| 104 | <div style="clear: both"></div> |
---|
| 105 | </div> |
---|
| 106 | </div> |
---|
| 107 | </div> |
---|
| 108 | <p/> |
---|
| 109 | %endif |
---|
| 110 | <div class="toolForm"> |
---|
| 111 | <div class="toolFormTitle">${tool.name}</div> |
---|
| 112 | <div class="toolFormBody"> |
---|
| 113 | <div class="form-row"> |
---|
| 114 | <label>Tool Id:</label> |
---|
| 115 | ${tool.tool_id} |
---|
| 116 | <div style="clear: both"></div> |
---|
| 117 | </div> |
---|
| 118 | <div class="form-row"> |
---|
| 119 | <label>Version:</label> |
---|
| 120 | ${tool.version} |
---|
| 121 | <div style="clear: both"></div> |
---|
| 122 | </div> |
---|
| 123 | <div class="form-row"> |
---|
| 124 | <label>Description:</label> |
---|
| 125 | ${tool.description} |
---|
| 126 | <div style="clear: both"></div> |
---|
| 127 | </div> |
---|
| 128 | <div class="form-row"> |
---|
| 129 | <label>User Description:</label> |
---|
| 130 | %if tool.user_description: |
---|
| 131 | <pre>${tool.user_description}</pre> |
---|
| 132 | %endif |
---|
| 133 | <div style="clear: both"></div> |
---|
| 134 | </div> |
---|
| 135 | <div class="form-row"> |
---|
| 136 | <label>Uploaded by:</label> |
---|
| 137 | ${tool.user.username} |
---|
| 138 | <div style="clear: both"></div> |
---|
| 139 | </div> |
---|
| 140 | <div class="form-row"> |
---|
| 141 | <label>Date uploaded:</label> |
---|
| 142 | ${time_ago( tool.create_time )} |
---|
| 143 | <div style="clear: both"></div> |
---|
| 144 | </div> |
---|
| 145 | <div class="form-row"> |
---|
| 146 | <label>Categories:</label> |
---|
| 147 | %if categories: |
---|
| 148 | <ul> |
---|
| 149 | %for category in categories: |
---|
| 150 | <li>${category.name}</li> |
---|
| 151 | %endfor |
---|
| 152 | </ul> |
---|
| 153 | %else: |
---|
| 154 | none set |
---|
| 155 | %endif |
---|
| 156 | <div style="clear: both"></div> |
---|
| 157 | </div> |
---|
| 158 | %if len( visible_versions ) > 1: |
---|
| 159 | <div class="form-row"> |
---|
| 160 | <label>All Versions:</label> |
---|
| 161 | <ul> |
---|
| 162 | %for version in visible_versions: |
---|
| 163 | %if version == tool: |
---|
| 164 | <li><strong>${version.version} (this version)</strong></li> |
---|
| 165 | %else: |
---|
| 166 | <li><a href="${h.url_for( controller='common', action='view_tool', id=trans.app.security.encode_id( version.id ), cntrller=cntrller )}">${version.version}</a></li> |
---|
| 167 | %endif |
---|
| 168 | %endfor |
---|
| 169 | </ul> |
---|
| 170 | <div style="clear: both"></div> |
---|
| 171 | </div> |
---|
| 172 | %endif |
---|
| 173 | </div> |
---|
| 174 | </div> |
---|
| 175 | <p/> |
---|
| 176 | <div class="toolForm"> |
---|
| 177 | <div class="toolFormTitle">Tool Contents</div> |
---|
| 178 | <div class="toolFormBody"> |
---|
| 179 | <div class="form-row"> |
---|
| 180 | <ul class="toolFile"> |
---|
| 181 | <li><a href="${h.url_for( controller='common', action='download_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">${tool.download_file_name}</a></li> |
---|
| 182 | <ul class="fileBrowser"> |
---|
| 183 | %for name in tool_file_contents: |
---|
| 184 | <li><a href="${h.url_for( controller='tool', action='view_tool_file', id=trans.app.security.encode_id( tool.id ), file_name=quote_plus( name ) )}">${name}</a></li> |
---|
| 185 | %endfor |
---|
| 186 | </ul> |
---|
| 187 | </ul> |
---|
| 188 | </div> |
---|
| 189 | </div> |
---|
| 190 | </div> |
---|
| 191 | <p/> |
---|
| 192 | %if tool.ratings: |
---|
| 193 | <div class="toolForm"> |
---|
| 194 | <div class="toolFormTitle">Rating</div> |
---|
| 195 | <div class="toolFormBody"> |
---|
| 196 | <div class="form-row"> |
---|
| 197 | <label>Times Rated:</label> |
---|
| 198 | ${num_ratings} |
---|
| 199 | <div style="clear: both"></div> |
---|
| 200 | </div> |
---|
| 201 | <div class="form-row"> |
---|
| 202 | <label>Average Rating:</label> |
---|
| 203 | ${render_star_rating( 'avg_rating', avg_rating, disabled=True )} |
---|
| 204 | <div style="clear: both"></div> |
---|
| 205 | </div> |
---|
| 206 | </div> |
---|
| 207 | </div> |
---|
| 208 | <p/> |
---|
| 209 | <div class="toolForm"> |
---|
| 210 | <div class="toolFormBody"> |
---|
| 211 | %if display_reviews: |
---|
| 212 | <div class="form-row"> |
---|
| 213 | <a href="${h.url_for( controller='common', action='view_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller, display_reviews=False )}"><label>Hide Reviews</label></a> |
---|
| 214 | </div> |
---|
| 215 | <table class="grid"> |
---|
| 216 | <thead> |
---|
| 217 | <tr> |
---|
| 218 | <th>Rating</th> |
---|
| 219 | <th>Comments</th> |
---|
| 220 | <th>Reviewed</th> |
---|
| 221 | <th>User</th> |
---|
| 222 | </tr> |
---|
| 223 | </thead> |
---|
| 224 | <% count = 0 %> |
---|
| 225 | %for review in tool.ratings: |
---|
| 226 | <% |
---|
| 227 | count += 1 |
---|
| 228 | name = 'rating%d' % count |
---|
| 229 | %> |
---|
| 230 | <tr> |
---|
| 231 | <td>${render_star_rating( name, review.rating, disabled=True )}</td> |
---|
| 232 | <td>${review.comment}</td> |
---|
| 233 | <td>${time_ago( review.update_time )}</td> |
---|
| 234 | <td>${review.user.username}</td> |
---|
| 235 | </tr> |
---|
| 236 | %endfor |
---|
| 237 | </table> |
---|
| 238 | %else: |
---|
| 239 | <div class="form-row"> |
---|
| 240 | <a href="${h.url_for( controller='common', action='view_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller, display_reviews=True )}"><label>Display Reviews</label></a> |
---|
| 241 | </div> |
---|
| 242 | %endif |
---|
| 243 | </div> |
---|
| 244 | </div> |
---|
| 245 | %endif |
---|
| 246 | <p/> |
---|
| 247 | %endif |
---|