[Rt-commit] [rtir] 06/14: First pass at beginning to refactor the main RTIR ticket creation page
Jesse Vincent
jesse at bestpractical.com
Wed Feb 18 20:55:05 EST 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit f34dcdc09fec1b04a74e377f4eecfbcc12947d7b
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Feb 18 15:46:16 2015 -0800
First pass at beginning to refactor the main RTIR ticket creation page
---
html/RTIR/Create.html | 78 +++++++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 40 deletions(-)
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index c873675..b6c4a5e 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -55,7 +55,7 @@
<& /Elements/ListActions, actions => \@results &>
% if ( $Split && !$SplitObj->CurrentUserHasRight('ModifyTicket') ) {
-<% loc("You are not allowed to split this [_1].", $name) %>
+<% loc("You are not allowed to split this [_1].", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle)) %>
% $m->abort();
% }
@@ -205,31 +205,35 @@
<tr>
<td class="label"><&|/l&>Message</&>:</td>
<td class="value">
-% my $include_signature = 1;
-% unless (exists $ARGS{Content}) {
-% my $Transactions;
-% if ($SplitObj) {
-% $Transactions = $SplitObj->Transactions;
-% } elsif (@IncidentObj) {
-% $Transactions = $IncidentObj[0]->Transactions;
-% }
-%
-% if ($Transactions) {
-% # Investigations should quote their included text
-% my $quote = 0;
-% if ($Type eq 'Investigation') {
-% $quote = 1;
-% }
-% $ARGS{Content} = $m->scomp("/RTIR/Elements/TransactionData",
-% Transactions => $Transactions,
-% Type => 'messages',
-% Include => {'Create', 'Correspond'},
-% QuoteText => $quote);
-% $ARGS{Content} =~ s/\>/>/g if $ARGS{Content};
-% }
-% } else {
-% $include_signature = 0;
-% }
+<%perl>
+ my $include_signature = 1;
+ unless (exists $ARGS{Content}) {
+ my $Transactions;
+ if ($SplitObj) {
+ $Transactions = $SplitObj->Transactions;
+ } elsif (@IncidentObj) {
+ $Transactions = $IncidentObj[0]->Transactions;
+ }
+
+ if ($Transactions) {
+ # Investigations should quote their included text
+ my $quote = 0;
+ if ($QueueObj->Lifecycle eq RT::IR->lifecycle_investigation){
+ $quote = 1;
+ }
+ $ARGS{Content} = $m->scomp("/RTIR/Elements/TransactionData",
+ Transactions => $Transactions,
+ Type => 'messages',
+ Include => {'Create', 'Correspond'},
+ QuoteText => $quote);
+ $ARGS{Content} =~ s/\>/>/g if $ARGS{Content};
+ }
+ } else {
+ $include_signature = 0;
+ }
+
+</%perl>
+
% if ( RT->Config->Get('ArticleOnTicketCreate')) {
<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj &>
% }
@@ -305,7 +309,7 @@
&>
</table></&>
-% if ( $Type eq "Investigation" && @IncidentObj ) {
+% if ( $QueueObj->Lifecycle eq RT::IR->lifecycle_investigation && @IncidentObj ) {
<& /RTIR/Elements/AttachReports, Ticket => \@IncidentObj &>
% }
@@ -332,20 +336,14 @@ $QueueObj->Load( $Queue ) || Abort( loc("Queue could not be loaded.") );
my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object
-my $Type = RT::IR::TicketType( Queue => $Queue );
-if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+my $Type = RT::IR::TicketType( Lifecycle => $QueueObj->Lifecycle);
+if ($QueueObj->Lifecycle eq RT::IR->lifecycle_countermeasure && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
Abort(loc("Blocks queue is disabled via config file"));
}
if ( $m->comp_exists("/RTIR/$Type/Create.html") ) {
return $m->comp( "/RTIR/$Type/Create.html", %ARGS );
}
-my ($name);
-if ( $Type eq 'Report' ) {
- $name = 'Incident Report';
-}
-$name ||= $Type;
-
my (@results, $checks_failure, $skip_create);
$skip_create = !$ARGS{'Create'};
@@ -406,7 +404,7 @@ if ( !$skip_create && $gnupg_widget ) {
}
unless ( $skip_create ) {
- if ( $Type eq 'Investigation' && !$ARGS{'Requestors'} ) {
+if ( $QueueObj->Lifecycle eq RT::IR->lifecycle_investigation && !$ARGS{'Requestors'} ) {
push @results, loc( "You must enter a correspondent" );
$checks_failure = 1;
}
@@ -460,14 +458,14 @@ unshift @results, loc("Creation failed:")
my ($Title, $SubmitCaption);
if ( $Split ) {
- $Title = loc("Split [_1] #[_2]: [_3]", $name, $SplitObj->id, $SplitObj->Subject);
+$Title = loc("Split [_1] #[_2]: [_3]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle), $SplitObj->id, $SplitObj->Subject);
$SubmitCaption = loc("Split");
} else {
- if ( $Type eq 'Investigation' ) {
- $Title = loc("Launch a new [_1]", $name);
+if ( $QueueObj->Lifecycle eq RT::IR->lifecycle_investigation ) {
+ $Title = loc("Launch a new investigation");
$SubmitCaption = loc("Launch");
} else {
- $Title = loc("Create a new [_1]", $name);
+ $Title = loc("Create a new [_1]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle));
$SubmitCaption = loc("Create");
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list