PageRenderTime 21ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/root/index.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 243 lines | 218 code | 22 blank | 3 comment | 6 complexity | 1a192558c6640a1f27e44c623564ef55 MD5 | raw file
  1. <%inherit file="/webapps/galaxy/base_panels.mako"/>
  2. <%def name="late_javascripts()">
  3. ${parent.late_javascripts()}
  4. <script type="text/javascript">
  5. // Set up GalaxyAsync object.
  6. var galaxy_async = new GalaxyAsync();
  7. galaxy_async.set_func_url(galaxy_async.set_user_pref, "${h.url_for( controller='user', action='set_user_pref_async' )}");
  8. $(function(){
  9. // Init history options.
  10. $("#history-options-button").css( "position", "relative" );
  11. make_popupmenu( $("#history-options-button"), {
  12. "History Lists": null,
  13. "Saved Histories": function() {
  14. galaxy_main.location = "${h.url_for( controller='history', action='list')}";
  15. },
  16. "Histories Shared with Me": function() {
  17. galaxy_main.location = "${h.url_for( controller='history', action='list_shared')}";
  18. },
  19. "Current History": null,
  20. "Create New": function() {
  21. galaxy_history.location = "${h.url_for( controller='root', action='history_new' )}";
  22. },
  23. "Clone": function() {
  24. galaxy_main.location = "${h.url_for( controller='history', action='clone')}";
  25. },
  26. "Copy Datasets": function() {
  27. galaxy_main.location = "${h.url_for( controller='dataset', action='copy_datasets' )}";
  28. },
  29. "Share or Publish": function() {
  30. galaxy_main.location = "${h.url_for( controller='history', action='sharing' )}";
  31. },
  32. "Extract Workflow": function() {
  33. galaxy_main.location = "${h.url_for( controller='workflow', action='build_from_current_history' )}";
  34. },
  35. "Dataset Security": function() {
  36. galaxy_main.location = "${h.url_for( controller='root', action='history_set_default_permissions' )}";
  37. },
  38. "Show Deleted Datasets": function() {
  39. galaxy_history.location = "${h.url_for( controller='root', action='history', show_deleted=True)}";
  40. },
  41. "Show Hidden Datasets": function() {
  42. galaxy_history.location = "${h.url_for( controller='root', action='history', show_hidden=True)}";
  43. },
  44. "Show Structure": function() {
  45. galaxy_main.location = "${h.url_for( controller='history', action='display_structured' )}";
  46. },
  47. "Export to File": function() {
  48. galaxy_main.location = "${h.url_for( controller='history', action='export_archive' )}";
  49. },
  50. "Delete": function() {
  51. if ( confirm( "Really delete the current history?" ) ) {
  52. galaxy_main.location = "${h.url_for( controller='history', action='delete_current' )}";
  53. }
  54. },
  55. "Other Actions": null,
  56. "Import from File": function() {
  57. galaxy_main.location = "${h.url_for( controller='history', action='import_archive' )}";
  58. }
  59. });
  60. var menu_options = {}; // Holds dictionary of { label: toggle_fn }
  61. SHOW_TOOL = "Show Tool Search";
  62. HIDE_TOOL = "Hide Tool Search";
  63. SHOW_RECENT = "Show Recently Used";
  64. HIDE_RECENT = "Hide Recently Used";
  65. var toggle_tool_search_fn = function() {
  66. // Show/hide menu and update vars, user preferences.
  67. var menu = $("#galaxy_tools").contents().find('#tool-search'),
  68. pref_value, menu_option_text, old_text;
  69. if (menu.is(":visible")) {
  70. // Hide menu.
  71. pref_value = "False";
  72. menu_option_text = SHOW_TOOL;
  73. old_text = HIDE_TOOL;
  74. // Reset search.
  75. reset_tool_search(true);
  76. } else {
  77. // Show menu.
  78. pref_value = "True";
  79. menu_option_text = HIDE_TOOL;
  80. old_text = SHOW_TOOL;
  81. }
  82. menu.toggle();
  83. // Update menu option.
  84. delete menu_options[old_text];
  85. var new_menu_options = {};
  86. // Because we always want tool menu to be the first link in the dropdown,
  87. // we re-create the menu_options dictionary by creating a new
  88. // dict and then appending the old dict to it
  89. new_menu_options[menu_option_text] = toggle_tool_search_fn;
  90. menu_options = $.extend( new_menu_options, menu_options );
  91. make_popupmenu( $("#tools-options-button"), menu_options );
  92. galaxy_async.set_user_pref("show_tool_search", pref_value);
  93. };
  94. var toggle_recently_used_fn = function() {
  95. // Show/hide menu.
  96. var ru_menu = $('#galaxy_tools').contents().find('#recently_used_wrapper'),
  97. ru_menu_body = ru_menu.find(".toolSectionBody"),
  98. pref_value, old_text, menu_option_text;
  99. if (ru_menu.hasClass("user_pref_visible")) {
  100. // Hide menu.
  101. ru_menu_body.slideUp();
  102. ru_menu.slideUp();
  103. // Set vars used below and in tool menu frame.
  104. pref_value = "False";
  105. old_text = HIDE_RECENT;
  106. menu_option_text = SHOW_RECENT;
  107. } else {
  108. // "Show" menu.
  109. if (!$('#galaxy_tools').contents().find('#tool-search-query').hasClass("search_active")) {
  110. // Default.
  111. ru_menu.slideDown();
  112. } else {
  113. // Search active: tf there are matching tools in RU menu, show menu.
  114. if ( ru_menu.find(".toolTitle.search_match").length !== 0 ) {
  115. ru_menu.slideDown();
  116. ru_menu_body.slideDown();
  117. }
  118. }
  119. // Set vars used below and in tool menu frame.
  120. pref_value = "True";
  121. old_text = SHOW_RECENT;
  122. menu_option_text = HIDE_RECENT;
  123. }
  124. // Update menu class and option.
  125. ru_menu.toggleClass("user_pref_hidden user_pref_visible");
  126. delete menu_options[old_text];
  127. menu_options[menu_option_text] = toggle_recently_used_fn;
  128. make_popupmenu( $("#tools-options-button"), menu_options );
  129. galaxy_async.set_user_pref("show_recently_used_menu", pref_value);
  130. };
  131. // Init tool options.
  132. ## Search tools menu item.
  133. %if trans.app.toolbox_search.enabled:
  134. <%
  135. show_tool_search = True
  136. if trans.user:
  137. show_tool_search = trans.user.preferences.get( "show_tool_search", "False" ) == "True"
  138. if show_tool_search:
  139. action = "HIDE_TOOL"
  140. else:
  141. action = "SHOW_TOOL"
  142. %>
  143. menu_options[ ${action} ] = toggle_tool_search_fn;
  144. %endif
  145. ## Recently used tools menu.
  146. %if trans.user:
  147. <%
  148. if trans.user.preferences.get( 'show_recently_used_menu', 'False' ) == 'True':
  149. action = "HIDE_RECENT"
  150. else:
  151. action = "SHOW_RECENT"
  152. %>
  153. menu_options[ ${action} ] = toggle_recently_used_fn;
  154. %endif
  155. make_popupmenu( $("#tools-options-button"), menu_options );
  156. });
  157. </script>
  158. </%def>
  159. <%def name="init()">
  160. <%
  161. if trans.app.config.cloud_controller_instance:
  162. self.has_left_panel=False
  163. self.has_right_panel=False
  164. self.active_view="cloud"
  165. else:
  166. self.has_left_panel=True
  167. self.has_right_panel=True
  168. self.active_view="analysis"
  169. %>
  170. %if trans.app.config.require_login and not trans.user:
  171. <script type="text/javascript">
  172. if ( window != top ) {
  173. top.location.href = location.href;
  174. }
  175. </script>
  176. %endif
  177. </%def>
  178. <%def name="left_panel()">
  179. <div class="unified-panel-header" unselectable="on">
  180. <div class='unified-panel-header-inner'>
  181. <div style="float: right">
  182. <a class='panel-header-button popup' id="tools-options-button" href="#">${_('Options')}</a>
  183. </div>
  184. ${n_('Tools')}
  185. </div>
  186. </div>
  187. <div class="unified-panel-body" style="overflow: hidden;">
  188. <iframe name="galaxy_tools" id="galaxy_tools" src="${h.url_for( controller='root', action='tool_menu' )}" frameborder="0" style="position: absolute; margin: 0; border: 0 none; height: 100%; width: 100%;"> </iframe>
  189. </div>
  190. </%def>
  191. <%def name="center_panel()">
  192. ## If a specific tool id was specified, load it in the middle frame
  193. <%
  194. if trans.app.config.require_login and not trans.user:
  195. center_url = h.url_for( controller='user', action='login' )
  196. elif tool_id is not None:
  197. center_url = h.url_for( 'tool_runner', tool_id=tool_id, from_noframe=True )
  198. elif workflow_id is not None:
  199. center_url = h.url_for( controller='workflow', action='run', id=workflow_id )
  200. elif m_c is not None:
  201. center_url = h.url_for( controller=m_c, action=m_a )
  202. elif trans.app.config.cloud_controller_instance:
  203. center_url = h.url_for( controller='cloud', action='list' )
  204. else:
  205. center_url = h.url_for( '/static/welcome.html' )
  206. %>
  207. <iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"> </iframe>
  208. </%def>
  209. <%def name="right_panel()">
  210. <div class="unified-panel-header" unselectable="on">
  211. <div class="unified-panel-header-inner">
  212. <div style="float: right">
  213. <a id="history-options-button" class='panel-header-button popup' href="${h.url_for( controller='root', action='history_options' )}" target="galaxy_main">${_('Options')}</a>
  214. </div>
  215. <div class="panel-header-text">${_('History')}</div>
  216. </div>
  217. </div>
  218. <div class="unified-panel-body" style="overflow: hidden;">
  219. <iframe name="galaxy_history" width="100%" height="100%" frameborder="0" style="position: absolute; margin: 0; border: 0 none; height: 100%;" src="${h.url_for( controller='root', action='history' )}"></iframe>
  220. </div>
  221. </%def>