Modified: branches/packs/app/controllers/research_objects_controller.rb (3730 => 3731)
--- branches/packs/app/controllers/research_objects_controller.rb 2013-09-26 15:04:22 UTC (rev 3730)
+++ branches/packs/app/controllers/research_objects_controller.rb 2013-09-27 01:05:53 UTC (rev 3731)
@@ -40,6 +40,25 @@
redirect_to research_object_url(slug) + "/" + ResearchObject::MANIFEST_PATH, :status => 303
}
format.zip {
+ redirect_to zipped_research_object_url(slug) + "/"
+ }
+ end
+ end
+
+ def download_zip
+
+ slug = params[:id]
+ slug = slug[0..-2] if slug.ends_with?("/")
+
+ ro = ResearchObject.find_by_slug_and_version(slug, nil)
+
+ unless ro
+ render :text => "Research Object not found", :status => 404
+ return
+ end
+
+ respond_to do |format|
+ format.zip {
zip_file_name = ro.generate_zip!
send_file zip_file_name, :type => "application/zip", :disposition => 'attachment', :filename => "#{ro.slug}.zip"
}
Modified: branches/packs/config/routes.rb (3730 => 3731)
--- branches/packs/config/routes.rb 2013-09-26 15:04:22 UTC (rev 3730)
+++ branches/packs/config/routes.rb 2013-09-27 01:05:53 UTC (rev 3731)
@@ -329,6 +329,8 @@
map.research_objects "/rodl/ROs", :controller => "research_objects", :action ="" "index", :conditions => { :method => :get }
map.connect "/rodl/ROs", :controller => "research_objects", :action ="" "create", :conditions => { :method => :post }
+ map.zipped_research_object "/rodl/zippedROs/:id", :controller => "research_objects", :action ="" "download_zip", :conditions => { :method => :get }
+
map.research_object "/rodl/ROs/:id", :controller => "research_objects", :action ="" "show", :conditions => { :method => :get }
map.connect "/rodl/ROs/:research_object_id", :controller => "resources", :action ="" "post", :conditions => { :method => :post }
map.connect "/rodl/ROs/:id", :controller => "research_objects", :action ="" "update", :conditions => { :method => :put }