diff --git a/code/CalendarDateTime.php b/code/CalendarDateTime.php index 919056f..7fcb554 100755 --- a/code/CalendarDateTime.php +++ b/code/CalendarDateTime.php @@ -31,18 +31,22 @@ class CalendarDateTime extends DataObject public function getCMSFields() { - DateField::set_default_config('showcalendar', true); - $f = new FieldList( - new DateField('StartDate',_t('CalendarDateTime.STARTDATE','Start date')), - new DateField('EndDate',_t('CalendarDateTime.ENDDATE','End date')), - new TimeField('StartTime', _t('CalendarDateTime.STARTTIME','Start time')), - new TimeField('EndTime', _t('CalendarDateTime.ENDTIME','End time')), + $fields = parent::getCMSFields(); + + $fields->removeByName('EventID'); + $fields->addFieldsToTab('Root.Main', array( + $start = new DateField('StartDate',_t('CalendarDateTime.STARTDATE', 'Start date')), + $end = new DateField('EndDate',_t('CalendarDateTime.ENDDATE', 'End date')), + new TimePickerField('StartTime', _t('CalendarDateTime.STARTTIME', 'Start time')), + new TimePickerField('EndTime', _t('CalendarDateTime.ENDTIME', 'End time')), new CheckboxField('AllDay', _t('CalendarDateTime.ALLDAY','This event lasts all day')) - ); + )); - $this->extend('updateCMSFields', $f); + $start->setConfig('showcalendar', true); + $end->setConfig('showcalendar', true); - return $f; + $this->extend('updateCMSFields', $fields); + return $fields; } diff --git a/code/CalendarTimeField.php b/code/CalendarTimeField.php deleted file mode 100755 index 53eb618..0000000 --- a/code/CalendarTimeField.php +++ /dev/null @@ -1,21 +0,0 @@ - 'text', - 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), - 'id' => $this->id(), - 'name' => $this->Name(), - 'value' => $this->attrValue(), - 'tabindex' => $this->getTabIndex(), - 'maxlength' => ($this->maxLength) ? $this->maxLength : null, - 'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : null - ); - - if($this->disabled) $attributes['disabled'] = 'disabled'; - - return $this->createTag('input', $attributes); - } -} \ No newline at end of file diff --git a/composer.json b/composer.json index 913382a..af2b319 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,25 @@ { - "name":"silverstripe/event-calendar", + "name":"silverstripe/event-calendar", "type": "silverstripe-module", "description": "Event Calendar for the SilverStripe CMS", "keywords": ["silverstripe", "events"], "license": "BSD-3-Clause", - "authors":[ + "authors": [ { "name": "Aaron Carlino", "homepage": "http://leftandmain.com" } ], - "require": - { + "require": { "php": ">=5.3.2", "silverstripe/framework": "3.*", - "silverstripe/cms": "3.*" + "silverstripe/cms": "3.*", + "silverstripe/timepickerfield": "dev-master" }, "support": { "issues": "https://github.com/unclecheese/EventCalendar/issues" }, - "extra": { + "extra": { "installer-name": "event_calendar" - } - -} \ No newline at end of file + } +}