From 44e3eff0aa6e7bdb7f4ecd9ee1ddf141e1b68af3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Apr 2002 05:56:09 +0000 Subject: working message catalogs (not used for enough yet) - almost (but not quite) closes Bug#385 - still have to catalog the backend things triggered by signup server. --- httemplate/browse/msgcat.cgi | 4 +-- httemplate/docs/install.html | 5 ++++ httemplate/edit/msgcat.cgi | 57 ++++++++++++++++++++++++++++++++++++++ httemplate/edit/process/msgcat.cgi | 19 +++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100755 httemplate/edit/msgcat.cgi create mode 100644 httemplate/edit/process/msgcat.cgi (limited to 'httemplate') diff --git a/httemplate/browse/msgcat.cgi b/httemplate/browse/msgcat.cgi index 5dab5cfc9..774473b36 100755 --- a/httemplate/browse/msgcat.cgi +++ b/httemplate/browse/msgcat.cgi @@ -18,8 +18,8 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= ''; #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode } - # qsearchs('msgcat', { 'locale' => $layer } ) ) { - foreach my $msgcat ( qsearchs('msgcat', { 'locale' => $layer } ) ) { + # qsearch('msgcat', { 'locale' => $layer } ) ) { + foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) { $html .= ''. $msgcat->msgnum. ''. ''. $msgcat->msgcode. ''. ''. $msgcat->msg. ''; diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 2ad75b15e..4870c7db7 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -180,6 +180,11 @@ $ freeside-adduser -h /usr/local/etc
 $ su freeside
 $ bin/fs-setup username
+
+
  • As the freeside UNIX user, run bin/populate-msgcat username to populate the message catalog, passing the username of a Freeside user you created above: +
    +$ su freeside
    +$ bin/populate-msgcat username
     
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup.
  • Now proceed to the initial administration of your installation. diff --git a/httemplate/edit/msgcat.cgi b/httemplate/edit/msgcat.cgi new file mode 100755 index 000000000..5d256c05b --- /dev/null +++ b/httemplate/edit/msgcat.cgi @@ -0,0 +1,57 @@ + +<% + +print header("Message catalog", menubar( +# 'Main Menu' => $p, +)), '
    '; + +print qq!Error: !. $cgi->param('error') + if $cgi->param('error'); + +my $widget = new HTML::Widgets::SelectLayers( + 'selected_layer' => 'en_US', + 'options' => { 'en_US'=>'en_US' }, + 'form_action' => 'process/msgcat.cgi', + 'layer_callback' => sub { + my $layer = shift; + my $html = qq!!. + "
    Messages for locale $layer
    ". table(). + "Code". + "Message"; + $html .= "en_US Message" unless $layer eq 'en_US'; + $html .= ''; + + #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode } + # qsearch('msgcat', { 'locale' => $layer } ) ) { + foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) { + $html .= + ''. $msgcat->msgnum. ''. $msgcat->msgcode. ''. + '!; + unless ( $layer eq 'en_US' ) { + my $en_msgcat = qsearchs('msgcat', { + 'locale' => 'en_US', + 'msgcode' => $msgcat->msgcode, + } ); + $html .= ''. $en_msgcat->msg. ''; + } + $html .= ''; + } + + $html .= '
    '; + + $html; + }, + +); + +print $widget->html; + +print < + + +END + +%> diff --git a/httemplate/edit/process/msgcat.cgi b/httemplate/edit/process/msgcat.cgi new file mode 100644 index 000000000..ab30f06b5 --- /dev/null +++ b/httemplate/edit/process/msgcat.cgi @@ -0,0 +1,19 @@ +<% + +my $error; +foreach my $param ( grep { /^\d+$/ } $cgi->param ) { + my $old = qsearchs('msgcat', { msgnum=>$param } ); + my $new = new FS::msgcat { $old->hash }; + $new->msg($cgi->param($param)); + $error = $new->replace($old); + last if $error; +} + +if ( $error ) { + $cgi->param('error',$error); + print $cgi->redirect($p. "msgcat.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/msgcat.cgi"); +} + +%> -- cgit v1.2.1