[Bps-public-commit] rtx-calendar branch, master, updated. 0.17-13-gb5b2ad7

Alex Vandiver alexmv at bestpractical.com
Wed May 7 20:24:34 EDT 2014


The branch, master has been updated
       via  b5b2ad74ee8b2c2e66910143ee5099153a9e895f (commit)
       via  5cc0802b319dbc6f1896bc6b30bd50c67011ceb2 (commit)
       via  085f77a8561dee1084d30a4b5b01b0f91012b6f3 (commit)
       via  56058e91252f3be10621029638136f0fef9f7aa7 (commit)
       via  3069b3405e65a530625648e6dea214f8ce1c2ec6 (commit)
       via  0172424d0723827e3b83542b7f4895058e7da6d7 (commit)
       via  5e865c5772f7d56c1c395dadd1e5aa7660f3ab43 (commit)
       via  95d9185fe5c00146bc2327511b58e60371bc5c5c (commit)
       via  e981c89a9e834179ca3161077a7f7fbf5f607342 (commit)
       via  8e506fd257a14308202ecaf8f7875c3b9414e804 (commit)
       via  a7b5bc722c5ca89646afce285a1c90a0443d8951 (commit)
       via  88a07af781cf01dada3efe595be8c3c5acc05fab (commit)
       via  b11c6bacc007ac0fcf063b2742cc1f5b23a22e07 (commit)
      from  82baaeba4be49aa762d984a6529790e685c86ba4 (commit)

Summary of changes:
 CHANGES                                            |   4 +
 META.yml                                           |   3 +-
 README                                             |   2 +-
 html/Callbacks/RTx-Calendar/Elements/Header/Head   |   5 -
 .../RTx-Calendar/Elements/Tabs/Privileged          |  30 ++---
 html/Elements/MyCalendar                           |  19 ++-
 html/NoAuth/css/calendar.css                       |  40 ------
 html/Prefs/Calendar.html                           |   4 +-
 html/Search/Calendar.html                          | 136 +++++++++++++--------
 inc/Module/Install/RTx.pm                          |  74 ++++++-----
 inc/Module/Install/ReadmeFromPod.pm                |   2 +-
 lib/RTx/Calendar.pm                                |  19 ++-
 static/css/calendar.css                            |  71 +++++++++++
 {html/NoAuth => static}/images/created.png         | Bin
 {html/NoAuth => static}/images/created_due.png     | Bin
 {html/NoAuth => static}/images/due.png             | Bin
 {html/NoAuth => static}/images/reminder.png        | Bin
 {html/NoAuth => static}/images/resolved.png        | Bin
 {html/NoAuth => static}/images/started.png         | Bin
 {html/NoAuth => static}/images/starts.png          | Bin
 {html/NoAuth => static}/images/starts_due.png      | Bin
 {html/NoAuth => static}/images/updated.png         | Bin
 22 files changed, 249 insertions(+), 160 deletions(-)
 delete mode 100644 html/Callbacks/RTx-Calendar/Elements/Header/Head
 delete mode 100644 html/NoAuth/css/calendar.css
 create mode 100644 static/css/calendar.css
 rename {html/NoAuth => static}/images/created.png (100%)
 rename {html/NoAuth => static}/images/created_due.png (100%)
 rename {html/NoAuth => static}/images/due.png (100%)
 rename {html/NoAuth => static}/images/reminder.png (100%)
 rename {html/NoAuth => static}/images/resolved.png (100%)
 rename {html/NoAuth => static}/images/started.png (100%)
 rename {html/NoAuth => static}/images/starts.png (100%)
 rename {html/NoAuth => static}/images/starts_due.png (100%)
 rename {html/NoAuth => static}/images/updated.png (100%)

- Log -----------------------------------------------------------------
commit b11c6bacc007ac0fcf063b2742cc1f5b23a22e07
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 18:49:40 2014 -0400

    Update for 4.2 compatibility

