[Rt-commit] r4104 - in rtir/branches/1.9-EXPERIMENTAL: . html/RTIR
html/RTIR/Incident html/RTIR/Tools
ruz at bestpractical.com
ruz at bestpractical.com
Tue Nov 15 23:42:58 EST 2005
Author: ruz
Date: Tue Nov 15 23:42:57 2005
New Revision: 4104
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/ScriptedAction.html
Log:
r280 at cubic-pc: cubic | 2005-11-16 07:46:06 +0300
r271 at cubic-pc: cubic | 2005-11-15 07:17:06 +0300
* update code according to ProcessUpdateMessage changes
* cleanups and refactoring
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html Tue Nov 15 23:42:57 2005
@@ -176,13 +176,13 @@
my $Ticket = new RT::Ticket($session{'CurrentUser'});
my $QueueObj = new RT::Queue($session{'CurrentUser'});
-if ($id ne 'new') {
- $Ticket = LoadTicket($id);
+if ( $id ne 'new' ) {
+ $Ticket = LoadTicket( $id );
unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
Abort("No permission to view ticket");
}
$QueueObj->Load($Ticket->QueueObj->Name) || Abort(loc("Queue could not be loaded."));
-} elsif( $Queue ) {
+} elsif ( $Queue ) {
$QueueObj->Load($Queue);
Abort(loc("Queue could not be loaded.")) unless $QueueObj->id;
}
@@ -193,7 +193,7 @@
$m->abort;
}
-if ( $id && $id eq 'new' ) {
+if ( $id eq 'new' ) {
unless ($QueueObj->CurrentUserHasRight('CreateTicket')) {
Abort('You have no permission to create tickets in that queue.');
}
@@ -212,19 +212,8 @@
Abort("No permission to view ticket");
}
- $ARGS{'UpdateContent'} =~ s/\r*\n/\n/og;
- chomp ($ARGS{'UpdateContent'});
-
- my @UpdateActions;
- if ( $ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne "-- \n" . $session{'CurrentUser'}->UserObj->Signature
- ) {
- $ARGS{UpdateAttachments} = $session{'Attachments'};
- ProcessUpdateMessage( ARGSRef=>\%ARGS,
- Actions=>\@UpdateActions,
- TicketObj=>$Ticket);
- delete $session{'Attachments'};
- }
+ $ARGS{UpdateAttachments} = delete $session{'Attachments'};
+ push @results, ProcessUpdateMessage( ARGSRef=>\%ARGS, TicketObj=>$Ticket );
if ($ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
my $action = $1;
@@ -252,9 +241,6 @@
$m->abort;
}
}
-
-} else {
- Abort('No incident specified');
}
($Type, undef) = $m->comp('Elements/Type', Ticket => $Ticket->Id);
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html Tue Nov 15 23:42:57 2005
@@ -87,7 +87,7 @@
<td class="value">
<& /RTIR/Elements/EditRTIRField,
TicketObj => $Ticket,
- Name => 'SLA' &>
+ Name => 'SLA' &>
</td>
</tr>
<tr>
@@ -99,7 +99,7 @@
<tr>
<td>
<& /RTIR/Elements/EditRTIRField,
- TicketObj => $Ticket,
+ TicketObj => $Ticket,
Name => 'HowReported' &>
</td>
<td class=labeltop>
@@ -107,7 +107,7 @@
</td>
<td class=value colspan=2>
<& /RTIR/Elements/EditRTIRField,
- TicketObj => $Ticket,
+ TicketObj => $Ticket,
Name => 'ReporterType' &>
</td>
</tr>
@@ -120,7 +120,7 @@
<td class="value">
<& /RTIR/Elements/EditRTIRField,
TicketObj => $Ticket,
- Name => 'IP' &>
+ Name => 'IP' &>
</td>
</tr>
<tr>
@@ -128,7 +128,7 @@
<td class="value">
<& /RTIR/Elements/EditRTIRField,
TicketObj => $Ticket,
- Name => 'Netmask' &>
+ Name => 'Netmask' &>
</td>
</tr>
<tr>
@@ -136,7 +136,7 @@
<td class="value">
<& /RTIR/Elements/EditRTIRField,
TicketObj => $Ticket,
- Name => 'Port' &>
+ Name => 'Port' &>
</td>
</tr>
<tr>
@@ -144,7 +144,7 @@
<td class="value">
<& /RTIR/Elements/EditRTIRField,
TicketObj => $Ticket,
- Name => 'WhereBlocked' &>
+ Name => 'WhereBlocked' &>
</td>
</tr>
% }
@@ -209,41 +209,20 @@
$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
-
-my (@wresults, @cfresults, @results, @okresults, @dresults, @lresults);
-
-my ($oldstate, $newstate);
-$oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
unless ($OnlySearchForPeople) {
- @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @cfresults = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
- @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
-
- $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
-
- if ($ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne '' &&
- $ARGS{'UpdateContent'} ne "-- \n" .
- $session{'CurrentUser'}->UserObj->Signature
- ) {
- ProcessUpdateMessage(TicketObj => $Ticket,
- ARGSRef=>\%ARGS,
- Actions=>\@results);
- }
+ push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessTicketCustomFieldUpdates( ARGSRef => \%ARGS );
+ push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
}
-$newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
if ($newstate ne $oldstate) {
push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
}
-push @results, @wresults;
-push @results, @cfresults;
-push @results, @dresults;
-push @results, @lresults;
-push @results, @okresults;
-
if( $ARGS{'SaveChanges'} && $RT::DisplayAfterEdit ) {
$m->comp("/RTIR/Display.html", results => [@results], %ARGS);
$m->abort;
@@ -264,8 +243,6 @@
</%INIT>
-
-
<%ARGS>
$OnlySearchForPeople => undef
$UserField => undef
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html Tue Nov 15 23:42:57 2005
@@ -117,9 +117,7 @@
my $members = new RT::Tickets( $t->CurrentUser );
$members->FromSQL( $query );
while( my $member = $members->Next ) {
- my @tmp;
- ProcessUpdateMessage(TicketObj => $member, ARGSRef => \%ARGS, Actions => \@tmp);
- push @tempresults, @tmp;
+ push @tempresults, ProcessUpdateMessage(TicketObj => $member, ARGSRef => \%ARGS );
}
}
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html Tue Nov 15 23:42:57 2005
@@ -39,8 +39,8 @@
<table border=0 cellpadding=0 cellspacing=2 width=100%><tr><td valign=top width=50%>
<& /Widgets/TitleBoxStart, title => loc('Incident #[_1]', $Ticket->Id),
- title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id,
- title_class=> 'inverse' &>
+ title_href =>"$RT::WebPath/RTIR/Edit.html?id=".$Ticket->Id,
+ title_class=> 'inverse' &>
<table>
<tr>
@@ -53,8 +53,8 @@
</td>
<td class="value">
<& /RTIR/Elements/ShowRTIRField,
- Name => 'State',
- Ticket => $Ticket &>
+ Name => 'State',
+ Ticket => $Ticket &>
</td>
</tr>
<tr>
@@ -66,8 +66,8 @@
<td class="value">
<& /RTIR/Elements/ShowRTIRField,
Ticket => $Ticket,
- Name => 'Description',
- Cols => 60 &>
+ Name => 'Description',
+ Cols => 60 &>
</td>
</tr>
<tr>
@@ -83,7 +83,7 @@
<td class="value">
<& /RTIR/Elements/ShowRTIRField,
Ticket => $Ticket,
- Name => 'Constituency' &>
+ Name => 'Constituency' &>
</td>
</tr>
<tr>
@@ -91,7 +91,7 @@
<td class="value">
<& /RTIR/Elements/ShowRTIRField,
Ticket => $Ticket,
- Name => 'Function' &>
+ Name => 'Function' &>
</td>
</tr>
<tr>
@@ -99,7 +99,7 @@
<td class="value">
<& /RTIR/Elements/ShowRTIRField,
Ticket => $Ticket,
- Name => 'Classification' &>
+ Name => 'Classification' &>
</td>
</tr>
</table>
@@ -229,9 +229,9 @@
my $incidents = new RT::Tickets($session{'CurrentUser'});
$incidents->FromSQL($query);
while (my $member = $incidents->Next) {
- $RT::Logger->debug ("Deleting: ".$member->Id."\n");
- $ARGS{'DeleteLink--MemberOf-'.$member->Id} = '';
- $unlinked->{$member->Id} = $member;
+ $RT::Logger->debug ("Deleting: ".$member->Id."\n");
+ $ARGS{'DeleteLink--MemberOf-'.$member->Id} = '';
+ $unlinked->{$member->Id} = $member;
}
}
@@ -258,7 +258,7 @@
if ($id eq 'new') {
# {{{ Create a new ticket
- my $Queue = new RT::Queue($session{'CurrentUser'});
+ my $Queue = new RT::Queue($session{'CurrentUser'});
unless ($Queue->Load($ARGS{'Queue'})) {
Abort('Queue not found');
}
@@ -283,7 +283,7 @@
} else {
$Ticket = LoadTicket($id);
unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
- Abort("No permission to view ticket");
+ Abort("No permission to view ticket");
}
if ($ChildObj) {
@@ -308,25 +308,12 @@
my ($oldstate, $newstate);
$oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
- $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
- chomp ($ARGS{'UpdateContent'}) ;
- if ($ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne '' &&
- $ARGS{'UpdateContent'} ne "-- \n" .
- $session{'CurrentUser'}->UserObj->Signature
- ) {
- $ARGS{UpdateAttachments} = $session{'Attachments'};
- ProcessUpdateMessage(ARGSRef=>\%ARGS,
- Actions=>\@results,
- TicketObj=>$Ticket);
- delete $session{'Attachments'};
- }
+ $ARGS{UpdateAttachments} = delete $session{'Attachments'};
+ push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $Ticket );
#Process basics updates
- my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket);
-
- push (@results, @BasicActions);
+ push @results, ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket);
$newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
if ($newstate ne $oldstate) {
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html Tue Nov 15 23:42:57 2005
@@ -140,48 +140,26 @@
my $CanRespond = 0;
my $CanComment = 0;
-
$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
-
-my (@wresults, @cfresults, @results, @okresults, @dresults, @lresults);
-
-my ($oldstate, $newstate);
-$oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
unless ($OnlySearchForPeople) {
- @wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @cfresults = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
- @dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
-
- $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
-
- if ($ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne '' &&
- $ARGS{'UpdateContent'} ne "-- \n" .
- $session{'CurrentUser'}->UserObj->Signature
- ) {
- ProcessUpdateMessage(TicketObj => $Ticket,
- ARGSRef=>\%ARGS,
- Actions=>\@results);
- }
+ push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
+ push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
}
-$newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
if ($newstate ne $oldstate) {
push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
}
-push @results, @wresults;
-push @results, @cfresults;
-push @results, @dresults;
-push @results, @lresults;
-push @results, @okresults;
-
if( $ARGS{'SaveChanges'} && $RT::DisplayAfterEdit ) {
$m->comp("/RTIR/Incident/Display.html", results => [@results], %ARGS);
$m->abort;
@@ -193,15 +171,8 @@
unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
Abort("No permission to view ticket");
}
-
-#It's hard to do this inline, so we'll preload the html of the selectstatus in here.
-my $SelectStatus = $m->scomp("/Elements/SelectStatus", Name => 'Status', Default=> $Ticket->Status);
-my $SelectQueue = $m->scomp("/Elements/SelectQueue", Name => 'Queue', Default =>$Ticket->QueueObj->Id);
-
</%INIT>
-
-
<%ARGS>
$OnlySearchForPeople => undef
$UserField => undef
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html Tue Nov 15 23:42:57 2005
@@ -117,19 +117,7 @@
Abort(loc("No search to operate on.")) unless ($session{'tickets'});
-my $do_comment_reply=0;
-# Prepare for ticket updates
-$ARGS{'UpdateContent'} =~ s/\r+\n/\n/g;
-chomp ($ARGS{'UpdateContent'});
-
-if (( $ARGS{Status} eq 'resolved' || $ARGS{Status} eq 'rejected') ||
- ($ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne "-- \n" .
- $session{'CurrentUser'}->UserObj->Signature)) {
- $do_comment_reply=1;
-}
-
-if ( $do_comment_reply ) {
+if ( $SubmitTicket ) {
foreach my $id( @SelectedTickets ) {
my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
$Ticket->Load( $id );
@@ -140,15 +128,11 @@
$id = $Ticket->id;
my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
-
- my @tempresults;
- my @tmp;
- ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@tmp);
- push @tempresults, @tmp;
-
- push @tempresults, ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS);
+ push @tempresults, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @tempresults, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+
if ($newstate ne $oldstate) {
push (@tempresults, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
}
@@ -157,7 +141,7 @@
}
# shouldn't we record message into incident?
- push @results, ProcessTicketBasics(TicketObj => $IncidentObj, ARGSRef => \%ARGS);
+ push @results, ProcessTicketBasics( TicketObj => $IncidentObj, ARGSRef => \%ARGS );
}
#Iterate through each ticket we've been handed
@@ -179,4 +163,5 @@
$Order => 'ASC'
$Action => 'Correspond'
@SelectedTickets => ()
+$SubmitTicket => 1
</%ARGS>
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/ScriptedAction.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/ScriptedAction.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/ScriptedAction.html Tue Nov 15 23:42:57 2005
@@ -423,9 +423,8 @@
# the content will be part of the template, if desired
$ARGS{'UpdateContent'} = " ";
$ARGS{UpdateAttachments} = $session{'Attachments'};
- ProcessUpdateMessage(ARGSRef=>\%ARGS,
- Actions=>\@updateresults,
- TicketObj=>$Ticket);
+ push @updateresults, ProcessUpdateMessage( ARGSRef => \%ARGS,
+ TicketObj=>$Ticket );
# restore original subject
$ARGS{'Subject'} = $orig_subject;
More information about the Rt-commit
mailing list