コード例 #1
1
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, item, definition);

            var typedDefinition = definition.WithAssertAndCast<JavaScriptDisplayTemplateDefinition>("model", value => value.RequireNotNull());

            item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F3851068";

            if (!string.IsNullOrEmpty(typedDefinition.Standalone))
                item["DisplayTemplateJSTemplateType"] = typedDefinition.Standalone;

            if (!string.IsNullOrEmpty(typedDefinition.TargetControlType))
                item["DisplayTemplateJSTargetControlType"] = typedDefinition.TargetControlType;

            if (!string.IsNullOrEmpty(typedDefinition.TargetListTemplateId))
                item["DisplayTemplateJSTargetListTemplate"] = typedDefinition.TargetListTemplateId;

            if (!string.IsNullOrEmpty(typedDefinition.TargetScope))
                item["DisplayTemplateJSTargetScope"] = typedDefinition.TargetScope;

            if (!string.IsNullOrEmpty(typedDefinition.IconUrl))
            {
                var iconValue = new FieldUrlValue { Url = typedDefinition.IconUrl };

                if (!string.IsNullOrEmpty(typedDefinition.IconDescription))
                    iconValue.Description = typedDefinition.IconDescription;

                item["DisplayTemplateJSIconUrl"] = iconValue;
            }
        }
コード例 #2
1
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, item, definition);

            var typedDefinition = definition.WithAssertAndCast<FilterDisplayTemplateDefinition>("model", value => value.RequireNotNull());

            item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660400F643FF79F6BD764F8A469B6F153396EE";


            if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileURL))
            {
                var crawlerXSLFileValue = new FieldUrlValue { Url = typedDefinition.CrawlerXSLFileURL };

                if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileDescription))
                    crawlerXSLFileValue.Description = typedDefinition.CrawlerXSLFileDescription;

                item["CrawlerXSLFile"] = crawlerXSLFileValue;
            }

            if (!string.IsNullOrEmpty(typedDefinition.CompatibleManagedProperties))
                item["CompatibleManagedProperties"] = typedDefinition.CompatibleManagedProperties;

            if (typedDefinition.CompatibleSearchDataTypes.Count > 0)
            {
                item["CompatibleSearchDataTypes"] = typedDefinition.CompatibleSearchDataTypes.ToArray();
            }
        }
コード例 #3
0
        protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, fileProperties, definition);

            var typedDefinition = definition.WithAssertAndCast<FilterDisplayTemplateDefinition>("model", value => value.RequireNotNull());

            fileProperties[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660400F643FF79F6BD764F8A469B6F153396EE";

            if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileURL))
            {
                var crawlerXSLFileValue = new SPFieldUrlValue { Url = typedDefinition.CrawlerXSLFileURL };

                if (!string.IsNullOrEmpty(typedDefinition.CrawlerXSLFileDescription))
                    crawlerXSLFileValue.Description = typedDefinition.CrawlerXSLFileDescription;

                fileProperties["CrawlerXSLFile"] = crawlerXSLFileValue.ToString();
            }

            if (!string.IsNullOrEmpty(typedDefinition.CompatibleManagedProperties))
                fileProperties["CompatibleManagedProperties"] = typedDefinition.CompatibleManagedProperties;

            if (typedDefinition.CompatibleSearchDataTypes.Count > 0)
            {
                var multiChoiceValue = new SPFieldMultiChoiceValue();

                foreach (var value in typedDefinition.CompatibleSearchDataTypes)
                    multiChoiceValue.Add(value);

                fileProperties["CompatibleSearchDataTypes"] = multiChoiceValue.ToString();
            }
        }
コード例 #4
0
        protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, fileProperties, definition);

            var typedTemplateModel = definition.WithAssertAndCast<ItemControlTemplateDefinitionBase>("model", value => value.RequireNotNull());

            if (typedTemplateModel.TargetControlTypes.Count > 0)
            {
                var multiChoiceValue = new SPFieldMultiChoiceValue();

                foreach (var value in typedTemplateModel.TargetControlTypes)
                    multiChoiceValue.Add(value);

                fileProperties["TargetControlType"] = multiChoiceValue.ToString();
            }

            if (!string.IsNullOrEmpty(typedTemplateModel.PreviewURL))
            {
                var htmlPreviewValue = new SPFieldUrlValue { Url = typedTemplateModel.PreviewURL };

                if (!string.IsNullOrEmpty(typedTemplateModel.PreviewDescription))
                    htmlPreviewValue.Description = typedTemplateModel.PreviewDescription;

                fileProperties["HtmlDesignPreviewUrl"] = htmlPreviewValue.ToString();
            }
        }
コード例 #5
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            var typedDefinition = definition.WithAssertAndCast<TemplateDefinitionBase>("model", value => value.RequireNotNull());

            item["TemplateHidden"] = typedDefinition.HiddenTemplate;

            if (!string.IsNullOrEmpty(typedDefinition.Description))
                item["MasterPageDescription"] = typedDefinition.Description;
        }