diff --git a/META.yml b/META.yml
index 7b605ed..3b05950 100644
--- a/META.yml
+++ b/META.yml
@@ -19,6 +19,7 @@ no_index:
   directory:
     - html
     - inc
+    - static
   package:
     - RT::Interface::Web::Menu
 requires:
diff --git a/html/Prefs/Calendar.html b/html/Prefs/Calendar.html
index 76ca3b6..ebf2780 100644
--- a/html/Prefs/Calendar.html
+++ b/html/Prefs/Calendar.html
@@ -74,9 +74,7 @@ Builder")%></a>.</p>
 %   }
 %   unless ($search_count) {
 
-<&| /Widgets/TitleBox, title => loc('Private Search ICal feeds')
-                     , title_class=> 'inverse'
-                     , color => "#993333" &>
+<&| /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>
diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index a030c18..a20c98f 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -20,9 +20,7 @@ $NewQuery => 0
 % }
 
 <&| /Widgets/TitleBox,
-     title => loc('Calendar for ') . $rtdate->GetMonth($Month) . " $Year" ,
-     title_class=> 'inverse',
-     color => "#993333" &>
+     title => loc('Calendar for [_1] [_2]', $rtdate->GetMonth($Month), $Year) &>
 
 <table width="100%">
 <tr>
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index c9fe996..8616d06 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.31';
+our $VERSION = '0.33';
 
 use FindBin;
 use File::Glob     ();
@@ -88,6 +88,11 @@ sub RTx {
             ."Upgrade to RT 3.8.1 or newer.\n" if $RT::VERSION =~ /^3\.8\.0/;
         $path{$_} = $RT::LocalPluginPath . "/$original_name/$_"
             foreach @DIRS;
+
+        # Copy RT 4.2.0 static files into NoAuth; insufficient for
+        # images, but good enough for css and js.
+        $path{static} = "$path{html}/NoAuth/"
+            unless $RT::StaticPath;
     } else {
         foreach ( @DIRS ) {
             no strict 'refs';
@@ -136,6 +141,9 @@ install ::
         $has_etc{acl}++;
     }
     if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; }
+    if ( grep { /\d+\.\d+\.\d+.*$/ } glob('etc/upgrade/*.*.*') ) {
+        $has_etc{upgrade}++;
+    }
 
     $self->postamble("$postamble\n");
     unless ( $subdirs{'lib'} ) {
@@ -164,49 +172,59 @@ install ::
 .
         $self->postamble("initdb ::\n$initdb\n");
         $self->postamble("initialize-database ::\n$initdb\n");
+        if ($has_etc{upgrade}) {
+            print "To upgrade from a previous version of this extension, use 'make upgrade-database'\n";
+            my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(upgrade \$(NAME) \$(VERSION)))"\n|;
+            $self->postamble("upgrade-database ::\n$upgradedb\n");
+            $self->postamble("upgradedb ::\n$upgradedb\n");
+        }
     }
 }
 
-# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
-{ my %word = (
-    a     => -4,
-    alpha => -4,
-    b     => -3,
-    beta  => -3,
-    pre   => -2,
-    rc    => -1,
-    head  => 9999,
-);
-sub cmp_version($$) {
-    my ($a, $b) = (@_);
-    my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
-        split /([^0-9]+)/, $a;
-    my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
-        split /([^0-9]+)/, $b;
-    @a > @b
-        ? push @b, (0) x (@a- at b)
-        : push @a, (0) x (@b- at a);
-    for ( my $i = 0; $i < @a; $i++ ) {
-        return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
-    }
-    return 0;
-}}
 sub requires_rt {
     my ($self,$version) = @_;
 
     # if we're exactly the same version as what we want, silently return
     return if ($version eq $RT::VERSION);
 
-    my @sorted = sort cmp_version $version,$RT::VERSION;
+    _load_rt_handle();
+    my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
         # should we die?
-        warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+        die "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+    }
+}
+
+sub rt_too_new {
+    my ($self,$version,$msg) = @_;
+    $msg ||= "Your version %s is too new, this extension requires a release of RT older than %s\n";
+
+    _load_rt_handle();
+    my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
+
+    if ($sorted[0] eq $version) {
+        die sprintf($msg,$RT::VERSION,$version);
+    }
+}
+
+# RT::Handle runs FinalizeDatabaseType which calls RT->Config->Get
+# On 3.8, this dies.  On 4.0/4.2 ->Config transparently runs LoadConfig.
+# LoadConfig requires being able to read RT_SiteConfig.pm (root) so we'd
+# like to avoid pushing that on users.
+# Fake up just enough Config to let FinalizeDatabaseType finish, and
+# anyone later calling LoadConfig will overwrite our shenanigans.
+sub _load_rt_handle {
+    unless ($RT::Config) {
+        require RT::Config;
+        $RT::Config = RT::Config->new;
+        RT->Config->Set('DatabaseType','mysql');
     }
+    require RT::Handle;
 }
 
 1;
 
 __END__
 
-#line 329
+#line 367
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index 6a80818..b5e03c3 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,7 +7,7 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.20';
+$VERSION = '0.22';
 
 sub readme_from {
   my $self = shift;
diff --git a/html/NoAuth/css/calendar.css b/static/css/calendar.css
similarity index 100%
rename from html/NoAuth/css/calendar.css
rename to static/css/calendar.css
diff --git a/html/NoAuth/images/created.png b/static/images/created.png
similarity index 100%
rename from html/NoAuth/images/created.png
rename to static/images/created.png
diff --git a/html/NoAuth/images/created_due.png b/static/images/created_due.png
similarity index 100%
rename from html/NoAuth/images/created_due.png
rename to static/images/created_due.png
diff --git a/html/NoAuth/images/due.png b/static/images/due.png
similarity index 100%
rename from html/NoAuth/images/due.png
rename to static/images/due.png
diff --git a/html/NoAuth/images/reminder.png b/static/images/reminder.png
similarity index 100%
rename from html/NoAuth/images/reminder.png
rename to static/images/reminder.png
diff --git a/html/NoAuth/images/resolved.png b/static/images/resolved.png
similarity index 100%
rename from html/NoAuth/images/resolved.png
rename to static/images/resolved.png
diff --git a/html/NoAuth/images/started.png b/static/images/started.png
similarity index 100%
rename from html/NoAuth/images/started.png
rename to static/images/started.png
diff --git a/html/NoAuth/images/starts.png b/static/images/starts.png
similarity index 100%
rename from html/NoAuth/images/starts.png
rename to static/images/starts.png
diff --git a/html/NoAuth/images/starts_due.png b/static/images/starts_due.png
similarity index 100%
rename from html/NoAuth/images/starts_due.png
rename to static/images/starts_due.png
diff --git a/html/NoAuth/images/updated.png b/static/images/updated.png
similarity index 100%
rename from html/NoAuth/images/updated.png
rename to static/images/updated.png

commit 88a07af781cf01dada3efe595be8c3c5acc05fab
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:01:51 2014 -0400

    Encode « and » in utf-8, not latin-1

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index a20c98f..6a778c6 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -30,7 +30,7 @@ $NewQuery => 0
 %    $PYear--;
 %    $PMonth = 11;
 % }
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
 </td>
 <td align="center">
 <a href="<%$RT::WebPath%>/Prefs/Calendar.html">Calendar Preferences and Help</a>
@@ -41,7 +41,7 @@ $NewQuery => 0
 %    $NYear++;
 %    $NMonth = 0;
 % }
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
 </td>
 </tr>
 </table>
@@ -81,10 +81,10 @@ $NewQuery => 0
 <table width="100%">
 <tr>
 <td align="left">
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
 </td>
 <td align="right">
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
 </td>
 </tr>
 </table>

