From 566786bdd7e253880b7fe6c00cb40fbc46f771a2 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Wed, 11 Aug 2010 10:58:59 +0200 Subject: move to wrapper 1.6.2, remove report-dir-check, initial commit of reach reporting stuff --- reach_reports/reach_application.rb | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 reach_reports/reach_application.rb (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb new file mode 100644 index 0000000..96b6b37 --- /dev/null +++ b/reach_reports/reach_application.rb @@ -0,0 +1,69 @@ + +[ 'rubygems', 'sinatra', 'sinatra/url_for', 'active_record', 'ar-extensions', 'opentox-ruby-api-wrapper' ].each do |lib| + require lib +end + +require 'reach_reports/reach_properties.rb' +require 'reach_reports/reach_persistance.rb' +require 'reach_reports/reach_service.rb' +require 'reach_reports/reach_to_xml.rb' + + +require "lib/format_util.rb" + +def extract_type(params) + halt 400, "illegal type, neither QMRF nor QPRF: "+params[:type] unless params[:type] && params[:type] =~ /(?i)Q(M|P)RF/ + params.delete("type") +end + +get '/reach_report/:type' do + content_type "text/uri-list" + type = extract_type(params) + LOGGER.info "list all "+type+" reports" + ReachReports.list_reports(type) +end + +post '/reach_report/:type' do + content_type "text/uri-list" + type = extract_type(params) + LOGGER.info "creating "+type+" report "+params.inspect + ReachReports.create_report(type,params) +end + +get '/reach_report/:type/:id' do + + type = extract_type(params) + LOGGER.info "get "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + rep = ReachReports.get_report(type, params[:id]) + + case request.env['HTTP_ACCEPT'].to_s + when "application/rdf+xml" + owl = OpenTox::Owl.create(rep.type+"Report",rep.report_uri) + owl.set_data( rep.get_content.keys_to_rdf_format ) + result = owl.rdf + when "application/qmrf-xml" + content_type "application/qmrf-xml" + result = ReachReports.reach_report_to_xml(rep) + when /application\/x-yaml|\*\/\*|^$/ # matches 'application/x-yaml', '*/*', '' + content_type "application/x-yaml" + result = rep.get_content.to_yaml + else + halt 400, "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\", \"application/x-yaml\", \"application/qmrf-xml\"." + end + result +end + +get '/reach_report/:type/:id/:section' do + + type = extract_type(params) + LOGGER.info "get "+type+" report section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + ReachReports.get_report(type, params[:id], params[:section]).to_yaml +end + +get '/reach_report/:type/:id/:section/:subsection' do + + type = extract_type(params) + LOGGER.info "get "+type+" report subsection '"+params[:subsection].to_s+"', section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + ReachReports.get_report(type, params[:id], params[:section], params[:subsection]).to_yaml +end + -- cgit v1.2.3 From 0f5cc11dcecf6eda0a7230d69aa346cfb86c6a49 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Wed, 18 Aug 2010 17:53:46 +0200 Subject: first version reach reporting --- reach_reports/reach_application.rb | 48 ++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 96b6b37..596bae2 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -1,13 +1,10 @@ -[ 'rubygems', 'sinatra', 'sinatra/url_for', 'active_record', 'ar-extensions', 'opentox-ruby-api-wrapper' ].each do |lib| +[ 'rubygems', 'sinatra', 'sinatra/url_for', 'opentox-ruby-api-wrapper' ].each do |lib| require lib end -require 'reach_reports/reach_properties.rb' require 'reach_reports/reach_persistance.rb' require 'reach_reports/reach_service.rb' -require 'reach_reports/reach_to_xml.rb' - require "lib/format_util.rb" @@ -27,7 +24,7 @@ post '/reach_report/:type' do content_type "text/uri-list" type = extract_type(params) LOGGER.info "creating "+type+" report "+params.inspect - ReachReports.create_report(type,params) + ReachReports.create_report(type,params,request.env["rack.input"]) end get '/reach_report/:type/:id' do @@ -38,32 +35,49 @@ get '/reach_report/:type/:id' do case request.env['HTTP_ACCEPT'].to_s when "application/rdf+xml" - owl = OpenTox::Owl.create(rep.type+"Report",rep.report_uri) + halt 400, "application/rdf+xml not yet supported" + owl = OpenTox::Owl.create(type+"Report",rep.report_uri) owl.set_data( rep.get_content.keys_to_rdf_format ) result = owl.rdf when "application/qmrf-xml" content_type "application/qmrf-xml" - result = ReachReports.reach_report_to_xml(rep) + result = rep.to_xml + #f = File.new("/home/martin/info_home/.public_html/qmrf.out.xml","w") + #f.puts result when /application\/x-yaml|\*\/\*|^$/ # matches 'application/x-yaml', '*/*', '' content_type "application/x-yaml" - result = rep.get_content.to_yaml + result = rep.to_yaml else halt 400, "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\", \"application/x-yaml\", \"application/qmrf-xml\"." end + result end -get '/reach_report/:type/:id/:section' do +post '/reach_report/:type/:id' do type = extract_type(params) - LOGGER.info "get "+type+" report section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" - ReachReports.get_report(type, params[:id], params[:section]).to_yaml -end + LOGGER.info "set "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + rep = ReachReports.get_report(type, params[:id]) -get '/reach_report/:type/:id/:section/:subsection' do - - type = extract_type(params) - LOGGER.info "get "+type+" report subsection '"+params[:subsection].to_s+"', section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" - ReachReports.get_report(type, params[:id], params[:section], params[:subsection]).to_yaml + input = request.env["rack.input"].read + halt 400, "no xml data specified" unless input && input.to_s.size>0 + ReachReports::QmrfReport.from_xml(rep,input) + #f = File.new("/home/martin/info_home/.public_html/qmrf.out.xml","w") + #f.puts rep.to_xml end +#get '/reach_report/:type/:id/:section' do +# +# type = extract_type(params) +# LOGGER.info "get "+type+" report section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" +# ReachReports.get_report(type, params[:id], params[:section]).to_yaml +#end +# +#get '/reach_report/:type/:id/:section/:subsection' do +# +# type = extract_type(params) +# LOGGER.info "get "+type+" report subsection '"+params[:subsection].to_s+"', section '"+params[:section].to_s+"', with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" +# ReachReports.get_report(type, params[:id], params[:section], params[:subsection]).to_yaml +#end + -- cgit v1.2.3 From f4c065998f6c918e67058b05ac17778cfbc57f58 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 19 Aug 2010 11:26:00 +0200 Subject: task title and creator, reach report minor fixes --- reach_reports/reach_application.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 596bae2..807800c 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -13,6 +13,11 @@ def extract_type(params) params.delete("type") end +get '/reach_report' do + content_type "text/uri-list" + url_for('/reach_report/QMRF', :full)+"\n"+url_for('/reach_report/QPRF', :full)+"\n" +end + get '/reach_report/:type' do content_type "text/uri-list" type = extract_type(params) @@ -57,12 +62,14 @@ end post '/reach_report/:type/:id' do type = extract_type(params) - LOGGER.info "set "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + LOGGER.info "Post to "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" rep = ReachReports.get_report(type, params[:id]) input = request.env["rack.input"].read - halt 400, "no xml data specified" unless input && input.to_s.size>0 + halt 400, "no xml data specified" unless input && input.to_s.size>0 + ReachReports::QmrfReport.from_xml(rep,input) + #f = File.new("/home/martin/info_home/.public_html/qmrf.out.xml","w") #f.puts rep.to_xml end -- cgit v1.2.3 From a53f82b606537154a0b77749cf779d9b27c5271f Mon Sep 17 00:00:00 2001 From: mguetlein Date: Tue, 7 Sep 2010 10:43:55 +0200 Subject: log posted report size --- reach_reports/reach_application.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 807800c..74a1006 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -67,6 +67,7 @@ post '/reach_report/:type/:id' do input = request.env["rack.input"].read halt 400, "no xml data specified" unless input && input.to_s.size>0 + LOGGER.debug "size of posted data: "+input.to_s.size.to_s ReachReports::QmrfReport.from_xml(rep,input) -- cgit v1.2.3 From 543490dc2bc883412ed25d03a33d94b52786873d Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 10 Sep 2010 10:39:44 +0200 Subject: params for task and qmrf jnlp --- reach_reports/reach_application.rb | 91 +++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 74a1006..87bfcbe 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -35,7 +35,7 @@ end get '/reach_report/:type/:id' do type = extract_type(params) - LOGGER.info "get "+type+" report with id "+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" + LOGGER.info "get "+type+" report with id '"+params[:id].to_s+"' "+request.env['HTTP_ACCEPT'].to_s+"'" rep = ReachReports.get_report(type, params[:id]) case request.env['HTTP_ACCEPT'].to_s @@ -75,6 +75,8 @@ post '/reach_report/:type/:id' do #f.puts rep.to_xml end + + #get '/reach_report/:type/:id/:section' do # # type = extract_type(params) @@ -89,3 +91,90 @@ end # ReachReports.get_report(type, params[:id], params[:section], params[:subsection]).to_yaml #end +get '/reach_report/:type/:id/editor' do + + type = extract_type(params) + LOGGER.info "editor for "+type+" report with id '"+params[:id].to_s+"' "+params.inspect + + jnlp = < + + +QMRF Editor +www.opentox.org +(Q)SAR Model Reporting Format Editor +(Q)SAR Model Reporting Format Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-x http://opentox.informatik.uni-freiburg.de/validation/reach_report/QMRF/ +EOF + jnlp += params[:id].to_s + + jnlp += < +-d http://opentox.informatik.uni-freiburg.de/qmrfedit2/qmrf.dtd +-t http://opentox.informatik.uni-freiburg.de/qmrfedit2/verdana.ttf + + + + + + +EOF + + content_type "application/x-java-jnlp-file" + jnlp +end + -- cgit v1.2.3 From e0872937009571570d2292ce94f0760fd17c9aff Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 10 Sep 2010 10:44:53 +0200 Subject: fix on qmrf editor --- reach_reports/reach_application.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 87bfcbe..74d35d7 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -160,6 +160,7 @@ get '/reach_report/:type/:id/editor' do -x http://opentox.informatik.uni-freiburg.de/validation/reach_report/QMRF/ EOF + jnlp.chomp! jnlp += params[:id].to_s jnlp += < Date: Fri, 10 Sep 2010 11:58:54 +0200 Subject: create qmrf report as task --- reach_reports/reach_application.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 74d35d7..8890ece 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -26,10 +26,16 @@ get '/reach_report/:type' do end post '/reach_report/:type' do - content_type "text/uri-list" + type = extract_type(params) - LOGGER.info "creating "+type+" report "+params.inspect - ReachReports.create_report(type,params,request.env["rack.input"]) + content_type "text/uri-list" + task_uri = OpenTox::Task.as_task( "Create "+type+" report", url_for("/reach_report/"+type, :full), params ) do + + LOGGER.info "creating "+type+" report "+params.inspect + ReachReports.create_report(type,params,request.env["rack.input"]) + end + halt 202,task_uri + end get '/reach_report/:type/:id' do -- cgit v1.2.3 From f7464e766afebd71397c0f7ad9252f77e13f6c3a Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 13 Sep 2010 08:31:12 +0200 Subject: added missing jar for jnlp --- reach_reports/reach_application.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 8890ece..6d60d21 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -141,6 +141,7 @@ get '/reach_report/:type/:id/editor' do + -- cgit v1.2.3 From 0acc756e0f2db27abeacf9e229a910df315d279d Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 13 Sep 2010 10:59:36 +0200 Subject: remove task when creatign report from xml --- reach_reports/reach_application.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 6d60d21..4afaf51 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -29,13 +29,15 @@ post '/reach_report/:type' do type = extract_type(params) content_type "text/uri-list" - task_uri = OpenTox::Task.as_task( "Create "+type+" report", url_for("/reach_report/"+type, :full), params ) do - LOGGER.info "creating "+type+" report "+params.inspect - ReachReports.create_report(type,params,request.env["rack.input"]) - end - halt 202,task_uri + LOGGER.info "creating "+type+" report "+params.inspect + result_uri = ReachReports.create_report(type,params,request.env["rack.input"]) + if OpenTox::Utils.task_uri?(result_uri) + halt 202,result_uri + else + result_uri + end end get '/reach_report/:type/:id' do -- cgit v1.2.3 From f72a88dcb8fd18778445b4e6678cdfdee7feda28 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Wed, 6 Oct 2010 12:09:08 +0200 Subject: add text/html support, remove delete disabling, add new line to uri-list returns --- reach_reports/reach_application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 4afaf51..e63c2a4 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -34,9 +34,9 @@ post '/reach_report/:type' do result_uri = ReachReports.create_report(type,params,request.env["rack.input"]) if OpenTox::Utils.task_uri?(result_uri) - halt 202,result_uri + halt 202,result_uri+"\n" else - result_uri + result_uri+"\n" end end -- cgit v1.2.3 From 16a25a63ba7882901a778745d0a32baaafc22cad Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 26 Nov 2010 16:05:25 +0100 Subject: huge commit, main changes: validation_type and .finished introduced, supporting subtasks, reporting slightly refactored --- reach_reports/reach_application.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index e63c2a4..bbe4092 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -31,6 +31,7 @@ post '/reach_report/:type' do content_type "text/uri-list" LOGGER.info "creating "+type+" report "+params.inspect + #puts "creating "+type+" report "+params.inspect result_uri = ReachReports.create_report(type,params,request.env["rack.input"]) if OpenTox::Utils.task_uri?(result_uri) -- cgit v1.2.3 From 3d8db6648a7831d41aad27d1509f29f87a30723e Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 29 Nov 2010 12:44:19 +0100 Subject: add qmrf to examples, add text/html support for qmrf --- reach_reports/reach_application.rb | 57 ++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 9 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index bbe4092..d82bc11 100644 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -3,6 +3,8 @@ require lib end +QMRF_EDITOR_URI = "http://ortona.informatik.uni-freiburg.de/qmrfedit2/OT_QMRFEditor.jnlp" + require 'reach_reports/reach_persistance.rb' require 'reach_reports/reach_service.rb' @@ -14,15 +16,46 @@ def extract_type(params) end get '/reach_report' do - content_type "text/uri-list" - url_for('/reach_report/QMRF', :full)+"\n"+url_for('/reach_report/QPRF', :full)+"\n" + uri_list = url_for('/reach_report/QMRF', :full)+"\n"+url_for('/reach_report/QPRF', :full)+"\n" + if request.env['HTTP_ACCEPT'] =~ /text\/html/ + content_type "text/html" + related_links = + "All validations: "+$sinatra.url_for("/",:full)+"\n"+ + "Validation reporting: "+$sinatra.url_for("/report",:full) + description = + "A list of all suported REACH reporting types." + OpenTox.text_to_html uri_list,related_links,description + else + content_type "text/uri-list" + uri_list + end end get '/reach_report/:type' do - content_type "text/uri-list" type = extract_type(params) LOGGER.info "list all "+type+" reports" - ReachReports.list_reports(type) + if request.env['HTTP_ACCEPT'] =~ /text\/html/ + content_type "text/html" + related_links = + "All REACH reporting types: "+$sinatra.url_for("/reach_report",:full) + description = + "A list of "+type+" reports." + post_params = "" + 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"]]] + when /(?i)QPRF/ + #TODO + end + OpenTox.text_to_html ReachReports.list_reports(type),related_links,description,post_params + else + content_type "text/uri-list" + ReachReports.list_reports(type) + end end post '/reach_report/:type' do @@ -52,20 +85,26 @@ get '/reach_report/:type/:id' do halt 400, "application/rdf+xml not yet supported" owl = OpenTox::Owl.create(type+"Report",rep.report_uri) owl.set_data( rep.get_content.keys_to_rdf_format ) - result = owl.rdf + owl.rdf when "application/qmrf-xml" content_type "application/qmrf-xml" - result = rep.to_xml + rep.to_xml #f = File.new("/home/martin/info_home/.public_html/qmrf.out.xml","w") #f.puts result + when /text\/html/ + content_type "text/html" + related_links = + "Open report in QMRF editor: "+rep.report_uri+"/editor"+"\n"+ + "All "+type+" reports: "+$sinatra.url_for("/reach_report/"+type,:full) + description = + "A QMRF report." + OpenTox.text_to_html rep.to_yaml,related_links,description when /application\/x-yaml|\*\/\*|^$/ # matches 'application/x-yaml', '*/*', '' content_type "application/x-yaml" - result = rep.to_yaml + rep.to_yaml else halt 400, "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\", \"application/x-yaml\", \"application/qmrf-xml\"." end - - result end post '/reach_report/:type/:id' do -- cgit v1.2.3 From eeb0b6df2dbdae29ccf3f4ccd923002e0ed65506 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 13 Jan 2011 15:18:45 +0100 Subject: adjust to new wrapper, replace activerecord with datamapper (remove activerecord code), is_classification to feature_type --- reach_reports/reach_application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 reach_reports/reach_application.rb (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb old mode 100644 new mode 100755 index d82bc11..4187c1b --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -1,5 +1,5 @@ -[ 'rubygems', 'sinatra', 'sinatra/url_for', 'opentox-ruby-api-wrapper' ].each do |lib| +[ 'rubygems', 'sinatra', 'sinatra/url_for', 'opentox-ruby' ].each do |lib| require lib end @@ -67,7 +67,7 @@ post '/reach_report/:type' do #puts "creating "+type+" report "+params.inspect result_uri = ReachReports.create_report(type,params,request.env["rack.input"]) - if OpenTox::Utils.task_uri?(result_uri) + if result_uri and result_uri.task_uri? halt 202,result_uri+"\n" else result_uri+"\n" -- cgit v1.2.3 From 7b06ce45180a5b2c0dd0095cd1a60ec974b46aa5 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Wed, 19 Jan 2011 16:12:21 +0100 Subject: aa suport, rdf support --- reach_reports/reach_application.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 4187c1b..fd77078 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -20,8 +20,8 @@ get '/reach_report' do if request.env['HTTP_ACCEPT'] =~ /text\/html/ content_type "text/html" related_links = - "All validations: "+$sinatra.url_for("/",:full)+"\n"+ - "Validation reporting: "+$sinatra.url_for("/report",:full) + "All validations: "+url_for("/",:full)+"\n"+ + "Validation reporting: "+url_for("/report",:full) description = "A list of all suported REACH reporting types." OpenTox.text_to_html uri_list,related_links,description @@ -37,7 +37,7 @@ get '/reach_report/:type' do if request.env['HTTP_ACCEPT'] =~ /text\/html/ content_type "text/html" related_links = - "All REACH reporting types: "+$sinatra.url_for("/reach_report",:full) + "All REACH reporting types: "+url_for("/reach_report",:full) description = "A list of "+type+" reports." post_params = "" @@ -95,7 +95,7 @@ get '/reach_report/:type/:id' do content_type "text/html" related_links = "Open report in QMRF editor: "+rep.report_uri+"/editor"+"\n"+ - "All "+type+" reports: "+$sinatra.url_for("/reach_report/"+type,:full) + "All "+type+" reports: "+url_for("/reach_report/"+type,:full) description = "A QMRF report." OpenTox.text_to_html rep.to_yaml,related_links,description -- cgit v1.2.3 From d99823f61fc3b2f463bc1a51db0a952c965c2141 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 7 Feb 2011 15:38:33 +0100 Subject: add a&a to qmrf reports --- reach_reports/reach_application.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index fd77078..969ce8b 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -65,7 +65,7 @@ post '/reach_report/:type' do LOGGER.info "creating "+type+" report "+params.inspect #puts "creating "+type+" report "+params.inspect - result_uri = ReachReports.create_report(type,params,request.env["rack.input"]) + result_uri = ReachReports.create_report(type,params,@subjectid,request.env["rack.input"]) if result_uri and result_uri.task_uri? halt 202,result_uri+"\n" @@ -123,6 +123,11 @@ post '/reach_report/:type/:id' do #f.puts rep.to_xml end +delete '/reach_report/:type/:id' do + type = extract_type(params) + LOGGER.info "delete "+type+" report with id '"+params[:id].to_s+"'" + ReachReports.delete_report(type, params[:id], @subjectid) +end #get '/reach_report/:type/:id/:section' do -- cgit v1.2.3 From 808db6ef7d84fcaeaee3933d0f3317ee916d1a6a Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 18 Feb 2011 12:00:01 +0100 Subject: add subject id to qmrf-jnlp --- reach_reports/reach_application.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 969ce8b..f11b2f8 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -219,6 +219,13 @@ EOF jnlp += < +-s +EOF + jnlp.chomp! + jnlp += @subjectid + + jnlp += < -d http://opentox.informatik.uni-freiburg.de/qmrfedit2/qmrf.dtd -t http://opentox.informatik.uni-freiburg.de/qmrfedit2/verdana.ttf -- cgit v1.2.3 From eaca95b2a3cdb807743e6f7248ac5e933d0820b6 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 18 Feb 2011 12:15:16 +0100 Subject: use --subjectid instead of .s --- reach_reports/reach_application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index f11b2f8..f650d6a 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -219,7 +219,7 @@ EOF jnlp += < --s +--subjectid= EOF jnlp.chomp! jnlp += @subjectid -- cgit v1.2.3 From 299552130b7deb821f7de544f153a9ebf00929db Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 18 Feb 2011 13:55:58 +0100 Subject: fix report uri in jnlp --- reach_reports/reach_application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index f650d6a..293a5ac 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -212,10 +212,10 @@ get '/reach_report/:type/:id/editor' do --x http://opentox.informatik.uni-freiburg.de/validation/reach_report/QMRF/ +-x EOF jnlp.chomp! - jnlp += params[:id].to_s + jnlp += File.join(url_for("/reach_report/QMRF",:full),params[:id]) jnlp += < -- cgit v1.2.3 From e77fd138b4de5e467ded21ef075828e2b04e7928 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Sat, 19 Feb 2011 11:28:29 +0100 Subject: add subject-id to to-html, minor changes --- reach_reports/reach_application.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index 293a5ac..fc670fd 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -24,7 +24,7 @@ get '/reach_report' do "Validation reporting: "+url_for("/report",:full) description = "A list of all suported REACH reporting types." - OpenTox.text_to_html uri_list,related_links,description + OpenTox.text_to_html uri_list,related_links,description, @subjectid else content_type "text/uri-list" uri_list @@ -51,7 +51,7 @@ get '/reach_report/:type' do when /(?i)QPRF/ #TODO end - OpenTox.text_to_html ReachReports.list_reports(type),related_links,description,post_params + OpenTox.text_to_html ReachReports.list_reports(type),@subjectid,related_links,description,post_params else content_type "text/uri-list" ReachReports.list_reports(type) @@ -98,7 +98,7 @@ get '/reach_report/:type/:id' do "All "+type+" reports: "+url_for("/reach_report/"+type,:full) description = "A QMRF report." - OpenTox.text_to_html rep.to_yaml,related_links,description + OpenTox.text_to_html rep.to_yaml,@subjectid,related_links,description when /application\/x-yaml|\*\/\*|^$/ # matches 'application/x-yaml', '*/*', '' content_type "application/x-yaml" rep.to_yaml -- cgit v1.2.3 From 84b787bf6d99f6b8cce56df2bc45a8b93ada4d64 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Tue, 22 Feb 2011 15:40:59 +0100 Subject: fix for building reports with no @subjectid --- reach_reports/reach_application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'reach_reports/reach_application.rb') diff --git a/reach_reports/reach_application.rb b/reach_reports/reach_application.rb index fc670fd..cd0695c 100755 --- a/reach_reports/reach_application.rb +++ b/reach_reports/reach_application.rb @@ -222,7 +222,7 @@ EOF --subjectid= EOF jnlp.chomp! - jnlp += @subjectid + jnlp += @subjectid.to_s jnlp += < -- cgit v1.2.3