From ed1f84b4e8f626245995ecda5afcf83092c153b2 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 15 Sep 2014 20:44:48 -0700 Subject: RT 4.0.22 --- rt/share/html/Elements/.CalendarDaySchedule.swp | Bin 0 -> 12288 bytes rt/share/html/Elements/.CalendarEventWeekly.swp | Bin 0 -> 12288 bytes rt/share/html/Elements/.CalendarSlotSchedule.swp | Bin 0 -> 16384 bytes .../html/Elements/CalendarSlotSchedule.dynamic | 93 +++++++++++++++++++++ rt/share/html/Elements/EditCustomFieldDate | 3 +- rt/share/html/Elements/EditCustomFieldDateTime | 3 +- rt/share/html/Elements/Error | 6 +- 7 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 rt/share/html/Elements/.CalendarDaySchedule.swp create mode 100644 rt/share/html/Elements/.CalendarEventWeekly.swp create mode 100644 rt/share/html/Elements/.CalendarSlotSchedule.swp create mode 100644 rt/share/html/Elements/CalendarSlotSchedule.dynamic (limited to 'rt/share/html/Elements') diff --git a/rt/share/html/Elements/.CalendarDaySchedule.swp b/rt/share/html/Elements/.CalendarDaySchedule.swp new file mode 100644 index 000000000..f79cd0938 Binary files /dev/null and b/rt/share/html/Elements/.CalendarDaySchedule.swp differ diff --git a/rt/share/html/Elements/.CalendarEventWeekly.swp b/rt/share/html/Elements/.CalendarEventWeekly.swp new file mode 100644 index 000000000..af6c22220 Binary files /dev/null and b/rt/share/html/Elements/.CalendarEventWeekly.swp differ diff --git a/rt/share/html/Elements/.CalendarSlotSchedule.swp b/rt/share/html/Elements/.CalendarSlotSchedule.swp new file mode 100644 index 000000000..6b8a8f9c2 Binary files /dev/null and b/rt/share/html/Elements/.CalendarSlotSchedule.swp 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 => () + +<%SHARED> +my @slots = ( [], [], [], [], [], [], [] ); + +% #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? + + + class="weekly +%# <% $is_today ? 'today' +%# : $is_yesterday ? 'yesterday' +%# : $is_aweekago ? 'aweekago' +%# : '' +%# %> + " + >MULTIPLE + + +% } else { +% +% foreach my $slot ( @{ $slots[$sday] } ) { +% my( $id, $ticket ) = @$slot; + + <% $id %> + + +% } +% +% if ( scalar(@{$slots[$sday]}) < $slots ) { + + + class="weekly +%# <% $is_today ? 'today' +%# : $is_yesterday ? 'yesterday' +%# : $is_aweekago ? 'aweekago' +%# : '' +%# %> + " + > + +% } +% +% } +<%ONCE> +my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5; +my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h + 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 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 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'); -- cgit v1.2.1