commit a7b5bc722c5ca89646afce285a1c90a0443d8951
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:21:34 2014 -0400

    Swap to a more terse hand-rolle submit button

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 6a778c6..c4092e3 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -107,7 +107,8 @@ $NewQuery => 0
 % }
 </select>
 
-<& /Elements/Submit&>
+<input type="submit" value="<% loc('Submit') %>" class="button" />
+
 </form>
 </td>
 <td valign="top" width="50%" align="right">

commit 8e506fd257a14308202ecaf8f7875c3b9414e804
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:22:14 2014 -0400

    /Elements/Footer will add the footer and </html>

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index c4092e3..4824795 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -128,7 +128,6 @@ $NewQuery => 0
 
 </&>
 
-</html>
 <%INIT>
 use RTx::Calendar;
 

commit e981c89a9e834179ca3161077a7f7fbf5f607342
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:23:08 2014 -0400

    RTx::Calendar is always loaded by RT

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 4824795..07d3c4e 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -129,7 +129,6 @@ $NewQuery => 0
 </&>
 
 <%INIT>
-use RTx::Calendar;
 
 my $title = loc("Calendar");
 

commit 95d9185fe5c00146bc2327511b58e60371bc5c5c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:24:46 2014 -0400

    Move legend into its own table

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 07d3c4e..140558b 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -32,9 +32,9 @@ $NewQuery => 0
 % }
 <a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
 </td>
