summaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-06-07 17:20:16 -0700
committerIvan Kohler <ivan@freeside.biz>2012-06-07 17:20:16 -0700
commitfec244eb00508517cd3313f6cf55973c2d2e99cf (patch)
tree0931b07101ac4b7fdecba13f2ff1b2555109e287 /rt
parent21a232b78413718d8a68867ba7eb4f52a287f9b6 (diff)
merge RTx-Calendar 0.14
Diffstat (limited to 'rt')
-rw-r--r--rt/lib/RTx/Calendar.pm61
-rw-r--r--rt/share/html/Callbacks/RTx-Calendar/Elements/Header/Head3
-rw-r--r--rt/share/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged73
-rw-r--r--rt/share/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default2
-rw-r--r--rt/share/html/Elements/CalendarEvent8
-rw-r--r--rt/share/html/NoAuth/Calendar/dhandler6
-rw-r--r--rt/share/html/NoAuth/css/calendar.css10
-rw-r--r--rt/share/html/Prefs/Calendar.html11
-rw-r--r--rt/share/html/Search/Calendar.html9
9 files changed, 136 insertions, 47 deletions
diff --git a/rt/lib/RTx/Calendar.pm b/rt/lib/RTx/Calendar.pm
index 20568e8..e297566 100644
--- a/rt/lib/RTx/Calendar.pm
+++ b/rt/lib/RTx/Calendar.pm
@@ -5,7 +5,10 @@ use base qw( Exporter );
use DateTime;
use DateTime::Set;
-our $VERSION = "0.07";
+our $VERSION = "0.14";
+
+RT->AddStyleSheets('calendar.css')
+ if RT->can('AddStyleSheets');
our @EXPORT_OK = qw( FirstDay LastDay );
@@ -48,7 +51,7 @@ sub DatesClauses {
my $clauses = "";
my @DateClauses = map {
- "($_ >= '" . $begin . "' AND $_ <= '" . $end . "')"
+ "($_ >= '" . $begin . " 00:00:00' AND $_ <= '" . $end . " 23:59:59')"
} @$Dates;
$clauses .= " AND " . " ( " . join(" OR ", @DateClauses) . " ) "
if @DateClauses;
@@ -82,9 +85,9 @@ sub FindTickets {
return %Tickets;
}
-#
+#
# Take a user object and return the search with Description "calendar" if it exists
-#
+#
sub SearchDefaultCalendar {
my $CurrentUser = shift;
my $Description = "calendar";
@@ -104,6 +107,28 @@ sub SearchDefaultCalendar {
}
}
+package RT::Interface::Web::Menu;
+
+# we should get an add_after method in 4.0.6 (hopefully), but until then
+# shim this in so I don't copy the code.
+unless (RT::Interface::Web::Menu->can('add_after')) {
+ *RT::Interface::Web::Menu::add_after = sub {
+ my $self = shift;
+ my $parent = $self->parent;
+ my $sort_order;
+ for my $contemporary ($parent->children) {
+ if ( $contemporary->key eq $self->key ) {
+ $sort_order = $contemporary->sort_order + 1;
+ next;
+ }
+ if ( $sort_order ) {
+ $contemporary->sort_order( $contemporary->sort_order + 1 );
+ }
+ }
+ $parent->child( @_, sort_order => $sort_order );
+ };
+}
+
1;
@@ -113,10 +138,6 @@ __END__
RTx::Calendar - Calendar for RT due tasks
-=head1 VERSION
-
-This document describes version 0.07 of RTx::Calendar
-
=head1 DESCRIPTION
This RT extension provides a calendar view for your tickets and your
@@ -129,9 +150,6 @@ You can also enable ics (ICal) feeds for your default calendar and all
your private searches in Prefs/Calendar.html. Authentication is magic
number based so that you can give those feeds to other people.
-You can find screenshots on
-http://gaspard.mine.nu/dotclear/index.php?tag/rtx-calendar
-
=head1 INSTALLATION
If you upgrade from 0.02, see next part before.
@@ -206,26 +224,25 @@ RTx-Calendar may work without this but it's not very clean.
=head1 BUGS
-=over
-
-=item *
-compatible only with RT 3.6 for the moment. If someone need
-compatibility with 3.4 I can work on this. And I will work on 3.7
-compatibility later.
-
-=back
-
+All bugs should be reported via
+L<http://rt.cpan.org/Public/Dist/Display.html?Name=RTx-Calendar>
+or L<bug-RTx-Calendar@rt.cpan.org>.
+
=head1 AUTHORS
+Best Practical Solutions
+
Nicolas Chuche E<lt>nchuche@barna.beE<gt>
Idea borrowed from redmine's calendar (Thanks Jean-Philippe).
=head1 COPYRIGHT
-Copyright 2007 by Nicolas Chuche E<lt>nchuche@barna.beE<gt>
+Copyright 2007-2009 by Nicolas Chuche E<lt>nchuche@barna.beE<gt>
+
+Copyright 2010-2012 by Best Practical Solutions.
-This program is free software; you can redistribute it and/or
+This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See L<http://www.perl.com/perl/misc/Artistic.html>
diff --git a/rt/share/html/Callbacks/RTx-Calendar/Elements/Header/Head b/rt/share/html/Callbacks/RTx-Calendar/Elements/Header/Head
index c1f24c2..dcaaa12 100644
--- a/rt/share/html/Callbacks/RTx-Calendar/Elements/Header/Head
+++ b/rt/share/html/Callbacks/RTx-Calendar/Elements/Header/Head
@@ -1,2 +1,5 @@
+<%init>
+return if RT->can('AddStyleSheets');
+</%init>
<link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/css/calendar.css" type="text/css" media="all" />
diff --git a/rt/share/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged b/rt/share/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
new file mode 100644
index 0000000..31ed90a
--- /dev/null
+++ b/rt/share/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
@@ -0,0 +1,73 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2011 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/licenses/old-licenses/gpl-2.0.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 }}}
+<%INIT>
+my $request_path = $HTML::Mason::Commands::r->path_info;
+
+my $query_string = sub {
+ my %args = @_;
+ my $u = URI->new();
+ $u->query_form(%args);
+ return $u->query;
+};
+
+if ( $request_path =~ qr{^/Search/} && $m->request_args->{Query} ) {
+ my $tabs = PageMenu;
+ my $chart = $tabs->child('chart');
+ $chart->add_after( 'calendar' => title => loc('Calendar'),
+ path => '/Search/Calendar.html?' . $query_string->( %{$m->request_args} ) );
+}
+
+my $about_me = Menu->child( 'preferences' );
+my $settings = $about_me ? $about_me->child('settings') : undef;
+
+if ( $settings ) {
+ $settings->child( 'calendar' => title => loc('Calendar'),
+ path => '/Prefs/Calendar.html' );
+}
+
+</%INIT>
diff --git a/rt/share/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default b/rt/share/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
index cb46fda..b6d3905 100644
--- a/rt/share/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
+++ b/rt/share/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
@@ -1,4 +1,4 @@
-<%init>
+<%init>
my $args;
$args= "?" . $m->comp(
'/Elements/QueryString',
diff --git a/rt/share/html/Elements/CalendarEvent b/rt/share/html/Elements/CalendarEvent
index 3a6b00b..65dd58c 100644
--- a/rt/share/html/Elements/CalendarEvent
+++ b/rt/share/html/Elements/CalendarEvent
@@ -13,11 +13,11 @@ $DateTypes => undef
% and RTx::Calendar::LocalDate($Object->ResolvedObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/resolved.png" />
-% } elsif ($DateTypes->{Starts} and $DateTypes->{Due}
+% } elsif ($DateTypes->{Starts} and $DateTypes->{Due}
% and RTx::Calendar::LocalDate($Object->StartsObj->Unix) eq $today and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today ) {
<img src="<%$RT::WebImagesURL%>/starts_due.png" />
-% } elsif ($DateTypes->{Due} and $DateTypes->{Created}
+% } elsif ($DateTypes->{Due} and $DateTypes->{Created}
% and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today and RTx::Calendar::LocalDate($Object->CreatedObj->Unix) eq $today ) {
<img src="<%$RT::WebImagesURL%>/created_due.png" />
@@ -25,7 +25,7 @@ $DateTypes => undef
% and RTx::Calendar::LocalDate($Object->StartsObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/starts.png" />
-% } elsif ($DateTypes->{Due}
+% } elsif ($DateTypes->{Due}
% and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/due.png" />
@@ -64,7 +64,7 @@ $DateTypes => undef
% my $method = '$Object->'.$attr.'()';
% $method =~ s/->ISO\(\)$/->ISO( Timezone => 'user' )/;
% $value = eval $method;
-% if ($@) {die "<b>Check your CalendarPopupFields config in etc/RT_SiteConfig.pm</b>.<br /><br />Failed to find \"$attr\" - ". $@};
+% if ($@) {die "<b>Check your CalendarPopupFields config in etc/RT_SiteConfig.pm</b>.<br /><br />Failed to find \"$attr\" - ". $@};
% }
<strong><&|/l&><% $label_of{$attr} %></&>:</strong> <% $value %><br />
% }
diff --git a/rt/share/html/NoAuth/Calendar/dhandler b/rt/share/html/NoAuth/Calendar/dhandler
index 4b4aa63..ea08c9a 100644
--- a/rt/share/html/NoAuth/Calendar/dhandler
+++ b/rt/share/html/NoAuth/Calendar/dhandler
@@ -101,14 +101,14 @@ my $cal = $calendar->as_string;
$r->content_type('text/calendar;charset=utf-8');
$m->clear_buffer();
$m->out($cal);
-$m->abort;
+$m->abort;
sub add_event {
my ($Reminder, $uid) = @_;
return unless defined $Reminder->RefersTo->First;
my $Ticket = $Reminder->RefersTo->First->TargetObj;
-
+
my %event = (
summary => $Reminder->Subject ? $Reminder->Subject : '',
url => "${RT::WebURL}/Ticket/Display.html?id=" . $Ticket->id,
@@ -142,7 +142,7 @@ sub add_todo {
$vtodo{attendee} = "MAILTO:" . $Ticket->OwnerObj->EmailAddress;
} elsif ($Ticket->QueueObj->CommentAddress) {
$vtodo{organizer} = "MAILTO:" . $Ticket->QueueObj->CommentAddress;
- $vtodo{attendee} = "MAILTO:" . $Ticket->QueueObj->CommentAddress;
+ $vtodo{attendee} = "MAILTO:" . $Ticket->QueueObj->CommentAddress;
}
$vtodo{priority} = $Ticket->Priority
diff --git a/rt/share/html/NoAuth/css/calendar.css b/rt/share/html/NoAuth/css/calendar.css
index c6b584e..93edccf 100644
--- a/rt/share/html/NoAuth/css/calendar.css
+++ b/rt/share/html/NoAuth/css/calendar.css
@@ -1,8 +1,8 @@
-.tooltip{position:relative;z-index:1;}
-.tooltip:hover{z-index:5;color:#000;}
-.tooltip span.tip{display: none; text-align:left;}
+.rtxcalendar .tooltip{position:relative;z-index:1;}
+.rtxcalendar .tooltip:hover{z-index:5;color:#000;}
+.rtxcalendar .tooltip span.tip{display: none; text-align:left;}
-div.tooltip:hover span.tip{
+.rtxcalendar div.tooltip:hover span.tip{
display:block;
position:absolute;
top:12px; left:24px; width:350px;
@@ -13,7 +13,7 @@ font-size: 0.8em;
color:#505050;
}
-.calendardate {
+.rtxcalendar .date {
text-align: right;
background-color: #f8f8ff;
width:100%;
diff --git a/rt/share/html/Prefs/Calendar.html b/rt/share/html/Prefs/Calendar.html
index 5fbdd27..b508d10 100644
--- a/rt/share/html/Prefs/Calendar.html
+++ b/rt/share/html/Prefs/Calendar.html
@@ -6,10 +6,7 @@ $HiddenField => undef
</%args>
<& /Elements/Header, Title => $title &>
-<& /User/Elements/Tabs,
- current_tab => 'Prefs/Calendar.html',
- Title => $title
-&>
+<& /Elements/Tabs &>
<&| /Widgets/TitleBox, title => loc('ICal Feeds (ics)') &>
@@ -50,7 +47,7 @@ Builder")%></a>.</p>
<& /Prefs/Elements/CalendarFeed &>
-% # only allow this part if
+% # only allow this part if
% if ($AllowSearch) {
% my $search_count;
@@ -107,9 +104,9 @@ $AllowSearch = 1
my $object;
-if ($HiddenField eq 'Private') {
+if ($HiddenField && $HiddenField eq 'Private') {
$object = $session{CurrentUser}->UserObj;
-} elsif ($AllowSearch and my ($SearchId) = $HiddenField =~ m/SavedSearch\-(\d+)/) {
+} elsif ($AllowSearch and $HiddenField my ($SearchId) = $HiddenField =~ m/SavedSearch\-(\d+)/) {
$object = $session{CurrentUser}->Attributes->WithId($SearchId);
}
diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html
index 9d2b6f5..8a1b796 100644
--- a/rt/share/html/Search/Calendar.html
+++ b/rt/share/html/Search/Calendar.html
@@ -10,9 +10,8 @@ $NewQuery => 0
</%args>
<& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs,
- current_tab => "Search/Calendar.html?$QueryString",
- Title => $title &>
+<& /Elements/Tabs &>
+
<&| /Widgets/TitleBox,
title => loc('Calendar for ') . $rtdate->GetMonth($Month) . " $Year" ,
title_class=> 'inverse',
@@ -195,7 +194,7 @@ my $set = DateTime::Set->from_recurrence(
next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) }
);
-my $QueryString =
+my $QueryString =
$m->comp(
'/Elements/QueryString',
Query => $Query,
@@ -212,7 +211,7 @@ $QueryString ||= 'NewQuery=1';
my $TempFormat = "__Starts__ __Due__";
my $TempQuery = "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
AND ( Owner = '" . $session{CurrentUser}->Id ."' OR Owner = 'Nobody' )
- AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
+ AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
if ( my $Search = RTx::Calendar::SearchDefaultCalendar($session{CurrentUser}) ) {
$TempFormat = $Search->SubValue('Format');