function FieldHolder() { Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js'); // swap the js file Requirements::block(SAPPHIRE_DIR . '/javascript/TableField.js'); Requirements::javascript('modifiedtablefield/javascript/ModifiedTableField.js'); Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css'); $defaults = $this->fieldDefaults; if ($this->fieldDefaults == null && !is_array($this->fieldDefaults)) { $sourceClass = $this->sourceClass; $defaults = singleton($sourceClass)->stat('defaults'); } if (count($defaults) > 0) { Requirements::customScript("var ".$this->name."_fieldDefaults = ".Convert::array2json($defaults)); } return $this->renderWith($this->template); }
function Field() { Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css'); Requirements::javascript(THIRDPARTY_DIR . "/tree/tree.js"); Requirements::css(THIRDPARTY_DIR . "/tree/tree.css"); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js"); if ($this->value) { $record = $this->getByKey($this->value); $title = $record ? $record->Title : _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown'); } else { $title = _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown'); } $id = $this->id(); $classes = "TreeDropdownField single"; if ($this->extraClass()) { $classes .= ' ' . $this->extraClass(); } return <<<HTML \t\t\t<div id="TreeDropdownField_{$id}" class="{$classes}"><input id="{$id}" type="hidden" name="{$this->name}" value="{$this->value}" /><span class="items">{$title}</span><a href="#" title="open" class="editLink"> </a></div>\t\t HTML; }
function init() { parent::init(); // somehow themed css gets mixed in, remove it $reqbe = Requirements::backend(); foreach ($reqbe->get_css() as $file => $val) { if (preg_match('/^themes\\//', $file)) { Requirements::block($file); } } Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.widget.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.mouse.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.tabs.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.button.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.position.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.dialog.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.draggable.js'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.core.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.dialog.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.theme.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.tabs.css'); Requirements::clear('jsparty/prototype.js'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js"); Requirements::add_i18n_javascript('dbplumber/javascript/lang'); Requirements::javascript("dbplumber/javascript/DatabaseBrowser.js"); Requirements::javascript("dbplumber/thirdparty/jquery.event.drag-1.4.js"); Requirements::javascript("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.js"); Requirements::javascript("dbplumber/thirdparty/jquery.textarea-expander.js"); Requirements::css("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.css"); Requirements::css("dbplumber/css/DatabaseBrowser_left.css"); Requirements::css("dbplumber/css/DatabaseBrowser_right.css"); }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { Requirements::add_i18n_javascript(ADVANCED_WORKFLOW_DIR . '/javascript/lang'); // 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/WorkflowCMS.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(); $fields->findOrMakeTab('Root.PublishingSchedule', _t('WorkflowEmbargoExpiryExtension.TabTitle', 'Publishing Schedule')); if ($this->getIsWorkflowInEffect()) { $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('DesiredPublishDate', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE', 'Requested publish date')), $ut = Datetimefield::create('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))); } else { $fields->addFieldsToTab('Root.PublishingSchedule', array(HeaderField::create('PublishDateHeader', _t('WorkflowEmbargoExpiryExtension.REQUESTED_PUBLISH_DATE_H3', 'Expiry and Embargo'), 3), LiteralField::create('PublishDateIntro', $this->getIntroMessage('PublishDateIntro')), $dt = Datetimefield::create('PublishOnDate', _t('WorkflowEmbargoExpiryExtension.PUBLISH_ON', 'Scheduled publish date')), $ut = Datetimefield::create('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'); } }
public function getPopupRequirements() { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js'); Requirements::add_i18n_javascript('eventlocations/javascript/lang'); Requirements::javascript('eventlocations/javascript/LocationDateTimeCms.js'); }
/** * @param GridField $gridField * * @return array */ public function getHTMLFragments($gridField) { Requirements::css(CMC_BULKUPDATER_MODULE_DIR . '/css/CmcGridFieldBulkUpdater.css'); Requirements::javascript(CMC_BULKUPDATER_MODULE_DIR . '/javascript/CmcGridFieldBulkUpdater.js'); Requirements::add_i18n_javascript(CMC_BULKUPDATER_MODULE_DIR . '/lang/js'); //initialize column data $cols = new ArrayList(); $fields = $gridField->getConfig()->getComponentByType('GridFieldEditableColumns')->getDisplayFields($gridField); foreach ($gridField->getColumns() as $col) { $fieldName = $col; $fieldType = ''; $fieldLabel = ''; if (isset($fields[$fieldName])) { $fieldData = $fields[$fieldName]; if (isset($fieldData['field'])) { $fieldType = $fieldData['field']; } if (isset($fieldData['title'])) { $fieldLabel = $fieldData['title']; } } //Debug::show($fieldType); if (class_exists($fieldType) && $fieldType != 'ReadonlyField') { $field = new $fieldType($fieldName, $fieldLabel); if ($fieldType == 'DatetimeField' || $fieldType == 'DateField' || $fieldType == 'TimeField') { $field->setValue(date('Y-m-d H:i:s')); $field->setConfig('showcalendar', true); } $cols->push(new ArrayData(array('UpdateField' => $field, 'Name' => $fieldName, 'Title' => $fieldLabel))); } else { $meta = $gridField->getColumnMetadata($col); $cols->push(new ArrayData(array('Name' => $col, 'Title' => $meta['title']))); } } $templateData = array(); if (!count($this->config['actions'])) { user_error('Trying to use GridFieldBulkManager without any bulk action.', E_USER_ERROR); } //set up actions $actionsListSource = array(); $actionsConfig = array(); foreach ($this->config['actions'] as $action => $actionData) { $actionsListSource[$action] = $actionData['label']; $actionsConfig[$action] = $actionData['config']; } reset($this->config['actions']); $firstAction = key($this->config['actions']); $dropDownActionsList = DropdownField::create('bulkActionName', '')->setSource($actionsListSource)->setAttribute('class', 'bulkActionName no-change-track')->setAttribute('id', ''); //initialize buttonLabel $buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION1_BTN_LABEL', $this->config['actions'][$firstAction]['label']); //add menu if more than one action if (count($this->config['actions']) > 1) { $templateData = array('Menu' => $dropDownActionsList->FieldHolder()); $buttonLabel = _t('CMC_GRIDFIELD_BULK_UPDATER.ACTION_BTN_LABEL', 'Go'); } //Debug::show($buttonLabel); $templateData = array_merge($templateData, array('Button' => array('Label' => $buttonLabel, 'Icon' => $this->config['actions'][$firstAction]['config']['icon']), 'Select' => array('Label' => _t('CMC_GRIDFIELD_BULK_UPDATER.SELECT_ALL_LABEL', 'Select all')), 'Colspan' => count($gridField->getColumns()) - 1, 'Cols' => $cols)); $templateData = new ArrayData($templateData); return array('header' => $templateData->renderWith('CmcBulkUpdaterButtons')); }
public function init() { // set reading lang if(Object::has_extension('SiteTree', 'Translatable') && !$this->request->isAjax()) { Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree'))); } parent::init(); Requirements::css(CMS_DIR . '/css/screen.css'); Requirements::combine_files( 'cmsmain.js', array_merge( array( CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', CMS_DIR . '/javascript/CMSPageHistoryController.js', CMS_DIR . '/javascript/CMSMain.Tree.js', CMS_DIR . '/javascript/SilverStripeNavigator.js' ), Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true) ) ); CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish'); CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish'); CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete'); CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive'); }
/** * * @param \GridField $gridField * @param \DataObject $record * @param string $columnName * @return string|null - the HTML for the column */ public function getColumnContent($gridField, $record, $columnName) { if (!$record instanceof \Payment) { return null; } if (!$record->canRefund()) { return null; } \Requirements::css('omnipay-ui/css/omnipay-ui-cms.css'); \Requirements::javascript('omnipay-ui/javascript/omnipay-ui-cms.js'); \Requirements::add_i18n_javascript('omnipay-ui/javascript/lang'); $infoText = ''; switch (GatewayInfo::refundMode($record->Gateway)) { case GatewayInfo::MULTIPLE: $infoText = 'MultiRefundInfo'; break; case GatewayInfo::PARTIAL: $infoText = 'SingleRefundInfo'; break; case GatewayInfo::FULL: $infoText = 'FullRefundInfo'; break; } /** @var \Money $money */ $money = $record->dbObject('Money'); /** @var \GridField_FormAction $field */ $field = \GridField_FormAction::create($gridField, 'RefundPayment' . $record->ID, false, 'refundpayment', array('RecordID' => $record->ID))->addExtraClass('gridfield-button-refund payment-dialog-button')->setAttribute('title', _t('GridFieldRefundAction.Title', 'Refund Payment'))->setAttribute('data-icon', 'button-refund')->setAttribute('data-dialog', json_encode(array('maxAmount' => $money->Nice(), 'maxAmountNum' => $money->getAmount(), 'hasAmountField' => $record->canRefund(null, true), 'infoTextKey' => $infoText, 'buttonTextKey' => 'RefundAmount')))->setDescription(_t('GridFieldRefundAction.Description', 'Refund a captured payment')); return $field->Field(); }
public function init() { // set reading lang if (SiteTree::has_extension('Translatable') && !$this->getRequest()->isAjax()) { Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree'))); } parent::init(); Versioned::reading_stage("Stage"); Requirements::css(CMS_DIR . '/css/screen.css'); Requirements::customCSS($this->generatePageIconsCss()); Requirements::combine_files('cmsmain.js', array_merge(array(CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', CMS_DIR . '/javascript/CMSPageHistoryController.js', CMS_DIR . '/javascript/CMSMain.Tree.js', CMS_DIR . '/javascript/SilverStripeNavigator.js', CMS_DIR . '/javascript/SiteTreeURLSegmentField.js'), Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true))); CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish'); CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish'); // Check legacy actions $legacy = $this->config()->enabled_legacy_actions; // Delete from live is unnecessary since we have unpublish which does the same thing if (in_array('CMSBatchAction_DeleteFromLive', $legacy)) { Deprecation::notice('4.0', 'Delete From Live is deprecated. Use Un-publish instead'); CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive'); } // Delete action if (in_array('CMSBatchAction_Delete', $legacy)) { Deprecation::notice('4.0', 'Delete from Stage is deprecated. Use Archive instead.'); CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete'); } else { CMSBatchActionHandler::register('archive', 'CMSBatchAction_Archive'); CMSBatchActionHandler::register('restore', 'CMSBatchAction_Restore'); } }
function Field() { Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js"); $fieldName = $this->name; if ($this->form) { $record = $this->form->getRecord(); if ($record && $record->hasMethod($fieldName)) { $items = $record->{$fieldName}(); } } if ($items) { foreach ($items as $item) { $titleArray[] = $item->Title; $idArray[] = $item->ID; } if ($titleArray) { $itemList = implode(", ", $titleArray); $value = implode(",", $idArray); } } $id = $this->id(); return <<<HTML \t\t\t<div class="TreeSelectorField"> \t\t\t\t<input type="hidden" name="{$this->name}" value="{$value}" /> \t\t\t\t<input type="button" class="edit" value="edit" /> \t\t\t\t<span class="items">{$itemList}</span> \t\t\t</div>\t\t HTML; }
public function Field($properties = array()) { Requirements::javascript(CMS_DIR . '/javascript/SiteTreeURLSegmentField.js'); Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true); Requirements::css(CMS_DIR . "/css/screen.css"); return parent::Field($properties); }
/** * Form used for defining the conversion form * @return {Form} Form to be used for configuring the conversion */ public function ConvertObjectForm() { //Reset the reading stage Versioned::reset(); $fields = new FieldList(CompositeField::create($convertModeField = new OptionsetField('ConvertMode', '', array('ReplacePage' => _t('KapostAdmin.REPLACES_AN_EXISTING_PAGE', '_This replaces an existing page'), 'NewPage' => _t('KapostAdmin.IS_NEW_PAGE', '_This is a new page')), 'NewPage'))->addExtraClass('kapostConvertLeftSide'), CompositeField::create($replacePageField = TreeDropdownField::create('ReplacePageID', _t('KapostAdmin.REPLACE_PAGE', '_Replace this page'), 'SiteTree')->addExtraClass('replace-page-id'), TreeDropdownField::create('ParentPageID', _t('KapostAdmin.USE_AS_PARENT', '_Use this page as the parent for the new page, leave empty for a top level page'), 'SiteTree')->addExtraClass('parent-page-id'))->addExtraClass('kapostConvertRightSide')); $actions = new FieldList(FormAction::create('doConvertObject', _t('KapostAdmin.CONTINUE_CONVERT', '_Continue'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'kapost-convert')); $validator = new RequiredFields('ConvertMode'); $form = new Form($this, 'ConvertObjectForm', $fields, $actions, $validator); $form->addExtraClass('KapostAdmin center')->setAttribute('data-layout-type', 'border')->setTemplate('KapostAdmin_ConvertForm'); //Handle pages to see if the page exists $convertToClass = $this->getDestinationClass(); if ($convertToClass !== false && ($convertToClass == 'SiteTree' || is_subclass_of($convertToClass, 'SiteTree'))) { $obj = SiteTree::get()->filter('KapostRefID', Convert::raw2sql($this->record->KapostRefID))->first(); if (!empty($obj) && $obj !== false && $obj->ID > 0) { $convertModeField->setValue('ReplacePage'); $replacePageField->setValue($obj->ID); $recordTitle = $this->record->Title; if (!empty($recordTitle) && $recordTitle != $obj->Title) { $urlFieldLabel = _t('KapostAdmin.TITLE_CHANGE_DETECT', '_The title differs from the page being replaced, it was "{wastitle}" and will be changed to "{newtitle}". Do you want to update the URL Segment?', array('wastitle' => $obj->Title, 'newtitle' => $recordTitle)); $fields->push(CheckboxField::create('UpdateURLSegment', $urlFieldLabel)->addExtraClass('urlsegmentcheck')->setAttribute('data-replace-id', $obj->ID)->setForm($form)->setDescription(_t('KapostAdmin.NEW_URL_SEGMENT', '_The new URL Segment will be or will be close to "{newsegment}"', array('newsegment' => $obj->generateURLSegment($recordTitle))))); } } } Requirements::css(KAPOST_DIR . '/css/KapostAdmin.css'); Requirements::add_i18n_javascript(KAPOST_DIR . '/javascript/lang/'); Requirements::javascript(KAPOST_DIR . '/javascript/KapostAdmin_convertPopup.js'); //Allow extensions to adjust the form $this->extend('updateConvertObjectForm', $form, $this->record); return $form; }
public function getCMSFields() { Requirements::add_i18n_javascript(BLOCKS_DIR . '/javascript/lang'); // this line is a temporary patch until I can work out why this dependency isn't being // loaded in some cases... if (!$this->blockManager) { $this->blockManager = singleton('BlockManager'); } $fields = parent::getCMSFields(); // ClassNmae - block type/class field $classes = $this->blockManager->getBlockClasses(); $fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Block Type', $classes)->addExtraClass('block-type'), 'Title'); // BlockArea - display areas field if on page edit controller if (Controller::curr()->class == 'CMSPageEditController') { $currentPage = Controller::curr()->currentPage(); $fields->addFieldToTab('Root.Main', DropdownField::create('ManyMany[BlockArea]', 'BlockArea', $this->blockManager->getAreasForPageType($currentPage->ClassName))->setHasEmptyDefault(true)->setRightTitle($currentPage->areasPreviewButton()), 'ClassName'); } $fields->removeFieldFromTab('Root', 'BlockSets'); $fields->removeFieldFromTab('Root', 'Pages'); // legacy fields, will be removed in later release $fields->removeByName('Weight'); $fields->removeByName('Area'); $fields->removeByName('Published'); if ($this->blockManager->getUseExtraCSSClasses()) { $fields->addFieldToTab('Root.Main', $fields->dataFieldByName('ExtraCSSClasses'), 'Title'); } else { $fields->removeByName('ExtraCSSClasses'); } // Viewer groups $fields->removeFieldFromTab('Root', 'ViewerGroups'); $groupsMap = Group::get()->map('ID', 'Breadcrumbs')->toArray(); asort($groupsMap); $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?")); $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')); $viewersOptionsSource = array(); $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone"); $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users"); $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)"); $viewersOptionsField->setSource($viewersOptionsSource)->setValue("Anyone"); $fields->addFieldsToTab('Root.ViewerGroups', array($viewersOptionsField, $viewerGroupsField)); // Disabled for now, until we can list ALL pages this block is applied to (inc via sets) // As otherwise it could be misleading // Show a GridField (list only) with pages which this block is used on // $fields->removeFieldFromTab('Root.Pages', 'Pages'); // $fields->addFieldsToTab('Root.Pages', // new GridField( // 'Pages', // 'Used on pages', // $this->Pages(), // $gconf = GridFieldConfig_Base::create())); // enhance gridfield with edit links to pages if GFEditSiteTreeItemButtons is available // a GFRecordEditor (default) combined with BetterButtons already gives the possibility to // edit versioned records (Pages), but STbutton loads them in their own interface instead // of GFdetailform // if(class_exists('GridFieldEditSiteTreeItemButton')){ // $gconf->addComponent(new GridFieldEditSiteTreeItemButton()); // } return $fields; }
public function init() { parent::init(); Requirements::css(SS_NR_BASE . '/css/NewRelicPerformanceReport.css'); Requirements::add_i18n_javascript(SS_NR_BASE . '/javascript/lang'); Requirements::javascript(SS_NR_BASE . '/javascript/NewRelicPerformanceReport.js'); Requirements::javascript(SS_NR_BASE . '/thirdparty/nnnick/chart-js/chart.min.js'); }
/** * Get HTML for the field to display * * @param array $properties Properties array * @return string */ public function Field($properties = array()) { $module_dir = basename(dirname(dirname(__DIR__))); Requirements::javascript($module_dir . '/javascript/MovieTitleField.js'); Requirements::add_i18n_javascript($module_dir . '/javascript/lang'); $list = new ArrayList($this->composite_fields); return $list->renderWith('MovieTitleField'); }
/** * Set up the controller */ public function init() { parent::init(); Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js"); Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true); Requirements::css(CMS_DIR . "/css/screen.css"); CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder'); }
function FieldHolder() { $ret = parent::FieldHolder(); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/HasManyFileField.js"); Requirements::javascript(SAPPHIRE_DIR . '/javascript/RelationComplexTableField.js'); Requirements::css(SAPPHIRE_DIR . '/css/HasManyFileField.css'); return $ret; }
/** * Initialise javascript translation files * * @return void */ public function init() { parent::init(); Requirements::add_i18n_javascript('advancedworkflow/javascript/lang'); Requirements::javascript('advancedworkflow/javascript/WorkflowField.js'); Requirements::javascript('advancedworkflow/javascript/WorkflowGridField.js'); Requirements::css('advancedworkflow/css/WorkflowField.css'); Requirements::css('advancedworkflow/css/WorkflowGridField.css'); }
public function init() { parent::init(); Requirements::add_i18n_javascript('software/lang'); Requirements::css("themes/openstack/bower_assets/webui-popover/dist/jquery.webui-popover.min.css"); Requirements::css("software/css/software.css"); Requirements::javascript("themes/openstack/bower_assets/webui-popover/dist/jquery.webui-popover.min.js"); Requirements::javascript("software/js/software.js"); }
public function FieldHolder($properties = array()) { $ret = parent::FieldHolder($properties); Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); Requirements::javascript(FRAMEWORK_DIR . "/javascript/HasManyFileField.js"); Requirements::javascript(FRAMEWORK_DIR . '/javascript/RelationComplexTableField.js'); Requirements::css(FRAMEWORK_DIR . '/css/HasManyFileField.css'); return $ret; }
/** * @todo Internationalisation * @return string */ public function FieldHolder($properties = array()) { Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(FRAMEWORK_DIR . '/javascript/ToggleCompositeField.js'); Requirements::javascript(INPAGE_MODULES_DIR . '/javascript/ContentModuleField.js'); Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css'); return $this->renderWith('ContentModuleField'); }
/** * @return string */ public function iframe() { // clear the requirements added by any parent controllers Requirements::clear(); Requirements::add_i18n_javascript('sapphire/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript('sapphire/javascript/FileIFrameField.js'); Requirements::css('cms/css/typography.css'); Requirements::css('sapphire/css/FileIFrameField.css'); return $this->renderWith('FileIFrameField'); }
function Field() { Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/UniqueFields.js'); if ($this->maxLength) { $field = "<input class=\"text restricted\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"{$this->maxLength}\" />"; } else { $field = "<input class=\"text restricted\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />"; } return $field . "<input type=\"hidden\" name=\"restricted-chars[" . $this->id() . "]\" id=\"" . $this->id() . "-restricted-chars\" value=\"" . $this->restrictedChars . "\" />"; }
public function init() { // set reading lang // if(Object::has_extension('SiteTree', 'Translatable') && !$this->request->isAjax()) { // Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree'))); // } parent::init(); Requirements::css(CMS_DIR . '/css/screen.css'); Requirements::css('swipestripe/css/ShopAdmin.css'); Requirements::combine_files('cmsmain.js', array_merge(array(CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', CMS_DIR . '/javascript/CMSPageHistoryController.js', CMS_DIR . '/javascript/CMSMain.Tree.js', CMS_DIR . '/javascript/SilverStripeNavigator.js', CMS_DIR . '/javascript/SiteTreeURLSegmentField.js'), Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true))); }
function Field() { Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js"); $this->jsValidation(); $url = Convert::raw2att($this->validateURL); if ($this->restrictedRegex) { $restrict = "<input type=\"hidden\" class=\"hidden\" name=\"{$this->name}Restricted\" id=\"" . $this->id() . "RestrictedRegex\" value=\"{$this->restrictedRegex}\" />"; } $attributes = array('type' => 'text', 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'value' => $this->Value(), 'tabindex' => $this->getTabIndex(), 'maxlength' => $this->maxLength ? $this->maxLength : null); return $this->createTag('input', $attributes); }
public function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js"); Requirements::javascript(THIRDPARTY_DIR . "/behaviour/behaviour.js"); Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); Requirements::javascript(FRAMEWORK_DIR . "/javascript/UniqueFields.js"); $url = Convert::raw2att($this->validateURL); if ($this->restrictedRegex) { $restrict = "<input type=\"hidden\" class=\"hidden\" name=\"{$this->name}Restricted\" id=\"" . $this->id() . "RestrictedRegex\" value=\"{$this->restrictedRegex}\" />"; } $attributes = array('type' => 'text', 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->getName(), 'value' => $this->Value(), 'tabindex' => $this->getAttribute('tabindex'), 'maxlength' => $this->maxLength ? $this->maxLength : null); return $this->createTag('input', $attributes); }
protected function initRequirements() { Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js'); Requirements::javascript(THIRDPARTY_DIR . '/json-js/json2.js'); Requirements::javascript(FRAMEWORK_DIR . '/javascript/i18n.js'); Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(FRAMEWORK_DIR . '/javascript/GridField.js'); Requirements::css('bootstrap_orderable_frontend/css/OrderablePaginatedList.css'); Requirements::javascript('bootstrap_orderable_frontend/javascript/OrderablePaginatedList.js'); }
public function init() { parent::init(); //Workaround to point the documentation entities here instead of to the DocumentationViewer path $baseLink = Controller::join_links($this->stat('url_base', true), $this->config()->get('url_segment', Config::FIRST_SET), '/'); Config::inst()->update('DocumentationViewer', 'link_base', $baseLink); //Requirements Requirements::css(CMSUSERDOCS_BASE . '/thirdparty/google/code-prettify/prettify.css'); Requirements::css(CMSUSERDOCS_BASE . '/css/CMSDocumentationViewer.css'); Requirements::add_i18n_javascript(CMSUSERDOCS_BASE . '/javascript/lang/'); Requirements::javascript(CMSUSERDOCS_BASE . '/thirdparty/google/code-prettify/run_prettify.js?autorun=false'); Requirements::javascript(CMSUSERDOCS_BASE . '/javascript/CMSDocumentationViewer.js'); }
/** * Returns the whole gridfield rendered with all the attached components * @return string */ public function FieldHolder($properties = array()) { Requirements::block(FRAMEWORK_DIR . '/css/GridField.css'); Requirements::themedCSS('FrontEndGridField', FRONTEND_GRIDFIELD_BASE); Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js'); Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lib.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(FRONTEND_GRIDFIELD_BASE . '/javascript/FrontEndGridField.js'); return parent::FieldHolder(); }
/** * * @param \GridField $gridField * @param \DataObject $record * @param string $columnName * @return string|null - the HTML for the column */ public function getColumnContent($gridField, $record, $columnName) { if (!$record instanceof \Payment) { return null; } if (!$record->canVoid()) { return null; } \Requirements::css('omnipay-ui/css/omnipay-ui-cms.css'); \Requirements::javascript('omnipay-ui/javascript/omnipay-ui-cms.js'); \Requirements::add_i18n_javascript('omnipay-ui/javascript/lang'); /** @var \GridField_FormAction $field */ $field = \GridField_FormAction::create($gridField, 'VoidPayment' . $record->ID, false, 'voidpayment', array('RecordID' => $record->ID))->addExtraClass('gridfield-button-void payment-dialog-button')->setAttribute('title', _t('GridFieldVoidAction.Title', 'Void Payment'))->setAttribute('data-icon', 'button-void')->setAttribute('data-dialog', json_encode(array('maxAmount' => $record->dbObject('Money')->Nice(), 'hasAmountField' => false, 'infoTextKey' => 'VoidInfo', 'buttonTextKey' => 'VoidPayment')))->setDescription(_t('GridFieldVoidAction.Description', 'Void an authorized payment')); return $field->Field(); }