Diff
Modified: branches/galaxy-integration/app/controllers/application_controller.rb (2965 => 2966)
--- branches/galaxy-integration/app/controllers/application_controller.rb 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/controllers/application_controller.rb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -20,7 +20,7 @@
include AuthenticatedSystem
before_filter :login_from_cookie
before_filter :oauth_required
- before_filter :check_galaxy_request
+ before_filter :check_external_site_request
include ActionView::Helpers::NumberHelper
@@ -1200,14 +1200,36 @@
end
- def check_galaxy_request
- if params[:galaxy_url]
- session[:galaxy_url] = CGI.unescape(params[:galaxy_url])
+ # Applies a header to the page
+ def check_external_site_request
+ external_url_keys = params.keys & Conf.external_site_integrations.keys.collect {|s| s + "_url"}
+
+ if external_url_keys.size == 1
+ external_url_key = external_url_keys.first
+ external_url = params[external_url_key]
+
+ if %w(http https).include?(URI.parse(external_url).scheme)
+ session[:came_from] = external_url_key[0..-5] # Strip the _url part
+ session[:return_url] = CGI.unescape(external_url)
+ else
+ raise("Invalid return URL given for #{external_url_key}: \n\t#{external_url}")
+ end
+ elsif external_url_keys.size > 1
+ raise("#{external_url_keys.size} external URLs specified. Can only cope with one!")
end
+ end
- #Disable galaxy layout when no longer relevant
- if false #Something? check subdomain?
- session[:galaxy_url] = nil
+ # Remove external site information from session
+ # and then go back the page we were at, or /home
+ def clear_external_site_session_info
+ params.delete("#{session.delete(:came_from)}_url")
+ session.delete(:return_url)
+
+ referrer = request.headers["Referer"]
+ target = referrer.blank? ? '/home' : URI.parse(referrer).path
+
+ respond_to do |format|
+ format.html { redirect_to target, (referrer.blank? ? nil : params) }
end
end
end
Modified: branches/galaxy-integration/app/helpers/application_helper.rb (2965 => 2966)
--- branches/galaxy-integration/app/helpers/application_helper.rb 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/helpers/application_helper.rb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -1614,14 +1614,7 @@
end
end
-
-
@layout = layout || {"layout" => Conf.page_template, "stylesheets" => [Conf.stylesheet]}
end
- #TODO: FIXME: Check subdomain?
- def using_galaxy?
- !session[:galaxy_url].blank?
- end
-
end
Deleted: branches/galaxy-integration/app/views/layouts/_galaxy.html.erb (2965 => 2966)
--- branches/galaxy-integration/app/views/layouts/_galaxy.html.erb 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/views/layouts/_galaxy.html.erb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -1,78 +0,0 @@
-<style type="text/css">
- #galaxy_header {
- background-color:#EEEEEE;
- color: #EEEEEE;
- position: fixed;
- width: 100%;
- top: 0px;
- left: 0px;
- font-family: Verdana, sans-serif;
- text-align: center;
- z-index: 5000;
- border-bottom: 1px solid #777777;
- }
-
- #galaxy_inner_header {
- background-color:#2C3143;
- color: #EEEEEE;
- height: 32px;
- width: 100%;
- border-bottom: 1px solid #444444;
- margin-bottom: 6px;
- }
-
- #galaxy_logo {
- font-size: 21px;
- font-weight: bold;
- float: left;
- padding: 3px 10px;
- line-height: 27px;
- position: absolute;
- }
-
- #galaxy_header a { text-decoration: none; color: #EEEEEE;}
- #galaxy_header a:hover { text-decoration: underline; color: #EEEEEE;}
-
- #galaxy_header ul {
- margin: 0;
- }
-
- #galaxy_header li {
- display: inline;
- line-height: 32px;
- font-size: 12px
- }
-
- #galaxy_header li a {
- display: inline-block;
- padding: 0 1em;
- }
-
- #galaxy_header li.selected a {
- background-color: #000000;
- }
-
- #galaxy_header li a:hover {
- text-decoration: underline;
- color: gold;
- }
-
- #doc2 {
- margin-top: 43px;
- }
-</style>
-
-<div id="galaxy_header">
- <div id="galaxy_inner_header">
- <div id="galaxy_logo">
- <a href="" session[:galaxy_url] -%>">
- <img style="width: 26px; vertical-align: top;" src=""
- Galaxy
- </a>
- </div>
- <ul>
- <li><a href="" session[:galaxy_url] -%>">Return to Galaxy</a></li>
- <li <%='class="selected"' if request.fullpath.start_with?('/galaxy') -%>><%= link_to 'Galaxy Workflows', '/galaxy' -%></li>
- </ul>
- </div>
-</div>
Modified: branches/galaxy-integration/app/views/layouts/_myexperiment.rhtml (2965 => 2966)
--- branches/galaxy-integration/app/views/layouts/_myexperiment.rhtml 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/views/layouts/_myexperiment.rhtml 2012-03-08 13:09:28 UTC (rev 2966)
@@ -21,9 +21,10 @@
</head>
<body>
+<%= render :partial => "layouts/integrations/#{session[:came_from]}" unless session[:came_from].blank? %>
+
<div id="doc2" class="yui-t4">
- <%# TODO: Rails 2: '@content_for_x' has changed to 'content_for?(:x)' in later versions of rails %>
<% if @content_for_header %>
<%= yield :header %>
<% else %>
Modified: branches/galaxy-integration/app/views/layouts/application.rhtml (2965 => 2966)
--- branches/galaxy-integration/app/views/layouts/application.rhtml 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/views/layouts/application.rhtml 2012-03-08 13:09:28 UTC (rev 2966)
@@ -1,3 +1,2 @@
<% configure_layout %>
-<%= render :partial => @layout["layout"] %>
-<%= render :partial => 'layouts/galaxy' if using_galaxy? %>
+<%= render :partial => @layout["layout"] %>
\ No newline at end of file
Copied: branches/galaxy-integration/app/views/layouts/integrations/_galaxy.html.erb (from rev 2964, branches/galaxy-integration/app/views/layouts/_galaxy.html.erb) (0 => 2966)
--- branches/galaxy-integration/app/views/layouts/integrations/_galaxy.html.erb (rev 0)
+++ branches/galaxy-integration/app/views/layouts/integrations/_galaxy.html.erb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -0,0 +1,89 @@
+<style type="text/css">
+ #galaxy_header {
+ background-color:#EEEEEE;
+ color: #EEEEEE;
+ position: fixed;
+ width: 100%;
+ top: 0px;
+ left: 0px;
+ font-family: Verdana, sans-serif;
+ text-align: center;
+ z-index: 5000;
+ border-bottom: 1px solid #777777;
+ }
+
+ #galaxy_inner_header {
+ background-color:#2C3143;
+ color: #EEEEEE;
+ height: 32px;
+ width: 100%;
+ border-bottom: 1px solid #444444;
+ margin-bottom: 6px;
+ }
+
+ #galaxy_logo {
+ font-size: 21px;
+ font-weight: bold;
+ float: left;
+ padding: 3px 10px;
+ line-height: 27px;
+ }
+
+ #remove_galaxy_frame {
+ float: right;
+ padding: 3px 10px;
+ line-height: 27px;
+ }
+
+ #galaxy_header a { text-decoration: none; color: #EEEEEE;}
+ #galaxy_header a:hover { text-decoration: underline; color: #EEEEEE;}
+
+ #galaxy_header ul {
+ margin: 0;
+ }
+
+ #galaxy_header li {
+ display: inline;
+ line-height: 32px;
+ font-size: 12px
+ }
+
+ #galaxy_header li a {
+ display: inline-block;
+ padding: 0 1em;
+ }
+
+ #galaxy_header li.selected a {
+ background-color: #000000;
+ }
+
+ #galaxy_header li a:hover {
+ text-decoration: underline;
+ color: gold;
+ }
+
+ #doc2 {
+ margin-top: 43px;
+ }
+</style>
+
+<div id="galaxy_header">
+ <div id="galaxy_inner_header">
+ <div id="galaxy_logo">
+ <a href="" session[:galaxy_url] -%>">
+ <img style="width: 26px; vertical-align: top;" src=""
+ Galaxy
+ </a>
+ </div>
+ <div id="remove_galaxy_frame">
+ <a href=""
+ <img style="vertical-align: text-bottom; margin-bottom: -1px" src=""
+ Remove Frame
+ </a>
+ </div>
+ <ul>
+ <li><a href="" session[:galaxy_url] -%>">Return to Galaxy</a></li>
+ <li <%='class="selected"' if request.fullpath.start_with?('/galaxy') -%>><%= link_to 'Galaxy Workflows', '/galaxy' -%></li>
+ </ul>
+ </div>
+</div>
Modified: branches/galaxy-integration/app/views/workflows/galaxy/_run_options.rhtml (2965 => 2966)
--- branches/galaxy-integration/app/views/workflows/galaxy/_run_options.rhtml 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/app/views/workflows/galaxy/_run_options.rhtml 2012-03-08 13:09:28 UTC (rev 2966)
@@ -1,4 +1,4 @@
-<% if using_galaxy? %>
+<% if session[:came_from] == 'galaxy' %>
<style type="text/css">
div.galaxy_import_form {
margin: 0 0.5em;
Modified: branches/galaxy-integration/config/routes.rb (2965 => 2966)
--- branches/galaxy-integration/config/routes.rb 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/config/routes.rb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -286,8 +286,13 @@
map.resources :licenses
map.resources :license_attributes
- map.connect 'galaxy', :controller => 'workflows', :action ="" 'index', :filter => 'TYPE_ID("7")'
+ # Generate special alias routes for external sites point to
+ Conf.external_site_integrations.each_value do |data|
+ map.connect data["path"], data["redirect"].symbolize_keys #Convert string keys to symbols
+ end
+ map.connect 'clear_external_site_session_info', :controller => 'application', :action ="" 'clear_external_site_session_info'
+
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end
Modified: branches/galaxy-integration/lib/conf.rb (2965 => 2966)
--- branches/galaxy-integration/lib/conf.rb 2012-03-07 10:28:15 UTC (rev 2965)
+++ branches/galaxy-integration/lib/conf.rb 2012-03-08 13:09:28 UTC (rev 2966)
@@ -182,6 +182,10 @@
layouts.delete_if {|k,v| v["environment"] && (v["environment"] != ENV["RAILS_ENV"])}
end
+ def self.external_site_integrations
+ self.fetch_entry('site_integrations',{})
+ end
+
# This method is required to create an administrator in the test fixtures
def self.admins=(value)