myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2627] trunk/app: fixed cases where workflows wer


From: noreply
Subject: [myexperiment-hackers] [2627] trunk/app: fixed cases where workflows were being queried instead of workflow versions
Date: Tue, 5 Jul 2011 11:26:37 -0400 (EDT)

Revision
2627
Author
dgc
Date
2011-07-05 11:26:37 -0400 (Tue, 05 Jul 2011)

Log Message

fixed cases where workflows were being queried instead of workflow versions

Modified Paths

Diff

Modified: trunk/app/controllers/workflows_controller.rb (2626 => 2627)


--- trunk/app/controllers/workflows_controller.rb	2011-07-05 09:25:09 UTC (rev 2626)
+++ trunk/app/controllers/workflows_controller.rb	2011-07-05 15:26:37 UTC (rev 2627)
@@ -117,14 +117,14 @@
       @download = Download.create(:contribution => @workflow.contribution, :user => (logged_in? ? current_user : nil), :user_agent => request.env['HTTP_USER_AGENT'], :accessed_from_site => accessed_from_website?())
     end
     
-    send_data(@viewing_version.content_blob.data, :filename => @workflow.filename(@viewing_version_number), :type => @workflow.content_type.mime_type)
+    send_data(@viewing_version.content_blob.data, :filename => @workflow.filename(@viewing_version_number), :type => @viewing_version.content_type.mime_type)
   end
   
   # GET /workflows/:id/download/:name
   def named_download
 
     # check that we got the right filename for this workflow
-    if params[:name] == @workflow.filename
+    if params[:name] == @workflow.filename(@viewing_version_number)
       download
     else
       render :nothing => true, :status => "404 Not Found"
@@ -718,7 +718,7 @@
                                 :id => @workflow.id, 
                                 :version => @viewing_version_number.to_s
         
-        @named_download_url = url_for @workflow.named_download_url + "address@hidden" 
+        @named_download_url = url_for @workflow.named_download_url(@viewing_version_number) + "address@hidden" 
                                       
         @launch_url = "/workflows/address@hidden/address@hidden"
 

Modified: trunk/app/models/workflow.rb (2626 => 2627)


--- trunk/app/models/workflow.rb	2011-07-05 09:25:09 UTC (rev 2626)
+++ trunk/app/models/workflow.rb	2011-07-05 15:26:37 UTC (rev 2627)
@@ -83,6 +83,18 @@
         XML::Node.new('components')
       end
     end
+
+    def processor_class
+      if self.content_type
+          @processor_class ||= WorkflowTypesHandler.processor_class_for_type_display_name(self.content_type.title)
+      end
+    end
+
+    def display_data_format
+      klass = self.processor_class
+      @display_data_format = (klass.nil? ? self.file_ext : klass.display_data_format)
+    end
+
   end
   
   non_versioned_columns.push("license_id", "tag_list", "preview_id")
@@ -163,7 +175,7 @@
     metadata
   end
 
-  # This method is called before save and attempts to pull out metadata if it
+  # This method is called before validation and attempts to pull out metadata if it
   # hasn't been set
 
   def apply_extracted_metadata
@@ -223,12 +235,12 @@
       return "#{unique_name}.#{file_ext}"
     else
       return nil unless (workflow_version = self.find_version(version))
-      return "#{workflow_version.unique_name}.#{file_ext}"
+      return "#{workflow_version.unique_name}.#{workflow_version.file_ext}"
     end
   end
   
-  def named_download_url
-    "#{Conf.base_uri}/workflows/#{id}/download/#{filename}"
+  def named_download_url(version = nil)
+    "#{Conf.base_uri}/workflows/#{id}/download/#{filename(version)}"
   end
 
   def get_all_search_terms

Modified: trunk/app/views/workflows/show.rhtml (2626 => 2627)


--- trunk/app/views/workflows/show.rhtml	2011-07-05 09:25:09 UTC (rev 2626)
+++ trunk/app/views/workflows/show.rhtml	2011-07-05 15:26:37 UTC (rev 2627)
@@ -148,7 +148,7 @@
 			
 			<p>
 				<b>Type:</b>
-				<%= link_to(h(@workflow.content_type.title), content_type_path(@workflow.content_type)) %>
+				<%= link_to(h(@viewing_version.content_type.title), content_type_path(@viewing_version.content_type)) %>
 			</p>
 			
 			<br/>
@@ -222,7 +222,7 @@
           <br />
 
           <ul class="sectionIcons">
-            <li style="margin-left: 0;"><%= icon('workflow', @named_download_url, "Download Workflow file/package (for version address@hidden)", nil, "Download Workflow File/Package (address@hidden)") -%></li>
+            <li style="margin-left: 0;"><%= icon('workflow', @named_download_url, "Download Workflow file/package (for version address@hidden)", nil, "Download Workflow File/Package (address@hidden)") -%></li>
           </ul>
           <% if session[:callback] &&
                 session[:callback][:types].include?(@workflow.content_type_id) -%>
@@ -231,7 +231,7 @@
               <li style="margin-left: 0;"><%= icon('workflow', callback_url(@workflow).to_s, "#{session[:callback][:label]} Workflow file/package (for version address@hidden)", {:rel => 'nofollow'}, "#{session[:callback][:label]} Workflow #{session[:callback][:additional]}") -%></li>
             </ul>
           <% end %>
-          <% if @workflow.content_type.title == "Taverna 2" %>
+          <% if @viewing_version.content_type.title == "Taverna 2" %>
             <br />
 
             <ul class="sectionIcons">
@@ -297,7 +297,7 @@
 <div class="contribution_right_box">
 	<div class="contribution_section_box" style= "font-size: 100%; padding: 0.7em 0.9em; font-weight: bold;">
 		<p><%= info_icon_with_tooltip("The type of workflow system that this Workflow is designed for.") %> Workflow Type</p>
-    <p><%= link_to(h(@workflow.content_type.title), content_type_path(@workflow.content_type)) %></p>
+    <p><%= link_to(h(@viewing_version.content_type.title), content_type_path(@viewing_version.content_type)) %></p>
 	</div>
 	
 	<%= render :partial => "contributions/uploader_box", :locals => { :contributable => @workflow } %>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]