From 0854f5326208d3d68e03ab12834550d403c42720 Mon Sep 17 00:00:00 2001 From: ajshort Date: Mon, 7 Mar 2011 13:59:13 +1100 Subject: [PATCH] ENHANCEMENT: Removed dependency on DataObjectManager by using ComplexTableField if it's not available. --- _config.php | 11 ++++------- code/Calendar.php | 3 ++- code/CalendarDateTime.php | 8 ++++++-- 3 files changed, 12 insertions(+), 10 deletions(-) mode change 100755 => 100644 _config.php mode change 100755 => 100644 code/Calendar.php mode change 100755 => 100644 code/CalendarDateTime.php diff --git a/_config.php b/_config.php old mode 100755 new mode 100644 index 1e68397..0eed2d8 --- a/_config.php +++ b/_config.php @@ -4,9 +4,6 @@ require_once(Director::baseFolder().'/event_calendar/code/sfDateTimeToolkit.class.php'); require_once(Director::baseFolder().'/event_calendar/code/CalendarUI.class.php'); -if(!class_exists("DataObjectManager")) - user_error(_t('EventCalendar.DATAOBJECTMANAGER','Event Calendar requires the DataObjectManager module.'),E_USER_ERROR); - LeftAndMain::require_javascript('event_calendar/javascript/calendar_interface.js'); LeftAndMain::require_css('event_calendar/css/calendar_cms.css'); @@ -27,7 +24,7 @@ /** * Available date format keys - + ** Start Date ** %{sWeekDayShort} e.g. Mon %{sWeekDayFull} e.g. Monday @@ -40,7 +37,7 @@ %{sMonFull} e.g. October %{sYearShort} e.g. 09 %{sYearFull} e.g. 2009 - + ** End Date ** %{eWeekDayShort} %{eWeekDayFull} @@ -54,13 +51,13 @@ %{eYearShort} %{eYearFull} -*/ +*/ global $customDateTemplates; $customDateTemplates = array( /* You can modify the date display by assigning new date templates to any of the following date scenarios. Use the above date format keys. - + 'OneDay' => '%{sMonShort}. %{sDayNumShort}, %{sYearFull}' 'SameMonthSameYear' => '%{sMonShort}. %{sDayNumShort} - %{eDayNumShort}, %{eYearFull}' 'DiffMonthSameYear' => '%{sMonShort}. %{sDayNumShort} - %{eMonShort}. %{eDayNumShort}, %{eYearFull}' diff --git a/code/Calendar.php b/code/Calendar.php old mode 100755 new mode 100644 index f1fdbfb..cc1233e --- a/code/Calendar.php +++ b/code/Calendar.php @@ -124,7 +124,8 @@ public function getCMSFields() $announcements = _t('Calendar.Announcements','Announcements'); $f->addFieldToTab("Root.Content.$announcements", $table); - $table = new DataObjectManager( + $tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField'; + $table = new $tableClass( $this, 'Feeds', 'ICSFeed', diff --git a/code/CalendarDateTime.php b/code/CalendarDateTime.php old mode 100755 new mode 100644 index 266272f..306d3ee --- a/code/CalendarDateTime.php +++ b/code/CalendarDateTime.php @@ -170,7 +170,9 @@ public function getDateTimeTable($eventID) $filter = "`CalendarDateTime`.EventID = {$eventID}"; $fields = $this->getPopupFields(); $fields->push(new HiddenField('EventID','',$eventID)); - $table = new DataObjectManager($this->getEventObject(), $name, get_class($this), $titles, $fields, $filter); + + $tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField'; + $table = new $tableClass($this->getEventObject(), $name, get_class($this), $titles, $fields, $filter); $table->setAddTitle(_t("CalendarDateTime.ADATE","a Date")); return $table; @@ -179,7 +181,9 @@ public function getDateTimeTable($eventID) public function getAnnouncementTable($calendarID) { $this->extendAnnouncement(); - $table = new DataObjectManager( + + $tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField'; + $table = new $tableClass( $this->getEventObject()->Parent(), 'Announcements', $this->class,