From 66f74183afa343e42b6a5a806ed8f632cd104546 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 13 Dec 2006 18:55:52 +0000 Subject: [PATCH] Calendar and Event print templates plus other template fixes. --- docs/changelog/7.x.x.txt | 3 +- .../upgrades/templates-7.3.2/CalendarDay.tmpl | 270 +++++++++++++++ .../templates-7.3.2/CalendarEvent.tmpl | 214 ++++++++++++ .../templates-7.3.2/CalendarMonth.tmpl | 321 ++++++++++++++++++ .../templates-7.3.2/CalendarWeek.tmpl | 265 +++++++++++++++ .../default-calendar-print-day.tmpl | 65 ++++ .../default-calendar-print-event.tmpl | 97 ++++++ .../default-calendar-print-month.tmpl | 65 ++++ .../default-calendar-print-week.tmpl | 65 ++++ lib/WebGUI/Asset/Event.pm | 24 +- lib/WebGUI/Asset/Wobject/Calendar.pm | 42 +++ 11 files changed, 1428 insertions(+), 3 deletions(-) create mode 100755 docs/upgrades/templates-7.3.2/CalendarDay.tmpl create mode 100755 docs/upgrades/templates-7.3.2/CalendarEvent.tmpl create mode 100755 docs/upgrades/templates-7.3.2/CalendarMonth.tmpl create mode 100755 docs/upgrades/templates-7.3.2/CalendarWeek.tmpl create mode 100755 docs/upgrades/templates-7.3.2/default-calendar-print-day.tmpl create mode 100755 docs/upgrades/templates-7.3.2/default-calendar-print-event.tmpl create mode 100755 docs/upgrades/templates-7.3.2/default-calendar-print-month.tmpl create mode 100755 docs/upgrades/templates-7.3.2/default-calendar-print-week.tmpl diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index aa262038a..9568909b0 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.3.2 - + - fix: Calendar and Event now have printable templates and URL parameters. + - fix: Miscellaneous Calendar template fixes 7.3.1 - Fixed a problem with IE and resizable text areas that caused IE to crash diff --git a/docs/upgrades/templates-7.3.2/CalendarDay.tmpl b/docs/upgrades/templates-7.3.2/CalendarDay.tmpl new file mode 100755 index 000000000..180e2258a --- /dev/null +++ b/docs/upgrades/templates-7.3.2/CalendarDay.tmpl @@ -0,0 +1,270 @@ +#CalendarDay00000000001 + +

+
+ + +

+
+ + +

+
+ + + + + + + + + + + + + + +
+ Day + Week + Month + Search + +
+ Add Event + Print +
+
+
+ « Previous Day + • + + , . • + Next Day » +
+
+
+ , , +
+
+ + + + + +
+
:00
+
+
    +
  • + +
  • +
+
+
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/CalendarEvent.tmpl b/docs/upgrades/templates-7.3.2/CalendarEvent.tmpl new file mode 100755 index 000000000..4a00e3547 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/CalendarEvent.tmpl @@ -0,0 +1,214 @@ +#CalendarEvent000000001 + + + + + + + + + + + + + +
+ Day + Week + Month + Search + +
+ Edit + • Delete + • Print +
+
+ + +
+ Event Details +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
Event Title
+
+
+ +
+
+
Location
+
+
+ +
+
+
Description
+
+
+
+
Scheduled
+
+
+ , + + + : , + + + : +
+
+
Related Material
+
+
+
+
+
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/CalendarMonth.tmpl b/docs/upgrades/templates-7.3.2/CalendarMonth.tmpl new file mode 100755 index 000000000..66c46eca2 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/CalendarMonth.tmpl @@ -0,0 +1,321 @@ +#CalendarMonth000000001 + +

+
+ + +

+
+ + + + + + + + + + + + + + + + + + +
+ Day + Week + Month + Search + +
Add EventPrint + +
+
+
+ « • + + + + • + » +
+
+
+ +
+
+ + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+~~~ + + diff --git a/docs/upgrades/templates-7.3.2/CalendarWeek.tmpl b/docs/upgrades/templates-7.3.2/CalendarWeek.tmpl new file mode 100755 index 000000000..88e77a109 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/CalendarWeek.tmpl @@ -0,0 +1,265 @@ +#CalendarWeek0000000001 + +

+
+ + +

+
+ + + + + + + + + + + + + + + + + + +
+ Day Week Month Search +
+ Add Event + Print + +
+
+ +
+
+ , to , +
+
+ + + + + +
+
+
+ +
    +
  • +
+
+
+
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/default-calendar-print-day.tmpl b/docs/upgrades/templates-7.3.2/default-calendar-print-day.tmpl new file mode 100755 index 000000000..c1b34fd0d --- /dev/null +++ b/docs/upgrades/templates-7.3.2/default-calendar-print-day.tmpl @@ -0,0 +1,65 @@ +#CalendarPrintDay000001 +#create +#namespace:Calendar/Print/Day +#url:default-calendar-print-day +#title:Default Calendar Print Day +#menuTitle:Default Calendar Print Day +
+ +
+ + + + + + + + +
:00 +
    +
  • +
    +
