diff options
| author | Mark Wells <mark@freeside.biz> | 2013-08-22 17:14:01 -0700 | 
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2013-08-22 17:14:01 -0700 | 
| commit | 4c0066949409448d9104fd7f7c05ccff0573e2a8 (patch) | |
| tree | 7e846c5eb0d4394b6dbb3f327c77cd54957240dc /httemplate/edit | |
| parent | 8a8089a9580bece258da2c0852acfd2c53b49ff0 (diff) | |
better locale support in message template UI, #24659
Diffstat (limited to 'httemplate/edit')
| -rw-r--r-- | httemplate/edit/msg_template.html | 39 | 
1 files changed, 32 insertions, 7 deletions
| diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html index f50d66d7c..5171289c3 100644 --- a/httemplate/edit/msg_template.html +++ b/httemplate/edit/msg_template.html @@ -15,13 +15,14 @@                               '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,  &> @@ -120,11 +121,12 @@ sub edit_callback {      # 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'; @@ -145,7 +147,7 @@ sub edit_callback {        curr_value  => 'new',        onchange    => $onchange_locale,      ); -  } # else it's already set up correctly +  }  }  sub menubar_opt_callback { @@ -159,10 +161,10 @@ 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 @@ -325,6 +327,11 @@ function insertHtml(what) {    var oEditor = FCKeditorAPI.GetInstance("body");    oEditor.InsertHtml(what);  }; + +function areyousure(url, message) { +  if (confirm(message)) +    window.location.href = url; +}  </SCRIPT>  <TD valign="top"><FORM name="dummy">  Substitutions: ' @@ -336,4 +343,22 @@ 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> | 
