[Rt-commit] [rtir] 01/01: popup select queue for ticket create proof of concept
Dustin Graves
dustin at bestpractical.com
Fri Feb 26 19:30:45 EST 2016
This is an automated email from the git hooks/post-receive script.
dustin pushed a commit to branch 3.4/popup-ticket-create
in repository rtir.
commit 23279793d66125d0da7eab06c356d3f8a6f482e8
Author: Dustin Graves <dustin at bestpractical.com>
Date: Sat Feb 27 00:28:52 2016 +0000
popup select queue for ticket create proof of concept
---
html/RTIR/Elements/CreateInRTIRQueueModal | 70 +++++++++++++++++++++
html/RTIR/Elements/CreateInRTIRQueueModalIncidents | 72 ++++++++++++++++++++++
html/RTIR/Helpers/CreateInRTIRQueueModal | 49 +++++++++++++++
html/RTIR/Helpers/CreateInRTIRQueueModalIncidents | 49 +++++++++++++++
html/RTIR/Incident/Create.html | 1 +
html/RTIR/Incident/Elements/ShowChildren | 3 +-
lib/RT/IR.pm | 1 +
static/js/rtir.js | 62 +++++++++++++++++++
8 files changed, 306 insertions(+), 1 deletion(-)
diff --git a/html/RTIR/Elements/CreateInRTIRQueueModal b/html/RTIR/Elements/CreateInRTIRQueueModal
new file mode 100644
index 0000000..cf98050
--- /dev/null
+++ b/html/RTIR/Elements/CreateInRTIRQueueModal
@@ -0,0 +1,70 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ARGS>
+$Lifecycle
+$LifecycleDesc => $Lifecycle
+$Incident => undef
+</%ARGS>
+<%INIT>
+$Lifecycle = $Lifecycle->[0] if (ref $Lifecycle eq 'ARRAY');
+</%INIT>
+<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
+% if ($Incident) {
+<input type="hidden" name="Incident" value="<%$Incident%>"/>
+% }
+ <&|/l_unsafe, $LifecycleDesc,
+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
+ Name => 'Queue',
+ Lifecycle => $Lifecycle,
+ #%ARGS,
+ ShowNullOption => 0,
+ LimitToConstituency => $m->{'RTIR_ConstituencyFilter'} ? 1:0,
+ Constituency => $m->{'RTIR_ConstituencyFilter'})
+ &>Create a new [_1] in the queue [_2]</&>
+ <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $LifecycleDesc) &>
+</form>
diff --git a/html/RTIR/Elements/CreateInRTIRQueueModalIncidents b/html/RTIR/Elements/CreateInRTIRQueueModalIncidents
new file mode 100644
index 0000000..2dcf91a
--- /dev/null
+++ b/html/RTIR/Elements/CreateInRTIRQueueModalIncidents
@@ -0,0 +1,72 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ARGS>
+$Child => undef
+</%ARGS>
+<%INIT>
+</%INIT>
+<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
+% if ($Child) {
+<input type="hidden" name="Child" value="<%$Child%>"/>
+% }
+ <&|/l_unsafe,
+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
+ Name => 'Queue',
+ Lifecycle => 'incidents',
+ ShowNullOption => 0,
+ LimitToConstituency => $m->{'RTIR_ConstituencyFilter'} ? 1:0,
+ Constituency => $m->{'RTIR_ConstituencyFilter'}),
+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
+ Name => 'InvestigationQueue',
+ Lifecycle => 'investigations',
+ ShowNullOption => 0,
+ LimitToConstituency => $m->{'RTIR_ConstituencyFilter'} ? 1:0,
+ Constituency => $m->{'RTIR_ConstituencyFilter'}),
+ &>Create a new incident in the queue [_1] with investigations queue [_2]</&>
+ <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled incident creation form.") &>
+</form>
diff --git a/html/RTIR/Helpers/CreateInRTIRQueueModal b/html/RTIR/Helpers/CreateInRTIRQueueModal
new file mode 100644
index 0000000..39ef32a
--- /dev/null
+++ b/html/RTIR/Helpers/CreateInRTIRQueueModal
@@ -0,0 +1,49 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /RTIR/Elements/CreateInRTIRQueueModal, %ARGS &>
+% $m->abort;
diff --git a/html/RTIR/Helpers/CreateInRTIRQueueModalIncidents b/html/RTIR/Helpers/CreateInRTIRQueueModalIncidents
new file mode 100644
index 0000000..480367d
--- /dev/null
+++ b/html/RTIR/Helpers/CreateInRTIRQueueModalIncidents
@@ -0,0 +1,49 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /RTIR/Elements/CreateInRTIRQueueModalIncidents, %ARGS &>
+% $m->abort;
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 3494189..406d3cb 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -270,6 +270,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
<& /RTIR/Investigation/Elements/Create,
%ARGS,
NamePrefix => 'Investigation',
+ Queue => $ARGS{InvestigationQueue},
Lifecycle => RT::IR->lifecycle_investigation,
Constituency => $constituency,
SkipField => { Owner => 1, Attachments => 1, DateFields => 1 },
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index 6402c72..fe6b278 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -115,6 +115,7 @@ if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
# $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
push @box_actions, {
title => $Lifecycle ne RT::IR->lifecycle_investigation? loc('Create') : loc('Launch'),
+ class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
path => RT::IR->HREFTo("Create.html?Incident=$id&Lifecycle=".$Lifecycle),
};
}
@@ -131,7 +132,7 @@ if ( $total_count > $Rows ) {
};
}
my $box_actions = join ' 'x3,
- map qq{<a href="}. $_->{'path'} .q{">}
+ map q{<a href="} . $_->{'path'} . ( $_->{'class'} ? q{" class="} . $_->{'class'} : '' ) . q{">}
. $m->interp->apply_escapes( $_->{title}, 'h' ) . q{</a>},
@box_actions;
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index c03f5cf..29b3b5f 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -132,6 +132,7 @@ use Parse::BooleanLogic;
my $ticket_sql_parser = Parse::BooleanLogic->new;
RT->AddJavaScript('jquery.uncheckable-radio-0.1.js');
+RT->AddJavaScript('rtir.js');
RT->AddStyleSheets( 'rtir-styles.css' );
# Add the RTIR search result page to the whitelist to allow
diff --git a/static/js/rtir.js b/static/js/rtir.js
new file mode 100644
index 0000000..1baf9cf
--- /dev/null
+++ b/static/js/rtir.js
@@ -0,0 +1,62 @@
+jQuery(function() {
+ var showModal = function(html) {
+ jQuery("<div class='modal'></div>")
+ .append(html).appendTo("body")
+ .bind('modal:close', function(ev,modal) { modal.elm.remove(); })
+ .modal();
+ };
+
+ var getQueryString = function(element) {
+ var href = jQuery(element).attr('href');
+ if (!href) return '';
+ var questionMarkIndex = href.indexOf('?');
+ if (!questionMarkIndex) return '';
+ return href.substring(questionMarkIndex+1);
+ };
+
+ var showReportsModal = function(e) {
+ e.preventDefault();
+ var queryString = getQueryString(this);
+ jQuery.get(
+ RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incident_reports&LifecycleDesc=report&' + queryString,
+ showModal
+ );
+ };
+
+ var showInvestigationsModal = function(e) {
+ e.preventDefault();
+ var queryString = getQueryString(this);
+ jQuery.get(
+ RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=investigations&LifecycleDesc=investigation&' + queryString,
+ showModal
+ );
+ };
+
+ var showBlocksModal = function(e) {
+ e.preventDefault();
+ var queryString = getQueryString(this);
+ jQuery.get(
+ RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=blocks&LifecycleDesc=block&' + queryString,
+ showModal
+ );
+ };
+
+ var showIncidentsModal = function(e) {
+ e.preventDefault();
+ var queryString = getQueryString(this);
+ jQuery.get(
+ RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModalIncidents?' + queryString,
+ showModal
+ );
+ };
+
+ jQuery("#reports-create").click(showReportsModal);
+ jQuery("#investigations-launch").click(showInvestigationsModal);
+ jQuery("#blocks-create").click(showBlocksModal);
+ jQuery("#incidents-create").click(showIncidentsModal);
+ jQuery("#create-incident").click(showIncidentsModal);
+
+ jQuery(".create_child_incident_reports").click(showReportsModal);
+ jQuery(".create_child_investigations").click(showInvestigationsModal);
+ jQuery(".create_child_blocks").click(showBlocksModal);
+});
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list