-<td align="center">
-<a href="<%$RT::WebPath%>/Prefs/Calendar.html">Calendar Preferences and Help</a>
-</td>
+<th align="center">
+  <font size="+1"><% $rtdate->GetMonth($Month). " $Year" %></font>
+</th>
 <td align="right">
 % my ($NMonth, $NYear) = ($Month + 1, $Year);
 % if ($NMonth > 11) {
@@ -83,16 +83,8 @@ $NewQuery => 0
 <td align="left">
 <a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
 </td>
-<td align="right">
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
-</td>
-</tr>
-</table>
 
-
-<table width="100%">
-<tr>
-<td valign="top" align="center" width="80%">
+<td valign="top" align="center">
 <form action="<%$RT::WebPath%>/Search/Calendar.html?<%$QueryString%>" method="post">
 
 <select name="Month">
@@ -111,25 +103,55 @@ $NewQuery => 0
 
 </form>
 </td>
-<td valign="top" width="50%" align="right">
-<img src="<%$RT::WebImagesURL%>/created.png" /> : <&|/l&>Created</&><br />
-<img src="<%$RT::WebImagesURL%>/due.png" /> : <&|/l&>Due</&><br />
-<img src="<%$RT::WebImagesURL%>/resolved.png" /> : <&|/l&>Resolved</&><br />
-<img src="<%$RT::WebImagesURL%>/updated.png" /> : <&|/l&>Last Updated</&><br />
-<img src="<%$RT::WebImagesURL%>/created_due.png" /> : <&|/l&>Created</&>, <&|/l&>Due</&><br />
-<img src="<%$RT::WebImagesURL%>/reminder.png" /> : <&|/l&>Reminders</&><br />
-<img src="<%$RT::WebImagesURL%>/starts.png" /> : <&|/l&>Starts</&><br />
-<img src="<%$RT::WebImagesURL%>/started.png" /> : <&|/l&>Started</&><br />
-<img src="<%$RT::WebImagesURL%>/starts_due.png" /> : <&|/l&>Starts</&>, <&|/l&>Due</&><br />
 
+<td align="right">
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
+</td>
+</tr>
+</table>
+
+<table width="100%">
+<tr>
 
+<td valign="top" rowspan=9>
+  <BR>
+  <a href="<%$RT::WebPath%>/Prefs/Calendar.html">Calendar Preferences and Help</a>
 </td>
+
+% foreach my $legend (keys %legend) {
+    <tr>
+      <td align="right">
+        <img src="<%$RT::WebImagesURL%>/<%$legend%>.png" />
+      </td>
+      <td align="left">
+%       my $more = 0;
+%       foreach ( @{$legend{$legend}} ) {
+          <% $more++ ? ', ' : '' %>
+          <&|/l&><% $_ %></&>
+%       }
+      </td>
+    </tr>
+% }
+
 </table>
 
 </&>
 
-<%INIT>
+<%ONCE>
+
+my %legend = (
+  'created'     => ['Created'],
+  'due'         => ['Due'],
+  'resolved'    => ['Resolved'],
+  'updated'     => ['Last Updated'],
+  'created_due' => ['Created','Due'],
+  'reminder'    => ['Reminders'],
+  'started'     => ['Started'],
+  'starts_due'  => ['Starts','Due'],
+);
 
+</%ONCE>
+<%INIT>
 my $title = loc("Calendar");
 
 my @DateTypes = qw/Created Starts Started Due LastUpdated Resolved/;

commit 5e865c5772f7d56c1c395dadd1e5aa7660f3ab43
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 18:49:46 2014 -0400

    Bump copyright

diff --git a/README b/README
index 8556d15..8ecd571 100644
--- a/README
+++ b/README
@@ -92,7 +92,7 @@ AUTHORS
 COPYRIGHT
     Copyright 2007-2009 by Nicolas Chuche <nchuche at barna.be>
 
-    Copyright 2010-2012 by Best Practical Solutions.
+    Copyright 2010-2014 by Best Practical Solutions.
 
     This program is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself.
diff --git a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
index 31ed90a..6be3dd4 100644
--- a/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTx-Calendar/Elements/Tabs/Privileged
@@ -1,40 +1,40 @@
 %# BEGIN BPS TAGGED BLOCK {{{
-%# 
+%#
 %# COPYRIGHT:
-%# 
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
-%#                                          <jesse at bestpractical.com>
-%# 
+%#
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+%#                                          <sales at 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
@@ -43,7 +43,7 @@
 %# 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;
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index db5a792..d8ff8c1 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -236,7 +236,7 @@ Idea borrowed from redmine's calendar (Thanks Jean-Philippe).
 
 Copyright 2007-2009 by Nicolas Chuche E<lt>nchuche at barna.beE<gt>
 
-Copyright 2010-2012 by Best Practical Solutions.
+Copyright 2010-2014 by Best Practical Solutions.
 
 This program is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself.

commit 0172424d0723827e3b83542b7f4895058e7da6d7
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 19:30:42 2014 -0400

    Allow for configurable start days

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 140558b..3b11015 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -47,20 +47,18 @@ $NewQuery => 0
 </table>
 
 <table class="rtxcalendar">
+
 <thead>
 <tr>
-<th></th>
-% for (1 .. 6, 0) {
+% for ( @{$week{$weekstart}} ) {
 <th width="14%"><%$rtdate->GetWeekday($_)%></th>
 % }
 </tr>
 </thead>
+
 <tbody>
 <tr>
 % while ($date <= $end) {
-%   if ( $date->day_of_week == 1) {
-<th><% $date->week_number %></th>
-%   }
 <td class="<% $date->month != ($Month + 1) ? 'oddline' : '' %>"
     style="width:14%;<%  DateTime->compare($today, $date) == 0 ? 'background:#f6f7f8;' : '' %>"
 >
@@ -69,10 +67,11 @@ $NewQuery => 0
 <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
 % }
 </td>
-% $date = $set->next($date);
-% if ( $date->day_of_week == 1) {
-</tr><tr>
-% }
+%   $date = $set->next($date);
+%   if ( $date->day_of_week == $startday_of_week ) {
+      </tr><tr>
+%   }
+
 % }
 </tr>
 </tbody>
@@ -158,9 +157,18 @@ my @DateTypes = qw/Created Starts Started Due LastUpdated Resolved/;
 
 my $rtdate = RT::Date->new($session{'CurrentUser'});
 
+my $weekstart = 'Sunday'; #RT::SiteConfig?  user pref?
+my %week = (
+  'Saturday' => [6,0..5],
+  'Sunday'   => [0..6],
+  'Monday'   => [1..6,0],
+);
+my $startday_of_week = ${$week{$weekstart}}[0]  || 7;
+my $endday_of_week   = ${$week{$weekstart}}[-1] || 7;
+
 my $today = DateTime->today;
-my $date  = RTx::Calendar::FirstMonday($Year, $Month + 1);
-my $end   = RTx::Calendar::LastSunday($Year, $Month + 1);
+my $date = RTx::Calendar::FirstDay($Year, $Month + 1, $startday_of_week );
+my $end  = RTx::Calendar::LastDay ($Year, $Month + 1, $endday_of_week );
 
 # use this to loop over days until $end
 my $set = DateTime::Set->from_recurrence(
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index d8ff8c1..97545d0 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -9,28 +9,28 @@ our $VERSION = "0.17";
 RT->AddStyleSheets('calendar.css')
     if RT->can('AddStyleSheets');
 
-sub FirstMonday {
-    my ($year, $month) = (shift, shift);
+sub FirstDay {
+    my ($year, $month, $matchday) = @_;
     my $set = DateTime::Set->from_recurrence(
 	next => sub { $_[0]->truncate( to => 'day' )->subtract( days => 1 ) }
     );
 
     my $day = DateTime->new( year => $year, month => $month );
 
-    $day = $set->next($day) while $day->day_of_week != 1;
+    $day = $set->next($day) while $day->day_of_week != $matchday;
     $day;
 
 }
 
-sub LastSunday {
-    my ($year, $month) = (shift, shift);
+sub LastDay {
+    my ($year, $month, $matchday) = @_;
     my $set = DateTime::Set->from_recurrence(
 	next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) }
     );
 
     my $day = DateTime->last_day_of_month( year => $year, month => $month );
 
-    $day = $set->next($day) while $day->day_of_week != 7;
+    $day = $set->next($day) while $day->day_of_week != $matchday;
     $day;
 }
 

commit 3069b3405e65a530625648e6dea214f8ce1c2ec6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 20:08:23 2014 -0400

    Give some padding around the chevrons

diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index 3b11015..f6d12ae 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -30,7 +30,7 @@ $NewQuery => 0
 %    $PYear--;
 %    $PMonth = 11;
 % }
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">« <%$rtdate->GetMonth($PMonth)%></a>
 </td>
 <th align="center">
   <font size="+1"><% $rtdate->GetMonth($Month). " $Year" %></font>
@@ -41,7 +41,7 @@ $NewQuery => 0
 %    $NYear++;
 %    $NMonth = 0;
 % }
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%> »</a>
 </td>
 </tr>
 </table>
