[Rt-commit] [rtir] 09/10: furtther refactoring to switch to lifecycle helpers
Jesse Vincent
jesse at bestpractical.com
Sat Feb 21 16:15:19 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 ecedd4443e58f7ed507fdae5adb41d95c022f604
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Sat Feb 21 13:02:47 2015 -0800
furtther refactoring to switch to lifecycle helpers
---
html/Callbacks/RTIR/Elements/MakeClicky/Default | 5 +++--
html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once | 3 ++-
html/Callbacks/RTIR/Elements/Tabs/Privileged | 8 ++++----
html/RTIR/Display.html | 7 +++++--
html/RTIR/Elements/ShowDates | 6 +++---
html/RTIR/Incident/BulkAbandon.html | 6 +++---
html/RTIR/Tools/Lookup.html | 2 +-
lib/RT/IR/Test/Web.pm | 2 +-
8 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/html/Callbacks/RTIR/Elements/MakeClicky/Default b/html/Callbacks/RTIR/Elements/MakeClicky/Default
index 53589a5..6f23050 100644
--- a/html/Callbacks/RTIR/Elements/MakeClicky/Default
+++ b/html/Callbacks/RTIR/Elements/MakeClicky/Default
@@ -107,7 +107,7 @@ my %actions;
my $result .= qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=ip&q=$escaped_host">}
.loc('lookup IP') .q{</a>]};
if ( $args{incident} && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
- $result .= qq{[<a href="$web_path/RTIR/Create.html?Incident=$args{incident}&Lifecycle=blocks&IP-Value=$escaped_host">block</a>]};
+ $result .= qq{[<a href="$web_path/RTIR/Create.html?Incident=$args{incident}&Lifecycle=}.RT::IR->lifecycle_countermeasure.qq{&IP-Value=$escaped_host">block</a>]};
}
if ( $args{'object'} && $args{'object'}->id ) {
my $cf = RT::IR::GetCustomField('IP');
@@ -153,7 +153,8 @@ my %actions;
$result .= qq{<input type="checkbox" name="Requestorbox-$escaped_email" unchecked />};
}
$result .= qq{[<a href="$web_path/RTIR/Create.html}
- . qq{?Incident=$args{'incident'}&Lifecycle=investigations&Requestors=$escaped_email">}
+ . qq{?Incident=$args{'incident'}&Lifecycle=}.RT::IR->lifecycle_investigation
+ . qq{&Requestors=$escaped_email">}
. loc('Investigate to') .qq{</a>]};
}
my $domain = (split /@/, $email, 2)[1];
diff --git a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
index 4395390..9d470e9 100644
--- a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
+++ b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
@@ -138,7 +138,8 @@ $COLUMN_MAP->{'LookupToolIncidentActions'} = {
;
}
push @res, \'<a href="',
- RT->Config->Get('WebPath') .'/RTIR/Create.html?Lifecycle=investigations&Incident='. $t->id,
+ RT->Config->Get('WebPath') .'/RTIR/Create.html?Lifecycle='.RT::IR->lifecycle_investigation
+ .'&Incident='. $t->id,
\'">',
'[' . $t->loc("Investigate") .']',
\'</a>'
diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 4d90a56..17c6229 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -103,18 +103,18 @@ $root->child(
);
$root->child(
investigations => title => loc('Investigations'),
- path => '/RTIR/Search/Results.html?Lifecycle=investigations'
+ path => '/RTIR/Search/Results.html?Lifecycle='.RT::IR->lifecycle_investigation
)->child(
launch => title => loc('Launch'),
- path => '/RTIR/Create.html?Lifecycle=investigations',
+ path => '/RTIR/Create.html?Lifecycle='.RT::IR->lifecycle_investigation,
);
unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
$root->child(
blocks => title => loc('Blocks'),
- path => '/RTIR/Search/Results.html?Lifecycle=blocks'
+ path => '/RTIR/Search/Results.html?Lifecycle='.RT::IR->lifecycle_countermeasure
)->child(
create => title => loc('Create'),
- path => '/RTIR/Create.html?Lifecycle=blocks',
+ path => '/RTIR/Create.html?Lifecycle='.RT::IR->lifecycle_countermeasure,
);
}
diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index c216102..d819b69 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -170,11 +170,14 @@ unless ( $id eq 'new' ) {
}
my $Type = RT::IR::TicketType( Lifecycle => $QueueObj->Lifecycle );
+# If it's not an RTIR ticket type, just show the regular RT ticket display page
return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
-if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+if ($QueueObj->Lifecycle eq RT::IR->lifecycle_countermeasure && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
Abort(loc("Blocks queue is disabled via config file"));
-}
+ }
+
+# If there's an RTIR specific display page for this kind of ticket, show that
if ( $m->comp_exists("/RTIR/$Type/Display.html") ) {
return $m->comp("/RTIR/$Type/Display.html", %ARGS);
}
diff --git a/html/RTIR/Elements/ShowDates b/html/RTIR/Elements/ShowDates
index 965d638..3dfcf4d 100644
--- a/html/RTIR/Elements/ShowDates
+++ b/html/RTIR/Elements/ShowDates
@@ -54,7 +54,7 @@
<td class="label"><&|/l&>Starts</&>:</td>
<td class="value"><% $Ticket->StartsObj->AsString %></td>
</tr>
-% if ( $Type =~ /^(Report|Investigation|Block)$/i ) {
+% if ( $lifecycle eq RT::IR->lifecycle_report || $lifecycle eq RT::IR->lifecycle_investigation || $lifecycle eq RT::IR->lifecycle_countermeasure) {
<tr>
<td class="label"><&|/l&>Started</&>:</td>
<td class="value"><% $Ticket->StartedObj->AsString %></td>
@@ -69,7 +69,7 @@
% } else {
<% $due->AsString %>
% }
-% if ( $Type ne 'Incident' && $Due ) {
+% if ( $lifecycle ne RT::IR->lifecycle_incident && $Due ) {
[<a href="Display.html?Due_Date=now%20%2B%20<% $Due |u %>%20days&id=<% $Ticket->Id %>"><% loc("Set to [_1] days from now", $Due ) %></a>]
% }
</td>
@@ -84,6 +84,6 @@
$Ticket => undef
</%ARGS>
<%INIT>
-my $Type = RT::IR::TicketType( Ticket => $Ticket );
+my $lifecycle = $Ticket->QueueObj->Lifecycle;
my $Due = ( $Ticket->QueueObj->DefaultDueIn || (RT->Config->Get('OverdueAfter')) || 7 ) ;
</%INIT>
diff --git a/html/RTIR/Incident/BulkAbandon.html b/html/RTIR/Incident/BulkAbandon.html
index ed087f4..561e972 100644
--- a/html/RTIR/Incident/BulkAbandon.html
+++ b/html/RTIR/Incident/BulkAbandon.html
@@ -58,9 +58,9 @@
<%PERL>
my $found = $m->comp('/RTIR/Search/Elements/ShowResults',
- Lifecycle => 'incidents',
+Lifecycle => RT::IR->lifecycle_incident,
BaseURL => 'RTIR/Incident/BulkAbandon.html',
- BaseQuery => RT::IR->ActiveQuery( Lifecycle => 'incidents' ),
+ BaseQuery => RT::IR->ActiveQuery( Lifecycle => RT::IR->lifecycle_incident ),
Query => $Query,
DisplayFormat => "__CheckBox__, $Format",
Format => $Format,
@@ -120,7 +120,7 @@ if ( $ARGS{'BulkAbandon'} ) {
}
$id = $t->id;
- unless( $t->QueueObj->Lifecycle eq 'incidents' ) {
+ unless( $t->QueueObj->Lifecycle eq RT::IR->lifecycle_incident ) {
push @tempresults, [ $id, loc("Is not incident.") ];
next;
}
diff --git a/html/RTIR/Tools/Lookup.html b/html/RTIR/Tools/Lookup.html
index 5b3c736..a5d7aa9 100644
--- a/html/RTIR/Tools/Lookup.html
+++ b/html/RTIR/Tools/Lookup.html
@@ -76,7 +76,7 @@ if ( $ARGS{'InvestigateTo'} ) {
return RT::Interface::Web::Redirect(
RT->Config->Get('WebURL')."RTIR/Create.html?"
. $m->comp('/Elements/QueryString',
- Lifecycle => 'investigations',
+ Lifecycle => RT::IR->lifecycle_investigation,
Requestors => $requestors,
Incident => $ARGS{'incidentid'},
)
diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 8b15ab1..314657c 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -78,7 +78,7 @@ sub goto_create_rtir_ticket {
my $lifecycle = lc( $queue);
$lifecycle =~ s/ /_/;
my $link_text = "Create";
- $link_text = "Launch" if $lifecycle eq 'investigations';
+ $link_text = "Launch" if $lifecycle eq RT::IR->lifecycle_investigation;
$self->get_ok("/RTIR/index.html", "Loaded home page");
$self->follow_link_ok(
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list