[Rt-commit] r5010 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR
html/RTIR/Block/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Tue Apr 11 05:05:00 EDT 2006
Author: ruz
Date: Tue Apr 11 05:04:59 2006
New Revision: 5010
Added:
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Block/Elements/EditState
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
Log:
r1276 at cubic-pc: cubic | 2006-04-11 04:28:04 +0400
* allow to modify Block's state via changes of the status
Added: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Block/Elements/EditState
==============================================================================
--- (empty file)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Block/Elements/EditState Tue Apr 11 05:04:59 2006
@@ -0,0 +1,17 @@
+<& /Widgets/Form/Select,
+ NamePrefix => '',
+ Name => 'Status',
+ Empty => 0,
+ Values => [qw(new open stalled resolved)],
+ ValuesLabel => {
+ new => loc('pending activation'),
+ open => loc('active'),
+ stalled => loc('pending removal'),
+ resolved => loc('removed'),
+ },
+ CurrentValue => $Default,
+&>
+<%ARGS>
+$TicketObj => undef
+$Default => undef
+</%ARGS>
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 Apr 11 05:04:59 2006
@@ -53,7 +53,11 @@
<%loc("State")%>:
</td>
<td class="value" colspan="2">
+% unless ( $Type eq 'Block' ) {
<& /RTIR/Elements/ShowRTIRField, Ticket => $Ticket, Name => 'State' &>
+% } else {
+ <& /RTIR/Block/Elements/EditState, TicketObj => $Ticket, Default => $Ticket->Status &>
+% }
</td>
</tr>
<tr>
@@ -204,59 +208,58 @@
my @results;
my $Ticket = LoadTicket($id);
-my ($Type) = $m->comp('/RTIR/Elements/Type', TicketObj => $Ticket);
-
-if ($Type eq 'Incident') {
- return $m->comp("/RTIR/Incident/Edit.html", %ARGS);
-}
+$id = $ARGS{'id'} = $Ticket->Id;
+my ($Type) = $m->comp('/RTIR/Elements/Type', TicketObj => $Ticket);
+return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
if( $Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
Abort(loc("Blocks queue is disabled via config file"));
}
+if ( $m->comp_exists("/RTIR/$Type/Edit.html") ) {
+ return $m->comp("/RTIR/$Type/Edit.html", %ARGS);
+}
my $name;
if ($Type eq 'Report') {
- $name = "Incident Report";
+ $name = "Incident Report";
} else {
- $name = $Type;
+ $name = $Type;
}
-my $CanRespond = 0;
-my $CanComment = 0;
-
-
+my ($CanRespond, $CanComment) = ( 0, 0 );
$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
-my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
-unless ($OnlySearchForPeople) {
+if ( $SaveChanges && !$OnlySearchForPeople ) {
+ my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
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, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS );
# XXX: edit page has no message box or attachments form
$ARGS{UpdateAttachments} = delete $session{'Attachments'};
push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
-}
-my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
-if ($newstate ne $oldstate) {
- push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
+
+ push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ push @results, ProcessTicketCustomFieldUpdates( ARGSRef => \%ARGS );
+
+ my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
+ if ($newstate ne $oldstate) {
+ push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
+ }
+ if ( RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ) {
+ return $m->comp("/RTIR/Display.html", results => [@results], id => $id);
+ }
}
-if( $ARGS{'SaveChanges'} && RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ) {
- return $m->comp("/RTIR/Display.html", results => [@results], %ARGS);
-}
-
# If they've gone and moved the ticket to somewhere they can't see, etc...
# TODO: display the results, even if we can't display the ticket.
unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
- Abort("No permission to view ticket");
+ Abort("No permission to view ticket");
}
my $Title = loc("Edit [_1] #[_2]: [_3]", $name, $Ticket->Id, $Ticket->Subject);
@@ -264,9 +267,12 @@
</%INIT>
<%ARGS>
+$id => undef
+
+$SaveChanges => 0
$OnlySearchForPeople => undef
-$UserField => undef
-$UserOp => undef
-$UserString => undef
-$id => undef
+
+$UserField => undef
+$UserOp => undef
+$UserString => undef
</%ARGS>
More information about the Rt-commit
mailing list