summaryrefslogtreecommitdiff
path: root/rt/html/Ticket/Elements/Reminders
diff options
context:
space:
mode:
Diffstat (limited to 'rt/html/Ticket/Elements/Reminders')
-rw-r--r--rt/html/Ticket/Elements/Reminders168
1 files changed, 168 insertions, 0 deletions
diff --git a/rt/html/Ticket/Elements/Reminders b/rt/html/Ticket/Elements/Reminders
new file mode 100644
index 000000000..63d68c7b1
--- /dev/null
+++ b/rt/html/Ticket/Elements/Reminders
@@ -0,0 +1,168 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+%# <jesse@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/copyleft/gpl.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>
+$Ticket => undef
+$id => undef
+$ShowCompleted => 0
+$Edit => 0
+</%args>
+<%init>
+
+$Ticket = LoadTicket($id) if ($id);
+
+my $request_args = $m->request_args();
+
+my $reminder_collection = $Ticket->Reminders->Collection;
+
+if ( $request_args->{'update-reminders'} ) {
+ while ( my $reminder = $reminder_collection->Next ) {
+ if ( $reminder->Status ne 'resolved' && $request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
+ $Ticket->Reminders->Resolve($reminder);
+ }
+ elsif ( $reminder->Status eq 'resolved' && !$request_args->{ 'Complete-Reminder-' . $reminder->id } ) {
+ $Ticket->Reminders->Open($reminder);
+ }
+
+ if ( exists( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) && ( $reminder->Subject ne $request_args->{ 'Reminder-Subject-' . $reminder->id } )) {
+ $reminder->SetSubject( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) ;
+ }
+
+ if ( exists( $request_args->{ 'Reminder-Owner-' . $reminder->id } ) && ( $reminder->Owner != $request_args->{ 'Reminder-Owner-' . $reminder->id } )) {
+ $reminder->SetOwner( $request_args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
+ }
+
+ if ( exists( $request_args->{ 'Reminder-Due-' . $reminder->id } ) && ( $reminder->DueObj->Date ne $request_args->{ 'Reminder-Due-' . $reminder->id } )) {
+ $reminder->SetDue( $request_args->{ 'Reminder-Due-' . $reminder->id } ) ;
+ }
+ }
+}
+
+if ( $request_args->{'NewReminder-Subject'} ) {
+ my $due_obj = RT::Date->new( $session{'CurrentUser'} );
+ my $date = Time::ParseDate::parsedate(
+ $request_args->{'NewReminder-Due'},
+ UK => $RT::DateDayBeforeMonth,
+ PREFER_PAST => 0,
+ PREFER_FUTURE => 1
+ );
+ $due_obj->Set( Value => $date, Format => 'unix' );
+ my ( $add_id, $msg, $txnid ) = $Ticket->Reminders->Add(
+
+ Subject => $request_args->{'NewReminder-Subject'},
+ Owner => $request_args->{'NewReminder-Owner'},
+ Due => $due_obj->ISO
+ );
+}
+
+# We've made changes, let's reload our search
+
+$reminder_collection = $Ticket->Reminders->Collection;
+</%init>
+<input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+<input type="hidden" class="hidden" name="update-reminders" value="1" />
+<div>
+% while (my $reminder = $reminder_collection->Next) {
+% if ($reminder->Status eq 'resolved' && !$ShowCompleted) {
+<input type="hidden" class="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" />
+% } elsif ($Edit) {
+<& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket &>
+% } else {
+<& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &>
+% }
+% }
+</div>
+<div>
+<h3><&|/l&>New reminder:</&></h3>
+<& SELF:NewReminder, Ticket => $Ticket &>
+<%method NewReminder>
+<%args>
+$Ticket
+</%args>
+<div class="input-row">
+<label class="horizontal" for="NewReminder-Subject" ><&|/l&>Subject</&>:</label>
+<input type="text" size="15" name="NewReminder-Subject" />
+</div>
+<div class="input-row">
+<label class="horizontal" for="NewReminder-Owner" ><&|/l&>Owner</&>:</label>
+<& /Elements/SelectOwner, Name => 'NewReminder-Owner', QueueObj => $Ticket->QueueObj, DefaultValue => 0 &>
+</div>
+<div class="input-row">
+<label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</&> <&|/l&>(yyyy/mm/dd)</&>:</label>
+<& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &>
+</div>
+</div>
+</%method>
+<%method EditEntry>
+<%args>
+$Reminder
+$Ticket
+</%args>
+<input
+ type="checkbox"
+ name="Complete-Reminder-<%$Reminder->id%>"
+ <% $Reminder->Status eq 'resolved' ? 'CHECKED' : '' %>
+/>
+ <input type="text" size="15" name="Reminder-Subject-<% $Reminder->id %>" value="<%$Reminder->Subject%>" /> &bull;
+ <& /Elements/SelectOwner, Name => 'Reminder-Owner-'.$Reminder->id, Queue => $Ticket->QueueObj, Default => $Reminder->Owner, DefaultValue => 0 &>
+ <& /Elements/SelectDate, Name => 'Reminder-Due-'.$Reminder->id, Default => $Reminder->DueObj->Date &>
+ (<%$Reminder->DueObj->Unix>0 ? $Reminder->DueObj->AgeAsString : '' %>)<br />
+</%method>
+<%method ShowEntry>
+<%args>
+$Reminder
+$Ticket
+</%args>
+<input
+ type="checkbox"
+ name="Complete-Reminder-<%$Reminder->id%>"
+ <% $Reminder->Status eq 'resolved' ? 'CHECKED' : '' %>
+/>
+ <%$Reminder->Subject%> &bull;
+ <%$Reminder->OwnerObj->Name%>
+ <%$Reminder->DueObj->Unix>0 ? "&bull; ". $Reminder->DueObj->AgeAsString : '' |n%><br />
+</%method>