[Rt-commit] r2975 - in rt/branches/CHALDEA-EXPERIMENTAL: . etc etc/upgrade/QUEBEC html/Elements html/NoAuth html/Ticket html/Ticket/Elements lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Mon May 30 00:50:02 EDT 2005


Author: jesse
Date: Mon May 30 00:50:01 2005
New Revision: 2975

Added:
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/MyReminders   (contents, props changed)
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Reminders.html   (contents, props changed)
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm
Removed:
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowMemberOf
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowReferences
Modified:
   rt/branches/CHALDEA-EXPERIMENTAL/   (props changed)
   rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/CHALDEA-EXPERIMENTAL/etc/initialdata
   rt/branches/CHALDEA-EXPERIMENTAL/etc/upgrade/QUEBEC/content
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditLinks
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowLinks
   rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary
   rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Tabs
Log:
 r17983 at hualien:  jesse | 2005-05-30 00:42:04 -0400
 * First cut implementation of Reminders
 


Modified: rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/etc/RT_Config.pm.in	Mon May 30 00:50:01 2005
@@ -385,7 +385,7 @@
 
 # $MaxInlineBody is an arrayref of allowed components customized homepage.
 
-Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues RefreshHomepage)]);
+Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders  RefreshHomepage)]);
 
 # @MasonParameters is the list of parameters for the constructor of
 # HTML::Mason's Apache or CGI Handler.  This is normally only useful

Modified: rt/branches/CHALDEA-EXPERIMENTAL/etc/initialdata
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/etc/initialdata	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/etc/initialdata	Mon May 30 00:50:01 2005
@@ -615,9 +615,9 @@
 	  { type => 'component',  name => 'QuickCreate'},
 	],
         'summary' => # loc
-	[ { type => 'component', name => 'Quicksearch' },
-	  { type => 'component', name => 'MySupportQueues' },
-	  { type => 'component', name => 'MyAdminQueues' },
+	[ 
+	  { type => 'component', name => 'MyReminders' },
+          { type => 'component', name => 'Quicksearch' },
 	  { type => 'component', name => 'RefreshHomepage' },
 	]
     },

Modified: rt/branches/CHALDEA-EXPERIMENTAL/etc/upgrade/QUEBEC/content
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/etc/upgrade/QUEBEC/content	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/etc/upgrade/QUEBEC/content	Mon May 30 00:50:01 2005
@@ -24,9 +24,9 @@
 	  { type => 'component',  name => 'QuickCreate'},
 	],
         'summary' =>
-	[ { type => 'component', name => 'Quicksearch' },
-	  { type => 'component', name => 'MySupportQueues' },
-	  { type => 'component', name => 'MyAdminQueues' },
+	[ 
+	  { type => 'component', name => 'MyReminders' },
+          { type => 'component', name => 'Quicksearch' },
 	  { type => 'component', name => 'RefreshHomepage' },
 	]
     },

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditLinks
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditLinks	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditLinks	Mon May 30 00:50:01 2005
@@ -103,6 +103,8 @@
     <td class="labeltop"><&|/l&>Referred to by</&>:</td>
     <td class="value">
 % while (my $link = $Object->ReferredToBy->Next) {
+% # Skip reminders
+% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
       <INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1">
         <& ShowLink, URI => $link->BaseURI &><br>
 % }

Added: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/MyReminders
==============================================================================
--- (empty file)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/MyReminders	Mon May 30 00:50:01 2005
@@ -0,0 +1,72 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
+%#                                          <jesse 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%# 
+%# 
+%# 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 }}}
+
+%# DEPRECATED
+<&|/Elements/TitleBox,
+    title => loc("Reminders") &>
+<table width="100%">
+% my $i =0;
+% while (my $reminder = $reminders->Next) {
+% $i++;
+% if ($reminder->RefersTo->First) {
+% my $ticket= $reminder->RefersTo->First->TargetObj;
+<tr class="<%$i%2 ? 'evenline' : 'oddline'%>"><td><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$ticket->id%>"><%$reminder->Subject%></a><br />
+<blockquote>
+#<%$ticket->id%>: <%$ticket->Subject%><br />
+<%$reminder->OwnerObj->Name %>  <%$reminder->DueObj->Unix >0 ? '&bull; '.$reminder->DueObj->AgeAsString : '' |n %>
+</blockquote>
+</td>
+</tr>
+% }}
+</table>
+</&>
+
+<%init>
+my $reminders = RT::Tickets->new($session{'CurrentUser'});
+$reminders->FromSQL('(Owner = "Nobody" OR Owner = "'.$session{'CurrentUser'}->Name.'")' .
+    ' AND Type = "reminder" AND (Status = "new" OR Status = "open") AND Due > "1970-01-01"'); 
+$reminders->OrderBy(FIELD => 'Due', ORDER => 'DESC');
+</%init>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowLinks
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowLinks	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/ShowLinks	Mon May 30 00:50:01 2005
@@ -93,6 +93,7 @@
     <td class="value">
     <ul>
 % while (my $Link = $Ticket->ReferredToBy->Next) {
+% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
 <li><& ShowLink, URI => $Link->BaseURI &>
 % }
 </ul>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css	Mon May 30 00:50:01 2005