コード例 #6
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            var typedDefinition = definition.WithAssertAndCast<MasterPagePreviewDefinition>("model", value => value.RequireNotNull());

            item[BuiltInInternalFieldNames.ContentTypeId] = BuiltInContentTypeId.MasterPagePreview;

            if (typedDefinition.UIVersion.Count > 0)
            {
                item["UIVersion"] = string.Join(";#", typedDefinition.UIVersion.ToArray());
            }
        }
コード例 #7
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            var typedDefinition = definition.WithAssertAndCast<WebPartGalleryFileDefinition>("model", value => value.RequireNotNull());

            if (!string.IsNullOrEmpty(typedDefinition.Group))
                item["Group"] = typedDefinition.Group;

            if (!string.IsNullOrEmpty(typedDefinition.Description))
                item["WebPartDescription"] = typedDefinition.Description;

            item["QuickAddGroups"] = typedDefinition.RecommendationSettings.ToArray();
        }
コード例 #8
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, item, definition);

            var typedDefinition = definition.WithAssertAndCast<ItemDisplayTemplateDefinition>("model", value => value.RequireNotNull());

            item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F38510660300500DA5E";
            //item["DisplayTemplateLevel"] = "Item";


            if (!string.IsNullOrEmpty(typedDefinition.ManagedPropertyMappings))
                item["ManagedPropertyMapping"] = typedDefinition.ManagedPropertyMappings;
        }
コード例 #9
0
        protected override void MapProperties(object modelHost, System.Collections.Hashtable fileProperties, ContentPageDefinitionBase definition)
        {
            var typedTemplateModel = definition.WithAssertAndCast<MasterPagePreviewDefinition>("model", value => value.RequireNotNull());

            fileProperties[BuiltInInternalFieldNames.ContentTypeId] = BuiltInContentTypeId.MasterPagePreview;

            if (typedTemplateModel.UIVersion.Count > 0)
            {
                var value = new SPFieldMultiChoiceValue();

                foreach (var v in typedTemplateModel.UIVersion)
                    value.Add(v);

                fileProperties["UIVersion"] = value.ToString();
            }
        }
コード例 #10
0
        protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition)
        {
            var typedTemplateModel = definition.WithAssertAndCast<TemplateDefinitionBase>("model", value => value.RequireNotNull());

            // SSOM provision for display templates sometimes gives invalid type case error #440
            // HiddenTemplate.ToString() happens to fails on some SharePoint's environentns
            // 1:0 works well
            // https://github.com/SubPointSolutions/spmeta2/issues/440
            fileProperties["TemplateHidden"] = typedTemplateModel.HiddenTemplate ? 1 : 0;

            if (!string.IsNullOrEmpty(typedTemplateModel.Description))
                fileProperties["MasterPageDescription"] = typedTemplateModel.Description;




        }
コード例 #11
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, item, definition);

            var typedTemplateModel = definition.WithAssertAndCast<ControlDisplayTemplateDefinition>("model", value => value.RequireNotNull());

            item[BuiltInInternalFieldNames.ContentTypeId] = "0x0101002039C03B61C64EC4A04F5361F385106601";

            if (!string.IsNullOrEmpty(typedTemplateModel.CrawlerXSLFileURL))
            {
                var crawlerXSLFileValue = new FieldUrlValue { Url = typedTemplateModel.CrawlerXSLFileURL };

                if (!string.IsNullOrEmpty(typedTemplateModel.CrawlerXSLFileDescription))
                    crawlerXSLFileValue.Description = typedTemplateModel.CrawlerXSLFileDescription;

                item["CrawlerXSLFile"] = crawlerXSLFileValue;
            }
        }
コード例 #12
0
        protected override void MapProperties(object modelHost, Hashtable fileProperties, ContentPageDefinitionBase definition)
        {
            var typedDefinition = definition.WithAssertAndCast<WebPartGalleryFileDefinition>("model", value => value.RequireNotNull());

            if (!string.IsNullOrEmpty(typedDefinition.Group))
                fileProperties["Group"] = typedDefinition.Group;

            if (!string.IsNullOrEmpty(typedDefinition.Description))
                fileProperties["WebPartDescription"] = typedDefinition.Description;


            var recSettingsValue = new SPFieldMultiChoiceValue();

            foreach (var value in typedDefinition.RecommendationSettings)
                recSettingsValue.Add(value);

            fileProperties["QuickAddGroups"] = recSettingsValue.ToString();
        }
コード例 #13
0
        protected override void MapProperties(object modelHost, ListItem item, ContentPageDefinitionBase definition)
        {
            base.MapProperties(modelHost, item, definition);

            var typedDefinition = definition.WithAssertAndCast<ItemControlTemplateDefinitionBase>("model", value => value.RequireNotNull());

            if (typedDefinition.TargetControlTypes.Count > 0)
            {
                item["TargetControlType"] = typedDefinition.TargetControlTypes.ToArray();
            }

            if (!string.IsNullOrEmpty(typedDefinition.PreviewURL))
            {
                var htmlPreviewValue = new FieldUrlValue { Url = typedDefinition.PreviewURL };

                if (!string.IsNullOrEmpty(typedDefinition.PreviewDescription))
                    htmlPreviewValue.Description = typedDefinition.PreviewDescription;

                item["HtmlDesignPreviewUrl"] = htmlPreviewValue;
            }
        }