root/galaxy-central/database/compiled_templates/root/history.mako.py @ 3

リビジョン 3, 23.0 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1from mako import runtime, filters, cache
2UNDEFINED = runtime.UNDEFINED
3__M_dict_builtin = dict
4__M_locals_builtin = locals
5_magic_number = 5
6_modified_time = 1287725327.3004439
7_template_filename='templates/root/history.mako'
8_template_uri='root/history.mako'
9_template_cache=cache.Cache(__name__, _modified_time)
10_source_encoding=None
11_exports = []
12
13
14def _mako_get_namespace(context, name):
15    try:
16        return context.namespaces[(__name__, name)]
17    except KeyError:
18        _mako_generate_namespaces(context)
19        return context.namespaces[(__name__, name)]
20def _mako_generate_namespaces(context):
21    # SOURCE LINE 364
22    ns = runtime.Namespace('__anon_0x110c0db10', context._clean_inheritance_tokens(), templateuri=u'../tagging_common.mako', callables=None, calling_uri=_template_uri, module=None)
23    context.namespaces[(__name__, '__anon_0x110c0db10')] = ns
24
25    # SOURCE LINE 365
26    ns = runtime.Namespace('__anon_0x110c0dc10', context._clean_inheritance_tokens(), templateuri=u'history_common.mako', callables=None, calling_uri=_template_uri, module=None)
27    context.namespaces[(__name__, '__anon_0x110c0dc10')] = ns
28
29def render_body(context,**pageargs):
30    context.caller_stack._push_frame()
31    try:
32        __M_locals = __M_dict_builtin(pageargs=pageargs)
33        _import_ns = {}
34        _mako_get_namespace(context, '__anon_0x110c0db10')._populate(_import_ns, [u'render_individual_tagging_element'])
35        _mako_get_namespace(context, '__anon_0x110c0dc10')._populate(_import_ns, [u'render_dataset'])
36        datasets = _import_ns.get('datasets', context.get('datasets', UNDEFINED))
37        show_deleted = _import_ns.get('show_deleted', context.get('show_deleted', UNDEFINED))
38        h = _import_ns.get('h', context.get('h', UNDEFINED))
39        reversed = _import_ns.get('reversed', context.get('reversed', UNDEFINED))
40        render_dataset = _import_ns.get('render_dataset', context.get('render_dataset', UNDEFINED))
41        trans = _import_ns.get('trans', context.get('trans', UNDEFINED))
42        dict = _import_ns.get('dict', context.get('dict', UNDEFINED))
43        show_hidden = _import_ns.get('show_hidden', context.get('show_hidden', UNDEFINED))
44        render_individual_tagging_element = _import_ns.get('render_individual_tagging_element', context.get('render_individual_tagging_element', UNDEFINED))
45        n_ = _import_ns.get('n_', context.get('n_', UNDEFINED))
46        hda_id = _import_ns.get('hda_id', context.get('hda_id', UNDEFINED))
47        bool = _import_ns.get('bool', context.get('bool', UNDEFINED))
48        annotation = _import_ns.get('annotation', context.get('annotation', UNDEFINED))
49        history = _import_ns.get('history', context.get('history', UNDEFINED))
50        __M_writer = context.writer()
51        # SOURCE LINE 1
52        _=n_
53       
54        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['_'] if __M_key in __M_locals_builtin()]))
55        __M_writer(u'\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n\n<html>\n\n<head>\n<title>')
56        # SOURCE LINE 7
57        __M_writer(unicode(_('Galaxy History')))
58        __M_writer(u'</title>\n\n')
59        # SOURCE LINE 10
60        if bool( [ data for data in history.active_datasets if data.state in ['running', 'queued', '', None ] ] ):
61            # SOURCE LINE 11
62            __M_writer(u'<!-- running: do not change this comment, used by TwillTestCase.wait -->\n')
63        # SOURCE LINE 13
64        __M_writer(u'\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n<meta http-equiv="Pragma" content="no-cache">\n\n')
65        # SOURCE LINE 17
66        __M_writer(unicode(h.css( "base", "history", "autocomplete_tagging" )))
67        __M_writer(u'\n')
68        # SOURCE LINE 18
69        __M_writer(unicode(h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "class", "jquery.jstore", "jquery.autocomplete", "autocomplete_tagging" )))
70        __M_writer(u'\n\n<script type="text/javascript">\n\n')
71        # SOURCE LINE 22
72        TERMINAL_STATES = ["ok", "error", "empty", "deleted", "discarded", "failed_metadata"]
73       
74        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['TERMINAL_STATES'] if __M_key in __M_locals_builtin()]))
75        __M_writer(u'\nTERMINAL_STATES = ')
76        # SOURCE LINE 23
77        __M_writer(unicode( h.to_json_string(TERMINAL_STATES) ))
78        __M_writer(u';\n\n$(function() {\n    var historywrapper = $("div.historyItemWrapper");\n    init_history_items(historywrapper);\n    historywrapper.each( function() {\n        // Delete link\n        $(this).find( "div.historyItemButtons > .delete" ).each( function() {\n            var data_id = this.id.split( "-" )[1];\n            $(this).click( function() {\n                $( \'#historyItem-\' + data_id + "> div.historyItemTitleBar" ).addClass( "spinner" );\n                $.ajax({\n                    url: "')
79        # SOURCE LINE 35
80        __M_writer(unicode(h.url_for( action='delete_async', id='XXX' )))
81        __M_writer(u'".replace( \'XXX\', data_id ),\n                    error: function() { alert( "Delete failed" ); },\n                    success: function(msg) {\n                        if (msg === "OK") {\n')
82        # SOURCE LINE 39
83        if show_deleted:
84            # SOURCE LINE 40
85            __M_writer(u'                            var to_update = {};\n                            to_update[data_id] = "none";\n                            updater( to_update );\n')
86            # SOURCE LINE 43
87        else:
88            # SOURCE LINE 44
89            __M_writer(u'                            $( "#historyItem-" + data_id ).fadeOut( "fast", function() {\n                                $( "#historyItemContainer-" + data_id ).remove();\n                                if ( $( "div.historyItemContainer" ).length < 1 ) {\n                                    $( "#emptyHistoryMessage" ).show();\n                                }\n                            });\n')
90        # SOURCE LINE 51
91        __M_writer(u'                            $(".tipsy").remove();\n                        } else {\n                            alert( "Delete failed" );\n                        }\n                    }\n                });\n                return false;\n            });\n        });\n        // Undelete link\n        $(this).find( "a.historyItemUndelete" ).each( function() {\n            var data_id = this.id.split( "-" )[1];\n            $(this).click( function() {\n                $( \'#historyItem-\' + data_id + " > div.historyItemTitleBar" ).addClass( "spinner" );\n                $.ajax({\n                    url: "')
92        # SOURCE LINE 66
93        __M_writer(unicode(h.url_for( controller='dataset', action='undelete_async', id='XXX' )))
94        __M_writer(u'".replace( \'XXX\', data_id ),\n                    error: function() { alert( "Undelete failed" ) },\n                    success: function() {\n                        var to_update = {};\n                        to_update[data_id] = "none";\n                        updater( to_update );\n                    }\n                });\n                return false;\n            });\n        });\n\n        // Tag handling.\n        $(this).find( "a.icon-button.tags").each( function() {\n            // Use links parameters but custom URL as ajax URL.\n            $(this).click( function() {\n                // Get tag area, tag element.\n                var history_item = $(this).parents(".historyItem");\n                var tag_area = history_item.find(".tag-area");\n                var tag_elt = history_item.find(".tag-elt");\n\n                // Show or hide tag area; if showing tag area and it\'s empty, fill it.\n                if ( tag_area.is( ":hidden" ) ) {\n                    if (!tag_elt.html()) {\n                        // Need to fill tag element.\n                        var href_parms = $(this).attr("href").split("?")[1];\n                        var ajax_url = "')
95        # SOURCE LINE 92
96        __M_writer(unicode(h.url_for( controller='tag', action='get_tagging_elt_async' )))
97        __M_writer(u'?" + href_parms;\n                        $.ajax({\n                            url: ajax_url,\n                            error: function() { alert( "Tagging failed" ) },\n                            success: function(tag_elt_html) {\n                                tag_elt.html(tag_elt_html);\n                                tag_elt.find(".tooltip").tipsy( { gravity: \'s\' } );\n                                tag_area.slideDown("fast");\n                            }\n                        });\n                    } else {\n                        // Tag element is filled; show.\n                        tag_area.slideDown("fast");\n                    }\n                } else {\n                    // Hide.\n                    tag_area.slideUp("fast");\n                }\n                return false;        \n            });\n        });\n\n        // Annotation handling.\n        $(this).find( "a.icon-button.annotate").each( function() {\n            // Use links parameters but custom URL as ajax URL.\n            $(this).click( function() {\n                // Get tag area, tag element.\n                var history_item = $(this).parents(".historyItem");\n                var annotation_area = history_item.find(".annotation-area");\n                var annotation_elt = history_item.find(".annotation-elt");\n\n                // Show or hide annotation area; if showing annotation area and it\'s empty, fill it.\n                if ( annotation_area.is( ":hidden" ) ) {\n                    if (!annotation_elt.html()) {\n                        // Need to fill annotation element.\n                        var href_parms = $(this).attr("href").split("?")[1];\n                        var ajax_url = "')
98        # SOURCE LINE 128
99        __M_writer(unicode(h.url_for( controller='dataset', action='get_annotation_async' )))
100        __M_writer(u'?" + href_parms;\n                        $.ajax({\n                            url: ajax_url,\n                            error: function() { alert( "Annotations failed" ) },\n                            success: function(annotation) {\n                                if (annotation == "") {\n                                    annotation = "<em>Describe or add notes to dataset</em>";\n                                }\n                                annotation_elt.html(annotation);\n                                annotation_area.find(".tooltip").tipsy( { gravity: \'s\' } );\n                                async_save_text(\n                                    annotation_elt.attr("id"), annotation_elt.attr("id"),\n                                    "')
101        # SOURCE LINE 140
102        __M_writer(unicode(h.url_for( controller="/dataset", action="annotate_async")))
103        __M_writer(u'?" + href_parms,\n                                    "new_annotation", 18, true, 4);\n                                annotation_area.slideDown("fast");\n                            }\n                        });\n                    } else {\n                        // Annotation element is filled; show.\n                        annotation_area.slideDown("fast");\n                    }\n                } else {\n                    // Hide.\n                    annotation_area.slideUp("fast");\n                }\n                return false;        \n            });\n        });\n    });\n    \n    // Trackster links\n    function init_trackster_links() {\n        $("a.trackster").live( "click", function() {\n            var link = $(this),\n                hid = link.attr("id").split("_")[1]; // visualize_{id}\n\n            $.ajax({\n                url: "')
104        # SOURCE LINE 165
105        __M_writer(unicode(h.url_for( controller='tracks', action='list_tracks' )))
106        __M_writer(u'",\n                data: {\'hid\': hid},\n                error: function() { alert( "Visualization error" ); },\n                success: function(html) {\n                    show_modal("Add Track &mdash; Select Dataset(s)", html, {\n                        "New Browser": function() {\n                            hide_modal();\n                        },\n                        "Insert": function() {\n                            hide_modal();\n                        },\n                        "Cancel": function() {\n                            hide_modal();\n                        }\n                    });\n                }\n            });\n        });    \n    }\n    \n    init_trackster_links();\n    \n    // History rename functionality.\n    async_save_text("history-name-container", "history-name", "')
107        # SOURCE LINE 188
108        __M_writer(unicode(h.url_for( controller="/history", action="rename_async", id=trans.security.encode_id(history.id) )))
109        __M_writer(u'", "new_name", 18);\n    \n    // History tagging functionality.\n    var historyTagArea = $(\'#history-tag-area\');\n    $(\'#history-tag\').click( function() {\n        if ( historyTagArea.is( ":hidden" ) ) {\n            historyTagArea.slideDown("fast");\n        } else {\n            historyTagArea.slideUp("fast");\n        }\n        return false;\n    });\n    \n    // History annotation functionality.\n    var historyAnnotationArea = $(\'#history-annotation-area\');\n    $(\'#history-annotate\').click( function() {\n        if ( historyAnnotationArea.is( ":hidden" ) ) {\n            historyAnnotationArea.slideDown("fast");\n        } else {\n            historyAnnotationArea.slideUp("fast");\n        }\n        return false;\n    });\n    async_save_text("history-annotation-container", "history-annotation", "')
110        # SOURCE LINE 211
111        __M_writer(unicode(h.url_for( controller="/history", action="annotate_async", id=trans.security.encode_id(history.id) )))
112        __M_writer(u'", "new_annotation", 18, true, 4);\n    \n    // Updater\n    updater(\n        ')
113        # SOURCE LINE 215
114        __M_writer(unicode( h.to_json_string( dict([(data.id, data.state) for data in reversed( datasets ) if data.visible and data.state not in TERMINAL_STATES]) ) ))
115        __M_writer(u'\n    );\n    \n    // Navigate to a dataset.\n')
116        # SOURCE LINE 219
117        if hda_id:
118            # SOURCE LINE 220
119            __M_writer(u'        self.location = "#')
120            __M_writer(unicode(hda_id))
121            __M_writer(u'";\n')
122        # SOURCE LINE 222
123        __M_writer(u'});\n\n// Looks for changes in dataset state using an async request. Keeps\n// calling itself (via setTimeout) until all datasets are in a terminal\n// state.\nvar updater = function ( tracked_datasets ) {\n    // Check if there are any items left to track\n    var empty = true;\n    for ( i in tracked_datasets ) {\n        empty = false;\n        break;\n    }\n    if ( !empty ) {\n        setTimeout( function() { updater_callback( tracked_datasets ) }, 4000 );\n    }\n};\nvar updater_callback = function ( tracked_datasets ) {\n    // Build request data\n    var ids = [],\n        states = [],\n        force_history_refresh = false;\n        \n    $.each( tracked_datasets, function ( id, state ) {\n        ids.push( id );\n        states.push( state );\n    });\n    // Make ajax call\n    $.ajax( {\n        type: "POST",\n        url: "')
124        # SOURCE LINE 251
125        __M_writer(unicode(h.url_for( controller='root', action='history_item_updates' )))
126        __M_writer(u'",\n        dataType: "json",\n        data: { ids: ids.join( "," ), states: states.join( "," ) },\n        success : function ( data ) {\n            $.each( data, function( id, val ) {\n                // Replace HTML\n                var container = $("#historyItemContainer-" + id);\n                container.html( val.html );\n                init_history_items( $("div.historyItemWrapper"), "noinit" );\n                // If new state is terminal, stop tracking\n                if (TERMINAL_STATES.indexOf(val.state) !== -1) {\n                    if ( val.force_history_refresh ){\n                        force_history_refresh = true;\n                    }\n                    delete tracked_datasets[ parseInt(id) ];\n                } else {\n                    tracked_datasets[ parseInt(id) ] = val.state;\n                }\n            });\n            if ( force_history_refresh ) {\n                parent.frames.galaxy_history.location.reload();\n            } else {\n                // Keep going (if there are still any items to track)\n                updater( tracked_datasets ); \n            }\n        },\n        error: function() {\n            // Just retry, like the old method, should try to be smarter\n            updater( tracked_datasets );\n        }\n    });\n};\n\n</script>\n\n<style>\n.historyItemBody {\n    display: none;\n}\ndiv.form-row {\n    padding: 5px 5px 5px 0px;\n}\n#top-links {\n    margin-bottom: 15px;\n}\n#history-name-container {\n    display: inline-block;\n    color: gray;\n    font-weight: bold;\n}\n.editable-text {\n    border: solid transparent 1px;\n    padding: 3px;\n    margin: -4px;\n}\n</style>\n\n<noscript>\n<style>\n.historyItemBody {\n    display: block;\n}\n</style>\n</noscript>\n\n</head>\n\n<body class="historyPage">\n<div id="top-links" class="historyLinks">\n    \n    <a title="')
127        # SOURCE LINE 321
128        __M_writer(unicode(_('refresh')))
129        __M_writer(u'" class="icon-button arrow-circle tooltip" href="')
130        __M_writer(unicode(h.url_for('history', show_deleted=show_deleted)))
131        __M_writer(u'"></a>\n    <a title=\'')
132        # SOURCE LINE 322
133        __M_writer(unicode(_('collapse all')))
134        __M_writer(u'\' class=\'icon-button toggle tooltip\' href=\'#\' style="display: none;"></a>\n    \n')
135        # SOURCE LINE 324
136        if trans.get_user():
137            # SOURCE LINE 325
138            __M_writer(u'    <div style="width: 40px; float: right; white-space: nowrap;">\n        <a id="history-tag" title="Edit history tags" class="icon-button tags tooltip" target="galaxy_main" href="')
139            # SOURCE LINE 326
140            __M_writer(unicode(h.url_for( controller='history', action='tag' )))
141            __M_writer(u'"></a>\n        <a id="history-annotate" title="Edit history annotation" class="icon-button annotate tooltip" target="galaxy_main" href="')
142            # SOURCE LINE 327
143            __M_writer(unicode(h.url_for( controller='history', action='annotate' )))
144            __M_writer(u'"></a>\n    </div>\n')
145        # SOURCE LINE 330
146        __M_writer(u'\n</div>\n\n<div style="clear: both;"></div>\n\n')
147        # SOURCE LINE 335
148        if show_deleted:
149            # SOURCE LINE 336
150            __M_writer(u'<div class="historyLinks">\n    <a href="')
151            # SOURCE LINE 337
152            __M_writer(unicode(h.url_for('history', show_deleted=False)))
153            __M_writer(u'">')
154            __M_writer(unicode(_('hide deleted')))
155            __M_writer(u'</a>\n</div>\n')
156        # SOURCE LINE 340
157        __M_writer(u'\n')
158        # SOURCE LINE 341
159        if show_hidden:
160            # SOURCE LINE 342
161            __M_writer(u'<div class="historyLinks">\n    <a href="')
162            # SOURCE LINE 343
163            __M_writer(unicode(h.url_for('history', show_hidden=False)))
164            __M_writer(u'">')
165            __M_writer(unicode(_('hide hidden')))
166            __M_writer(u'</a>\n</div>\n')
167        # SOURCE LINE 346
168        __M_writer(u'\n<div id="history-name-area" class="historyLinks">\n    \n')
169        # SOURCE LINE 349
170        if trans.get_user():
171            # SOURCE LINE 350
172            __M_writer(u'    <div id="history-name-container">\n        <div id="history-name" class="tooltip editable-text" title="Click to rename history">')
173            # SOURCE LINE 351
174            __M_writer(filters.html_escape(unicode(history.get_display_name() )))
175            __M_writer(u'</div>\n    </div>\n')
176        # SOURCE LINE 354
177        __M_writer(u'                               \n</div>\n\n')
178        # SOURCE LINE 357
179        if history.deleted:
180            # SOURCE LINE 358
181            __M_writer(u'    <div class="warningmessagesmall">\n        ')
182            # SOURCE LINE 359
183            __M_writer(unicode(_('You are currently viewing a deleted history!')))
184            __M_writer(u'\n    </div>\n    <p></p>\n')
185        # SOURCE LINE 363
186        __M_writer(u'\n')
187        # SOURCE LINE 364
188        __M_writer(u'\n')
189        # SOURCE LINE 365
190        __M_writer(u'\n\n')
191        # SOURCE LINE 367
192        if trans.get_user() is not None:
193            # SOURCE LINE 368
194            __M_writer(u'    <div style="margin: 0px 5px 10px 5px">\n')
195            # SOURCE LINE 370
196            __M_writer(u'        <div id="history-tag-area" style="display: none">\n            <b>Tags:</b>\n            ')
197            # SOURCE LINE 372
198            __M_writer(unicode(render_individual_tagging_element(user=trans.get_user(), tagged_item=history, elt_context="history.mako", use_toggle_link=False, input_size="20")))
199            __M_writer(u'\n        </div>\n    \n')
200            # SOURCE LINE 376
201            __M_writer(u'        <div id="history-annotation-area" style="display: none">\n   \t        <b>Annotation / Notes:</b>\n   \t        <div id="history-annotation-container">\n\t\t    <div id="history-annotation" class="tooltip editable-text" title="Click to edit annotation">\n')
202            # SOURCE LINE 380
203            if annotation:
204                # SOURCE LINE 381
205                __M_writer(u'                    ')
206                __M_writer(filters.html_escape(unicode(h.to_unicode( annotation ) )))
207                __M_writer(u'\n')
208                # SOURCE LINE 382
209            else:
210                # SOURCE LINE 383
211                __M_writer(u'                    <em>Describe or add notes to history</em>\n')
212            # SOURCE LINE 385
213            __M_writer(u'\t\t    </div>\n            </div>\n        </div>\n        \n    </div>\n')
214        # SOURCE LINE 391
215        __M_writer(u'\n')
216        # SOURCE LINE 392
217        if not datasets:
218            # SOURCE LINE 393
219            __M_writer(u'\n    <div class="infomessagesmall" id="emptyHistoryMessage">\n\n')
220            # SOURCE LINE 396
221        else:   
222            # SOURCE LINE 397
223            __M_writer(u'\n')
224            # SOURCE LINE 399
225            for data in reversed( datasets ):
226                # SOURCE LINE 400
227                if data.visible or show_hidden:
228                    # SOURCE LINE 401
229                    __M_writer(u'            <div class="historyItemContainer" id="historyItemContainer-')
230                    __M_writer(unicode(data.id))
231                    __M_writer(u'">\n                ')
232                    # SOURCE LINE 402
233                    __M_writer(unicode(render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = True )))
234                    __M_writer(u'\n            </div>\n')
235            # SOURCE LINE 406
236            __M_writer(u'\n    <div class="infomessagesmall" id="emptyHistoryMessage" style="display:none;">\n')
237        # SOURCE LINE 409
238        __M_writer(u'        ')
239        __M_writer(unicode(_("Your history is empty. Click 'Get Data' on the left pane to start")))
240        __M_writer(u'\n    </div>\n\n</body>\n</html>\n')
241        return ''
242    finally:
243        context.caller_stack._pop_frame()
244
245
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。