Modified: trunk/app/controllers/application.rb (2081 => 2082)
--- trunk/app/controllers/application.rb 2009-02-03 11:32:11 UTC (rev 2081)
+++ trunk/app/controllers/application.rb 2009-02-03 18:00:33 UTC (rev 2082)
@@ -73,7 +73,7 @@
# (i.e. request is sent not by a bot and is legitimate)
allow_logging = true
BOT_IGNORE_LIST.each do |pattern|
- if request.env['HTTP_USER_AGENT'].match(pattern)
+ if request.env['HTTP_USER_AGENT'] and request.env['HTTP_USER_AGENT'].match(pattern)
allow_logging = false
break
end
Modified: trunk/app/models/pack.rb (2081 => 2082)
--- trunk/app/models/pack.rb 2009-02-03 11:32:11 UTC (rev 2081)
+++ trunk/app/models/pack.rb 2009-02-03 18:00:33 UTC (rev 2082)
@@ -582,6 +582,10 @@
return CGI::unescapeHTML(desc)
end
+ def contributables
+ contributable_entries.map do |e| e.contributable end
+ end
+
protected
# produces html string containing the required messaged, enclosed within left-padded P tag, belonging to 'none_text' class
Modified: trunk/lib/rest.rb (2081 => 2082)
--- trunk/lib/rest.rb 2009-02-03 11:32:11 UTC (rev 2081)
+++ trunk/lib/rest.rb 2009-02-03 18:00:33 UTC (rev 2082)
@@ -28,7 +28,6 @@
TABLES["REST"][:data]["comment"].delete("DELETE")
TABLES["REST"][:data]["workflow"].delete("PUT")
TABLES["REST"][:data]["job"].delete("POST")
-TABLES["REST"][:data]["pack"].delete("GET")
def rest_routes(map)
TABLES['REST'][:data].keys.each do |uri|
@@ -320,27 +319,30 @@
def rest_resource_uri(ob)
case ob.class.to_s
- when 'Workflow'; return workflow_url(ob)
- when 'Blob'; return file_url(ob)
- when 'Network'; return group_url(ob)
- when 'User'; return user_url(ob)
- when 'Review'; return review_url(ob.reviewable, ob)
- when 'Comment'; return "#{rest_resource_uri(ob.commentable)}/comments/#{ob.id}"
- when 'Blog'; return blog_url(ob)
- when 'BlogPost'; return blog_post_url(ob.blog, ob)
- when 'Rating'; return "#{rest_resource_uri(ob.rateable)}/ratings/#{ob.id}"
- when 'Tag'; return tag_url(ob)
- when 'Picture'; return picture_url(ob.owner, ob)
- when 'Message'; return message_url(ob)
- when 'Citation'; return citation_url(ob.workflow, ob)
- when 'Announcement'; return announcement_url(ob)
- when 'Pack'; return pack_url(ob)
- when 'Experiment'; return experiment_url(ob)
- when 'TavernaEnactor'; return runner_url(ob)
- when 'Job'; return experiment_job_url(ob.experiment, ob)
+ when 'Workflow'; return workflow_url(ob)
+ when 'Blob'; return file_url(ob)
+ when 'Network'; return group_url(ob)
+ when 'User'; return user_url(ob)
+ when 'Review'; return review_url(ob.reviewable, ob)
+ when 'Comment'; return "#{rest_resource_uri(ob.commentable)}/comments/#{ob.id}"
+ when 'Blog'; return blog_url(ob)
+ when 'BlogPost'; return blog_post_url(ob.blog, ob)
+ when 'Rating'; return "#{rest_resource_uri(ob.rateable)}/ratings/#{ob.id}"
+ when 'Tag'; return tag_url(ob)
+ when 'Picture'; return picture_url(ob.owner, ob)
+ when 'Message'; return message_url(ob)
+ when 'Citation'; return citation_url(ob.workflow, ob)
+ when 'Announcement'; return announcement_url(ob)
+ when 'Pack'; return pack_url(ob)
+ when 'Experiment'; return experiment_url(ob)
+ when 'TavernaEnactor'; return runner_url(ob)
+ when 'Job'; return experiment_job_url(ob.experiment, ob)
+ when 'PackRemoteEntry'; return ob.uri
- when 'Workflow::Version'; "#{rest_resource_uri(ob.workflow)}?version=#{ob.version}"
+ when 'Workflow::Version'; return "#{rest_resource_uri(ob.workflow)}?version=#{ob.version}"
end
+
+ raise "Class not processed in rest_resource_uri: #{ob.class.to_s}"
end
def rest_access_uri(ob)
@@ -348,28 +350,31 @@
base = "#{request.protocol}#{request.host_with_port}"
case ob.class.to_s
- when 'Workflow'; return "#{base}/workflow.xml?id=#{ob.id}"
- when 'Blob'; return "#{base}/file.xml?id=#{ob.id}"
- when 'Network'; return "#{base}/group.xml?id=#{ob.id}"
- when 'User'; return "#{base}/user.xml?id=#{ob.id}"
- when 'Review'; return "#{base}/review.xml?id=#{ob.id}"
- when 'Comment'; return "#{base}/comment.xml?id=#{ob.id}"
- when 'Blog'; return "#{base}/blog.xml?id=#{ob.id}"
- when 'BlogPost'; return "#{base}/blog-post.xml?id=#{ob.id}"
- when 'Rating'; return "#{base}/rating.xml?id=#{ob.id}"
- when 'Tag'; return "#{base}/tag.xml?id=#{ob.id}"
- when 'Picture'; return "#{base}/picture.xml?id=#{ob.id}"
- when 'Message'; return "#{base}/message.xml?id=#{ob.id}"
- when 'Citation'; return "#{base}/citation.xml?id=#{ob.id}"
- when 'Announcement'; return "#{base}/announcement.xml?id=#{ob.id}"
- when 'Pack'; return "#{base}/pack.xml?id=#{ob.id}"
- when 'Experiment'; return "#{base}/experiment.xml?id=#{ob.id}"
- when 'TavernaEnactor'; return "#{base}/runner.xml?id=#{ob.id}"
- when 'Job'; return "#{base}/job.xml?id=#{ob.id}"
- when 'Download'; return "#{base}/download.xml?id=#{ob.id}"
+ when 'Workflow'; return "#{base}/workflow.xml?id=#{ob.id}"
+ when 'Blob'; return "#{base}/file.xml?id=#{ob.id}"
+ when 'Network'; return "#{base}/group.xml?id=#{ob.id}"
+ when 'User'; return "#{base}/user.xml?id=#{ob.id}"
+ when 'Review'; return "#{base}/review.xml?id=#{ob.id}"
+ when 'Comment'; return "#{base}/comment.xml?id=#{ob.id}"
+ when 'Blog'; return "#{base}/blog.xml?id=#{ob.id}"
+ when 'BlogPost'; return "#{base}/blog-post.xml?id=#{ob.id}"
+ when 'Rating'; return "#{base}/rating.xml?id=#{ob.id}"
+ when 'Tag'; return "#{base}/tag.xml?id=#{ob.id}"
+ when 'Picture'; return "#{base}/picture.xml?id=#{ob.id}"
+ when 'Message'; return "#{base}/message.xml?id=#{ob.id}"
+ when 'Citation'; return "#{base}/citation.xml?id=#{ob.id}"
+ when 'Announcement'; return "#{base}/announcement.xml?id=#{ob.id}"
+ when 'Pack'; return "#{base}/pack.xml?id=#{ob.id}"
+ when 'Experiment'; return "#{base}/experiment.xml?id=#{ob.id}"
+ when 'TavernaEnactor'; return "#{base}/runner.xml?id=#{ob.id}"
+ when 'Job'; return "#{base}/job.xml?id=#{ob.id}"
+ when 'Download'; return "#{base}/download.xml?id=#{ob.id}"
+ when 'PackRemoteEntry'; return "#{base}/external.xml?id=#{ob.id}"
when 'Workflow::Version'; return "#{base}/workflow.xml?id=#{ob.workflow.id}&version=#{ob.version}"
end
+
+ raise "Class not processed in rest_access_uri: #{ob.class.to_s}"
end
def rest_reference(ob, query)
@@ -378,18 +383,19 @@
text = ''
case ob.class.to_s
- when 'User'; tag = 'user'; text = ob.name
- when 'Workflow'; tag = 'workflow'; text = ob.title
- when 'Blob'; tag = 'file'; text = ob.title
- when 'Network'; tag = 'group'; text = ob.title
- when 'Rating'; tag = 'rating'; text = ob.rating.to_s
- when 'Creditation'; tag = 'creditation'; text = ''
- when 'Citation'; tag = 'citation'; text = ob.title
- when 'Announcement'; tag = 'announcement'; text = ob.title
- when 'Tag'; tag = 'tag'; text = ob.name
- when 'Pack'; tag = 'pack'; text = ob.title
- when 'Experiment'; tag = 'experiment'; text = ob.title
- when 'Download'; tag = 'download'; text = ''
+ when 'User'; tag = 'user'; text = ob.name
+ when 'Workflow'; tag = 'workflow'; text = ob.title
+ when 'Blob'; tag = 'file'; text = ob.title
+ when 'Network'; tag = 'group'; text = ob.title
+ when 'Rating'; tag = 'rating'; text = ob.rating.to_s
+ when 'Creditation'; tag = 'creditation'; text = ''
+ when 'Citation'; tag = 'citation'; text = ob.title
+ when 'Announcement'; tag = 'announcement'; text = ob.title
+ when 'Tag'; tag = 'tag'; text = ob.name
+ when 'Pack'; tag = 'pack'; text = ob.title
+ when 'Experiment'; tag = 'experiment'; text = ob.title
+ when 'Download'; tag = 'download'; text = ''
+ when 'PackRemoteEntry'; tag = 'external'; text = ob.title
when 'Workflow::Version'; tag = 'workflow'; text = ob.title
end