[Rt-commit] r18852 - in rt/3.999/branches/lorzy/share/html: Admin/Elements Elements/GnuPG Ticket/Elements
clkao at bestpractical.com
clkao at bestpractical.com
Thu Mar 19 11:01:05 EDT 2009
Author: clkao
Date: Thu Mar 19 11:01:03 2009
New Revision: 18852
Modified:
rt/3.999/branches/lorzy/share/html/Admin/Elements/ListGlobalScrips
rt/3.999/branches/lorzy/share/html/Elements/GnuPG/SignEncryptWidget
rt/3.999/branches/lorzy/share/html/Ticket/Elements/PreviewScrips
rt/3.999/branches/lorzy/share/html/Ticket/Update.html
Log:
re-enable scrip previewing using rule hinting.
Modified: rt/3.999/branches/lorzy/share/html/Admin/Elements/ListGlobalScrips
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Admin/Elements/ListGlobalScrips (original)
+++ rt/3.999/branches/lorzy/share/html/Admin/Elements/ListGlobalScrips Thu Mar 19 11:01:03 2009
@@ -46,25 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
-% unless ( $Scrips->count ) {
<p><i><&|/l&>(No scrips)</&></i></p>
-% } else {
-<& /Elements/CollectionList,
- order_by => 'description',
- order => 'ASC',
- rows => 0,
- %ARGS,
- format => $format,
- collection => $Scrips,
- show_header => 0,
-&>
-% }
<%init>
-my $format = q{'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__id__</a>/TITLE:#'}
- .q{,'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__&Queue=0">__Autodescription__</a>/TITLE:Condition, Action and Template'}
- .q{__NEWLINE__,'','<small>__description__</small>'};
-
-my $Scrips = RT::Model::ScripCollection->new( current_user => Jifty->web->current_user );
-$Scrips->limit_to_global;
</%init>
Modified: rt/3.999/branches/lorzy/share/html/Elements/GnuPG/SignEncryptWidget
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Elements/GnuPG/SignEncryptWidget (original)
+++ rt/3.999/branches/lorzy/share/html/Elements/GnuPG/SignEncryptWidget Thu Mar 19 11:01:03 2009
@@ -145,22 +145,22 @@
if ( $operation eq 'update' ) {
# skip any email addresses that we won't be sending mail to
-# my %squelch = $m->comp(
-# '/Ticket/Elements/PreviewScrips:SquelchRecipients',
-# %$self,
-# ticket_obj => $ticket_obj
-# );
-#
-# @recipients = $m->comp(
-# '/Ticket/Elements/PreviewScrips:GetRecipients',
-# %$self, ticket_obj => $ticket_obj
-# );
+ my %squelch = $m->comp(
+ '/Ticket/Elements/PreviewScrips:SquelchRecipients',
+ %$self,
+ ticket_obj => $ticket_obj
+ );
+
+ @recipients = $m->comp(
+ '/Ticket/Elements/PreviewScrips:GetRecipients',
+ %$self, ticket_obj => $ticket_obj
+ );
}
elsif ( $operation eq 'create' ) {
-# @recipients = $m->comp(
-# '/Ticket/Elements/PreviewScrips:GetRecipientsOnCreate',
-# %$self,
-# );
+ @recipients = $m->comp(
+ '/Ticket/Elements/PreviewScrips:GetRecipientsOnCreate',
+ %$self,
+ );
}
else {
Jifty->log->fatal('Incorrect operation: '. $operation );
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Elements/PreviewScrips
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Elements/PreviewScrips (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Elements/PreviewScrips Thu Mar 19 11:01:03 2009
@@ -51,33 +51,36 @@
</%args>
<%init>
###### XXX: this needs to be ported to introspect lorzy
-return;
+
my %squelch = $m->comp('SELF:SquelchRecipients', %ARGS);
-my $object = $squelch{'object'};
+my $recipients = $squelch{'recipients'};
my @non_recipients = @{ $squelch{'emails'} };
</%init>
<h2><&|/l&>This message will be sent to...</&></h2>
-% if ( $object and $object->scrips ) {
+% if ( my @rules = keys %{$recipients} ) {
<i><&|/l&>(Check boxes to disable notifications to the listed recipients)</&></i><br />
-% foreach my $scrip (@{$object->scrips->prepared}) {
-% next unless $scrip->scrip_action->action->isa('RT::ScripAction::SendEmail');
-<b><% $scrip->description || _('Scrip #%1',$scrip->id) %></b><br />
-<&|/l, _($scrip->scrip_condition->name), _($scrip->scrip_action->name), _($scrip->template_obj->name)&>%1 %2 with template %3</&>
+% foreach my $rule (@rules) {
+<b><% $rule %></b><br />
+%# XXX: hints should give template info as well, condition might come
+ # from other places
+%#<&|/l, _($scrip->scrip_condition->name), _($scrip->scrip_action->name), _($scrip->template_obj->name)&>%1 %2 with template %3</&>
<br />
%foreach my $type qw(to cc bcc) {
-%my @addresses = $scrip->scrip_action->action->$type();
+%my @addresses = @{$recipients->{$rule}{$type}};
+%#warn Dumper(\@address)
<ul>
%foreach my $addr (@addresses) {
<li> <b><%_($type)%></b>: <input type="checkbox" class="checkbox" name="Ticket-<%$ticket_obj->id%>-SquelchMailTo" value="<%$addr->address%>" /> <%$addr->address%>
% }
</ul>
% }
-% if (RT->config->get('PreviewScripMessages')) {
+%# later
+% if (0 && RT->config->get('PreviewScripMessages')) {
<textarea cols="80" rows="5">
-<%$scrip->scrip_action->template_obj->mime_obj->as_string%>
+<%#$scrip->scrip_action->template_obj->mime_obj->as_string%>
</textarea>
% }
% }
@@ -130,19 +133,26 @@
body => $ARGS{'update_content'},
);
-my ( $Transaction, $description, $object ) = $ticket_obj->$action(
+my ( $txn_id, $description, $txn ) = $ticket_obj->$action(
cc_message_to => $ARGS{'update_cc'},
bcc_message_to => $ARGS{'update_bcc'},
mime_obj => $Message,
time_taken => $ARGS{'update_time_worked'},
dry_run => 1
);
-unless ( $Transaction ) {
+
+unless ( $txn_id ) {
Jifty->log->error("Coulfn't fire '$action' action: $description");
}
+my $recipients = {};
+for (@{$txn->rules}) {
+ my $hints = $_->hints;
+ next unless $hints->{class} eq 'SendEmail';
+ $recipients->{$hints->{description}} = $hints->{recipients};
+}
-return (object => $object, emails => [$ticket_obj->squelch_mail_to]);
+return (recipients => $recipients, emails => [$ticket_obj->squelch_mail_to]);
</%INIT>
</%METHOD>
@@ -179,12 +189,12 @@
}
my @recipients;
-foreach my $scrip ( @{ $txn->scrips->prepared } ) {
- my $action = $scrip->scrip_action->action;
- next unless $action->isa('RT::ScripAction::SendEmail');
+foreach my $rule ( @{ $txn->rules } ) {
+ my $hints = $rule->hints;
+ next unless $hints->{class} eq 'SendEmail';
foreach my $type qw(to cc bcc) {
- push @recipients, $action->$type();
+ push @recipients, @{$hints->{recipients}{$type}};
}
}
return @recipients;
@@ -224,12 +234,12 @@
}
my @recipients;
-foreach my $scrip ( @{ $txn->scrips->prepared } ) {
- my $action = $scrip->scrip_action->action;
- next unless $action->isa('RT::ScripAction::SendEmail');
+foreach my $rule ( @{ $txn->rules } ) {
+ my $hints = $rule->hints;
+ next unless $hints->{class} eq 'SendEmail';
foreach my $type qw(to cc bcc) {
- push @recipients, $action->$type();
+ push @recipients, @{$hints->{recipients}{$type}};
}
}
return @recipients;
Modified: rt/3.999/branches/lorzy/share/html/Ticket/Update.html
==============================================================================
--- rt/3.999/branches/lorzy/share/html/Ticket/Update.html (original)
+++ rt/3.999/branches/lorzy/share/html/Ticket/Update.html Thu Mar 19 11:01:03 2009
@@ -150,8 +150,7 @@
<& /Elements/Submit, label => _('Update Ticket'), name => 'submit_ticket' &>
-%# XXX previewscrips disabled for now
-% if (0 && $ticket_obj->current_user_has_right('ShowOutgoingEmail')) {
+% if ($ticket_obj->current_user_has_right('ShowOutgoingEmail')) {
<&|/Widgets/TitleBox, title => _('Scrips and Recipients') &>
<& /Ticket/Elements/PreviewScrips, ticket_obj => $ticket_obj, %ARGS &>
</&>
More information about the Rt-commit
mailing list