@@ -80,7 +80,7 @@ $NewQuery => 0
 <table width="100%">
 <tr>
 <td align="left">
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">«<%$rtdate->GetMonth($PMonth)%></a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$PMonth%>&Year=<%$PYear%>&<%$QueryString%>">« <%$rtdate->GetMonth($PMonth)%></a>
 </td>
 
 <td valign="top" align="center">
@@ -104,7 +104,7 @@ $NewQuery => 0
 </td>
 
 <td align="right">
-<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%>»</a>
+<a href="<%$RT::WebPath%>/Search/Calendar.html?Month=<%$NMonth%>&Year=<%$NYear%>&<%$QueryString%>"><%$rtdate->GetMonth($NMonth)%> »</a>
 </td>
 </tr>
 </table>

commit 56058e91252f3be10621029638136f0fef9f7aa7
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 20:12:24 2014 -0400

    Improve styling of individual days

diff --git a/html/Elements/MyCalendar b/html/Elements/MyCalendar
index a54ab39..068dd84 100644
--- a/html/Elements/MyCalendar
+++ b/html/Elements/MyCalendar
@@ -16,12 +16,18 @@
 <tr>
 % $date = $begin->clone;
 % while ($date <= $end) {
-<td>
-<p class="date"><%$date->day%></p>
-% for my $t (@{ $Tickets{$date->strftime("%F")} }) {
-<& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
-% }
-</td>
+%   my @classes = ();
+%   push @classes, "today"     if (DateTime->compare($today,     $date) == 0);
+%   push @classes, "yesterday" if (DateTime->compare($yesterday, $date) == 0);
+
+    <td class="<% @classes %>"><div class="inside-day">
+      <div class="calendardate"><%$date->day%></div>
+
+%     for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
+        <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
+%     }
+
+    </div></td>
 % $date = $set->next($date);
 % }
 </tr>
