[Bps-public-commit] rtx-calendar branch multiple-days-events-2 created. 1.05-29-ge13bcde

BPS Git Server git at git.bestpractical.com
Thu Dec 14 17:02:18 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtx-calendar".

The branch, multiple-days-events-2 has been created
        at  e13bcde7cc2d6633ff87e7099f6eea5ac32016d6 (commit)

- Log -----------------------------------------------------------------
commit e13bcde7cc2d6633ff87e7099f6eea5ac32016d6
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Tue Dec 12 18:46:41 2023 -0300

    Restore the default popup configuration
    
    After moving the popup content rendering to a helper for loading it
    asynchronously, the defaults for @CalendarPopupFields were no longer
    working. Restore the defaults and move them to RTxCalendar_Config.pm
    with other default values.
    
    Also document these default values and add some guidance in how
    to set custom values.

diff --git a/META.yml b/META.yml
index fe5224e..47bf122 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 ---
 abstract: 'Calendar for RT due dates'
 author:
-  - 'Best Practical Solutions, LLC <modules at bestpractical.com>'
+  - 'Best Practical Solutions, LLC'
 build_requires:
   ExtUtils::MakeMaker: 6.59
 configure_requires:
diff --git a/README b/README
index 3e23eb1..7969fdb 100644
--- a/README
+++ b/README
@@ -61,14 +61,37 @@ CONFIGURATION
         Set($CalendarDisplayOwner, 1);
 
    Choosing the fields to be displayed in the popup
-    You can change which fields show up in the popup display when you mouse
-    over a date in etc/RT_SiteConfig.pm:
+    When you mouse over events on the calendar, a popup window shows
+    additional details from the ticket associated with that event. You can
+    configure which fields are displayed with @CalendarPopupFields. This is
+    the default configuration:
+
+        Set(@CalendarPopupFields, (
+            "OwnerObj->Name",
+            "CreatedObj->ISO",
+            "StartsObj->ISO",
+            "StartedObj->ISO",
+            "LastUpdatedObj->ISO",
+            "DueObj->ISO",
+            "ResolvedObj->ISO",
+            "Status",
+            "Priority",
+            "Requestors->MemberEmailAddressesAsString",
+        ));
+
+    To show custom field values, add them using the custom field name in
+    this format: "CustomField.{Maintenance Start}".
 
-        Set(@CalendarPopupFields,
-            ('Status',
-             'OwnerObj->Name',
-             'DueObj->ISO',
-             'CustomField.{Maintenance Estimated Start Date/Time - ET}'));
+    Valid values are all fields on an RT ticket. See the RT documentation
+    for RT::Ticket for a list.
+
+    As shown above, for ticket fields that can have multiple output formats,
+    like dates and users, you can also use the Obj associated with the field
+    to call a specific method to display the format you want. The ticket
+    dates shown above will display dates in ISO format. The documentation
+    for RT::Date has other format options. User fields, like Owner, can use
+    the methods shown in the RT::User documentation to show values like
+    EmailAddress or RealName, for example.
 
    Event colors
     It's also possible to change the color of the events in the calendar by
@@ -123,11 +146,8 @@ CONFIGURATION
     Note that the Starts and Ends fields must be included in the search
     result Format in order the event to be displayed on the calendar.
 
-USAGE
-    A small help section is available in /Search/Calendar.html
-
 AUTHOR
-    Best Practical Solutions, LLC <modules at bestpractical.com>
+    Best Practical Solutions, LLC
 
     Originally written by Nicolas Chuche <nchuche at barna.be>
 
diff --git a/etc/RTxCalendar_Config.pm b/etc/RTxCalendar_Config.pm
index 3fead2c..d931763 100644
--- a/etc/RTxCalendar_Config.pm
+++ b/etc/RTxCalendar_Config.pm
@@ -23,4 +23,17 @@ Set(@CalendarFilterStatuses, qw(new open stalled rejected resolved));
 
 Set(@CalendarFilterDefaultStatuses, qw(new open));
 
+Set(@CalendarPopupFields, (
+    "OwnerObj->Name",
+    "CreatedObj->ISO",
+    "StartsObj->ISO",
+    "StartedObj->ISO",
+    "LastUpdatedObj->ISO",
+    "DueObj->ISO",
+    "ResolvedObj->ISO",
+    "Status",
+    "Priority",
+    "Requestors->MemberEmailAddressesAsString",
+));
+
 1;
