rt 4.2.15
[freeside.git] / rt / share / html / Dashboards / Subscription.html
index 3669e46..b00dde6 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -75,7 +75,7 @@
 <ol class="dashboard-queries">
 %    for my $portlet (@portlets) {
         <li class="dashboard-query">
-            <% loc($portlet->{description}, $fields{'Rows'}) %>
+            <% loc( RT::SavedSearch->EscapeDescription($portlet->{description}), $fields{'Rows'}) %>
         </li>
 %    }
 </ol>
 <&|/l&>Frequency</&>:
 </td><td class="value">
 
-<input type="radio" name="Frequency" value="daily" <% $fields{'Frequency'} eq 'daily' ? 'checked="checked"' : "" |n %>>
-    <&|/l&>daily</&>
-</input><br />
+<input type="radio" id="Frequency-daily" name="Frequency" value="daily" <% $fields{'Frequency'} eq 'daily' ? 'checked="checked"' : "" |n %>></input>
+<label for="Frequency-daily"><&|/l&>daily</&></label>
+<br />
 
-<input type="radio" name="Frequency" value="m-f" <% $fields{'Frequency'} eq 'm-f' ? 'checked="checked"' : "" |n %>>
-    <&|/l&>Monday through Friday</&>
-</input><br />
+<input type="radio" id="Frequency-m-f" name="Frequency" value="m-f" <% $fields{'Frequency'} eq 'm-f' ? 'checked="checked"' : "" |n %>></input>
+<label for="Frequency-m-f"><&|/l&>Monday through Friday</&></label>
+<br />
 
-<input type="radio" name="Frequency" value="weekly"<% $fields{'Frequency'} eq 'weekly' ? 'checked="checked"' : "" |n %>>
-<&|/l&>weekly</&></input>, <&|/l&>on</&>
+<input type="radio" id="Frequency-weekly" name="Frequency" value="weekly"<% $fields{'Frequency'} eq 'weekly' ? 'checked="checked"' : "" |n %>></input>
+<label for="Frequency-weekly">
+<&|/l&>weekly</&>, <&|/l&>on</&>
 <select name="Dow">
     <option value="Monday" <% $fields{'Dow'} eq 'Monday' ? 'selected="selected"' : '' |n %>><&|/l&>Monday</&></option>
     <option value="Tuesday" <% $fields{'Dow'} eq 'Tuesday' ? 'selected="selected"' : '' |n %>><&|/l&>Tuesday</&></option>
 % }
 </select>
 <&|/l&>weeks</&>
+</label>
 <br />
 
-<input type="radio" name="Frequency" value="monthly"<% $fields{'Frequency'} eq 'monthly' ? 'checked="checked"' : "" |n %>>
-<&|/l&>monthly</&></input> , <&|/l&>on day</&>
+<input type="radio" id="Frequency-monthly" name="Frequency" value="monthly"<% $fields{'Frequency'} eq 'monthly' ? 'checked="checked"' : "" |n %>></input>
+<label for="Frequency-monthly">
+<&|/l&>monthly</&>, <&|/l&>on day</&>
 <select name="Dom">
 %   for my $dom (1..31) {
     <option value="<% $dom %>" <% $fields{'Dom'} == $dom ? 'selected="selected"' : '' |n %>><% loc($dom) %></option>
 %   }
 </select>
+</label>
 <br />
 
-<input type="radio" name="Frequency" value="never" <% $fields{'Frequency'} eq 'never' ? 'checked="checked"' : "" |n %>>
-    <&|/l&>never</&>
-</input>
+<input type="radio" id="Frequency-never" name="Frequency" value="never" <% $fields{'Frequency'} eq 'never' ? 'checked="checked"' : "" |n %>></input>
+<label for="Frequency-never"><&|/l&>never</&></label>
 
 </td></tr>
 <tr><td class="label">
 <&|/l&>Recipient</&>:
 </td><td class="value">
 <input name="Recipient" id="Recipient" size="30" value="<%$fields{Recipient} ? $fields{Recipient} : ''%>" />
-<div class="hints"><% loc("Leave blank to send to your current email address ([_1])", $session{'CurrentUser'}->UserObj->EmailAddress) %></div>
+<div class="hints"><% loc("Leave blank to send to your current email address ([_1])", $session{'CurrentUser'}->EmailAddress) %></div>
 </td></tr>
+% $m->callback( %ARGS, CallbackName => 'SubscriptionFormEnd', FieldsRef => \%fields,
+%     SubscriptionObj => $SubscriptionObj, DashboardObj => $Dashboard );
 </table>
 </&>
 </td>
@@ -213,6 +218,9 @@ my %fields = (
     Counter     => 0,
 );
 
+$m->callback( %ARGS, CallbackName => 'SubscriptionFields', FieldsRef => \%fields,
+     SubscriptionObj => $SubscriptionObj, DashboardObj => $Dashboard);
+
 # update any fields with the values from the subscription object
 if ($SubscriptionObj) {
     for my $field (keys %fields) {
@@ -227,6 +235,8 @@ for my $field (keys %fields) {
         if defined($ARGS{$field});
 }
 
+$m->callback( %ARGS, CallbackName => 'MassageSubscriptionFields', FieldsRef => \%fields,
+     SubscriptionObj => $SubscriptionObj, DashboardObj => $Dashboard);
 
 # this'll be defined on submit
 if (defined $ARGS{Save}) {
@@ -248,16 +258,12 @@ if (defined $ARGS{Save}) {
             ($ok, $msg) = $SubscriptionObj->SetSubValues(%fields);
             $fields{'DashboardId'} = $id;
 
-            # not so good to spew base64-encoded data at the user :)
-            if ($msg =~ /^Content changed from/) {
-                $msg = "Subscription updated.";
-            }
-
+            $msg = loc("Subscription updated") if $ok;
             push @results, $msg;
         }
         # create
         else {
-            Abort(loc("Unable to subscribe to dashboard [_1]: Permission denied", $id))
+            Abort(loc("Unable to subscribe to dashboard [_1]: Permission Denied", $id))
                 unless $Dashboard->CurrentUserCanSubscribe;
 
             $SubscriptionObj = RT::Attribute->new($session{CurrentUser});