summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-06-03 18:59:04 +0000
committerlevinse <levinse>2011-06-03 18:59:04 +0000
commit9f42fa8fb7cb27deb5f249ffc3ce334de545c580 (patch)
tree503bcf2577984bdf602febc6fac1d22bdd86d86d
parent23ceb08c948d848556555840ffde296caebd6df6 (diff)
new msgcat browse/edit, RT12515
-rw-r--r--httemplate/browse/msgcat.html25
-rw-r--r--httemplate/edit/msgcat.html1
-rw-r--r--httemplate/edit/process/msgcat.html5
-rw-r--r--httemplate/elements/menu.html2
4 files changed, 23 insertions, 10 deletions
diff --git a/httemplate/browse/msgcat.html b/httemplate/browse/msgcat.html
index b7fe17ad6..ac8a3a437 100644
--- a/httemplate/browse/msgcat.html
+++ b/httemplate/browse/msgcat.html
@@ -1,13 +1,14 @@
<& elements/browse.html,
title => mt('Message catalog'),
- name_singular => 'string', #mt?
- menubar => $menubar,
- query => { 'table' => 'msgcat',
+ 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 @@ my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Configuration');
-my $menubar = [ mt('Add a string') => $p.'edit/msgcat.html' ];
+my $locale = $cgi->param('locale') || 'en_US';
+die "invalid locale" unless $locale =~ /^[A-Za-z_]+$/;
-my $where = '';
-
-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>
diff --git a/httemplate/edit/msgcat.html b/httemplate/edit/msgcat.html
index 7ac577b7c..5a197ffb7 100644
--- a/httemplate/edit/msgcat.html
+++ b/httemplate/edit/msgcat.html
@@ -1,4 +1,5 @@
<& elements/edit.html,
name_singular => 'string', #mt?
table => 'msgcat',
+ viewall_dir => 'browse',
&>
diff --git a/httemplate/edit/process/msgcat.html b/httemplate/edit/process/msgcat.html
index b8c8eff2f..8a763ba08 100644
--- a/httemplate/edit/process/msgcat.html
+++ b/httemplate/edit/process/msgcat.html
@@ -1 +1,4 @@
-<& elements/process.html, table => 'msgcat' &>
+<& elements/process.html,
+ table => 'msgcat',
+ viewall_dir => 'browse',
+&>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index fcf2caa0e..f5639a9ef 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -535,7 +535,7 @@ $config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Whe
|| $curuser->access_right('Edit global advertising sources');
if ( $curuser->access_right('Configuration') ) {
$config_misc{'Virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ];
- $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels for each locale' ];
+ $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.html', 'Change error messages and other customizable labels for each locale' ];
}
$config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]
if $curuser->access_right('Edit inventory')