summaryrefslogtreecommitdiff
path: root/rt/share/html/Elements
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-09-15 20:44:48 -0700
committerIvan Kohler <ivan@freeside.biz>2014-09-15 20:44:48 -0700
commited1f84b4e8f626245995ecda5afcf83092c153b2 (patch)
tree3f58bbef5fbf2502e65d29b37b5dbe537519e89d /rt/share/html/Elements
parentfe9ea9183e8a16616d6d04a7b5c7498d28e78248 (diff)
RT 4.0.22
Diffstat (limited to 'rt/share/html/Elements')
-rw-r--r--rt/share/html/Elements/.CalendarDaySchedule.swpbin0 -> 12288 bytes
-rw-r--r--rt/share/html/Elements/.CalendarEventWeekly.swpbin0 -> 12288 bytes
-rw-r--r--rt/share/html/Elements/.CalendarSlotSchedule.swpbin0 -> 16384 bytes
-rw-r--r--rt/share/html/Elements/CalendarSlotSchedule.dynamic93
-rw-r--r--rt/share/html/Elements/EditCustomFieldDate3
-rw-r--r--rt/share/html/Elements/EditCustomFieldDateTime3
-rwxr-xr-xrt/share/html/Elements/Error6
7 files changed, 98 insertions, 7 deletions
diff --git a/rt/share/html/Elements/.CalendarDaySchedule.swp b/rt/share/html/Elements/.CalendarDaySchedule.swp
new file mode 100644
index 000000000..f79cd0938
--- /dev/null
+++ b/rt/share/html/Elements/.CalendarDaySchedule.swp
Binary files differ
diff --git a/rt/share/html/Elements/.CalendarEventWeekly.swp b/rt/share/html/Elements/.CalendarEventWeekly.swp
new file mode 100644
index 000000000..af6c22220
--- /dev/null
+++ b/rt/share/html/Elements/.CalendarEventWeekly.swp
Binary files differ
diff --git a/rt/share/html/Elements/.CalendarSlotSchedule.swp b/rt/share/html/Elements/.CalendarSlotSchedule.swp
new file mode 100644
index 000000000..6b8a8f9c2
--- /dev/null
+++ b/rt/share/html/Elements/.CalendarSlotSchedule.swp
Binary files differ
diff --git a/rt/share/html/Elements/CalendarSlotSchedule.dynamic b/rt/share/html/Elements/CalendarSlotSchedule.dynamic
new file mode 100644
index 000000000..88202d417
--- /dev/null
+++ b/rt/share/html/Elements/CalendarSlotSchedule.dynamic
@@ -0,0 +1,93 @@
+<%ARGS>
+ $Date => undef,
+ @Tickets => ()
+ $slots => $default_slots,
+ $sday => undef,
+ $tod_row => undef,
+ $timestep => $default_timestep,
+ @username => ()
+</%ARGS>
+<%SHARED>
+my @slots = ( [], [], [], [], [], [], [] );
+</%SHARED>
+% #for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
+% for my $t (@Tickets) {
+%
+% my($sm, $sh) = ($t->StartsObj->Localtime('user'))[1,2];
+% my $starts = $sh*60 + $sm;
+%
+% if ( RTx::Calendar::LocalDate($t->StartsObj->Unix) eq $Date->strftime('%F') #today
+% && $starts >= $tod_row && $starts < ($tod_row + $timestep) ) {
+% #then we're a new entry, find a slot for us
+% my $s = 0;
+% while ( ref($slots[$sday]->[$s]) ) { $s++ }
+% $slots[$sday]->[$s] = [ $t->Id, $t ];
+% }
+%
+% my($dm, $dh) = ($t->DueObj->Localtime('user'))[1,2];
+% my $due = $dh*60 + $dm;
+%
+% if ( RTx::Calendar::LocalDate($t->DueObj->Unix) eq $Date->strftime('%F') #today
+% && $due <= $tod_row && $due > ($tod_row + $timestep ) ) {
+% #then find our slot and remove us
+% @{ $slots[$sday] } =
+% map { (!ref($_) || $_->[0] != $t->Id) ? $_ : '' }
+% @{ $slots[$sday] };
+% }
+%
+% }
+%
+% pop @{ $slots[$sday] } while @{ $slots[$sday] } && !ref($slots[$sday]->[-1]);
+%
+% #now display:
+%
+% if ( scalar(@{$slots[$sday]}) > $slots ) {
+% #overflow situation, eek... could be handled better, how?
+
+ <td colspan=<%$slots%>
+ class="weekly
+%# <% $is_today ? 'today'
+%# : $is_yesterday ? 'yesterday'
+%# : $is_aweekago ? 'aweekago'
+%# : ''
+%# %>
+ "
+ >MULTIPLE
+ </td>
+
+% } else {
+%
+% foreach my $slot ( @{ $slots[$sday] } ) {
+% my( $id, $ticket ) = @$slot;
+
+ <td class="weekly
+%# <% $is_today ? 'today'
+%# : $is_yesterday ? 'yesterday'
+%# : $is_aweekago ? 'aweekago'
+%# : ''
+%# %>
+ "
+ ><% $id %>
+ </td>
+
+% }
+%
+% if ( scalar(@{$slots[$sday]}) < $slots ) {
+
+ <td colspan=<% $slots - scalar(@{$slots[$sday]}) %>
+ class="weekly
+%# <% $is_today ? 'today'
+%# : $is_yesterday ? 'yesterday'
+%# : $is_aweekago ? 'aweekago'
+%# : ''
+%# %>
+ "
+ >
+ </td>
+% }
+%
+% }
+<%ONCE>
+my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5;
+my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h
+</%ONCE>
diff --git a/rt/share/html/Elements/EditCustomFieldDate b/rt/share/html/Elements/EditCustomFieldDate
index f62f04704..c430b0b33 100644
--- a/rt/share/html/Elements/EditCustomFieldDate
+++ b/rt/share/html/Elements/EditCustomFieldDate
@@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
% my $name = $NamePrefix.$CustomField->Id.'-Values';
-<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
+<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0, $KeepValue && $Default ? (Default => $Default) : () &> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
@@ -59,4 +59,5 @@ $NamePrefix => undef
$Default => undef
$Values => undef
$MaxValues => 1
+$KeepValue => undef
</%ARGS>
diff --git a/rt/share/html/Elements/EditCustomFieldDateTime b/rt/share/html/Elements/EditCustomFieldDateTime
index edf125e80..b50ea431a 100644
--- a/rt/share/html/Elements/EditCustomFieldDateTime
+++ b/rt/share/html/Elements/EditCustomFieldDateTime
@@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
% my $name = $NamePrefix.$CustomField->Id.'-Values';
-<& /Elements/SelectDate, Name => "$name", current => 0 &> (<%$DateObj->AsString%>)
+<& /Elements/SelectDate, Name => "$name", current => 0, $KeepValue && $Default ? (Default => $Default) : () &> (<%$DateObj->AsString($KeepValue ? ( Timezone => 'utc' ) : () )%>)
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
@@ -60,4 +60,5 @@ $Default => undef
$Values => undef
$MaxValues => 1
$Format => 'ISO'
+$KeepValue => undef
</%ARGS>
diff --git a/rt/share/html/Elements/Error b/rt/share/html/Elements/Error
index b2042610e..d747c4e5b 100755
--- a/rt/share/html/Elements/Error
+++ b/rt/share/html/Elements/Error
@@ -78,11 +78,7 @@ $SuppressHeader => 0,
my $error = "WebRT: $Why";
$error .= " ($Details)" if defined $Details && length $Details;
-# TODO: Log::Dispatch isn't UTF-8 safe. Autrijus needs to talk to dave rolsky about getting this fixed
-use Encode ();
-Encode::_utf8_off($error);
-
-$RT::Logger->error($error);
+$RT::Logger->error( $error );
if ( $session{'REST'} ) {
$r->content_type('text/plain');