示例#1
0
 /**
  *
  * Views model definition
  *
  */
 public static ListViewDefinition ContactsView()
 {
     return(new ListViewDefinition
     {
         Title = "All Items",
         Url = "AllItems.aspx",
         RowLimit = 25,
         Query = "<OrderBy><FieldRef Name='ID' Ascending='FALSE'/></OrderBy>",
         IsDefault = true,
         Fields = new Collection <string>
         {
             BuiltInInternalFieldNames.Edit,
             BuiltInInternalFieldNames.ID,
             BuiltInInternalFieldNames.LinkTitle,
             FieldsInfo.Email().InternalName,
             FieldsInfo.PhoneNumber().InternalName,
             BuiltInInternalFieldNames.Editor,
             BuiltInInternalFieldNames.Modified
         },
         TitleResource = new List <ValueForUICulture> {
             new ValueForUICulture {
                 CultureId = 1033, Value = "All Items"
             },
             new ValueForUICulture {
                 CultureId = 1049, Value = "Все элементы"
             }
         }
     });
 }
示例#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
        /**
         *
         * 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())
                    ;
                })
                ;
            }));
        }