예제 #1
0
 /**
  *
  * SPWeb model data population example
  * The model example with data feeding nodes only
  *
  */
 public static WebModelNode WebDemoDataModel()
 {
     return(SPMeta2Model.NewWebModel(Web =>
     {
         Web
         .AddHostList(ListsInfo.Contacts(), List =>
         {
             List
             .ImportContactsItems();
             ;
         })
         .AddHostList(ListsInfo.Functions(), List =>
         {
             List
             .ImportFunctionsItems()
             ;
         })
         .AddHostList(ListsInfo.SubFunctions(), List =>
         {
             List
             .ImportSubFunctionsItems()
             ;
         })
         ;
     }));
 }
예제 #2
0
        /**
         *
         * Model definition to JS example
         * For the cases when artifacts names should be received in the JS on client side
         * This is completely optional and shows a concept
         *
         */
        public static void FillApplytoFile()
        {
            var SettingsArr = new string[]
            {
                "var spmeta2 = spmeta2 || {};",
                "spmeta2.Fields = spmeta2.Fields || {};",
                "spmeta2.Lists = spmeta2.Lists || {};",

                "spmeta2.Fields.Email = \"" + FieldsInfo.Email().InternalName + "\";",
                "spmeta2.Fields.PhoneNumber = \"" + FieldsInfo.PhoneNumber().InternalName + "\";",
                "spmeta2.Fields.EmployeesCount = \"" + FieldsInfo.EmployeesCount().InternalName + "\";",
                "spmeta2.Fields.Owner = \"" + FieldsInfo.Owner().InternalName + "\";",
                "spmeta2.Fields.Function = \"" + FieldsInfo.Function().InternalName + "\";",

                "spmeta2.Lists.Contacts = \"" + ListsInfo.Contacts().CustomUrl + "\";",
                "spmeta2.Lists.Functions = \"" + ListsInfo.Functions().CustomUrl + "\";",
                "spmeta2.Lists.SubFunctions = \"" + ListsInfo.SubFunctions().CustomUrl + "\";"
            };

            SPF.M2.Extentions.GenerateJavascriptFile(Path.Combine(ConstsInfo.SystemPath, ConstsInfo.ApplyToPath), SettingsArr);
        }
예제 #3
0
 public static LookupFieldDefinition Owner()
 {
     return(new LookupFieldDefinition
     {
         Id = new Guid("8a10aaec-481d-494c-b412-3a626851d20c"),
         Title = "Owner",
         InternalName = "DemosOwnerLookup",
         Group = ConstsInfo.DefaultGroupName,
         Required = false,
         AllowMultipleValues = false,
         LookupWebUrl = "~site",
         LookupListUrl = ListsInfo.Contacts().CustomUrl,
         LookupField = BuiltInInternalFieldNames.Title,
         TitleResource = new List <ValueForUICulture> {
             new ValueForUICulture {
                 CultureId = 1033, Value = "Owner"
             },
             new ValueForUICulture {
                 CultureId = 1049, Value = "Владелец"
             }
         }
     });
 }
예제 #4
0
        /**
         *
         * SPWeb model assembly example
         *
         */
        public static WebModelNode WebDemoModel()
        {
            return(SPMeta2Model.NewWebModel(Web =>
            {
                Web
                .AddWelcomePage(new WelcomePageDefinition
                {
                    Url = ListsInfo.Contacts().CustomUrl
                })

                .AddWebFeature(FeaturesInfo.DisableMinimalDownloadStrategy)

                .AddField(FieldsInfo.Email())
                .AddField(FieldsInfo.PhoneNumber())
                .AddField(FieldsInfo.EmployeesCount())
                .AddField(FieldsInfo.Owner())
                .AddField(FieldsInfo.Function())

                .AddContentType(ContentTypesInfo.Contact(), contentType =>
                {
                    contentType
                    .AddContentTypeFieldLink(new ContentTypeFieldLinkDefinition
                    {
                        FieldId = BuiltInFieldId.Title,
                        DisplayName = "Name",
                        Required = true
                    })
                    .AddContentTypeFieldLink(FieldsInfo.Email())
                    .AddContentTypeFieldLink(FieldsInfo.PhoneNumber())
                    ;
                })
                .AddContentType(ContentTypesInfo.Function(), contentType =>
                {
                    contentType
                    .AddContentTypeFieldLink(FieldsInfo.Owner())
                    .AddContentTypeFieldLink(FieldsInfo.EmployeesCount())
                    ;
                })
                .AddContentType(ContentTypesInfo.SubFunction(), contentType =>
                {
                    contentType
                    .AddContentTypeFieldLink(FieldsInfo.Function())
                    .AddContentTypeFieldLink(FieldsInfo.Owner())
                    ;
                })

                .AddList(ListsInfo.Contacts(), List =>
                {
                    List
                    .AddRemoveStandardContentTypes()
                    .AddContentTypeLink(ContentTypesInfo.Contact())
                    .AddListView(ViewsInfo.ContactsView())
                    ;
                })
                .AddList(ListsInfo.Functions(), List =>
                {
                    List
                    .AddRemoveStandardContentTypes()
                    .AddContentTypeLink(ContentTypesInfo.Function())
                    .AddListView(ViewsInfo.FunctionsView())
                    ;
                })
                .AddList(ListsInfo.SubFunctions(), List =>
                {
                    List
                    .AddRemoveStandardContentTypes()
                    .AddContentTypeLink(ContentTypesInfo.SubFunction())
                    .AddListView(ViewsInfo.SubFunctionsView())
                    ;
                })
                ;
            }));
        }