@@ -629,6 +629,22 @@
 }
 
 
+div.horizontal {
+        float: left;
+        display: block;
+        margin: 0.5em;
+
+}
+
+
+label.horizontal {
+        display: block;
+        margin: 0;
+
+}
+
+
+
 %# Provide a callback for adding/modifying the style sheet.
 %# http://www.w3.org/TR/REC-CSS1 - section 3.2, says:
 %#   "latter specified rule wins"

Added: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders
==============================================================================
--- (empty file)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Reminders	Mon May 30 00:50:01 2005
@@ -0,0 +1,99 @@
+<%args>
+$Ticket => undef
+$id => undef
+$ShowCompleted => 0
+</%args>
+<%init>
+
+$Ticket = LoadTicket($id) if ($id);
+
+my $request_args = $m->request_args();
+
+
+my $reminder_collection = $Ticket->Reminders->Collection;
+
+while (my $reminder = $reminder_collection->Next) {
+    # If they've just checked the box, make sure we resolve it
+   if ($reminder->Status ne 'resolved'   
+       && $request_args->{'Complete-Reminder-'.$reminder->id}) {
+        $reminder->SetStatus('resolved');
+   }
+   elsif ($reminder->Status eq 'resolved' && ! $request_args->{'Complete-Reminder-'.$reminder->id}) {
+           $reminder->SetStatus('open');
+              }
+
+}
+
+
+foreach my $arg (keys %$request_args) {
+    if ($arg =~ /Complete-Reminder-(\d+)$/) {
+        my $reminder = LoadTicket($1);
+    }
+
+
+}
+
+
+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 ( $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" name="id" value="<%$Ticket->id%>">
+% while (my $reminder = $reminder_collection->Next) {
+% next if ($reminder->Status eq 'resolved' && !$ShowCompleted);
+<& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &>
+% }
+<br />
+<br />
+<&|/l&>New reminder:</&><br />
+<& SELF:NewReminder, Ticket => $Ticket &>
+
+<%method NewReminder>
+<%args>
+$Ticket
+</%args>
+
+<div class="horizontal">
+<label class="horizontal" for="NewReminder-Subject" ><&|/l&>Subject</&>:</label> 
+<input type="text" size="15" name="NewReminder-Subject">
+</div>
+<div class="horizontal">
+<label class="horizontal" for="NewReminder-Owner" ><&|/l&>Owner</&>:</label> 
+<& /Elements/SelectOwner, Name => 'NewReminder-Owner', Queue => $Ticket->QueueObj &>
+</div>
+<div class="horizontal">
+<label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</&>:</label> 
+<input type="text" size="10" name="NewReminder-Due">
+</div>
+</%method>
+
+<%method ShowEntry>
+<%args>
+$Reminder
+</%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>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/ShowSummary	Mon May 30 00:50:01 2005
@@ -69,10 +69,23 @@
 		color => "#333399" &>
 	  <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
 	  <& /Elements/TitleBoxEnd &>
-	<BR>
+	<BR/>
+	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &>
+
+	  <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
+
 	</TD>
 	<TD VALIGN=TOP WIDTH="50%" class="boxcontainer">
-
+	  <&|/Elements/TitleBox, title => loc("Reminders"),
+		title_href =>"$RT::WebPath/Ticket/Reminders.html?id=".$Ticket->Id, 
+		title_class=> 'inverse',  
+		 color => "#666699" &>
+            <form action="<%$RT::WebPath%>/Ticket/Display.html" method="post">
+	  <& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
+        <div align="right"><input type="submit" value="Save" /></div>
+        </form>
+	  </&>
+        <br />
 	  <& /Elements/TitleBoxStart, title => loc("Dates"),
 		title_href =>"$RT::WebPath/Ticket/ModifyDates.html?id=".$Ticket->Id, 
 		title_class=> 'inverse',  
@@ -86,11 +99,7 @@
 		titleright => '', color=> "#336633" &>
 	        <& /Elements/ShowLinks, Ticket => $Ticket &>
 	<& /Elements/TitleBoxEnd &>
-        <BR>
-	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &>
-
-	  <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
-
+        <br />
 
 	</TD>
       </TR>

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Tabs
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Tabs	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Elements/Tabs	Mon May 30 00:50:01 2005
@@ -119,7 +119,9 @@
       { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
     _E => { title => loc('Links'),
             path  => "Ticket/ModifyLinks.html?id=" . $id, },
-    _F => { title => loc('Jumbo'),
+    _F => { title => loc('Reminders'),
+            path  => "Ticket/Reminders.html?id=" . $id, },
+    _X => { title => loc('Jumbo'),
             path  => "Ticket/ModifyAll.html?id=" . $id,
             separator => 1
  },

Added: rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Reminders.html
==============================================================================
--- (empty file)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Ticket/Reminders.html	Mon May 30 00:50:01 2005
@@ -0,0 +1,69 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
+%#                                          <jesse 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%# 
+%# 
+%# 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 }}}
+<& /Elements/Header, Title => loc("Reminder ticket #[_1]", $Ticket->Id) &>
+<& /Ticket/Elements/Tabs, 
+    Ticket => $Ticket, 
+    current_tab => "Ticket/Reminders.html?id=".$Ticket->Id, 
+    Title => loc("Reminders for ticket #[_1]", $Ticket->Id) &>
+<form action="<%$RT::WebPath%>/Ticket/Reminders.html" method="post">
+<&|/Elements/TitleBox, title => loc("Reminders"),
+                       title_class=> 'inverse',
+                       color => "#666699" &>
+
+<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 1 &>
+</&>
+<& /Elements/Submit, Label => 'Save'&>
+</form>
+
+
+<%INIT>
+  
+my $Ticket = LoadTicket($id);
+    
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>

Added: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm
==============================================================================
--- (empty file)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Reminders.pm	Mon May 30 00:50:01 2005
@@ -0,0 +1,95 @@
+package RT::Reminders;
+
+use base qw/RT::Base/;
+
+our $REMINDER_QUEUE = 'General';
+
+
+sub new {
+    my $class = shift;
+    my $self = {};
+    bless $self, $class;
+    $self->CurrentUser(@_);
+    return($self);
+}
+
+
+sub Ticket {
+    my $self = shift;
+    $self->{'_ticket'} = shift if (@_);
+    return ($self->{'_ticket'});
+}
+
+sub TicketObj {
+    my $self = shift;
+    unless ($self->{'_ticketobj'}) {
+        $self->{'_ticketobj'} = RT::Ticket->new($self->CurrentUser);
+        $self->{'_ticketobj'}->Load($self->Ticket);
+    }
+        return $self->{'_ticketobj'};
+}
+
+
+=head2 Collection
+
+Returns an RT::Tickets object containing reminders for this object's "Ticket"
+
+=cut
+
+sub Collection {
+    my $self = shift;
+    my $col = RT::Tickets->new($self->CurrentUser);
+
+     my $query =     'Queue = "'. $self->TicketObj->QueueObj->Name .'" AND Type = "reminder"';
+    $query .= ' AND RefersTo = "'.$self->Ticket.'"';
+   
+    $col->FromSQL($query);
+    
+    return($col);
+}
+
+=head2 Add
+
+Add a reminder for this ticket.
+
+Takes
+
+    Subject
+    Owner
+    Due
+
+
+=cut
+
+
+sub Add {
+    my $self = shift;
+    my %args = ( Subject => undef,
+                 Owner => undef,
+                 Due => undef,
+                 @_);
+
+    my $reminder = RT::Ticket->new($self->CurrentUser);
+    $reminder->Create( Subject => $args{'Subject'},
+                       Owner => $args{'Owner'},
+                       Due => $args{'Due'},
+                       RefersTo => $self->Ticket,
+                       Type => 'reminder',
+                       Queue => $self->TicketObj->Queue,
+                   
+                   );
+
+}
+
+    eval "require RT::Reminders_Vendor";
+        if ($@ && $@ !~ qr{^Can't locate RT/Reminders_Vendor.pm}) {
+            die $@;
+        };
+
+        eval "require RT::Reminders_Local";
+        if ($@ && $@ !~ qr{^Can't locate RT/Reminders_Local.pm}) {
+            die $@;
+        };
+
+
+1;


More information about the Rt-commit mailing list