From 9e8a84f55ed79c58b3309e7fef4ec7242fb4c5e2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:38:47 -0400 Subject: v5: cgi helper script, sample search form, single form, monolingual option * single cgi form, (with different internal variables set for output types) * monolingual output search form option --- lib/sisu/v5/cgi_sql_common.rb | 113 ++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 54 deletions(-) (limited to 'lib/sisu/v5/cgi_sql_common.rb') diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index b551d6c8..0944ab61 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -845,72 +845,77 @@ module SiSU_CGI_SQL @hostpath="#{@hosturl_files}/#{@stub}" WOK_SQL end - def dir_structure - case @opt.dir_structure_by - when :language - <<-'WOK_SQL' - def path_manifest(fn,ln=nil) - "#{@hostpath}/#{ln}/manifest/#{fn}.html" - end - def path_html_seg(fn,ln=nil) - "#{@hostpath}/#{ln}/html/#{fn}" - end - def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.html" - end - def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.html" - end - def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.html" - end - def path_html_doc(fn,ln=nil) - "#{@hostpath}/#{ln}/html/#{fn}.html" - end - WOK_SQL - when :filetype - <<-'WOK_SQL' - def path_manifest(fn,ln=nil) - "#{@hostpath}/manifest/#{fn}.#{ln}.html" - end - def path_html_seg(fn,ln=nil) - "#{@hostpath}/html/#{fn}" - end - def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.#{ln}.html" - end - def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" - end - def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" - end - def path_html_doc(fn,ln=nil) - "#{@hostpath}/html/#{fn}.#{ln}.html" - end - WOK_SQL - else - <<-'WOK_SQL' + def dir_structure #@opt.dir_structure_by + <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" + case @output_dir_structure_by + when 'filename' + @lingual =='mono' \ + ? "#{@hostpath}/#{fn}/sisu_manifest.html" + : "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" + when 'filetype' + @lingual =='mono' \ + ? "#{@hostpath}/manifest/#{fn}.html" + : "#{@hostpath}/manifest/#{fn}.#{ln}.html" + else + "#{@hostpath}/#{ln}/manifest/#{fn}.html" + end end def path_html_seg(fn,ln=nil) - "#{@hostpath}/#{fn}" + case @output_dir_structure_by + when 'filename' + "#{@hostpath}/#{fn}" + when 'filetype' + "#{@hostpath}/html/#{fn}" + else + "#{@hostpath}/#{ln}/html/#{fn}" + end end def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/toc.html" + : "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/toc.html" + end end def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/#{seg}.html" + : "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/#{seg}.html" + end end def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/endnotes.html" + : "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/endnotes.html" + end end def path_html_doc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" + case @output_dir_structure_by + when 'filename' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/scroll.html" + : "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" + when 'filetype' + @lingual =='mono' \ + ? "#{@hostpath}/html/#{fn}.html" + : "#{@hostpath}/html/#{fn}.#{ln}.html" + else + "#{@hostpath}/#{ln}/html/#{fn}.html" + end end - WOK_SQL - end + WOK_SQL end def main3 <<-'WOK_SQL' -- cgit v1.2.3