[Bps-public-commit] rtx-calendar branch, master, updated. 0.20-2-gd5e94f4

? sunnavy sunnavy at bestpractical.com
Tue Oct 28 10:05:14 EDT 2014


The branch, master has been updated
       via  d5e94f4e8077cabf5fc4f7224fad259608552841 (commit)
       via  ee853e90c33f8a4602b027e71b70b2e43e1b1013 (commit)
      from  816e970b1f4fe4646ffa10606388d032ed059288 (commit)

Summary of changes:
 .../RTx-Calendar/Elements/Tabs/Privileged          |   8 --
 .../RTx-Calendar/Ticket/Elements/Tabs/Default      |  19 ---
 .../RTx-Calendar/User/Elements/Tabs/Default        |   9 --
 html/NoAuth/Calendar/dhandler                      | 160 ---------------------
 html/Prefs/Calendar.html                           | 125 ----------------
 html/Prefs/Elements/CalendarFeed                   |  68 ---------
 6 files changed, 389 deletions(-)
 delete mode 100644 html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
 delete mode 100644 html/Callbacks/RTx-Calendar/User/Elements/Tabs/Default
 delete mode 100644 html/NoAuth/Calendar/dhandler
 delete mode 100644 html/Prefs/Calendar.html
 delete mode 100644 html/Prefs/Elements/CalendarFeed

- Log -----------------------------------------------------------------
commit ee853e90c33f8a4602b027e71b70b2e43e1b1013
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 28 21:59:25 2014 +0800

    there is no "/Ticket/Elements/Tabs" since RT 4

diff --git a/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default b/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
deleted file mode 100644
index b6d3905..0000000
--- a/html/Callbacks/RTx-Calendar/Ticket/Elements/Tabs/Default
+++ /dev/null
@@ -1,19 +0,0 @@
-<%init>
-my $args;
-$args= "?" . $m->comp(
-    '/Elements/QueryString',
-    Query   => $ARGS{'Query'}   || $session{'CurrentSearchHash'}->{'Query'},
-    Format  => $ARGS{'Format'}  || $session{'CurrentSearchHash'}->{'Format'},
-    OrderBy => $ARGS{'OrderBy'} || $session{'CurrentSearchHash'}->{'OrderBy'},
-    Order   => $ARGS{'Order'}   || $session{'CurrentSearchHash'}->{'Order'},
-    Page   => $ARGS{'Page'}   || $session{'CurrentSearchHash'}->{'Page'},
-    Rows    => $ARGS{'Rows'},
-  ) if ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'});
-$args ||= '';
-
-$tabs->{'zz'} = { title =>loc("Calendar"),
-                  path  => "Search/Calendar.html$args" };
-</%init>
-<%args>
-$tabs
-</%args>

commit d5e94f4e8077cabf5fc4f7224fad259608552841
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 28 21:57:52 2014 +0800

    drop feed support since we have it in core since RT 4

