root/galaxy-central/templates/root/history_common.mako

リビジョン 2, 12.0 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1<% _=n_ %>
2## Render the dataset `data` as history item, using `hid` as the displayed id
3<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True )">
4    <a name="${trans.security.encode_id( data.id )}"></a>
5    <%
6        if data.state in ['no state','',None]:
7            data_state = "queued"
8        else:
9            data_state = data.state
10        current_user_roles = trans.get_current_user_roles()
11    %>
12    %if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
13        <div class="historyItemWrapper historyItem historyItem-${data_state} historyItem-noPermission" id="historyItem-${data.id}">
14    %else:
15        <div class="historyItemWrapper historyItem historyItem-${data_state}" id="historyItem-${data.id}">
16    %endif
17       
18    %if data.deleted:
19        <div class="warningmessagesmall">
20            <strong>This dataset has been deleted. Click <a href="${h.url_for( controller='dataset', action='undelete', id=data.id )}" class="historyItemUndelete" id="historyItemUndeleter-${data.id}" target="galaxy_history">here</a> to undelete.</strong>
21        </div>
22    %endif
23
24    %if data.visible is False:
25        <div class="warningmessagesmall">
26            <strong>This dataset has been hidden. Click <a href="${h.url_for( controller='dataset', action='unhide', id=data.id )}" class="historyItemUnhide" id="historyItemUnhider-${data.id}" target="galaxy_history">here</a> to unhide.</strong>
27        </div>
28    %endif
29
30
31    ## Header row for history items (name, state, action buttons)
32    <div style="overflow: hidden;" class="historyItemTitleBar">     
33        <div class="historyItemButtons">
34            %if data_state == "upload":
35                ## TODO: Make these CSS, just adding a "disabled" class to the normal
36                ## links should be enough. However the number of datasets being uploaded
37                ## at a time is usually small so the impact of these images is also small.
38                <img title='Display Data' class='icon-button display_disabled' />
39                %if for_editing:
40                    <img title='Edit Attributes' class='icon-button edit_disabled' />
41                %endif
42            %else:
43                <%
44                    dataset_id = trans.security.encode_id( data.id )
45                    if for_editing:
46                        display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
47                    else:
48                        # Get URL for display only.
49                        if data.history.user and data.history.user.username:
50                            display_url = h.url_for( controller='dataset', action='display_by_username_and_slug',
51                                                     username=data.history.user.username, slug=dataset_id )
52                        else:
53                            # HACK: revert to for_editing display URL when there is no user/username. This should only happen when
54                            # there's no user/username because dataset is being displayed by history/view after error reported.
55                            # There are no security concerns here because both dataset/display and dataset/display_by_username_and_slug
56                            # check user permissions (to the same degree) before displaying.
57                            display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
58                %>
59                <a class="icon-button display tooltip" title="Display data in browser" href="${display_url}"
60                %if for_editing:
61                    target="galaxy_main"
62                %endif
63                ></a>
64                %if for_editing:
65                    <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main"></a>
66                %endif
67            %endif
68            %if for_editing:
69                <a class="icon-button delete tooltip" title="Delete" href="${h.url_for( action='delete', id=data.id, show_deleted_on_refresh=show_deleted_on_refresh )}" id="historyItemDeleter-${data.id}"></a>
70            %endif
71        </div>
72        <span class="state-icon"></span>
73        <span class="historyItemTitle">${hid}: ${data.display_name()}</span>
74    </div>
75       
76    ## Body for history items, extra info and actions, data "peek"
77   
78    <div id="info${data.id}" class="historyItemBody">
79        %if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
80            <div>You do not have permission to view this dataset.</div>
81        %elif data_state == "upload":
82            <div>Dataset is uploading</div>
83        %elif data_state == "queued":
84            <div>${_('Job is waiting to run')}</div>
85        %elif data_state == "running":
86            <div>${_('Job is currently running')}</div>
87        %elif data_state == "error":
88            <div>
89                An error occurred running this job: <i>${data.display_info().strip()}</i>
90            </div>
91            <div>
92                <a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug tooltip"></a>
93                <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
94            </div>
95        %elif data_state == "discarded":
96            <div>
97                The job creating this dataset was cancelled before completion.
98            </div>
99        %elif data_state == 'setting_metadata':
100            <div>${_('Metadata is being Auto-Detected.')}</div>
101        %elif data_state == "empty":
102            <div>${_('No data: ')}<i>${data.display_info()}</i></div>
103        %elif data_state in [ "ok", "failed_metadata" ]:
104            %if data_state == "failed_metadata":
105                <div class="warningmessagesmall" style="margin: 4px 0 4px 0">
106                    An error occurred setting the metadata for this dataset.  You may be able to <a href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main">set it manually or retry auto-detection</a>.
107                </div>
108            %endif
109            <div>
110                ${data.blurb},
111                format: <span class="${data.ext}">${data.ext}</span>,
112                database:
113                %if data.dbkey == '?':
114                    <a href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main">${_(data.dbkey)}</a>
115                %else:
116                    <span class="${data.dbkey}">${_(data.dbkey)}</span>
117                %endif
118            </div>
119            <div class="info">${_('Info: ')}${data.display_info()}</div>
120            <div>
121                <% dataset_id=trans.security.encode_id( data.id ) %>
122                %if data.has_data():
123                    <a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Save" class="icon-button disk tooltip"></a>
124                    %if for_editing:
125                        <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
126                        %if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks():
127                            <a data-url="${h.url_for( controller='tracks', action='list_tracks' )}" class="icon-button vis-chart tooltip trackster-add"
128                                action-url="${h.url_for( controller='tracks', action='browser', dataset_id=dataset_id)}"
129                                new-url="${h.url_for( controller='tracks', action='index', dataset_id=dataset_id, default_dbkey=data.dbkey)}" title="Visualize in Trackster"></a>
130                        %endif
131                        %if trans.user:
132                            <div style="float: right">
133                                <a href="${h.url_for( controller='tag', action='retag', item_class=data.__class__.__name__, item_id=dataset_id )}" target="galaxy_main" title="Edit dataset tags" class="icon-button tags tooltip"></a>
134                                <a href="${h.url_for( controller='dataset', action='annotate', id=dataset_id )}" target="galaxy_main" title="Edit dataset annotation" class="icon-button annotate tooltip"></a>
135                            </div>
136                            <div style="clear: both"></div>
137                            <div class="tag-area" style="display: none">
138                                <strong>Tags:</strong>
139                                <div class="tag-elt"></div>
140                            </div>
141                            <div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">
142                                <strong>Annotation:</strong>
143                                <div id="${dataset_id}-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>
144                            </div>
145                           
146                        %endif
147                    %else:
148                        ## When displaying datasets for viewing, this is often needed to prevent peek from overlapping
149                        ## icons.
150                        <div style="clear: both"></div>
151                    %endif
152                        <div style="clear: both"></div>
153                    %for display_app in data.datatype.get_display_types():
154                        <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
155                        %if len( display_links ) > 0:
156                            | ${data.datatype.get_display_label(display_app)}
157                            %for display_name, display_link in display_links:
158                                <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
159                            %endfor
160                        %endif
161                    %endfor
162                    %for display_app in data.get_display_applications( trans ).itervalues():
163                        | ${display_app.name}
164                        %for link_app in display_app.links.itervalues():
165                            <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a>
166                        %endfor
167                    %endfor
168                %elif for_editing:
169                    <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
170                %endif
171   
172                </div>
173                %if data.peek != "no peek":
174                    <div><pre id="peek${data.id}" class="peek">${_(data.display_peek())}</pre></div>
175                %endif           
176        %else:
177            <div>${_('Error: unknown dataset state "%s".') % data_state}</div>
178        %endif
179           
180        ## Recurse for child datasets
181                         
182        %if len( data.children ) > 0:
183            ## FIXME: This should not be in the template, there should
184            ##        be a 'visible_children' method on dataset.
185            <%
186            children = []
187            for child in data.children:
188                if child.visible:
189                    children.append( child )
190            %>
191            %if len( children ) > 0:
192                <div>
193                    There are ${len( children )} secondary datasets.
194                    %for idx, child in enumerate(children):
195                        ${render_dataset( child, idx + 1, show_deleted_on_refresh = show_deleted_on_refresh )}
196                    %endfor
197                </div>
198            %endif
199        %endif
200
201    <div style="clear: both;"></div>
202
203    </div>
204       
205       
206    </div>
207
208</%def>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。