/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { // Add timepicker functionality // @see https://github.com/trentrichardson/jQuery-Timepicker-Addon Requirements::css(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css'); Requirements::css(ADVANCED_WORKFLOW_DIR . '/css/WorkflowFieldTimePicker.css'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js'); Requirements::javascript(ADVANCED_WORKFLOW_DIR . '/javascript/WorkflowField.js'); $this->setIsWorkflowInEffect(); if ($this->getIsWorkflowInEffect()) { $fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = new Datetimefield('DesiredUnPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_UNPUBLISH_DATE', 'Requested un-publish date')), Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date'))->setDisabled(true), Datetimefield::create('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date'))->setDisabled(true), $uth = new HiddenField('PublishOnDateOwner'))); // Set a value to our hidden field $uth->setValue($this->owner->PublishOnDate); } else { $fields->addFieldsToTab('Root.PublishingSchedule', array(new HeaderField('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), new LiteralField('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = new Datetimefield('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = new Datetimefield('UnPublishOnDate', _t('WorkflowEmbargoExpiryExtension.UNPUBLISH_ON', 'Scheduled un-publish date')))); } $dt->getDateField()->setConfig('showcalendar', true); $ut->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); $ut->getTimeField()->setConfig('timeformat', 'HH:mm:ss'); // Enable a jQuery-UI timepicker widget if (self::$showTimePicker) { $dt->getTimeField()->addExtraClass('hasTimePicker'); $ut->getTimeField()->addExtraClass('hasTimePicker'); } }
/** * @param FieldSet $fields */ public function updateCMSFields($fields) { $fields->addFieldsToTab('Root.Content.PublishingSchedule', array($dt = new Datetimefield('PublishOnDate', _t('AdvancedWorkflow.PUBLISH_ON', 'Publish on')), $ut = new Datetimefield('UnPublishOnDate', _t('AdvancedWorkflow.UNPUBLISH_ON', 'Un-publish on')))); $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); $ut->getDateField()->setConfig('showcalendar', true); $ut->getTimeField()->setConfig('showdropdown', true); }
/** * * @param FieldSet $fields */ public function updateCMSFields($fields) { $fields->addFieldsToTab('Root.Schedule', array($dt = new Datetimefield('FirstExecution', _t('ScheduledExecution.FIRST_EXECUTION', 'First Execution')), new DropdownField('ExecuteEvery', _t('ScheduledExecution.EXECUTE_EVERY', 'Execute every'), $this->owner->dbObject('ExecuteEvery')->enumValues()), new TextField('ExecuteFree', _t('ScheduledExecution.EXECUTE_FREE', 'Scheduled (in strtotime format from first execution)')))); if ($this->owner->ScheduledJobID) { $jobTime = $this->owner->ScheduledJob()->StartAfter; $fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('ScheduledExecution.NEXT_RUN_DATE', 'Next run date'), $jobTime))); } $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); }
/** * @param FieldSet $fields */ public function updateCMSFields(FieldList $fields) { $fields->findOrMakeTab('Root.Schedule', _t('ScheduledExecution.ScheduleTabTitle', 'Schedule')); $fields->addFieldsToTab('Root.Schedule', array($dt = new Datetimefield('FirstExecution', _t('ScheduledExecution.FIRST_EXECUTION', 'First Execution')), FieldGroup::create(new NumericField('ExecuteInterval', ''), new DropdownField('ExecuteEvery', '', array('' => '', 'Minute' => _t('ScheduledExecution.ExecuteEveryMinute', 'Minute'), 'Hour' => _t('ScheduledExecution.ExecuteEveryHour', 'Hour'), 'Day' => _t('ScheduledExecution.ExecuteEveryDay', 'Day'), 'Week' => _t('ScheduledExecution.ExecuteEveryWeek', 'Week'), 'Fortnight' => _t('ScheduledExecution.ExecuteEveryFortnight', 'Fortnight'), 'Month' => _t('ScheduledExecution.ExecuteEveryMonth', 'Month'), 'Year' => _t('ScheduledExecution.ExecuteEveryYear', 'Year'))))->setTitle(_t('ScheduledExecution.EXECUTE_EVERY', 'Execute every')), new TextField('ExecuteFree', _t('ScheduledExecution.EXECUTE_FREE', 'Scheduled (in strtotime format from first execution)')))); if ($this->owner->ScheduledJobID) { $jobTime = $this->owner->ScheduledJob()->StartAfter; $fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('ScheduledExecution.NEXT_RUN_DATE', 'Next run date'), $jobTime))); } $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); }
/** * * @param FieldSet $fields */ public function updateCMSFields(FieldList $fields) { if (class_exists('AbstractQueuedJob')) { $fields->addFieldsToTab('Root.Schedule', array(new TextField('ScheduledTitle', _t('AdvancedReport.SCHEDULED_TITLE', 'Title for scheduled report')), $dt = new Datetimefield('FirstGeneration', _t('AdvancedReport.FIRST_GENERATION', 'First generation')), new DropdownField('RegenerateEvery', _t('AdvancedReport.REGENERATE_EVERY', 'Regenerate every'), $this->owner->dbObject('RegenerateEvery')->enumValues()), new TextField('RegenerateFree', _t('AdvancedReport.REGENERATE_FREE', 'Scheduled (in strtotime format from first generation)')), new TextField('SendReportTo', _t('AdvancedReport.SEND_TO', 'Send to email addresses')))); if ($this->owner->ScheduledJobID) { $jobTime = $this->owner->ScheduledJob()->StartAfter; $fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('AdvancedReport.NEXT_RUN_DATE', 'Next run date'), $jobTime))); } $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); } else { $fields->addFieldToTab('Root.Schedule', new LiteralField('WARNING', 'You must install the Queued Jobs module to schedule reports')); } }
public function getCMSFields() { $fields = parent::getCMSFields(); $available_classes = ClassInfo::subclassesFor("BuildTask"); array_shift($available_classes); ksort($available_classes); $available_jobtypes = array(QueuedJob::IMMEDIATE => "Small", QueuedJob::QUEUED => "Medium", QueuedJob::LARGE => "Large"); $fields->removeByName(array("ExecuteInterval", "ExecuteEvery", "ExecuteFree", "ScheduledJobID")); $fields->addFieldsToTab('Root.Main', array(DropdownField::create("BuildTaskClass", "Build Task", $available_classes), KeyValueField::create("RequestVariables", "Request Variables")->setDescription("Optional"), $dt = new Datetimefield('FirstExecution', _t('ScheduledExecution.FIRST_EXECUTION', 'First Execution')), FieldGroup::create(new NumericField('ExecuteInterval', ''), new DropdownField('ExecuteEvery', '', array('' => '', 'Minute' => _t('ScheduledExecution.ExecuteEveryMinute', 'Minute'), 'Hour' => _t('ScheduledExecution.ExecuteEveryHour', 'Hour'), 'Day' => _t('ScheduledExecution.ExecuteEveryDay', 'Day'), 'Week' => _t('ScheduledExecution.ExecuteEveryWeek', 'Week'), 'Fortnight' => _t('ScheduledExecution.ExecuteEveryFortnight', 'Fortnight'), 'Month' => _t('ScheduledExecution.ExecuteEveryMonth', 'Month'), 'Year' => _t('ScheduledExecution.ExecuteEveryYear', 'Year'))))->setTitle(_t('ScheduledExecution.EXECUTE_EVERY', 'Execute every')), DropdownField::create("JobType", "Job Type", $available_jobtypes))); if ($this->ScheduledJobID) { $jobTime = $this->getNextRunDate(); $fields->addFieldsToTab('Root.Schedule', array(new ReadonlyField('NextRunDate', _t('ScheduledExecution.NEXT_RUN_DATE', 'Next run date'), $jobTime))); } $dt->getDateField()->setConfig('showcalendar', true); $dt->getTimeField()->setConfig('showdropdown', true); return $fields; }