diff --git a/html/Helpers/CalendarEventInfo b/html/Helpers/CalendarEventInfo
index 125fb8f..c5b6f93 100644
--- a/html/Helpers/CalendarEventInfo
+++ b/html/Helpers/CalendarEventInfo
@@ -25,16 +25,14 @@ if ($Object->Type eq 'reminder') {
     $status = $Object->Status;
 }
 
-my @display_fields = RT->Config->Get('CalendarPopupFields');
-
-# default
-if (0 == @display_fields) {
-    @display_fields = qw(OwnerObj->Name CreatedObj->ISO StartsObj->ISO
-			 StartedObj->ISO LastUpdatedObj->ISO DueObj->ISO
-			 ResolvedObj->ISO Status Priority
-			 Requestors->MemberEmailAddressesAsString);
+my @display_fields = ();
+if ( RT->Config->Get('CalendarPopupFields') ) {
+    @display_fields = RT->Config->Get('CalendarPopupFields');
 }
 
+RT->Logger->warning("No CalendarPopupFields defined. Popups will have no extra information.")
+    unless @display_fields;
+
 my %label_of;
 for my $field (@display_fields) {
     my $label = $field;
diff --git a/lib/RTx/Calendar.pm b/lib/RTx/Calendar.pm
index 4e00fb7..4ec03c9 100644
--- a/lib/RTx/Calendar.pm
+++ b/lib/RTx/Calendar.pm
@@ -401,14 +401,37 @@ F<etc/RT_SiteConfig.pm>:
 
 =head3 Choosing the fields to be displayed in the popup
 
-You can change which fields show up in the popup display when you
-mouse over a date in F<etc/RT_SiteConfig.pm>:
+When you mouse over events on the calendar, a popup window shows additional
+details from the ticket associated with that event. You can configure which
+fields are displayed with C<@CalendarPopupFields>. This is the default
+configuration:
+
+    Set(@CalendarPopupFields, (
+        "OwnerObj->Name",
+        "CreatedObj->ISO",
+        "StartsObj->ISO",
+        "StartedObj->ISO",
+        "LastUpdatedObj->ISO",
+        "DueObj->ISO",
+        "ResolvedObj->ISO",
+        "Status",
+        "Priority",
+        "Requestors->MemberEmailAddressesAsString",
+    ));
+
+To show custom field values, add them using the custom field name in
+this format: C<"CustomField.{Maintenance Start}">.
+
+Valid values are all fields on an RT ticket. See the RT documentation for
+C<RT::Ticket> for a list.
 
-    Set(@CalendarPopupFields,
-        ('Status',
-         'OwnerObj->Name',
-         'DueObj->ISO',
-         'CustomField.{Maintenance Estimated Start Date/Time - ET}'));
+As shown above, for ticket fields that can have multiple output formats,
+like dates and users, you can also use the C<Obj> associated with the field
+to call a specific method to display the format you want. The ticket dates
+shown above will display dates in C<ISO> format. The documentation for C<RT::Date>
+has other format options. User fields, like Owner, can use the methods shown
+in the C<RT::User> documentation to show values like EmailAddress or
+RealName, for example.
 
 =head3 Event colors
 
@@ -469,13 +492,9 @@ setting to your F<etc/RT_SiteConfig.pm>:
 Note that the Starts and Ends fields must be included in the search result
 Format in order the event to be displayed on the calendar.
 
-=head1 USAGE
-
-A small help section is available in /Search/Calendar.html
-
 =head1 AUTHOR
 
-Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
+Best Practical Solutions, LLC
 
 Originally written by Nicolas Chuche E<lt>nchuche at barna.beE<gt>
 

commit 503edd088b911448fdcfc4fcf12f4ca1f252e663
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Fri Dec 1 17:21:50 2023 -0300

    Don't die in the popup helper if attributes are not found
    
    If an attribute is not found, log an error and continue.

diff --git a/html/Helpers/CalendarEventInfo b/html/Helpers/CalendarEventInfo
index cca3221..125fb8f 100644
--- a/html/Helpers/CalendarEventInfo
+++ b/html/Helpers/CalendarEventInfo
@@ -74,7 +74,10 @@ foreach my $attr (@display_fields) {
         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 ($@) {
+            RT->Logger->error("Check your CalendarPopupFields config. Failed to find \"$attr\" - ". $@);
+            $value = '-';
+        };
     }
 </%perl>
 	<strong><&|/l&><% $label_of{$attr} %></&>:</strong> <% $value %><br />

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


hooks/post-receive
-- 
rtx-calendar


More information about the Bps-public-commit mailing list