'msgname' => 'Template name',
'from_addr' => 'From: ',
'bcc_addr' => 'Bcc: ',
- 'locale' => 'Language',
+ 'locale' => 'Locale',
'subject' => 'Subject: ',
'body' => 'Message body',
},
'edit_callback' => \&edit_callback,
'error_callback' => \&edit_callback,
'html_bottom' => '</DIV>',
+ 'html_table_bottom'=> \&html_table_bottom,
'html_foot' => ( $no_submit ? '' : "</TD>$sidebar</TR></TABLE>" ),
'no_submit' => $no_submit,
&>
{ field => 'subject', size=>60, },
{ field => 'body',
type => 'htmlarea',
- width => 763
+ width => 763,
+ config=> { extraPlugins => 'blockprotect' },
},
;
} else { #readonly
# make a list of available locales
my $content_locales = $object->content_locales;
- my @locales = grep { !exists($content_locales->{$_}) } FS::Locales->locales;
+ my @locales = grep { !exists($content_locales->{$_}) }
+ FS::Conf->new->config('available-locales');
my %labels;
foreach (@locales) {
my %info = FS::Locales->locale_info($_);
- $labels{$_} = $info{'name'}; # ignoring country for now
+ $labels{$_} = $info{'label'};
}
unshift @locales, 'new';
$labels{'new'} = 'Select language';
curr_value => 'new',
onchange => $onchange_locale,
);
- } # else it's already set up correctly
+ }
}
sub menubar_opt_callback {
foreach my $l (FS::Locales->locales) {
if ( exists $object->content_locales->{$l} ) {
my %info = FS::Locales->locale_info($l);
- push @tabs,
- $info{'name'},
+ push @tabs,
+ $info{'label'},
';locale='.$l;
- $selected = $info{'name'} if $object->locale eq $l;
+ $selected = $info{'label'} if $object->locale eq $l;
}
else {
$display_new = 1; # there is at least one unused locale left
'$company_name' => 'Our company name',
'$company_address'=> 'Our company address',
'$company_phonenum' => 'Our phone number',
+ '$selfservice_server_base_url' => 'Base URL of customer self-service',
],
'contact' => [ # duplicate this for shipping
'$name' => 'Company and contact name',
'$mobile' => 'Mobile phone',
'$fax' => 'Fax',
],
+ 'service' => [
+ '$ship_address1' => 'Address line 1',
+ '$ship_address2' => 'Address line 2',
+ '$ship_city' => 'City',
+ '$ship_county' => 'County',
+ '$ship_state' => 'State',
+ '$ship_zip' => 'Zip',
+ '$ship_country' => 'Country',
+ ],
'cust_bill' => [
'$invnum' => 'Invoice#',
+ '$_date_pretty' => 'Invoice date',
+ '$due_date' => 'Invoice due date (timestamp)',
+ '$due_date2str' => 'Invoice due date (human readable)',
],
'cust_pkg' => [
'$pkgnum' => 'Package#',
'$payby' => 'Payment method',
'$date' => 'Payment date',
'$payinfo' => 'Card/account# (masked)',
+ '$payinfo_end' => 'Card/account last 4 digits',
'$error' => 'Decline reason',
],
+ 'cust_refund' => [
+ '$refundnum' => 'Refund#',
+ '$refund' => 'Refund Amount',
+ '$payby' => 'Refund method',
+ '$date' => 'Refund date',
+ '$payinfo' => 'Card/account# (masked)',
+ '$payinfo_end' => 'Card/account last 4 digits',
+ ],
);
-my @c = @{ $substitutions{'contact'} };
-for (my $i=0; $i<scalar(@c); $i += 2) {
- $c[$i] =~ s/\$(.*)/\$ship_$1/;
-}
-$substitutions{'shipping'} = \@c;
tie my %sections, 'Tie::IxHash', (
'contact' => 'Name and contact info (billing)',
-'shipping' => 'Name and contact info (shipping)',
+'service' => 'Service address',
'cust_main' => 'Customer status and payment info',
'cust_pkg' => 'Package fields',
+'cust_refund' => 'Refund fields',
'cust_bill' => 'Invoice fields',
'cust_pay' => 'Payment fields',
'svc_acct' => 'Login service fields',
my $sidebar = '
<SCRIPT TYPE="text/javascript">
function insertHtml(what) {
- var oEditor = FCKeditorAPI.GetInstance("body");
- oEditor.InsertHtml(what);
+ var oEditor = CKEDITOR.instances["body"];
+ oEditor.insertHtml(what);
};
+
+function areyousure(url, message) {
+ if (confirm(message))
+ window.location.href = url;
+}
</SCRIPT>
<TD valign="top"><FORM name="dummy">
Substitutions: '
</FONT></TD>
';
+sub html_table_bottom {
+ my $object = shift;
+ $cgi->param('locale') =~ /^(\w+)$/;
+ my $locale = $1;
+ my $html;
+ if ( $locale and $locale ne 'new' ) {
+ # set up a delete link
+ my $msgnum = $object->msgnum;
+ my $url = $p."misc/delete-template_content.html?msgnum=$msgnum;locale=$1";
+ my $link = qq!<A HREF="javascript:areyousure('$url','Really delete this template?')">! .
+ 'Delete this template' .
+ '</A>';
+ $html = qq!<TR><TD></TD>
+ <TD STYLE="font-style: italic; font-size: small">$link</TD></TR>!;
+ }
+ $html;
+}
+
</%init>