[2] | 1 | ## This needs to be on the first line, otherwise IE6 goes into quirks mode |
---|
| 2 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
---|
| 3 | |
---|
| 4 | <% |
---|
| 5 | self.has_left_panel=True |
---|
| 6 | self.has_right_panel=True |
---|
| 7 | self.message_box_visible=False |
---|
| 8 | self.overlay_visible=False |
---|
| 9 | self.message_box_class="" |
---|
| 10 | self.active_view=None |
---|
| 11 | self.body_class="" |
---|
| 12 | %> |
---|
| 13 | |
---|
| 14 | <%def name="init()"> |
---|
| 15 | ## Override |
---|
| 16 | </%def> |
---|
| 17 | |
---|
| 18 | ## Default stylesheets |
---|
| 19 | <%def name="stylesheets()"> |
---|
| 20 | ${h.css('base','panel_layout','jquery.rating')} |
---|
| 21 | <style type="text/css"> |
---|
| 22 | #center { |
---|
| 23 | %if not self.has_left_panel: |
---|
| 24 | left: 0; |
---|
| 25 | %endif |
---|
| 26 | %if not self.has_right_panel: |
---|
| 27 | right: 0; |
---|
| 28 | %endif |
---|
| 29 | } |
---|
| 30 | %if self.message_box_visible: |
---|
| 31 | #left, #left-border, #center, #right-border, #right |
---|
| 32 | { |
---|
| 33 | top: 64px; |
---|
| 34 | } |
---|
| 35 | %endif |
---|
| 36 | </style> |
---|
| 37 | </%def> |
---|
| 38 | |
---|
| 39 | ## Default javascripts |
---|
| 40 | <%def name="javascripts()"> |
---|
| 41 | <!--[if lt IE 7]> |
---|
| 42 | ${h.js( 'IE7', 'ie7-recalc' )} |
---|
| 43 | <![endif]--> |
---|
| 44 | <script type="text/javascript"> |
---|
| 45 | var image_path = '${h.url_for("/static/images")}'; |
---|
| 46 | </script> |
---|
| 47 | ${h.js( 'jquery' )} |
---|
| 48 | </%def> |
---|
| 49 | |
---|
| 50 | ## Default late-load javascripts |
---|
| 51 | <%def name="late_javascripts()"> |
---|
| 52 | ## Scripts can be loaded later since they progressively add features to |
---|
| 53 | ## the panels, but do not change layout |
---|
| 54 | ${h.js( 'jquery.event.drag', 'jquery.event.hover', 'jquery.form', 'jquery.rating', 'galaxy.base', 'galaxy.panels' )} |
---|
| 55 | <script type="text/javascript"> |
---|
| 56 | |
---|
| 57 | ensure_dd_helper(); |
---|
| 58 | |
---|
| 59 | %if self.has_left_panel: |
---|
| 60 | var lp = make_left_panel( $("#left"), $("#center"), $("#left-border" ) ); |
---|
| 61 | force_left_panel = lp.force_panel; |
---|
| 62 | %endif |
---|
| 63 | |
---|
| 64 | %if self.has_right_panel: |
---|
| 65 | var rp = make_right_panel( $("#right"), $("#center"), $("#right-border" ) ); |
---|
| 66 | handle_minwidth_hint = rp.handle_minwidth_hint; |
---|
| 67 | force_right_panel = rp.force_panel; |
---|
| 68 | %endif |
---|
| 69 | |
---|
| 70 | </script> |
---|
| 71 | ## Handle AJAX (actually hidden iframe) upload tool |
---|
| 72 | <![if !IE]> |
---|
| 73 | <script type="text/javascript"> |
---|
| 74 | var upload_form_error = function( msg ) { |
---|
| 75 | if ( ! $("iframe#galaxy_main").contents().find("body").find("div[class='errormessage']").size() ) { |
---|
| 76 | $("iframe#galaxy_main").contents().find("body").prepend( '<div class="errormessage" name="upload_error">' + msg + '</div><p/>' ); |
---|
| 77 | } else { |
---|
| 78 | $("iframe#galaxy_main").contents().find("body").find("div[class='errormessage']").text( msg ); |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | jQuery( function() { |
---|
| 82 | $("iframe#galaxy_main").load( function() { |
---|
| 83 | $(this).contents().find("form").each( function() { |
---|
| 84 | if ( $(this).find("input[galaxy-ajax-upload]").length > 0 ){ |
---|
| 85 | $(this).submit( function() { |
---|
| 86 | // Only bother using a hidden iframe if there's a file (e.g. big data) upload |
---|
| 87 | var file_upload = false; |
---|
| 88 | $(this).find("input[galaxy-ajax-upload]").each( function() { |
---|
| 89 | if ( $(this).val() != '' ) { |
---|
| 90 | file_upload = true; |
---|
| 91 | } |
---|
| 92 | }); |
---|
| 93 | if ( ! file_upload ) { |
---|
| 94 | return true; |
---|
| 95 | } |
---|
| 96 | // Make a synchronous request to create the datasets first |
---|
| 97 | var async_datasets; |
---|
| 98 | var upload_error = false; |
---|
| 99 | $.ajax( { |
---|
| 100 | async: false, |
---|
| 101 | type: "POST", |
---|
| 102 | url: "${h.url_for(controller='/tool_runner', action='upload_async_create')}", |
---|
| 103 | data: $(this).formSerialize(), |
---|
| 104 | dataType: "json", |
---|
| 105 | success: function(array_obj, status) { |
---|
| 106 | if (array_obj.length > 0) { |
---|
| 107 | if (array_obj[0] == 'error') { |
---|
| 108 | upload_error = true; |
---|
| 109 | upload_form_error(array_obj[1]); |
---|
| 110 | } else { |
---|
| 111 | async_datasets = array_obj.join(); |
---|
| 112 | } |
---|
| 113 | } else { |
---|
| 114 | // ( gvk 1/22/10 ) FIXME: this block is never entered, so there may be a bug somewhere |
---|
| 115 | // I've done some debugging like checking to see if array_obj is undefined, but have not |
---|
| 116 | // tracked down the behavior that will result in this block being entered. I believe the |
---|
| 117 | // intent was to have this block entered if the upload button is clicked on the upload |
---|
| 118 | // form but no file was selected. |
---|
| 119 | upload_error = true; |
---|
| 120 | upload_form_error( 'No data was entered in the upload form. You may choose to upload a file, paste some data directly in the data box, or enter URL(s) to fetch data.' ); |
---|
| 121 | } |
---|
| 122 | } |
---|
| 123 | } ); |
---|
| 124 | if (upload_error == true) { |
---|
| 125 | return false; |
---|
| 126 | } else { |
---|
| 127 | $(this).find("input[name=async_datasets]").val( async_datasets ); |
---|
| 128 | $(this).append("<input type='hidden' name='ajax_upload' value='true'>"); |
---|
| 129 | } |
---|
| 130 | // iframe submit is required for nginx (otherwise the encoding is wrong) |
---|
| 131 | $(this).ajaxSubmit( { iframe: true } ); |
---|
| 132 | if ( $(this).find("input[name='folder_id']").val() != undefined ) { |
---|
| 133 | var library_id = $(this).find("input[name='library_id']").val(); |
---|
| 134 | var show_deleted = $(this).find("input[name='show_deleted']").val(); |
---|
| 135 | if ( location.pathname.indexOf( 'admin' ) != -1 ) { |
---|
| 136 | $("iframe#galaxy_main").attr("src","${h.url_for( controller='library_common', action='browse_library' )}?cntrller=library_admin&id=" + library_id + "&created_ldda_ids=" + async_datasets + "&show_deleted=" + show_deleted); |
---|
| 137 | } else { |
---|
| 138 | $("iframe#galaxy_main").attr("src","${h.url_for( controller='library_common', action='browse_library' )}?cntrller=library&id=" + library_id + "&created_ldda_ids=" + async_datasets + "&show_deleted=" + show_deleted); |
---|
| 139 | } |
---|
| 140 | } else { |
---|
| 141 | $("iframe#galaxy_main").attr("src","${h.url_for(controller='tool_runner', action='upload_async_message')}"); |
---|
| 142 | } |
---|
| 143 | return false; |
---|
| 144 | }); |
---|
| 145 | } |
---|
| 146 | }); |
---|
| 147 | }); |
---|
| 148 | }); |
---|
| 149 | </script> |
---|
| 150 | <![endif]> |
---|
| 151 | </%def> |
---|
| 152 | |
---|
| 153 | ## Masthead |
---|
| 154 | <%def name="masthead()"> |
---|
| 155 | ## Override |
---|
| 156 | </%def> |
---|
| 157 | |
---|
| 158 | <%def name="overlay( title='', content='' )"> |
---|
| 159 | <%def name="title()"></%def> |
---|
| 160 | <%def name="content()"></%def> |
---|
| 161 | |
---|
| 162 | <div id="overlay" |
---|
| 163 | %if not self.overlay_visible: |
---|
| 164 | style="display: none;" |
---|
| 165 | %endif |
---|
| 166 | > |
---|
| 167 | ## |
---|
| 168 | <div id="overlay-background" style="position: absolute; width: 100%; height: 100%;"></div> |
---|
| 169 | |
---|
| 170 | ## Need a table here for centering in IE6 |
---|
| 171 | <table class="dialog-box-container" border="0" cellpadding="0" cellspacing="0" |
---|
| 172 | %if not self.overlay_visible: |
---|
| 173 | style="display: none;" |
---|
| 174 | %endif |
---|
| 175 | ><tr><td> |
---|
| 176 | <div class="dialog-box-wrapper"> |
---|
| 177 | <div class="dialog-box"> |
---|
| 178 | <div class="unified-panel-header"> |
---|
| 179 | <div class="unified-panel-header-inner"><span class='title'>${title}</span></div> |
---|
| 180 | </div> |
---|
| 181 | <div class="body">${content}</div> |
---|
| 182 | <div> |
---|
| 183 | <div class="buttons" style="display: none; float: right;"></div> |
---|
| 184 | <div class="extra_buttons" style="display: none; padding: 5px;"></div> |
---|
| 185 | <div style="clear: both;"></div> |
---|
| 186 | </div> |
---|
| 187 | </div> |
---|
| 188 | </div> |
---|
| 189 | </td></tr></table> |
---|
| 190 | </div> |
---|
| 191 | </%def> |
---|
| 192 | |
---|
| 193 | ## Messagebox |
---|
| 194 | <%def name="message_box_content()"> |
---|
| 195 | </%def> |
---|
| 196 | |
---|
| 197 | ## Document |
---|
| 198 | <html> |
---|
| 199 | ${self.init()} |
---|
| 200 | <head> |
---|
| 201 | <title>${self.title()}</title> |
---|
| 202 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
| 203 | ${self.stylesheets()} |
---|
| 204 | ${self.javascripts()} |
---|
| 205 | </head> |
---|
| 206 | |
---|
| 207 | <body scroll="no" class="${self.body_class}"> |
---|
| 208 | <div id="everything" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; min-width: 600px;"> |
---|
| 209 | ## Background displays first |
---|
| 210 | <div id="background"></div> |
---|
| 211 | ## Layer iframes over backgrounds |
---|
| 212 | <div id="masthead"> |
---|
| 213 | ${self.masthead()} |
---|
| 214 | </div> |
---|
| 215 | <div id="messagebox" class="panel-${self.message_box_class}-message"> |
---|
| 216 | %if self.message_box_visible: |
---|
| 217 | ${self.message_box_content()} |
---|
| 218 | %endif |
---|
| 219 | </div> |
---|
| 220 | ${self.overlay()} |
---|
| 221 | %if self.has_left_panel: |
---|
| 222 | <div id="left"> |
---|
| 223 | ${self.left_panel()} |
---|
| 224 | </div> |
---|
| 225 | <div id="left-border"> |
---|
| 226 | <div id="left-border-inner" style="display: none;"></div> |
---|
| 227 | </div> |
---|
| 228 | %endif |
---|
| 229 | <div id="center"> |
---|
| 230 | ${self.center_panel()} |
---|
| 231 | </div> |
---|
| 232 | %if self.has_right_panel: |
---|
| 233 | <div id="right-border"><div id="right-border-inner" style="display: none;"></div></div> |
---|
| 234 | <div id="right"> |
---|
| 235 | ${self.right_panel()} |
---|
| 236 | </div> |
---|
| 237 | %endif |
---|
| 238 | </div> |
---|
| 239 | ## Allow other body level elements |
---|
| 240 | </body> |
---|
| 241 | ## Scripts can be loaded later since they progressively add features to |
---|
| 242 | ## the panels, but do not change layout |
---|
| 243 | ${self.late_javascripts()} |
---|
| 244 | </html> |
---|