public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldFromTab('Root', 'Pages'); $fields->removeFieldsFromTab('Root.Main', array('SortOrder', 'showBlockbyClass', 'shownInClass', 'MemberVisibility')); $fields->addFieldToTab('Root.Main', LiteralField::create('Status', 'Published: ' . $this->Published()), 'Title'); $memberGroups = Group::get(); $sourcemap = $memberGroups->map('Code', 'Title'); $source = array('anonymous' => 'Anonymous visitors'); foreach ($sourcemap as $mapping => $key) { $source[$mapping] = $key; } $memberVisibility = new CheckboxSetField($name = "MemberVisibility", $title = "Show block for specific groups", $source); $memberVisibility->setDescription('Show this block only for the selected group(s). If you select no groups, the block will be visible to all members.'); $availabelClasses = $this->availableClasses(); $inClass = new CheckboxSetField($name = "shownInClass", $title = "Show block for specific content types", $availabelClasses); $filterSelector = OptionsetField::create('showBlockbyClass', 'Choose filter set', array('0' => 'by page', '1' => 'by page/data type'))->setDescription('<p><br /><strong>by page</strong>: block will be displayed in the selected page(s)<br /><strong>by page/data type</strong>: block will be displayed on the pages created with the particular page/data type. e.g. is <strong>"InternalPage"</strong> is picked, the block will be displayed, and will ONLY be displayed on all <strong>Internal Pages</strong></p>'); $availablePages = Page::get()->exclude('ClassName', array('ErrorPage', 'RedirectorPage', 'VirtualPage')); $pageSelector = new CheckboxSetField($name = "Pages", $title = "Show on Page(s)", $availablePages->map('ID', 'Title')); if ($this->canConfigPageAndType(Member::currentUser())) { $fields->addFieldsToTab('Root.VisibilitySettings', array($filterSelector, $pageSelector, $inClass)); } if ($this->canConfigMemberVisibility(Member::currentUser())) { $fields->addFieldToTab('Root.VisibilitySettings', $memberVisibility); } if (!$fields->fieldByName('Options')) { $fields->insertBefore($right = RightSidebar::create('Options'), 'Root'); } $fields->addFieldsToTab('Options', array(CheckboxField::create('addMarginTop', 'add "margin-top" class to block wrapper'), CheckboxField::create('addMarginBottom', 'add "margin-bottom" class to block wrapper'))); return $fields; }
/** * * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $environments = $fields->dataFieldByName("Environments"); $releaseSteps = $fields->dataFieldByName('ReleaseSteps'); $fields->fieldByName("Root")->removeByName("Viewers"); $fields->fieldByName("Root")->removeByName("Environments"); $fields->fieldByName("Root")->removeByName("ReleaseSteps"); $fields->fieldByName("Root")->removeByName("LocalCVSPath"); $fields->dataFieldByName('DiskQuotaMB')->setDescription('This is the maximum amount of disk space (in megabytes) that all environments within this project can use for stored snapshots'); $fields->fieldByName('Root.Main.Name')->setTitle('Project name')->setDescription('Changing the name will <strong>reset</strong> the deploy configuration and avoid using non alphanumeric characters'); $fields->fieldByName('Root.Main.CVSPath')->setTitle('Git repository')->setDescription('E.g. git@github.com:silverstripe/silverstripe-installer.git'); $workspaceField = new ReadonlyField('LocalWorkspace', 'Git workspace', $this->getLocalCVSPath()); $workspaceField->setDescription('This is where the GIT repository are located on this server'); $fields->insertAfter($workspaceField, 'CVSPath'); $readAccessGroups = new CheckboxSetField("Viewers", "Project viewers", Group::get()->map()); $readAccessGroups->setDescription('These groups can view the project in the front-end.'); $fields->addFieldToTab("Root.Main", $readAccessGroups); $this->setCreateProjectFolderField($fields); $this->setEnvironmentFields($fields, $environments); $this->setDeployStepsFields($fields, $releaseSteps); return $fields; }
/** * * @return FieldList */ public function getCMSFields() { $fields = parent::getCMSFields(); $members = array(); foreach ($this->Project()->Viewers() as $group) { foreach ($group->Members()->map() as $k => $v) { $members[$k] = $v; } } asort($members); $fields->fieldByName("Root")->removeByName("Deployers"); $fields->fieldByName("Root")->removeByName("CanRestoreMembers"); $fields->fieldByName("Root")->removeByName("CanBackupMembers"); $fields->fieldByName("Root")->removeByName("ArchiveUploaders"); $fields->fieldByName("Root")->removeByName("ArchiveDownloaders"); $fields->fieldByName("Root")->removeByName("ArchiveDeleters"); // The Main.ProjectID $projectField = $fields->fieldByName('Root.Main.ProjectID')->performReadonlyTransformation(); $fields->insertBefore($projectField, 'Name'); // The Main.Name $nameField = $fields->fieldByName('Root.Main.Name'); $nameField->setTitle('Environment name'); $nameField->setDescription('A descriptive name for this environment, e.g. staging, uat, production'); $fields->insertAfter($nameField, 'ProjectID'); // The Main.Filename $fileNameField = $fields->fieldByName('Root.Main.Filename')->performReadonlyTransformation(); $fileNameField->setTitle('Filename'); $fileNameField->setDescription('The capistrano environment file name'); $fields->insertAfter($fileNameField, 'Name'); // The Main.Deployers $deployers = new CheckboxSetField("Deployers", "Who can deploy?", $members); $deployers->setDescription('Users who can deploy to this environment'); $fields->insertAfter($deployers, 'URL'); // A box to tick all snapshot boxes. $tickAll = new CheckboxSetField("TickAllSnapshot", "<em>All snapshot permissions</em>", $members); $tickAll->setDescription('UI shortcut to tick all snapshot-related boxes - not written to the database.'); $fields->insertAfter($tickAll, 'Deployers'); // The Main.CanRestoreMembers $canRestoreMembers = new CheckboxSetField('CanRestoreMembers', 'Who can restore?', $members); $canRestoreMembers->setDescription('Users who can restore archives from Deploynaut into this environment'); $fields->insertAfter($canRestoreMembers, 'TickAllSnapshot'); // The Main.CanBackupMembers $canBackupMembers = new CheckboxSetField('CanBackupMembers', 'Who can backup?', $members); $canBackupMembers->setDescription('Users who can backup archives from this environment into Deploynaut'); $fields->insertAfter($canBackupMembers, 'CanRestoreMembers'); // The Main.ArchiveDeleters $archiveDeleters = new CheckboxSetField('ArchiveDeleters', 'Who can delete?', $members); $archiveDeleters->setDescription('Users who can delete archives from this environment\'s staging area.'); $fields->insertAfter($archiveDeleters, 'CanBackupMembers'); // The Main.ArchiveUploaders $archiveUploaders = new CheckboxSetField('ArchiveUploaders', 'Who can upload?', $members); $archiveUploaders->setDescription('Users who can upload archives linked to this environment into Deploynaut.<br>' . 'Linking them to an environment allows limiting download permissions (see below).'); $fields->insertAfter($archiveUploaders, 'ArchiveDeleters'); // The Main.ArchiveDownloaders $archiveDownloaders = new CheckboxSetField('ArchiveDownloaders', 'Who can download?', $members); $archiveDownloaders->setDescription('Users who can download archives from this environment to their computer.<br>' . 'Since this implies access to the snapshot, it is also a prerequisite for restores to other environments,' . ' alongside the "Who can restore" permission.<br>' . 'Should include all users with upload permissions, otherwise they can\'t download their own uploads.'); $fields->insertAfter($archiveDownloaders, 'ArchiveUploaders'); // The Main.DeployConfig if ($this->Project()->exists()) { $this->setDeployConfigurationFields($fields); } // The Main.URL field $urlField = $fields->fieldByName('Root.Main.URL'); $urlField->setTitle('Server URL'); $fields->removeByName('Root.Main.URL'); $urlField->setDescription('This url will be used to provide the front-end with a link to this environment'); $fields->insertAfter($urlField, 'Name'); // The Extra.GraphiteServers $graphiteServerField = $fields->fieldByName('Root.Main.GraphiteServers'); $fields->removeByName('Root.Main.GraphiteServers'); $graphiteServerField->setDescription('Find the relevant graphite servers at ' . '<a href="http://graphite.silverstripe.com/" target="_blank">graphite.silverstripe.com</a>' . ' and enter them one per line, e.g. "server.wgtn.oscar"'); $fields->addFieldToTab('Root.Extra', $graphiteServerField); Requirements::javascript('deploynaut/javascript/environment.js'); // Add actions $action = new FormAction('check', 'Check Connection'); $action->setUseButtonTag(true); $action->setAttribute('data-url', Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping'); $fields->insertBefore($action, 'Name'); return $fields; }