[freeside-commits] freeside/httemplate/browse msgcat.html,1.1,1.2

Erik Levinson levinse at wavetail.420.am
Fri Jun 3 11:56:20 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv28608/httemplate/browse

Modified Files:
	msgcat.html 
Log Message:
new msgcat browse/edit, RT12515

Index: msgcat.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/msgcat.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- msgcat.html	3 Jun 2011 17:47:38 -0000	1.1
+++ msgcat.html	3 Jun 2011 18:56:18 -0000	1.2
@@ -1,13 +1,14 @@
 <& elements/browse.html,
      title         => mt('Message catalog'),
-     name_singular => 'string', #mt?
-     menubar       => $menubar,
+     name_singular => 'string', #mt? no, we need to do it through the quant/PL stuff
      query         => { 'table' => 'msgcat',
+                        'hashref'   => { 'locale' => $locale, },
                       },
      count_query   => $count_query,
      header        => [ mt('Message code'), mt('Message string') ],
      fields        => [ 'msgcode', 'msg' ],
-     links         => [ $link, $link ],
+     links         => $locale eq 'en_US' ? [] : [ $link, $link ],
+     html_init     => $html_init,
 &>
 <%init>
 
@@ -16,12 +17,20 @@
 die "access denied"
   unless $curuser->access_right('Configuration');
 
-my $menubar = [ mt('Add a string') => $p.'edit/msgcat.html' ];
-
-my $where = '';
+my $locale = $cgi->param('locale') || 'en_US';
+die "invalid locale" unless $locale =~ /^[A-Za-z_]+$/;
 
-my $count_query = 'SELECT COUNT(*) FROM msgcat';
+my $count_query = "SELECT COUNT(*) FROM msgcat where locale = '$locale'";
 
 my $link = [ "${p}edit/msgcat.html?", 'msgnum' ];
 
+my $html_init = '';
+foreach my $alocale ( FS::Locales->locales ) {
+     my %info = FS::Locales->locale_info($alocale);
+     my $selectedstart = $alocale eq $locale ? '<B>' : '';
+     my $selectedend = $alocale eq $locale ? '</B>' : '';
+     $html_init .= qq!<A HREF="msgcat.html?locale=$alocale">$selectedstart$info{name} ($info{country})$selectedend</A> &nbsp; !;
+}
+$html_init .= '<BR><BR>';
+
 </%init>



More information about the freeside-commits mailing list