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_pgsql.rb | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'lib/sisu/v5/cgi_pgsql.rb') diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index bdb457f3..d44e8993 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -73,11 +73,14 @@ module SiSU_CGI_PgSQL get_init=SiSU_Env::GetInit.new @rc=get_init.sisu_yaml.rc @name_of={} - @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ - and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ - @rc['output_dir_structure_by'] + @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 if defined? @rc['search'] \ and defined? @rc['search']['sisu'] \ and defined? @rc['search']['sisu']['action'] \ @@ -93,8 +96,7 @@ module SiSU_CGI_PgSQL @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:cgi_script]=@env.url.cgi_sample_search_form_name(@opt) @name_of[:user]=@db.psql.user(@opt) - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" - @cgi_link_name=@name_of[:cgi_script] #sisu_pgsql.cgi, + @cgi_file_name=@name_of[:cgi_script] @image_src="#{@env.url.webserv_base_cgi(@opt)}/_sisu/image_sys" @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) end @@ -161,24 +163,19 @@ module SiSU_CGI_PgSQL # 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 #{@cgi_link_name}; \\ - sudo ln -s #{@cgi_file_name} #{@cgi_link_name}; \\ - cd - + sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} WOK end SiSU_Screen::Ansi.new(@opt.cmd,a).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 a="\n\t(to create and populate postgresql database see 'man sisu' and in particular the --pg option)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tusing postgresql tools directly: 'createdb #{@db.psql.db}' for a list of existing databases try 'psql --list']" @@ -202,6 +199,7 @@ module SiSU_CGI_PgSQL @hosturl_cgi='#{@name_of[:host_url_cgi]}' @hosturl_files='#{@name_of[:host_url_docs]}' @output_dir_structure_by='#{@name_of[:output_dir_structure]}' + @lingual='#{@name_of[:lingual]}' @port='#{@db.psql.port}' @db_name_prefix='#{Db[:name_prefix]}' @user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' -- cgit v1.2.3