public void StorePartDefinition(ContentPartDefinition contentPartDefinition) { _signals.Trigger(ContentDefinitionSignal); Apply(contentPartDefinition, Acquire(contentPartDefinition)); }
public void ApplySortCriterion(SortCriterionContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { bool ascending = (bool)context.State.Sort; var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action <IHqlExpressionFactory> predicate = y => y.Eq("PropertyName", propertyName); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService // apply where clause context.Query = context.Query.Where(relationship, predicate); // apply sort context.Query = ascending ? context.Query.OrderBy(relationship, x => x.Asc("Value")) : context.Query.OrderBy(relationship, x => x.Desc("Value")); }
public virtual bool CanSync(string contentType, ContentPartDefinition contentPartDefinition) { return(contentPartDefinition.Name == PartName); }
public void StorePartDefinition(ContentPartDefinition contentPartDefinition) => throw new System.NotImplementedException();
public static bool IsAttachable(this ContentPartDefinition part) { return(part.Settings.ToObject <ContentPartSettings>().Attachable); }
public void StorePartDefinition(ContentPartDefinition contentPartDefinition) { Apply(contentPartDefinition, Acquire(contentPartDefinition)); }
public PartConfigurerImpl(ContentTypePartDefinition part) : base(part) { Current = part; _partDefinition = part.PartDefinition; }
public dynamic Render(PropertyContext context, ContentItem contentItem, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var p = contentItem.Parts.FirstOrDefault(x => x.PartDefinition.Name == part.Name); if (p == null) { return(String.Empty); } var f = p.Fields.FirstOrDefault(x => x.Name == field.Name); if (f == null) { return(String.Empty); } var value = f.Storage.Get <object>(storageName); if (value == null) { return(null); } // call specific formatter rendering return(_propertyFormater.Format(storageType, value, context.State)); }
public ContentPartDefinitionModel(ContentPartDefinition contentPartDefinition) { Fields = new List <ContentFieldDefinitionModel>(); Settings = new Dictionary <string, string>(contentPartDefinition.Settings); Name = contentPartDefinition.Name; }
public override void ApplySortCriterion(Orchard.Projections.Descriptors.SortCriterion.SortCriterionContext context, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { }
public LocalizedString DisplayFilter(PropertyContext context, ContentPartDefinition part, ContentPartFieldDefinition fieldDefinition, string storageName) { return(T("Field {0}: {1}", fieldDefinition.Name, String.IsNullOrEmpty(storageName) ? T("Default value").Text : storageName)); }
public override void ApplyFilter(FilterContext context, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var op = (OptionSetOperator)Enum.Parse(typeof(OptionSetOperator), (string)context.State.Operator); string value = context.State.Value; var valueArr = value != null ? value.Split('&').Select(int.Parse).ToArray() : new[] { 0 }; switch (op) { case OptionSetOperator.MatchesAny: Action <IAliasFactory> selectorAny = alias => alias.ContentPartRecord <OptionItemContainerPartRecord>().Property("OptionItems", "opits").Property("OptionItemRecord", "opcpr"); Action <IHqlExpressionFactory> filterAny = x => x.InG("Id", valueArr); context.Query.Where(selectorAny, filterAny); break; case OptionSetOperator.MatchesAll: foreach (var id in valueArr) { var optionId = id; Action <IAliasFactory> selectorAll = alias => alias.ContentPartRecord <OptionItemContainerPartRecord>().Property("OptionItems", "opit" + optionId); Action <IHqlExpressionFactory> filterAll = x => x.Eq("OptionItemRecord.Id", optionId); context.Query.Where(selectorAll, filterAll); } break; case OptionSetOperator.NotMatchesAny: Action <IAliasFactory> selectorNotAny = alias => alias.ContentPartRecord <OptionItemContainerPartRecord>().Property("OptionItems", "opits").Property("OptionItemRecord", "opcpr"); Action <IHqlExpressionFactory> filterNotAny = x => x.Not(y => y.InG("Id", valueArr)); context.Query.Where(selectorNotAny, filterNotAny); break; } }
public EditPartViewModel(ContentPartDefinition contentPartDefinition) { Name = contentPartDefinition.Name; PartDefinition = contentPartDefinition; _displayName = contentPartDefinition.DisplayName(); }
public EditPartViewModel(ContentPartDefinition contentPartDefinition) { Name = contentPartDefinition.Name; PartDefinition = contentPartDefinition; }
public void StorePartDefinition(ContentPartDefinition contentPartDefinition) { Apply(contentPartDefinition, Acquire(contentPartDefinition)); TriggerContentDefinitionSignal(); }
public virtual IEnumerable <TemplateViewModel> PartEditor(ContentPartDefinition definition) { return(Enumerable.Empty <TemplateViewModel>()); }
public ContentTypePartDefinition(ContentPartDefinition contentPartDefinition, SettingsDictionary settings) { PartDefinition = contentPartDefinition; Settings = settings; }
public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action <IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService Action <IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // apply where clause context.Query = context.Query.Where(relationship, andPredicate); }
public override IEnumerable <TemplateViewModel> PartEditor(ContentPartDefinition definition) { var model = definition.Settings.GetModel <ContentPartSettings>(); yield return(DefinitionTemplate(model)); }
public static bool IsReusable(this ContentPartDefinition part) { return(part.GetSettings <ContentPartSettings>().Reusable); }
public void StorePartDefinition(ContentPartDefinition contentPartDefinition) { Apply(contentPartDefinition, Acquire(contentPartDefinition)); UpdateContentDefinitionRecord(); }
public static string Description(this ContentPartDefinition part) { return(part.GetSettings <ContentPartSettings>().Description); }
public void AlterPartFieldsOrder(ContentPartDefinition partDefinition, string[] fieldNames) => throw new NotImplementedException();