コード例 #1
0
ファイル: DNProject.php プロジェクト: ss23/deploynaut
 /**
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $environments = $fields->dataFieldByName("Environments");
     $fields->fieldByName("Root")->removeByName("Viewers");
     $fields->fieldByName("Root")->removeByName("Environments");
     $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 = ListboxField::create('Viewers', 'Project viewers', Group::get()->map()->toArray())->setMultiple(true)->setDescription('These groups can view the project in the front-end.');
     $fields->addFieldToTab("Root.Main", $readAccessGroups);
     $this->setCreateProjectFolderField($fields);
     $this->setEnvironmentFields($fields, $environments);
     return $fields;
 }
 /**
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $dataType = $this->Schema()->DataType;
     if ($dataType) {
         $fieldList = singleton($dataType)->inheritedDatabaseFields();
         $fieldList = array_combine(array_keys($fieldList), array_keys($fieldList));
         unset($fieldList->ParentID);
         unset($fieldList->WorkflowDefinitionID);
         unset($fieldList->Version);
         $fieldNameField = new DropdownField("FieldName", "Field Name", $fieldList);
         $fieldNameField->setEmptyString("(choose)");
         $fields->insertBefore($fieldNameField, "CSSSelector");
     } else {
         $fields->replaceField('FieldName', $fieldName = new ReadonlyField("FieldName", "Field Name"));
         $fieldName->setDescription('Save this rule before being able to add a field name');
     }
     return $fields;
 }
コード例 #3
0
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     /** @var GridField $environments */
     $environments = $fields->dataFieldByName("Environments");
     $fields->fieldByName("Root")->removeByName("Viewers");
     $fields->fieldByName("Root")->removeByName("Environments");
     $fields->fieldByName("Root")->removeByName("LocalCVSPath");
     $diskQuotaDesc = 'This is the maximum amount of disk space (in megabytes) that all environments within this ' . 'project can use for stored snapshots';
     $fields->dataFieldByName('DiskQuotaMB')->setDescription($diskQuotaDesc);
     $projectNameDesc = 'Changing the name will <strong>reset</strong> the deploy configuration and avoid using non' . 'alphanumeric characters';
     $fields->fieldByName('Root.Main.Name')->setTitle('Project name')->setDescription($projectNameDesc);
     $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 = ListboxField::create('Viewers', 'Project viewers', Group::get()->map()->toArray())->setMultiple(true)->setDescription('These groups can view the project in the front-end.');
     $fields->addFieldToTab("Root.Main", $readAccessGroups);
     $this->setCreateProjectFolderField($fields);
     $this->setEnvironmentFields($fields, $environments);
     $environmentTypes = ClassInfo::implementorsOf('EnvironmentCreateBackend');
     $types = array();
     foreach ($environmentTypes as $type) {
         $types[$type] = $type;
     }
     $fields->addFieldsToTab('Root.Main', array(DropdownField::create('AllowedEnvironmentType', 'Allowed Environment Type', $types)->setDescription('This defined which form to show on the front end for ' . 'environment creation. This will not affect backend functionality.')->setEmptyString(' - None - ')));
     return $fields;
 }