diff options
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 3 | ||||
| -rw-r--r-- | lib/sisu/v3/cgi.rb | 1 | ||||
| -rw-r--r-- | lib/sisu/v3/cgi_pgsql.rb | 6 | ||||
| -rw-r--r-- | lib/sisu/v3/cgi_sql_common.rb | 74 | ||||
| -rw-r--r-- | lib/sisu/v3/cgi_sqlite.rb | 6 | 
5 files changed, 49 insertions, 41 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index a48a8cc3..20eafaab 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -42,6 +42,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.9.orig.tar.gz    * dal_expand_insertions, fix resulting urls for shortcut for sisu generated      document in same output directory +  * cgi sample search form generated to provide different links depending on +    output structure, now links only to manifest and html toc +    * manifest, url path, fix  %% 3.0.8.orig.tar.gz (2011-05-05:18/4) diff --git a/lib/sisu/v3/cgi.rb b/lib/sisu/v3/cgi.rb index 357a4332..f1d628d2 100644 --- a/lib/sisu/v3/cgi.rb +++ b/lib/sisu/v3/cgi.rb @@ -60,7 +60,6 @@  module  SiSU_CGI                                                                 #% database building documents    require_relative 'sysenv'                             # sysenv.rb    require_relative 'cgi_pgsql'                          # cgi_pgsql.rb -    include SiSU_CGI_pgsql    require_relative 'cgi_sqlite'                         # cgi_sqlite.rb    class SiSU_search      def initialize(opt) diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index fc802f03..4afda106 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -66,9 +66,9 @@ module  SiSU_CGI_pgsql        @env=SiSU_Env::Info_env.new('',opt)        @sys=SiSU_Env::System_call.new        @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" -      @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env) +      @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt,@image_src,@env)        @db=SiSU_Env::Info_db.new -      @cgi_file_name="#{Db[:name_prefix_db]}pgsql.cgi" +      @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_pgsql.cgi"      end      def pgsql        serve=[] @@ -95,7 +95,7 @@ module  SiSU_CGI_pgsql        f2 << "          end\n"        if FileTest.writable?('.')          output=File.open(@cgi_file_name,'w') -        output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 +        output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3          a=%{        generated sisu_pgsql.cgi,              BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D)          } diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 1174be6e..0f56f77f 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -58,8 +58,9 @@  =end  module SiSU_CGI_sql    class SiSU_CGI_common -    def initialize(webserv,cmd,image_src,dir) -      @webserv,@cmd,@image_src,@env=webserv,cmd,image_src,dir +    def initialize(webserv,opt,image_src,dir) +      @webserv,@opt,@image_src,@env=webserv,opt,image_src,dir +      @cmd=opt.cmd      end      def about        <<-'WOK_SQL' @@ -829,45 +830,50 @@ module SiSU_CGI_sql            end            @hostpath="#{@hosturl_files}/#{@stub}"            @ln='en' -          def output_dir_structure -            def by_language_code? -              true -            end -            def by_filetype? -              false -            end -            def by_filename? -              false -            end -            self +      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}.manifest.html"            end +          def path_html_seg(fn,ln=nil) +            "#{@hostpath}/#{ln}/html/#{fn}" +          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) -            if output_dir_structure.by_language_code? -              manifest_at="#{@hostpath}/#{ln}/manifest/#{fn}.manifest.html" -            elsif output_dir_structure.by_filetype? -              manifest_at="#{@hostpath}/manifest/#{fn}.manifest.html" -            elsif output_dir_structure.by_filename? -              manifest_at="#{@hostpath}/#{fn}/manifest.html" -            end +            "#{@hostpath}/manifest/#{fn}.manifest.html"            end            def path_html_seg(fn,ln=nil) -            if output_dir_structure.by_language_code? -              html_at="#{@hostpath}/#{ln}/html/#{fn}" -            elsif output_dir_structure.by_filetype? -              html_at="#{@hostpath}/html/#{fn}" -            elsif output_dir_structure.by_filename? -              html_at="#{@hostpath}/#{fn}" -            end +            "#{@hostpath}/html/#{fn}"            end            def path_html_doc(fn,ln=nil) -            if output_dir_structure.by_language_code? -              html_at="#{@hostpath}/#{ln}/html/#{fn}.html" -            elsif output_dir_structure.by_filetype? -              html_at="#{@hostpath}/html/#{fn}.html" -            elsif output_dir_structure.by_filename? -              html_at="#{@hostpath}/#{fn}/doc.html" -            end +            "#{@hostpath}/html/#{fn}.html" +          end +        WOK_SQL +      else +        <<-'WOK_SQL' +          def path_manifest(fn,ln=nil) +            "#{@hostpath}/#{fn}/manifest.html" +          end +          def path_html_seg(fn,ln=nil) +            "#{@hostpath}/#{fn}"            end +          def path_html_doc(fn,ln=nil) +            "#{@hostpath}/#{fn}/doc.html" +          end +        WOK_SQL +      end +    end +    def main3 +      <<-'WOK_SQL'                      #% text_objects_body            s_contents.each do |c|                                               #% text body              location=c['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1] diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index 4a5838ab..92178b4e 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -65,8 +65,8 @@ module  SiSU_CGI_sqlite        @opt,@webserv=opt,webserv        @env=SiSU_Env::Info_env.new('',opt)        @image_src="#{@env.url.webserv_cgi}/_sisu/image_sys" -      @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env) -      @cgi_file_name="#{Db[:name_prefix_db]}sqlite.cgi" +      @common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt,@image_src,@env) +      @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_sqlite.cgi"      end      def sqlite        serve=[] @@ -97,7 +97,7 @@ module  SiSU_CGI_sqlite        f3 << %{           else  '#{@env.path.webserv}/#{serve[0]}/sisu_sqlite.db'\n          end\n}        if FileTest.writable?('.')          output=File.open(@cgi_file_name,'w') -        output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 +        output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3          a=%{        generated sisu_sqlite.cgi,              BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d)          } | 