diff --git a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
index 6be3dd4..9173352 100644
--- a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
@@ -62,12 +62,4 @@ if ( $request_path =~ qr{^/Search/} && $m->request_args->{Query} ) {
                        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/html/Callbacks/RTx-Calendar/User/Elements/Tabs/Default b/html/Callbacks/RTx-Calendar/User/Elements/Tabs/Default
deleted file mode 100644
index 06413e2..0000000
--- a/html/Callbacks/RTx-Calendar/User/Elements/Tabs/Default
+++ /dev/null
@@ -1,9 +0,0 @@
-<%init>
-    $tabs->{'z'} = { title =>loc("Calendar"),
-                          path  => "Prefs/Calendar.html" };
-</%init>
-<%args>
-$tabs
-$current_subtab => undef
-$Searches => undef
-</%args>
diff --git a/html/NoAuth/Calendar/dhandler b/html/NoAuth/Calendar/dhandler
deleted file mode 100644
index 7c91bb5..0000000
--- a/html/NoAuth/Calendar/dhandler
+++ /dev/null
@@ -1,160 +0,0 @@
-<%init>
-
-use Data::ICal;
-use Data::ICal::Entry::Todo;
-use Data::ICal::Entry::Event;
-
-$RT::ICalTicketType   ||= "Data::ICal::Entry::Todo";
-$RT::ICalReminderType ||= "Data::ICal::Entry::Event";
-
-my ($UserId, $SearchId, $MagicNumber);
-my $arg = $m->dhandler_arg;
-
-if ($arg =~ m{^(\d+)@(\d+)/(.*)$}) {
-    $UserId = $1;
-    $SearchId = $2;
-    $MagicNumber = $3;
-} elsif ($arg =~ m{^(\d+)/(.*)}) {
-    $UserId = $1;
-    $MagicNumber = $2;
-} else {
-    Abort("Corrupted URL.");
-}
-
-my $CurrentUser = new RT::CurrentUser();
-$CurrentUser->LoadById($UserId);
-my $user = $CurrentUser->Name;
-
-# if no user, abort
-unless ($CurrentUser->Id) {
-    $RT::Logger->error("No such user id $UserId from $ENV{'REMOTE_ADDR'}");
-    $m->out("RT/".$RT::VERSION ." ".404 ."\n\nno such file\n");
-    $m->abort;
-}
-
-# verify user has LoadSavedSearch right
-if ($SearchId and not $CurrentUser->HasRight( Right => 'LoadSavedSearch',
-                                              Object=> $RT::System )) {
-    $RT::Logger->error("not enough rights for user $user from $ENV{'REMOTE_ADDR'}");
-    $m->out("RT/".$RT::VERSION ." ".404 ."\n\nno such file\n");
-    $m->abort;
-}
-
-
-# if MagicNumber doesn't match the one stored in database, abort
-my $Search;
-my $ICalAttribute;
-if ($SearchId) {
-    $Search = $CurrentUser->Attributes->WithId($SearchId);
-    $ICalAttribute = $Search->FirstAttribute('ICalURL');
-} else {
-    $ICalAttribute = $CurrentUser->UserObj->FirstAttribute('ICalURL');
-}
-
-unless ($ICalAttribute) {
-    $RT::Logger->error("No such ICal feed for $user from $ENV{'REMOTE_ADDR'}");
-    $m->out("RT/".$RT::VERSION ." ".404 ."\n\nno such file\n");
-    $m->abort;
-}
-
-
-if ($MagicNumber ne $ICalAttribute->Content) {
-    $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
-    $m->out("RT/".$RT::VERSION ." ".404 ."\n\nno such file\n");
-    $m->abort;
-}
-
-my $Tickets   = RT::Tickets->new($CurrentUser);
-
-my $Query = "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
- AND ( Owner = '" . $CurrentUser->Id ."' OR Owner = 'Nobody'  )
- AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
-
-$Query = $Search->SubValue('Query')
-    if $Search;
-
-$Query .= " AND ( Due > '1970-01-01' OR Starts > '1970-01-01' )";
-
-$Tickets->FromSQL($Query);
-
-$Tickets->OrderBy(FIELD => 'Due', ORDER => 'ASC');
-
-my $calendar = Data::ICal->new();
-
-my ($uid) = $RT::WebURL =~ m{https?://([^:]+)};
-
-while (my $Ticket = $Tickets->Next ) {
-
-    my $event;
-    if ($Ticket->Type eq 'ticket') {
-	$event = add_todo($Ticket, $uid);
-    } else {
-	$event = add_event($Ticket, $uid);
-    }
-    next unless $event;
-    $calendar->add_entry($event);
-}
-
-my $cal = $calendar->as_string;
-
-$r->content_type('text/calendar;charset=utf-8');
-$m->clear_buffer();
-$m->out($cal);
-$m->abort;
-
-sub add_event {
-    my ($Reminder, $uid) = @_;
-
-    return unless defined $Reminder->RefersTo->First;
-    my $Ticket  = $Reminder->RefersTo->First->TargetObj;
-
-    my $now = RT::Date->new( $session{'CurrentUser'} ); $now->SetToNow;
-    my %event = (
-	summary => $Reminder->Subject ? $Reminder->Subject : '',
-	url        => "${RT::WebURL}/Ticket/Display.html?id=" . $Ticket->id,
-	uid        => $now->iCal . "-" . $Reminder->Id . "@" . $uid,
-	categories => $Ticket->QueueObj->Name,
-	dtstart     => $Reminder->DueObj->iCal,
-    );
-
-    my $event = $RT::ICalReminderType->new();
-    $event->add_properties(%event);
-
-    return $event;
-}
-
-sub add_todo {
-    my ($Ticket, $uid) = @_;
-
-    my $now = RT::Date->new( $session{'CurrentUser'} ); $now->SetToNow;
-    my %vtodo = (
-	summary    => $Ticket->Subject ? $Ticket->Subject : '',
-	dtstart    => $Ticket->CreatedObj->iCal,
-	url        => "${RT::WebURL}/Ticket/Display.html?id=" . $Ticket->id,
-	uid        => $now->iCal . "-" . $Ticket->Id . "@" . $uid,
-	categories => $Ticket->QueueObj->Name,
-    );
-
-    $vtodo{due} = $Ticket->DueObj->iCal,
-        if $Ticket->DueObj;
-
-    if ($Ticket->OwnerObj->Id != $RT::Nobody->Id and $Ticket->OwnerObj->EmailAddress) {
-	$vtodo{organizer} = "MAILTO:" . $Ticket->OwnerObj->EmailAddress;
-	$vtodo{attendee} = "MAILTO:" . $Ticket->OwnerObj->EmailAddress;
-    } elsif ($Ticket->QueueObj->CommentAddress) {
-	$vtodo{organizer} = "MAILTO:" . $Ticket->QueueObj->CommentAddress;
-	$vtodo{attendee} = "MAILTO:" . $Ticket->QueueObj->CommentAddress;
-    }
-
-    $vtodo{priority} = $Ticket->Priority
-	if $Ticket->Priority;
-
-    my $vtodo = $RT::ICalTicketType->new();
-    $vtodo->add_properties(%vtodo);
-
-    return $vtodo;
-}
-
-
-
-</%init>
diff --git a/html/Prefs/Calendar.html b/html/Prefs/Calendar.html
deleted file mode 100644
index ebf2780..0000000
--- a/html/Prefs/Calendar.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<%args>
-$ChangeURL   => undef
-$ResetURL    => undef
-$SearchType  => 'Ticket'
-$HiddenField => undef
-</%args>
-
-<& /Elements/Header, Title => $title &>
-% if ( $m->comp_exists( '/User/Elements/Tabs' ) ) {
-<& /User/Elements/Tabs,
-    current_tab => 'Prefs/Calendar.html',
-    Title => $title
-&>
-% } else {
-<& /Elements/Tabs &>
-% }
-
-<&| /Widgets/TitleBox, title => loc('ICal Feeds (ics)') &>
-
-<&| /Widgets/TitleBox, title => 'Help' &>
-
-<h3>displaying reminders :</h3>
-<p>If you want to have reminders in a search you need to go in the <a
-href="<%$RT::WebPath%>/Search/Edit.html"><%loc("Edit Query")%></a> tab
-of the <%loc("query builder")%> and add something like that :
-
- <pre>
-   AND ( Type = 'ticket' OR Type = 'reminder' )
-</pre>
-</p>
-
-<h3>displaying other kind of dates :</h3>
-<p>By default RTx::Calendar display Due and Starts dates. You can
-select other kind of events you want with the <%loc("Display
-Columns")%> section in the <a
-href="<%$RT::WebPath%>/Search/Build.html"><%loc("Query
-Builder")%></a>. The following one will display the two latter and
-LastUpdated dates :
-
-<pre>
-  '<small>__Due__</small>',
-  '<small>__Starts__</small>',
-  '<small>__LastUpdated__</small>'
-</pre>
-</p>
-
-<h3>changing the default query :</h3>
-<p>You can change the default Query of Calendar.html and MyCalendar
-portlet by saving a query with the name <code>calendar</code> in the
-<a href="<%$RT::WebPath%>/Search/Build.html"><%loc("Query
-Builder")%></a>.</p>
-
-</&>
-
-<& /Prefs/Elements/CalendarFeed &>
-
-% # only allow this part if
-% if ($AllowSearch) {
-
-% my $search_count;
-
-%   # I'm quite sure the loop isn't usefull but...
-%   my @Objects = $session{CurrentUser}->UserObj;
-%   for my $object (@Objects) {
-%     next unless ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id;
-%     my @searches = $object->Attributes->Named('SavedSearch');
-%     for my $search (@searches) {
-%       next if ($search->SubValue('SearchType')
-%              && $search->SubValue('SearchType') ne $SearchType);
-%       $search_count++;
-<& /Prefs/Elements/CalendarFeed, Object => $object, Search => $search &>
-
-%     }
-%   }
-%   unless ($search_count) {
-
-<&| /Widgets/TitleBox, title => loc('Private Search ICal feeds') &>
-
-You can add private ICal feeds by saving new queries in <a
-href="<%$RT::WebPath . '/Search/Build.html'%>">the Query Builder</a>
-
-</&>
-
-%   }
-% } else {
-%#<&| /Widgets/TitleBox, title => loc('Private Search ICal feeds')
-%#                     , title_class=> 'inverse'
-%#                     , color => "#993333" &>
-%#
-%#<%loc('Private search ICal feeds disabled. To enable them, ask your admin for "[_1]" and "[_2]" rights',
-%#       loc('CreateSavedSearch'),
-%#       loc('LoadSavedSearch') )%>
-%#
-%#</&>
-% }
-
-</&>
-
-<%INIT>
-use Digest::SHA;
-use RT::SavedSearches;
-
-my $title = loc("Calendar Prefs");
-my $AllowSearch;
-
-$AllowSearch = 1
- if $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
-                                       Object=> $RT::System );
-
-my $object;
-
-if ($HiddenField && $HiddenField eq 'Private') {
-   $object = $session{CurrentUser}->UserObj;
-} elsif ($AllowSearch and $HiddenField and my ($SearchId) = $HiddenField =~ m/SavedSearch\-(\d+)/) {
-    $object = $session{CurrentUser}->Attributes->WithId($SearchId);
-}
-
-if (defined $ChangeURL) {
-  my @args = $object->SetAttribute(Name => 'ICalURL', Content => Digest::SHA::sha1_base64(time));
-} elsif (defined $ResetURL) {
-  my @args = $object->DeleteAttribute('ICalURL');
-}
-
-
-</%INIT>
diff --git a/html/Prefs/Elements/CalendarFeed b/html/Prefs/Elements/CalendarFeed
deleted file mode 100644
index 4689343..0000000
--- a/html/Prefs/Elements/CalendarFeed
+++ /dev/null
@@ -1,68 +0,0 @@
-<%args>
-$Search => undef
-$Object => undef
-$HiddenField => undef
-</%args>
-
-<&| /Widgets/TitleBox, title => $title &>
-
-% if ($FeedText) {
-<p><%$FeedText%></p>
-% } else {
-This feed will show tickets with due date find with query:<br />
-"<%$Search->SubValue('Query')%>".
-% }
-
-% if ($ICalURL) {
-<p>Your can paste this url in your calendar  : <b><a href="<%$link%>"><%$link%></a></b><p>
-<table>
-<tr>
-<td>
-<form action="<%$RT::WebPath%>/Prefs/Calendar.html" method="post">
-<input type="hidden" name="HiddenField" value="<%$HiddenField%>" />
-<input type="submit" class="button" name="ResetURL" value="<%loc('Disable Feed')%>" />
-</form>
-</td>
-<td>
-<form action="<%$RT::WebPath%>/Prefs/Calendar.html" method="post">
-<input type="hidden" name="HiddenField" value="<%$HiddenField%>" />
-<input type="submit" class="button" name="ChangeURL" value="<%loc('Change Feed URL')%>" />
-</form>
-</td>
-</tr>
-</table>
-% } else {
-
-<form action="<%$RT::WebPath%>/Prefs/Calendar.html" method="post">
-<input type="hidden" name="HiddenField" value="<%$HiddenField%>" />
-<input type="submit" class="button" name="ChangeURL" value="<%loc('Enable Feed')%>" />
-</form>
-% }
-
-</&>
-
-<%init>
-my $title;
-my $ICalURL;
-my $Id;
-my $FeedText;
-my $link;
-
-if ($Object) {
-  $title = loc('Feed for "') . ($Search->Description || loc('Unnamed search')) . '" search';
-  $HiddenField = "SavedSearch-" . $Search->Id;
-  $ICalURL = $Search->FirstAttribute('ICalURL');
-  $Id = $session{CurrentUser}->Id . "@" . $Search->Id;
-  $title .= " (disabled)" unless $ICalURL;
-} else {
-  $title = loc('Feed for default calendar');
-  $HiddenField = "Private";
-  $ICalURL = $session{CurrentUser}->UserObj->FirstAttribute('ICalURL');
-  $Id = $session{CurrentUser}->Id;
-  $FeedText = "This feed will show yours and Nobody's tasks with due date.";
-}
-
-$link = $RT::WebURL . "NoAuth/Calendar/" . $Id . "/" . $ICalURL->Content
-  if $ICalURL;
-
-</%init>
\ No newline at end of file

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list