+
+ +
+ © Plain Black 2006 +
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/default-calendar-print-event.tmpl b/docs/upgrades/templates-7.3.2/default-calendar-print-event.tmpl new file mode 100755 index 000000000..a7c125124 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/default-calendar-print-event.tmpl @@ -0,0 +1,97 @@ +#CalendarPrintEvent0001 +#create +#namespace:Calendar/Print/Event +#url:default-calendar-print-event +#title:Default Calendar Print Event +#menuTitle:Default Calendar Print Event +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
Location
+
+
+ +
+
+
Description
+
+
+
+
Scheduled
+
+
+ , + + + : , + + + : +
+
+
Related Material
+
+
+
+
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/default-calendar-print-month.tmpl b/docs/upgrades/templates-7.3.2/default-calendar-print-month.tmpl new file mode 100755 index 000000000..736795675 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/default-calendar-print-month.tmpl @@ -0,0 +1,65 @@ +#CalendarPrintMonth0001 +#create +#namespace:Calendar/Print/Month +#url:default-calendar-print-month +#title:Default Calendar Print Month +#menuTitle:Default Calendar Print Month +
+ +
+ + + + + + + + +
+
    +
  • +
    +
+
+ +
+ © Plain Black 2006 +
+~~~ + diff --git a/docs/upgrades/templates-7.3.2/default-calendar-print-week.tmpl b/docs/upgrades/templates-7.3.2/default-calendar-print-week.tmpl new file mode 100755 index 000000000..c2286edc6 --- /dev/null +++ b/docs/upgrades/templates-7.3.2/default-calendar-print-week.tmpl @@ -0,0 +1,65 @@ +#CalendarPrintWeek00001 +#create +#namespace:Calendar/Print/Week +#url:default-calendar-print-week +#title:Default Calendar Print Week +#menuTitle:Default Calendar Print Week +
+   -   +
+ + + + + + + + +
+
    +
  • +
    +
+
+ +
+ © Plain Black 2006 +
+~~~ + diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index c73fe4f1a..43984cf56 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -24,7 +24,7 @@ use WebGUI::Form; use base 'WebGUI::Asset'; -use DateTime; +use WebGUI::DateTime; @@ -1306,6 +1306,8 @@ sub isAllDay Prepares the view template to be used later. The template to be used is found from this asset's parent (Usually a Calendar). +If the "print" form parameter is set, will prepare the print template. + =cut sub prepareView @@ -1316,7 +1318,15 @@ sub prepareView if ($parent) { - $templateId = $parent->get("templateIdEvent") + if ($self->session->form->param("print")) + { + $templateId = $parent->get("templateIdPrintEvent"); + $self->session->style->makePrintable(1); + } + else + { + $templateId = $parent->get("templateIdEvent"); + } } else { @@ -2048,6 +2058,16 @@ ENDJS Shows the event based on the parent asset's style and Event Details template +=head3 URL Parameters + +=over 8 + +=item print + +If true, will show the printable version of the event + +=back + =cut sub www_view { diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index 2cfc8f0e4..65a6d01a7 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -725,6 +725,8 @@ sub getLastEvent Loads the template to be used by the view() method. +Determines which template to load based on the "type" and "print" URL +parameters. =cut @@ -737,6 +739,14 @@ sub prepareView || ucfirst $self->get("defaultView") || "Month"; + if ($self->session->form->param("print")) + { + $view = "Print".$view; + $self->session->style->makePrintable(1); + } + + #$self->session->errorHandler->warn("Prepare view ".$view." with template ".$self->get("templateId".$view)); + my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId".$view)); $template->prepare; @@ -747,6 +757,7 @@ sub prepareView + #################################################################### =head2 processPropertiesFromFormPost ( ) @@ -903,6 +914,7 @@ sub view $var->{"urlMonth"} = $self->getUrl("type=month;start=".$params->{start}); $var->{"urlAdd"} = $self->getUrl("func=add;class=WebGUI::Asset::Event"); $var->{"urlSearch"} = $self->getUrl("func=search"); + $var->{"urlPrint"} = $self->getUrl("type=".$params->{type}.";start=".$params->{start}.";print=1"); # Parameters $var->{"paramStart"} = $params->{start}; @@ -1683,6 +1695,36 @@ sub www_search +#################################################################### + +=head2 www_view ( ) + +Shows the normal view + +=head3 URL Parameters + +=over 8 + +=item type + +What view of the calendar to show. One of "month, "week", or "day". + +=item start + +What time to start the calendar. Must be a full MySQL Date/Time string in the +format 2006-12-17 14:00:00. + +The calendar will truncate the start to show the entire month, week, or day, +depending on the type. + +=item print + +If set to some true value (like "1"), will show the printable version of the +page. + +=back + + =head1 Templates