[Rt-commit] r3376 - in rt/branches/3.5-TESTING: . bin html
html/Elements html/Ticket html/Ticket/Elements lib/RT
jesse at bestpractical.com
jesse at bestpractical.com
Sun Jul 3 19:00:46 EDT 2005
Author: jesse
Date: Sun Jul 3 19:00:45 2005
New Revision: 3376
Added:
rt/branches/3.5-TESTING/html/CalPopup.html
rt/branches/3.5-TESTING/html/rt.js
Modified:
rt/branches/3.5-TESTING/ (props changed)
rt/branches/3.5-TESTING/bin/webmux.pl.in
rt/branches/3.5-TESTING/html/Elements/Header
rt/branches/3.5-TESTING/html/Elements/SelectDate
rt/branches/3.5-TESTING/html/Ticket/Create.html
rt/branches/3.5-TESTING/html/Ticket/Elements/Reminders
rt/branches/3.5-TESTING/html/Ticket/Reminders.html
rt/branches/3.5-TESTING/lib/RT/Date.pm
rt/branches/3.5-TESTING/lib/RT/Reminders.pm
Log:
r22230 at hualien: jesse | 2005-07-03 18:25:54 -0400
r22155 at hualien: jesse | 2005-07-03 17:56:30 -0400
r22026 at hualien (orig r3268): alexmv | 2005-07-01 00:29:51 -0400
r22027 at hualien (orig r3269): alexmv | 2005-07-01 00:29:58 -0400
r22032 at hualien (orig r3274): alexmv | 2005-07-01 14:48:21 -0400
r4600 at zoq-fot-pik: chmrr | 2005-07-01 14:53:11 -0400
* Revert 3268
r22035 at hualien (orig r3277): alexmv | 2005-07-01 16:12:56 -0400
r4602 at zoq-fot-pik: chmrr | 2005-07-01 16:17:13 -0400
* Fix syntax error in html/Ticket/Elements/Reminders
* Fix missing 'Obj' on TicketObj in lib/RT/Reminders.pm
* Move JS into separate file
* Calendar popups
r22036 at hualien (orig r3278): alexmv | 2005-07-01 18:53:15 -0400
r4606 at zoq-fot-pik: chmrr | 2005-07-01 18:57:33 -0400
* Editing of Reminders
* RT::Date has ->Date and ->Time methods now
* Calendar popup is always yyyy-mm-dd
Modified: rt/branches/3.5-TESTING/bin/webmux.pl.in
==============================================================================
--- rt/branches/3.5-TESTING/bin/webmux.pl.in (original)
+++ rt/branches/3.5-TESTING/bin/webmux.pl.in Sun Jul 3 19:00:45 2005
@@ -115,7 +115,7 @@
$r->filename( File::Spec::Unix->catfile( $r->filename, 'index.html' ) );
}
elsif (defined( $r->content_type )) {
- $r->content_type =~ m!(^text/|\bxml\b)!i or return -1;
+ $r->content_type =~ m!(^text/|\bxml\b|\bjavascript\b)!i or return -1;
}
Module::Refresh->refresh if $RT::DevelMode;
Added: rt/branches/3.5-TESTING/html/CalPopup.html
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/CalPopup.html Sun Jul 3 19:00:45 2005
@@ -0,0 +1,83 @@
+<& /Elements/Header &>
+<script>
+function updateParent(strItem) {
+ window.opener.document.getElementById('<%$field%>').value = strItem;
+ window.close();
+}
+</script>
+<a href="javascript: window.close();">close window</a>
+<br><br>
+<div align="center">
+<div class="table-wrapper">
+<table>
+ <caption><%$months[$DisplayedMonth]%> <%$DisplayedYear%></caption>
+ <tr>
+% foreach my $wday (@weekdays) {
+ <th><%$wday%></th>
+% }
+ </tr>
+% foreach my $week (@cal) {
+ <tr>
+% foreach my $day (@{$week}) {
+ <td>
+% if ($day) {
+% my $datestr = sprintf('%04d-%02d-%02d', $DisplayedYear, $DisplayedMonth+1, $day);
+ <dt><a href="javascript: updateParent('<%$datestr%>')"><%$day%></a></dt>
+% }
+ </td>
+% } #foreach $day
+ </tr>
+% } # foreach $week
+ <tr>
+ <td colspan="2"><a href="CalPopup.html?DisplayedMonth=<%$prev_month%>&DisplayedYear=<%$prev_year%>&field=<%$field%>">Previous</a></td>
+ <td colspan="3"> </td>
+ <td colspan="2"><a href="CalPopup.html?DisplayedMonth=<%$next_month%>&DisplayedYear=<%$next_year%>&field=<%$field%>">Next</a></td>
+</table>
+</div>
+</div>
+
+<%init>
+use Calendar::Simple;
+my @today = localtime(time());
+
+my @weekdays = (loc('Sun'), loc('Mon'), loc('Tue'), loc('Wed'), loc('Thu'),
+ loc('Fri'), loc('Sat'));
+my @months = (loc('January'), loc('February'), loc('March'), loc('April'),
+ loc('May'), loc('June'), loc('July'), loc('August'),
+ loc('September'), loc('October'), loc('November'),
+ loc('December'));
+
+unless ($DisplayedYear) {
+ $DisplayedMonth = $today[4];
+ $DisplayedYear = ($today[5] + 1900);
+}
+
+my ($prev_year, $next_year, $prev_month, $next_month);
+$prev_month = $next_month = $DisplayedMonth;
+$prev_year = $next_year = $DisplayedYear;
+
+$next_month++;
+$prev_month--;
+
+if ($DisplayedMonth == 11) {
+ $next_year++;
+ $next_month = 0;
+ }
+elsif ($DisplayedMonth == 0) {
+ $prev_month = 11;
+ $prev_year--;
+
+
+ }
+
+
+
+
+my @cal = calendar($DisplayedMonth, $DisplayedYear);
+
+</%init>
+<%args>
+$field => 'none'
+$DisplayedMonth => undef
+$DisplayedYear => undef
+</%args>
Modified: rt/branches/3.5-TESTING/html/Elements/Header
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/Header (original)
+++ rt/branches/3.5-TESTING/html/Elements/Header Sun Jul 3 19:00:45 2005
@@ -53,21 +53,9 @@
% if ($Refresh > 0) {
<meta http-equiv="refresh" content="<%$Refresh%>" />
% }
- <link rel="shortcut icon" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
- <link type="text/css" rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/css/main.css" />
- <script>
- function hideshow(num) {
- var idstring = "element-" + num;
- var chunk = document.getElementById(idstring);
- if ( chunk.style.display == "none") {
- chunk.style.display = chunk.style.tag;
- } else {
- chunk.style.tag = chunk.style.display;
- chunk.style.display = "none";
- }
- return false;
- }
- </script>
+<link rel="shortcut icon" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
+<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css">
+<script type="text/javascript" src="<%$RT::WebPath%>/rt.js"></script>
<& /Elements/Callback, _CallbackName => 'Head', %ARGS &>
</head>
<body
Modified: rt/branches/3.5-TESTING/html/Elements/SelectDate
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/SelectDate (original)
+++ rt/branches/3.5-TESTING/html/Elements/SelectDate Sun Jul 3 19:00:45 2005
@@ -43,7 +43,14 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<input name="<%$Name%>" value="<%$Default%>" size=<%$Size%>>
+<input type="text" id="<% $Name %>" name="<% $Name %>" value="<% $Default %>" size="<% $Size %>">
+<script language="javascript" type="text/javascript">
+<!--
+document.write('<a href="javascript:');
+document.write("openCalWindow('<% $Name %>');");
+document.write('">pick</a>');
+// -->
+</script>
<%init>
unless ((defined $Default) or
Modified: rt/branches/3.5-TESTING/html/Ticket/Create.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Create.html (original)
+++ rt/branches/3.5-TESTING/html/Ticket/Create.html Sun Jul 3 19:00:45 2005
@@ -207,13 +207,12 @@
title_class=> 'inverse',
color => "#663366" &>
-<table border="0">
-<tr><td align="RIGHT"><&|/l&>Starts</&>:</td><td><input size="10" name="Starts" value="<% $ARGS{Starts} %>"></td></tr>
-<tr><td align="RIGHT"><&|/l&>Due</&>:</td><td><input size="10" name="Due" value="<%
-$ARGS{Due}%>"></td></tr>
+<table>
+<tr><td class="label"><&|/l&>Starts</&>:</td><td><& /Elements/SelectDate, Name => "Starts", Value => $ARGS{Starts}, Default => '' &></td></tr>
+<tr><td class="label"><&|/l&>Due</&>:</td><td><& /Elements/SelectDate, Name => "Due", Value => $ARGS{Due}, Default => '' &></td></tr>
</table>
</&>
-<br/>
+<br />
</td>
<td valign="TOP">
Modified: rt/branches/3.5-TESTING/html/Ticket/Elements/Reminders
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Elements/Reminders (original)
+++ rt/branches/3.5-TESTING/html/Ticket/Elements/Reminders Sun Jul 3 19:00:45 2005
@@ -2,6 +2,7 @@
$Ticket => undef
$id => undef
$ShowCompleted => 0
+$Edit => 0
</%args>
<%init>
@@ -14,12 +15,21 @@
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);
}
+ elsif ( $reminder->Subject ne $request_args->{ 'Reminder-Subject-' . $reminder->id } ) {
+ $reminder->SetSubject( $request_args->{ 'Reminder-Subject-' . $reminder->id } ) ;
+ }
+ elsif ( $reminder->Owner != $request_args->{ 'Reminder-Owner-' . $reminder->id } ) {
+ $reminder->SetOwner( $request_args->{ 'Reminder-Owner-' . $reminder->id } , "Force" ) ;
+ }
+ elsif ( $reminder->DueObj->Date ne $request_args->{ 'Reminder-Due-' . $reminder->id } ) {
+ $reminder->SetDue( $request_args->{ 'Reminder-Due-' . $reminder->id } ) ;
+ }
}
}
@@ -49,6 +59,8 @@
% while (my $reminder = $reminder_collection->Next) {
% if ($reminder->Status eq 'resolved' && !$ShowCompleted) {
<input type="hidden" name="Complete-Reminder-<% $reminder->id %>" value="1" />
+% } elsif ($Edit) {
+<& SELF:EditEntry, Reminder => $reminder, Ticket => $Ticket &>
% } else {
<& SELF:ShowEntry, Reminder => $reminder, Ticket => $Ticket &>
% }
@@ -67,16 +79,32 @@
</div>
<div class="horizontal">
<label class="horizontal" for="NewReminder-Owner" ><&|/l&>Owner</&>:</label>
-<& /Elements/SelectOwner, Name => 'NewReminder-Owner', Queue => $Ticket->QueueObj &>
+<& /Elements/SelectOwner, Name => 'NewReminder-Owner', Queue => $Ticket->QueueObj, DefaultValue => 0 &>
</div>
<div class="horizontal">
<label class="horizontal" for="NewReminder-Due" ><&|/l&>Due</&> <&|/l&>(yyyy/mm/dd)</&>:</label>
-<input type="text" size="10" name="NewReminder-Due">
+<& /Elements/SelectDate, Name => "NewReminder-Due", Default => "" &>
</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%>"> •
+ <& /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"
Modified: rt/branches/3.5-TESTING/html/Ticket/Reminders.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Reminders.html (original)
+++ rt/branches/3.5-TESTING/html/Ticket/Reminders.html Sun Jul 3 19:00:45 2005
@@ -53,7 +53,7 @@
title_class=> 'inverse',
color => "#666699" &>
-<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 1 &>
+<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 1, Edit => 1 &>
</&>
<& /Elements/Submit, Label => 'Save'&>
</form>
Added: rt/branches/3.5-TESTING/html/rt.js
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/rt.js Sun Jul 3 19:00:45 2005
@@ -0,0 +1,19 @@
+% $r->content_type('application/x-javascript');
+
+function hideshow(num) {
+ idstring = "element-" + num;
+ chunk = document.getElementById(idstring);
+ if ( chunk.style.display == "none") {
+ chunk.style.display = chunk.style.tag;
+ } else {
+ chunk.style.tag = chunk.style.display;
+ chunk.style.display = "none";
+ }
+}
+
+function openCalWindow(field) {
+ var objWindow = window.open('<%$RT::WebPath%>/CalPopup.html?field='+field, 'Pick', 'height=400,width=400,scrollbars=1');
+ objWindow.focus();
+}
+
+% $m->abort;
\ No newline at end of file
Modified: rt/branches/3.5-TESTING/lib/RT/Date.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Date.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Date.pm Sun Jul 3 19:00:45 2005
@@ -555,6 +555,44 @@
# }}}
+# {{{ sub Date
+
+=head2 Date
+
+Takes nothing
+
+Returns the object's date in yyyy-mm-dd format; this is the same as
+the ISO format without the time
+
+=cut
+
+sub Date {
+ my $self = shift;
+ my ($date, $time) = split ' ', $self->ISO;
+ return $date;
+}
+
+# }}}}
+
+# {{{ sub Time
+
+=head2 Time
+
+Takes nothing
+
+Returns the object's time in hh:mm:ss format; this is the same as
+the ISO format without the date
+
+=cut
+
+sub Time {
+ my $self = shift;
+ my ($date, $time) = split ' ', $self->ISO;
+ return $time;
+}
+
+# }}}}
+
# {{{ sub W3CDTF
=head2 W3CDTF
Modified: rt/branches/3.5-TESTING/lib/RT/Reminders.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Reminders.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Reminders.pm Sun Jul 3 19:00:45 2005
@@ -78,7 +78,7 @@
Queue => $self->TicketObj->Queue,
);
- $self->Ticket->_NewTransaction(Type => 'AddReminder',
+ $self->TicketObj->_NewTransaction(Type => 'AddReminder',
Field => 'RT::Ticket',
NewValue => $reminder->id);
@@ -91,7 +91,7 @@
my $reminder = shift;
$reminder->SetStatus('open');
- $self->Ticket->_NewTransaction(Type => 'OpenReminder',
+ $self->TicketObj->_NewTransaction(Type => 'OpenReminder',
Field => 'RT::Ticket',
NewValue => $reminder->id);
}
@@ -101,7 +101,7 @@
my $self = shift;
my $reminder = shift;
$reminder->SetStatus('resolved');
- $self->Ticket->_NewTransaction(Type => 'ResolveReminder',
+ $self->TicketObj->_NewTransaction(Type => 'ResolveReminder',
Field => 'RT::Ticket',
NewValue => $reminder->id);
}
More information about the Rt-commit
mailing list