@@ -41,6 +47,7 @@ my $rtdate = RT::Date->new($session{'CurrentUser'});
 my @DateTypes = qw/Created Starts Started Due LastUpdated Resolved/;
 
 my $today = DateTime->today;
+my $yesterday = $today->clone->subtract( days=>1 );
 
 # this line is used to debug MyCalendar
 # $today = DateTime->new(year => 2007, month => 4, day => 11);
diff --git a/html/Search/Calendar.html b/html/Search/Calendar.html
index f6d12ae..f48f1b2 100644
--- a/html/Search/Calendar.html
+++ b/html/Search/Calendar.html
@@ -59,14 +59,21 @@ $NewQuery => 0
 <tbody>
 <tr>
 % while ($date <= $end) {
-<td class="<% $date->month != ($Month + 1) ? 'oddline' : '' %>"
-    style="width:14%;<%  DateTime->compare($today, $date) == 0 ? 'background:#f6f7f8;' : '' %>"
->
-<p class="date"><%$date->day%></p>
-% for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
-<& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
-% }
-</td>
+%   my @classes = ();
+%   push @classes, "offmonth"  if $date->month != ($Month + 1);
+%   push @classes, "today"     if (DateTime->compare($today,     $date) == 0);
+%   push @classes, "yesterday" if (DateTime->compare($yesterday, $date) == 0);
+%   push @classes, "aweekago"  if (DateTime->compare($aweekago,  $date) == 0);
+
+    <td class="<% @classes %>"><div class="inside-day">
+      <div class="calendardate"><%$date->day%></div>
+
+%     for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
+        <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
+%     }
+
+    </div></td>
+
 %   $date = $set->next($date);
 %   if ( $date->day_of_week == $startday_of_week ) {
       </tr><tr>
@@ -167,6 +174,8 @@ my $startday_of_week = ${$week{$weekstart}}[0]  || 7;
 my $endday_of_week   = ${$week{$weekstart}}[-1] || 7;
 
 my $today = DateTime->today;
+my $yesterday = $today->clone->subtract( days=>1 );
+my $aweekago  = $today->clone->subtract( days=>7 );
 my $date = RTx::Calendar::FirstDay($Year, $Month + 1, $startday_of_week );
 my $end  = RTx::Calendar::LastDay ($Year, $Month + 1, $endday_of_week );
 
diff --git a/static/css/calendar.css b/static/css/calendar.css
index 60773e7..aee3989 100644
--- a/static/css/calendar.css
+++ b/static/css/calendar.css
@@ -1,40 +1,71 @@
-.rtxcalendar .tooltip{position:relative;z-index:1;}
-.rtxcalendar .tooltip:hover{z-index:5;color:#000;}
-.rtxcalendar .tooltip span.tip{display: none; text-align:left;}
-
-.rtxcalendar div.tooltip:hover span.tip{
-display:block;
-position:absolute;
-top:12px; left:24px; width:350px;
-border:1px solid #555;
-background-color:#fff;
-padding: 4px;
-font-size: 0.8em;
-color:#505050;
+/* Tooltips */
+table.rtxcalendar .tooltip {
+    position: relative;
+    z-index: 1;
 }
-
-.rtxcalendar .date {
-text-align: right;
+table.rtxcalendar .tooltip:hover {
+    z-index: 5;
+    color:#000;
+}
+table.rtxcalendar .tooltip span.tip {
+    display: none;
+    text-align: left;
 }
+table.rtxcalendar div.tooltip:hover span.tip{
+    display: block;
+    position: absolute;
+    top:12px; left:24px; width:350px;
+    border: 1px solid #555;
+    background-color: #fff;
+    padding: 4px;
+    font-size: 0.8em;
+    color: #505050;
+}
+
 
+/* For the full calendar */
 table.rtxcalendar {
     width:100%;
     border-collapse: collapse;
-    border: 1px dotted #d0d0d0;
+    border: 1px solid #d0d0d0;
     margin-bottom: 6px;
 }
 
 table.rtxcalendar td {
     border: 1px solid #d7d7d7;
+    background: #fff;
     vertical-align: top;
+    width: 14%;
 }
 
 table.rtxcalendar th {
     border: 1px solid #d7d7d7;
-    background: #eee;
+    background: #eef;
 }
-table.rtxcalendar tbody th {
-    border: 1px solid #d7d7d7;
-    background: #eee;
-    font-weight: normal;
+
+table.rtxcalendar td .inside-day {
+    min-height: 5em;
+}
+
+table.rtxcalendar td.offmonth {
+    background: #f8f8f8;
+    color: #aaa;
+}
+
+table.rtxcalendar td.today {
+    background: #ffe;
+    border: 1px solid #fc6;
+}
+
+table.rtxcalendar td.today .calendardate {
+    background-color: #fc6;
+    width:100%;
+}
+
+table.rtxcalendar td.yesterday {
+    border-right: none;
+}
+
+table.rtxcalendar td.aweekago {
+    border-bottom: none;
 }

commit 085f77a8561dee1084d30a4b5b01b0f91012b6f3
Merge: 5e865c5 56058e9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 20:16:54 2014 -0400

    Merge branch 'ui-cleanup'


commit 5cc0802b319dbc6f1896bc6b30bd50c67011ceb2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 20:20:31 2014 -0400

    Remove 3.8 compat

diff --git a/html/Callbacks/RTx-Calendar/Elements/Header/Head b/html/Callbacks/RTx-Calendar/Elements/Header/Head
deleted file mode 100644
index dcaaa12..0000000
--- a/html/Callbacks/RTx-Calendar/Elements/Header/Head
+++ /dev/null
@@ -1,5 +0,0 @@
-<%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/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 97545d0..f0a84da 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -6,8 +6,7 @@ use DateTime::Set;
 
 our $VERSION = "0.17";
 
-RT->AddStyleSheets('calendar.css')
-    if RT->can('AddStyleSheets');
+RT->AddStyleSheets('calendar.css');
 
 sub FirstDay {
     my ($year, $month, $matchday) = @_;

commit b5b2ad74ee8b2c2e66910143ee5099153a9e895f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed May 7 20:15:42 2014 -0400

    Version bump

diff --git a/CHANGES b/CHANGES
index 423fbc2..8c9adeb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+Changes for 0.18
+  * RT 4.2 compatibility
+  * UI updates from Ivan Kohler
+
 Changes for 0.17
   * Re-released after resolving PAUSE permissions; no changes since 0.16
 
diff --git a/META.yml b/META.yml
index 3b05950..b8bf350 100644
--- a/META.yml
+++ b/META.yml
@@ -29,4 +29,4 @@ requires:
   Digest::SHA: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.17
+version: 0.18
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index f0a84da..925d701 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -4,7 +4,7 @@ use strict;
 use DateTime;
 use DateTime::Set;
 
-our $VERSION = "0.17";
+our $VERSION = "0.18";
 
 RT->AddStyleSheets('calendar.css');
 

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


More information about the Bps-public-commit mailing list