From 2635b72eaa5e22cc7f16a43aa292c22496f7c19c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 8 Aug 2013 00:19:39 -0400 Subject: v4: merge v5 lib (5.0.10) * output structure by, add monolingual alt for :filetype & :filename, step 1 * output structure by, monolingual alternative for :filetype or :filename without language code, if document is in default language * set a default language, 'en' or as specified * set in rc file or from command line instruction * command line e.g. sisu -hv --monolingual --by-filename sisu_markup.sst sisu -3v --monolingual --by-filetype sisu_manual.ssm * sisurc.yml lingual: 'mono' | 'multi' lingual: 'mono' * note: output by :filetype is roughly equivalent to what monolingual output by :language would be * allow command line setting of default language using language code --default-language='en' --default-lang-en if used together with --monolingual and --by-filetype or --by-filename the selected default language document will not have a language code in the output filename * output structure by, monolingual alternative, documentation * cgi helper script, sample search form, single form, monolingual option * single cgi form, (with different internal variables set for output types) --- lib/sisu/v4/cgi_sqlite.rb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v4/cgi_sqlite.rb') diff --git a/lib/sisu/v4/cgi_sqlite.rb b/lib/sisu/v4/cgi_sqlite.rb index 93129b5c..b3b67d42 100644 --- a/lib/sisu/v4/cgi_sqlite.rb +++ b/lib/sisu/v4/cgi_sqlite.rb @@ -69,8 +69,17 @@ module SiSU_CGI_SQLite @cX=SiSU_Screen::Ansi.new(opt.cmd).cX @env=SiSU_Env::InfoEnv.new('',opt) @image_src="#{@env.url.webserv_cgi(@opt)}/_sisu/image_sys" + @name_of={} + @name_of[:output_dir_structure]=if @opt.dir_structure_by.to_s =~/(?:language|filetype|filename)/ + @opt.dir_structure_by.to_s + else 'language' + end + @name_of[:lingual]=if @opt.lingual.to_s =~/(?:mono|multi)/ + @opt.lingual.to_s + else 'multi' + end @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_sqlite.cgi" + @cgi_file_name=@env.url.cgi_sample_search_form_name(@opt) @name_of_sqlite_db_file='sisu_sqlite.db' end def sqlite @@ -126,26 +135,21 @@ module SiSU_CGI_SQLite # if necessary make the directory '/usr/lib/cgi-bin' # here we copy the postgresql search form to cgi-bin # (copy #{@cgi_file_name} to your cgi directory) - # set file permissions to 755, & - # make symbolic link to #{@cgi_link_name} + # set file permissions to 755 WOK a=case @webserv when /pwd/; '' else <<-WOK sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\ - cd /usr/lib/cgi-bin && \\ - sudo chmod -v 755 #{@cgi_file_name}; \\ - sudo rm -vi #{@env.url.cgi_sample_search_form_name(@opt)}; \\ - sudo ln -sf #{@cgi_file_name} #{@env.url.cgi_sample_search_form_name(@opt)}; \\ - cd - + sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} WOK end b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)' SiSU_Screen::Ansi.new(@opt.cmd,a,b).warn a=<<-WOK - #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_link_name} + #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name} WOK SiSU_Screen::Ansi.new(@opt.cmd,a).print_blue @@ -167,6 +171,8 @@ module SiSU_CGI_SQLite @image_src='#{@image_src}' @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' @hosturl_files='#{@env.url.webserv_files_from_db(@opt)}' + @output_dir_structure_by='#{@name_of[:output_dir_structure]}' + @lingual='#{@name_of[:lingual]}' @db_name_prefix='#{Db[:name_prefix]}' @base='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin/#{@env.url.cgi_sample_search_form_name(@opt)}' #fix sqlite WOK_SQL -- cgit v1.2.3