summaryrefslogtreecommitdiff
path: root/reach_reports
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-06-16 23:52:31 +0200
committermguetlein <martin.guetlein@gmail.com>2011-06-16 23:52:31 +0200
commit654ff16ab0c63c9125785e9fe6546973cfe462a7 (patch)
tree0e13ec00ea7f10ea1328693fbc175d1f94299cc0 /reach_reports
parentb542cfbd54901ad86d60fed03c8a05f9151f7616 (diff)
add post forms
Diffstat (limited to 'reach_reports')
-rwxr-xr-xreach_reports/reach_application.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb
index d914452..aa64ea2 100755
--- a/reach_reports/reach_application.rb
+++ b/reach_reports/reach_application.rb
@@ -54,18 +54,19 @@ get '/reach_report/:type' do
"All REACH reporting types: "+url_for("/reach_report",:full)
description =
"A list of "+type+" reports."
- post_params = ""
+ post_command = nil
case type
when /(?i)QMRF/
related_links += "\n"+
"OpenTox version of QMRF editor: "+QMRF_EDITOR_URI
description += "\n"+
"To create a QMRF report use the POST method."
- post_params = [[[:model_uri]],[["Existing QMRF report, content-type application/qmrf-xml"]]]
+ post_command = OpenTox::PostCommand.new request.url,"Create QMRF report"
+ post_command.attributes << OpenTox::PostAttribute.new("model_uri")
when /(?i)QPRF/
#TODO
end
- OpenTox.text_to_html ReachReports.list_reports(type),@subjectid,related_links,description,post_params
+ OpenTox.text_to_html ReachReports.list_reports(type),@subjectid,related_links,description,post_command
else
content_type "text/uri-list"
ReachReports.list_reports(type)
@@ -78,6 +79,9 @@ post '/reach_report/:type' do
content_type "text/uri-list"
LOGGER.info "creating "+type+" report "+params.inspect
+ raise OpenTox::BadRequestError.new "model_uri missing" if type=~/(?i)QMRF/ and
+ params[:model_uri]!=nil and params[:model_uri].to_s.size==0
+
#puts "creating "+type+" report "+params.inspect
result_uri = ReachReports.create_report(type,params,@subjectid,request.env["rack.input"])