/// <summary> /// Constructor to setup an existing DocumentTypeProperty from a DataType /// </summary> /// <param name="dataType"></param> public DocumentTypeProperty(DataType dataType) { Mandate.ParameterNotNull(dataType, "dataType"); DataType = dataType; DataTypeId = DataType.Id; }
/// <summary> /// Creates selected template property /// </summary> /// <param name="docType"></param> /// <returns></returns> private DocumentTypeProperty CreateSelectedTemplate(DocumentTypeEditorModel docType) { var selectedTemplateAttributeType = _attributeTypeRegistry.GetAttributeType(SelectedTemplateAttributeType.AliasValue); _selectedTemplateDataType = new DataType( selectedTemplateAttributeType.Id, selectedTemplateAttributeType.Name, selectedTemplateAttributeType.Alias, _propertyEditorFactory.GetPropertyEditor(new Guid(CorePluginConstants.SelectedTemplatePropertyEditorId)).Value, string.Empty); var dtp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _selectedTemplateDataType); dtp.Name = "Selected template"; dtp.Alias = SelectedTemplateAttributeDefinition.AliasValue; //dtp.TabId = docType.DefinedTabs.Where(x => x.Alias == _generalGroup.Alias).Single().Id; dtp.TabId = docType.DefinedTabs.Single(x => x.Alias == FixedGroupDefinitions.GeneralGroup.Alias).Id; dtp.SortOrder = 0; return dtp; }
/// <summary> /// Constructor to setup an existing DocumentTypeProperty from a DataType /// </summary> /// <param name="id"></param> /// <param name="dataType"></param> public DocumentTypeProperty(HiveId id, DataType dataType) : this(dataType) { Mandate.ParameterNotEmpty(id, "id"); Id = id; }
/// <summary> /// Creates Node Name property /// </summary> /// <param name="docType"></param> /// <returns></returns> private DocumentTypeProperty CreateNodeName(DocumentTypeEditorModel docType) { var nodeNameAttributeType = _attributeTypeRegistry.GetAttributeType(NodeNameAttributeType.AliasValue); _nodeNameDataType = new DataType( nodeNameAttributeType.Id, nodeNameAttributeType.Name, nodeNameAttributeType.Alias, _propertyEditorFactory.GetPropertyEditor(new Guid(CorePluginConstants.NodeNamePropertyEditorId)).Value, string.Empty); var dtp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _nodeNameDataType); dtp.Name = "Node Name"; dtp.Alias = NodeNameAttributeDefinition.AliasValue; dtp.TabId = docType.DefinedTabs.Single(x => x.Alias == FixedGroupDefinitions.GeneralGroup.Alias).Id; dtp.SortOrder = 0; return dtp; }
/// <summary> /// Creates the test data types /// </summary> private void InitDataTypes() { //get the data types from the CoreCmsData _dataTypes = new List<DataType>() { _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("rte-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("sltb-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("csp-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("tag-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("mltb-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("media-picker-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("integer-pe".EncodeAsGuid())).Single()), _frameworkContext.TypeMappers.Map<DataType>(CoreCmsData.RequiredCoreUserAttributeTypes().Where(x => x.Id == new HiveId("uploader-pe".EncodeAsGuid())).Single()) }; //create the inbuilt data types var selectedTemplateAttributeType = _attributeTypeRegistry.GetAttributeType(SelectedTemplateAttributeType.AliasValue); _selectedTemplateDataType = new DataType( selectedTemplateAttributeType.Id, selectedTemplateAttributeType.Name, selectedTemplateAttributeType.Alias, PropertyEditorFactory.GetPropertyEditor(new Guid(CorePluginConstants.SelectedTemplatePropertyEditorId)).Value, string.Empty); var nodeNameAttributeType = _attributeTypeRegistry.GetAttributeType(NodeNameAttributeType.AliasValue); _nodeNameDataType = new DataType( nodeNameAttributeType.Id, nodeNameAttributeType.Name, nodeNameAttributeType.Alias, PropertyEditorFactory.GetPropertyEditor(new Guid(CorePluginConstants.NodeNamePropertyEditorId)).Value, string.Empty); }
public virtual ActionResult CreateForm() { //get the property editor Id from the values var propertyEditorId = Guid.Parse(ValueProvider.GetValue("PropertyEditorId").AttemptedValue); //this will throw an exception if its not found var propertyEditor = _propertyEditors.Where(x => x.Metadata.Id == propertyEditorId).Single(); var dataType = new DataType(string.Empty, string.Empty, propertyEditor.Value); var dataTypeEditorViewModel = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map<DataType, DataTypeEditorModel>(dataType); return ProcessSubmit(dataTypeEditorViewModel, null); }
public virtual ActionResult Create(Guid? propertyEditorId, string name) { if (!propertyEditorId.HasValue || propertyEditorId == default(Guid)) return HttpNotFound(); if (name == null) return HttpNotFound(); var propertyEditor = _propertyEditors.Where(x => x.Metadata.Id == propertyEditorId.Value).Single(); var dt = new DataType(name, name.ToUmbracoAlias() ,propertyEditor.Value); var model = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map<DataType, DataTypeEditorModel>(dt); EnsurePropEditorListViewBagData(); return View("Edit", model); }
public virtual ActionResult CreateNewForm(CreateDataTypeModel createModel) { if (!TryValidateModel(createModel)) { EnsurePropEditorListViewBagData(); return View(createModel); } var propertyEditor = _propertyEditors.Where(x => x.Metadata.Id == createModel.PropertyEditorId).Single(); var dataType = new DataType(string.Empty, string.Empty, propertyEditor.Value); var dataTypeEditorViewModel = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map<DataType, DataTypeEditorModel>(dataType); return ProcessSubmit(dataTypeEditorViewModel, null); return RedirectToAction("Create", new { propertyEditorId = createModel.PropertyEditorId, name = createModel.Name }); }