コード例 #1
0
        public static ModelNode GetModel()
        {
            var model = SPMeta2Model.NewWebModel(web => {
                web
                .AddWebFeature(GoogleMapsFeatures.DisableMinimalDownloadStrategy)
                .AddField(GoogleMapsFields.LocationPoint)
                .AddField(GoogleMapsFields.LocationArea)
                .AddList(GoogleMapsLists.Locations, list => {
                    list
                    .AddField(GoogleMapsFields.LocationPoint)
                    .AddField(GoogleMapsFields.LocationArea)
                    .AddListView(GoogleMapsListViews.AllItems);
                })
                .AddHostList(BuiltInListDefinitions.SiteAssets, list =>
                {
                    if (Directory.Exists(GoogleMapsConsts.SiteAssetsPath))
                    {
                        ModuleFileUtils.LoadModuleFilesFromLocalFolder(list,
                                                                       GoogleMapsConsts.SiteAssetsPath);
                    }
                });
            });

            return(model);
        }
コード例 #2
0
        public void CanPassTypedSyntax_Extensions()
        {
            var model = SPMeta2Model.NewWebModel(web =>
            {
                web.AddRandomList(list =>
                {
                    ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, Directory.GetCurrentDirectory());

                    list.AddRandomFolder(folder =>
                    {
                        ModuleFileUtils.LoadModuleFilesFromLocalFolder(folder, Directory.GetCurrentDirectory());
                    });
                });
            });
        }
コード例 #3
0
 public static SiteModelNode DeployModel()
 {
     return(SPMeta2Model.NewSiteModel(site =>
     {
         site
         .AddField(ArtFields.SpfWebUrl())
         .AddContentType(ArtContentTypes.CustomAutoTitleCT(), contentType =>
         {
             contentType
             .AddContentTypeFieldLink(ArtFields.SpfWebUrl())
             ;
         })
         .AddRootWeb(new RootWebDefinition(), RootWeb =>
         {
             RootWeb
             .AddList(ArtLists.CustomAutoTitleList(), SpfList =>
             {
                 SpfList
                 .AddContentTypeLink(ArtContentTypes.CustomAutoTitleCT())
                 .AddUniqueContentTypeOrder(new UniqueContentTypeOrderDefinition
                 {
                     ContentTypes = new List <ContentTypeLinkValue>
                     {
                         new ContentTypeLinkValue {
                             ContentTypeName = ArtContentTypes.CustomAutoTitleCT().Name
                         }
                     }
                 })
                 .AddListView(ArtViews.SettingsView());
             })
             .AddHostList(BuiltInListDefinitions.Catalogs.MasterPage, list =>
             {
                 var FolderPath = Path.Combine(ArtConsts.SystemPath, ArtConsts.Assets);
                 if (Directory.Exists(FolderPath))
                 {
                     Extentions.FillApplytoFile();
                     ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, FolderPath);
                 }
             })
             ;
         })
         .AddUserCustomAction(ArtActions.ListSettings())
         .AddUserCustomAction(ArtActions.FolderSettings())
         ;
     }));
 }
コード例 #4
0
        public static SiteModelNode DeployModel(string assetFolder)
        {
            // keep model clean, parametrised
            if (!Directory.Exists(assetFolder))
            {
                throw new Exception(string.Format("Cannot find folder:[{0}]", assetFolder));
            }

            return(SPMeta2Model.NewSiteModel(site =>
            {
                site.AddRootWeb(new RootWebDefinition(), rootWeb =>
                {
                    rootWeb.AddHostList(BuiltInListDefinitions.Catalogs.MasterPage, list =>
                    {
                        ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, assetFolder);
                    });
                });
            }));
        }
コード例 #5
0
 public static SiteModelNode DeployModel()
 {
     return(SPMeta2Model.NewSiteModel(site =>
     {
         site
         .AddRootWeb(new RootWebDefinition(), RootWeb =>
         {
             RootWeb
             .AddHostList(BuiltInListDefinitions.Catalogs.MasterPage, list =>
             {
                 var FolderPath = Path.Combine(SystemPath, Assets);
                 if (Directory.Exists(FolderPath))
                 {
                     ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, FolderPath);
                 }
             });
         })
         ;
     }));
 }
コード例 #6
0
        public void CanPassTypedSyntax_Extensions()
        {
            var tmpDir = Path.Combine(
                Path.GetTempPath(),
                string.Format("m2_regression_test_CanPassTypedSyntax_Extensions_{0}", Guid.NewGuid().ToString("N")));

            Directory.CreateDirectory(tmpDir);

            var model = SPMeta2Model.NewWebModel(web =>
            {
                web.AddRandomList(list =>
                {
                    ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, tmpDir);

                    list.AddRandomFolder(folder =>
                    {
                        ModuleFileUtils.LoadModuleFilesFromLocalFolder(folder, tmpDir);
                    });
                });
            });
        }
コード例 #7
0
        public ModelNode GetStyleLibraryModel()
        {
            var webModel = SPMeta2Model.NewWebModel(rootWeb =>
            {
                // AddHostList() to indicate that we don't provision list, but just look it up
                rootWeb.AddHostList(BuiltInListDefinitions.StyleLibrary, list =>
                {
                    //LoadModuleFilesFromLocalFolder() helper gets everything from the local folder
                    //and creates a new M2 model full of folders/module files

                    //everything you have in M2ProjectPrefixConsts.DefaultStyleLibraryPath
                    //will be pushed to 'Style Library' back to back

                    if (Directory.Exists(M2ProjectPrefixConsts.DefaultStyleLibraryPath))
                    {
                        ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, M2ProjectPrefixConsts.DefaultStyleLibraryPath);
                    }
                });
            });

            return(webModel);
        }
コード例 #8
0
 /**
  *
  * SPSite model assembly example
  *
  */
 public static SiteModelNode SiteDemoModel()
 {
     return(SPMeta2Model.NewSiteModel(site =>
     {
         site
         .AddUserCustomAction(ActionsInfo.M2ArtefactsAction())
         .AddRootWeb(new RootWebDefinition(), RootWeb =>
         {
             RootWeb
             .AddHostList(BuiltInListDefinitions.Catalogs.MasterPage, list =>
             {
                 var FolderPath = Path.Combine(ConstsInfo.SystemPath, ConstsInfo.DynamicAssets);
                 if (Directory.Exists(FolderPath))
                 {
                     JSInfo.FillApplytoFile();
                     ModuleFileUtils.LoadModuleFilesFromLocalFolder(list, FolderPath);
                 }
             })
             ;
         });
     }));
 }