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()">Rate Tool</%def> |
---|
58 | |
---|
59 | <h2>Rate 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_delete: |
---|
79 | <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> |
---|
80 | %endif |
---|
81 | %if can_upload_new_version: |
---|
82 | <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> |
---|
83 | %endif |
---|
84 | %if can_purge: |
---|
85 | <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> |
---|
86 | %endif |
---|
87 | </div> |
---|
88 | </ul> |
---|
89 | |
---|
90 | %if message: |
---|
91 | ${render_msg( message, status )} |
---|
92 | %endif |
---|
93 | |
---|
94 | %if can_rate: |
---|
95 | <div class="toolForm"> |
---|
96 | <div class="toolFormTitle">${tool.name}</div> |
---|
97 | <div class="toolFormBody"> |
---|
98 | <div class="form-row"> |
---|
99 | <label>Tool Id:</label> |
---|
100 | ${tool.tool_id} |
---|
101 | <div style="clear: both"></div> |
---|
102 | </div> |
---|
103 | <div class="form-row"> |
---|
104 | <label>Version:</label> |
---|
105 | ${tool.version} |
---|
106 | <div style="clear: both"></div> |
---|
107 | </div> |
---|
108 | <div class="form-row"> |
---|
109 | <label>Description:</label> |
---|
110 | ${tool.description} |
---|
111 | <div style="clear: both"></div> |
---|
112 | </div> |
---|
113 | <div class="form-row"> |
---|
114 | <label>User Description:</label> |
---|
115 | %if tool.user_description: |
---|
116 | <pre>${tool.user_description}</pre> |
---|
117 | %endif |
---|
118 | <div style="clear: both"></div> |
---|
119 | </div> |
---|
120 | <div class="form-row"> |
---|
121 | <label>Uploaded By:</label> |
---|
122 | ${tool.user.username} |
---|
123 | <div style="clear: both"></div> |
---|
124 | </div> |
---|
125 | <div class="form-row"> |
---|
126 | <label>Date Uploaded:</label> |
---|
127 | ${time_ago( tool.create_time )} |
---|
128 | <div style="clear: both"></div> |
---|
129 | </div> |
---|
130 | </div> |
---|
131 | </div> |
---|
132 | <p/> |
---|
133 | <div class="toolForm"> |
---|
134 | <div class="toolFormTitle">Rate and Review</div> |
---|
135 | <div class="toolFormBody"> |
---|
136 | <form id="rate_tool" name="rate_tool" action="${h.url_for( controller='common', action='rate_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller )}" method="post"> |
---|
137 | <div class="form-row"> |
---|
138 | <label>Times Rated:</label> |
---|
139 | ${num_ratings} |
---|
140 | <div style="clear: both"></div> |
---|
141 | </div> |
---|
142 | <div class="form-row"> |
---|
143 | <label>Average Rating:</label> |
---|
144 | ${render_star_rating( 'avg_rating', avg_rating, disabled=True )} |
---|
145 | <div style="clear: both"></div> |
---|
146 | </div> |
---|
147 | <div class="form-row"> |
---|
148 | <label>Your Rating:</label> |
---|
149 | ${render_star_rating( 'rating', tra.rating )} |
---|
150 | <div style="clear: both"></div> |
---|
151 | </div> |
---|
152 | <div class="form-row"> |
---|
153 | <label>Review:</label> |
---|
154 | %if tra and tra.comment: |
---|
155 | <div class="form-row-input"><textarea name="comment" rows="5" cols="35">${tra.comment}</textarea></div> |
---|
156 | %else: |
---|
157 | <div class="form-row-input"><textarea name="comment" rows="5" cols="35"></textarea></div> |
---|
158 | %endif |
---|
159 | <div style="clear: both"></div> |
---|
160 | </div> |
---|
161 | <div class="form-row"> |
---|
162 | <input type="submit" name="rate_button" id="rate_button" value="Submit" /> |
---|
163 | </div> |
---|
164 | </form> |
---|
165 | </div> |
---|
166 | </div> |
---|
167 | <p/> |
---|
168 | %if tool.ratings and ( len( tool.ratings ) > 1 or tool.ratings[0] != tra ): |
---|
169 | <div class="toolForm"> |
---|
170 | <div class="toolFormBody"> |
---|
171 | %if display_reviews: |
---|
172 | <div class="form-row"> |
---|
173 | <a href="${h.url_for( controller='common', action='rate_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller, display_reviews=False )}"><label>Hide Reviews</label></a> |
---|
174 | </div> |
---|
175 | <table class="grid"> |
---|
176 | <thead> |
---|
177 | <tr> |
---|
178 | <th>Rating</th> |
---|
179 | <th>Comments</th> |
---|
180 | <th>Reviewed</th> |
---|
181 | <th>User</th> |
---|
182 | </tr> |
---|
183 | </thead> |
---|
184 | <% count = 0 %> |
---|
185 | %for review in tool.ratings: |
---|
186 | <% |
---|
187 | count += 1 |
---|
188 | name = 'rating%d' % count |
---|
189 | %> |
---|
190 | <tr> |
---|
191 | <td>${render_star_rating( name, review.rating, disabled=True )}</td> |
---|
192 | <td>${review.comment}</td> |
---|
193 | <td>${time_ago( review.update_time )}</td> |
---|
194 | <td>${review.user.username}</td> |
---|
195 | </tr> |
---|
196 | %endfor |
---|
197 | </table> |
---|
198 | %else: |
---|
199 | <div class="form-row"> |
---|
200 | <a href="${h.url_for( controller='common', action='rate_tool', id=trans.security.encode_id( tool.id ), cntrller=cntrller, display_reviews=True )}"><label>Display Reviews</label></a> |
---|
201 | </div> |
---|
202 | %endif |
---|
203 | </div> |
---|
204 | </div> |
---|
205 | %endif |
---|
206 | %endif |
---|