Beispiel #1
0
        private List <List> GetLists(CustomFeature feature)
        {
            var lists = new List <List>();
            var path  = Path.Combine(feature.Path, "Lists");

            if (Directory.Exists(path))
            {
                var listDirectories = Directory.EnumerateDirectories(path);
                foreach (var dp in listDirectories)
                {
                    var configPath = Path.Combine(dp, "list.json");
                    if (File.Exists(configPath))
                    {
                        var list = Json.Deserialize <List>(configPath);
                        list.ConfigFolderPath = dp;
                        list.Fields           = GetListFields(dp);
                        list.SiteColumns      = GetListSiteColumns(dp);
                        list.ListContentTypes = GetListContentTypes(dp);
                        list.Views            = GetListViews(dp);
                        lists.Add(list);
                    }
                }
            }

            return(lists);
        }
Beispiel #2
0
        private static List <Group> GetGroups(CustomFeature feature)
        {
            var groups = new List <Group>();
            var path   = Path.Combine(feature.Path, "groups.json");

            if (File.Exists(path))
            {
                try
                {
                    var json = File.ReadAllText(path);
                    groups = JsonConvert.DeserializeObject <List <Group> >(json);
                    foreach (var group in groups)
                    {
                        for (var i = 0; i < group.Members.Count; i++)
                        {
                            group.Members[i] = Farm.Domain + "\\" + group.Members[i];
                        }
                    }
                }
                catch (Exception ex)
                {
                    var x = ex.Message;
                }
            }
            return(groups);
        }
Beispiel #3
0
        public static List <List> GetListTemplates(CustomFeature feature)
        {
            var lists = new List <List>();
            var path  = Path.Combine(feature.Path, "ListTemplates");

            if (Directory.Exists(path))
            {
                var listDirectories = Directory.EnumerateDirectories(path);
                foreach (var dp in listDirectories)
                {
                    var configPath = Path.Combine(dp, "list.json");
                    if (File.Exists(configPath))
                    {
                        try
                        {
                            var json = File.ReadAllText(configPath);
                            var list = JsonConvert.DeserializeObject <List>(json);
                            list.ConfigFolderPath = dp;
                            list.Fields           = GetListFields(dp);
                            list.SiteColumns      = GetListSiteColumns(dp);
                            list.ListContentTypes = GetListContentTypes(dp);
                            list.Views            = GetListViews(dp);
                            lists.Add(list);
                        }
                        catch (Exception ex)
                        {
                            var x = ex.Message;
                        }
                    }
                }
            }

            return(lists);
        }
Beispiel #4
0
        private static List <SiteColumn> GetSiteColumns(CustomFeature feature)
        {
            var siteColumns = new List <SiteColumn>();
            var path        = Path.Combine(feature.Path, "fields.json");

            if (File.Exists(path))
            {
                try
                {
                    var json = File.ReadAllText(path);
                    siteColumns = JsonConvert.DeserializeObject <List <SiteColumn> >(json);
                    foreach (var siteColumn in siteColumns)
                    {
                        siteColumn.Id          = Match(siteColumn.Xml, @" ID='(?<ID>[^']*)'", "ID");
                        siteColumn.DisplayName = Match(siteColumn.Xml, @" DisplayName='(?<DisplayName>[^']*)'", "DisplayName");
                        siteColumn.Name        = Match(siteColumn.Xml, @" Name='(?<Name>[^']*)'", "Name");
                        siteColumn.Group       = Match(siteColumn.Xml, @" Group='(?<Group>[^']*)'", "Group");
                        siteColumn.IsLookup    = siteColumn.Xml.Contains("Type='Lookup'");
                    }
                }
                catch (Exception ex)
                {
                    var x = ex.Message;
                }
            }
            return(siteColumns);
        }
        public static string RenderLists(List <List> lists, CustomFeature customFeature, IDataRenderer renderer)
        {
            if (lists.Count == 0)
            {
                return("");
            }
            string rendu = "";

            foreach (var list in lists)
            {
                rendu += RenderList(list, customFeature.ContentTypes, customFeature.SiteColumns, renderer);
                if (string.IsNullOrWhiteSpace(rendu))
                {
                    return("");
                }
                if (list.Views.Count > 0)
                {
                    var listViews = new List <string>();
                    foreach (var view in list.Views)
                    {
                        listViews.Add(view.Name);
                    }
                    rendu += renderer.RenderTitle("Vues :", 9) + new HTMLRenderer().RenderUnorderedList(listViews);
                }
            }
            return(renderer.RenderTitle("Listes :", 7) + rendu);
        }
Beispiel #6
0
 private static void CreateListTemplates(CustomFeature feature)
 {
     if (feature.ListTemplates.Count > 0)
     {
         foreach (var list in feature.ListTemplates.OrderBy(l => l.DeployOrder))
         {
         }
     }
 }
Beispiel #7
0
 private static void CreateGroups(CustomFeature feature)
 {
     if (feature.Groups.Count > 0)
     {
         Output.SubTitle("Création des groupes de sécurité");
         foreach (var group in feature.Groups)
         {
         }
     }
 }
Beispiel #8
0
 private static void UploadCode(CustomFeature feature)
 {
     if (!String.IsNullOrEmpty(feature.CodePath))
     {
         var files = Directory.GetFiles(feature.CodePath, "*.*", SearchOption.AllDirectories);
         foreach (var file in files)
         {
         }
     }
 }
Beispiel #9
0
        private static void ExecuteActions(CustomFeature feature)
        {
            if (feature.Actions.Count > 0)
            {
                Output.SubTitle("Exécution des actions de configuration");

                foreach (var action in feature.Actions)
                {
                }
            }
        }
Beispiel #10
0
        private static void ConfigureWorkflows(CustomFeature feature)
        {
            if (feature.Workflows.Count > 0)
            {
                Output.SubTitle("Configuration des flux de travail");

                foreach (var workflow in feature.Workflows)
                {
                }
            }
        }
Beispiel #11
0
        private static void ConfigureReports(CustomFeature feature)
        {
            if (feature.Reports.Count > 0)
            {
                Output.SubTitle("Configuration des rapports");

                foreach (var report in feature.Reports)
                {
                }
            }
        }
Beispiel #12
0
        private static void ConfigureEvents(CustomFeature feature)
        {
            if (feature.Events.Count > 0)
            {
                Output.SubTitle("Configuration des évnènements");

                foreach (var evt in feature.Events)
                {
                }
            }
        }
Beispiel #13
0
        private List <T> GetFeatureConfigItem <T>(CustomFeature feature, string itemName)
        {
            var items = new List <T>();
            var path  = Path.Combine(feature.Path, itemName + ".json");

            if (File.Exists(path))
            {
                items = Json.Deserialize <List <T> >(path);
            }
            return(items);
        }
Beispiel #14
0
        private static void ConfigureAlerts(CustomFeature feature)
        {
            if (feature.Alerts.Count > 0)
            {
                Output.SubTitle("Configuration des alertes");

                foreach (var alert in feature.Alerts)
                {
                }
            }
        }
Beispiel #15
0
        private static void CreateQuickLaunch(CustomFeature feature)
        {
            if (feature.QuickLaunch.Count > 0)
            {
                Output.SubTitle("Création des liens de lancement rapides");

                foreach (var link in feature.QuickLaunch)
                {
                }
            }
        }
Beispiel #16
0
        private static void InsertData(CustomFeature feature)
        {
            if (feature.ListData.List != null)
            {
                Output.SubTitle("Insertion des données de la liste : " + feature.ListData.List);

                foreach (var data in feature.ListData.Items)
                {
                }
            }
        }
Beispiel #17
0
        private static void CreateSiteColumns(CustomFeature feature)
        {
            if (feature.SiteColumns.Count > 0)
            {
                Output.SubTitle("Création des colonnes de sites");

                foreach (var column in feature.SiteColumns)
                {
                    CreateSiteColumn(column);
                }
            }
        }
Beispiel #18
0
        private List <Group> GetGroups(CustomFeature feature)
        {
            var groups = new List <Group>();
            var path   = Path.Combine(feature.Path, "groups.json");

            if (File.Exists(path))
            {
                groups = Json.Deserialize <List <Group> >(path);
                foreach (var group in groups)
                {
                    for (var i = 0; i < group.Members.Count; i++)
                    {
                        group.Members[i] = group.Members[i];
                    }
                }
            }
            return(groups);
        }
Beispiel #19
0
        private static List <T> GetFeatureConfigItem <T>(CustomFeature feature, string itemName)
        {
            var items = new List <T>();
            var path  = Path.Combine(feature.Path, itemName + ".json");

            if (File.Exists(path))
            {
                try
                {
                    var json = File.ReadAllText(path);
                    items = JsonConvert.DeserializeObject <List <T> >(json);
                }
                catch (Exception ex)
                {
                    var x = ex.Message;
                }
            }
            return(items);
        }
        private static string RenderFeature(CustomFeature feature, TableDeMatiere tableDeMatiere, IDataRenderer renderer)
        {
            string rendu = "";

            if (feature.DependentOn.Count > 0)
            {
                rendu += "Cette fonctionnalité depend des fonctionnalités suivantes :\n" +
                         new HTMLRenderer().RenderUnorderedList(feature.DependentOn);
            }
            rendu += RenderGroups(feature.Groups, renderer);
            rendu += RenderLists(feature.Lists, feature, renderer);
            string tF = string.Format("Fonctionnalité {0}", feature.Name);

            if (string.IsNullOrWhiteSpace(rendu))
            {
                return("");
            }
            return(renderer.RenderTitle(tF, 6) + rendu);
        }
Beispiel #21
0
        private static Data GetFeatureData(CustomFeature feature, string itemName)
        {
            var result = new Data();
            var path   = Path.Combine(feature.Path, itemName + ".json");

            if (File.Exists(path))
            {
                try
                {
                    var json = File.ReadAllText(path);
                    result = JsonConvert.DeserializeObject <Data>(json);
                }
                catch (Exception ex)
                {
                    var x = ex.Message;
                }
            }
            return(result);
        }
Beispiel #22
0
        public static void InstallCustomFeature(CustomFeature feature)
        {
            Output.Title("Installation de la fonctionnalité " + feature.Name);

            CreateRoleDefinitions(feature);
            CreateSiteColumns(feature);
            CreateContentTypes(feature);
            CreateListTemplates(feature);
            CreateLists(feature);
            CreateGroups(feature);
            CreateQuickLaunch(feature);
            UploadCode(feature);
            ConfigureAlerts(feature);
            ConfigureEvents(feature);
            ConfigureWorkflows(feature);
            ConfigureReports(feature);
            ExecuteActions(feature);
            InsertData(feature);
        }
Beispiel #23
0
        private List <SiteColumn> GetSiteColumns(CustomFeature feature)
        {
            var siteColumns = new List <SiteColumn>();
            var path        = Path.Combine(feature.Path, "fields.json");

            if (File.Exists(path))
            {
                siteColumns = Json.Deserialize <List <SiteColumn> >(path);
                foreach (var siteColumn in siteColumns)
                {
                    siteColumn.Id          = GetAttributeValueFromXml(siteColumn.Xml, "ID");
                    siteColumn.DisplayName = GetAttributeValueFromXml(siteColumn.Xml, "DisplayName");
                    siteColumn.Name        = GetAttributeValueFromXml(siteColumn.Xml, "Name");
                    siteColumn.Type        = GetAttributeValueFromXml(siteColumn.Xml, "Type");
                    siteColumn.IsRequired  = GetAttributeValueFromXml(siteColumn.Xml, "Required")
                                             .Equals("True", StringComparison.InvariantCultureIgnoreCase);

                    siteColumn.Group    = GetAttributeValueFromXml(siteColumn.Xml, "Group");
                    siteColumn.IsLookup = siteColumn.Xml.Contains("Type='Lookup'");
                }
            }
            return(siteColumns);
        }
Beispiel #24
0
        public static List <View> GetViews(List list, CustomFeature feature)
        {
            var path  = Path.Combine(list.ConfigFolderPath, "Views");
            var views = new List <View>();

            if (Directory.Exists(path))
            {
                views = new DirectoryInfo(path).EnumerateFiles()
                        .Select(file =>
                {
                    var xml = File.ReadAllText(file.FullName);
                    return(new View()
                    {
                        Name = file.Name.Replace(".xml", ""),
                        Xml = xml,
                        DisplayName = Match(xml, " DisplayName=\"(?<DisplayName>[^\"]*)\"", "DisplayName"),
                        IsDefault = Match(xml, " DefaultView=\"(?<DefaultView>[^\"]*)\"", "DefaultView") == "TRUE" ? true : false
                    });
                })
                        .ToList();
            }

            return(views);
        }
Beispiel #25
0
        private static void CreateContentTypes(CustomFeature feature)
        {
            if (feature.ContentTypes.Count > 0)
            {
                Output.SubTitle("Création des types de contenu");

                foreach (var type in feature.ContentTypes)
                {
                    string text;
                    string t1 = string.Format("# {0}\n", type.Id);
                    string t2 = string.Format("# {0}\n", type.Name);
                    string t3 = string.Format("# {0}\n", type.Group);
                    string t4 = string.Format("# {0}\n", type.EditFormUrl);
                    string t5 = string.Format("# {0}\n", type.NewFormUrl);
                    string t6 = string.Format("# {0}\n", type.DisplayFormUrl);
                    text = (t1 + "\n" + t2 + "\n" + t3 + "\n" + t4 + "\n" + t5 + "\n" + t6);
                    string path = @"D:\readme1.md";
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.Write(text);
                    }
                }
            }
        }
Beispiel #26
0
 internal virtual IEnumerator DoCustomFeature(CustomFeature featureType, List <string> parameters)
 {
     throw new System.NotImplementedException($"TextAnimator: Custom Feature not implemented with type: {featureType}. If you did implement it, please do not call the base method from your overridden one.");
 }
Beispiel #27
0
        private static void CreateList(List list, CustomFeature feature)
        {
            if (list.SiteColumns.Count > 0)
            {
                Output.SubTitle("Création des colonnes de site de la liste " + list.Name);
                foreach (var column in list.SiteColumns)
                {
                }
            }

            if (list.ContentTypes.Count > 0)
            {
                Output.SubTitle("Création des types de contenu de la liste " + list.Name);
                foreach (var type in list.ListContentTypes)
                {
                }
            }

            Output.SubTitle("Création de la liste " + list.Name);


            //Création des colonnes
            if (list.Fields.Count > 0)
            {
                foreach (var fld in list.Fields.OrderBy(f => f.IsCalculated))
                {
                }
            }

            //Définition des champs des formulaires
            for (int i = 0; i < list.Fields.Count; i++)
            {
                var field = list.Fields[i];


                //if (!field.ReadOnlyField)
                //{
                //    if ((IsRequired(field.Name, list) != null)
                //        || (IsHidden(field.Name, list) != null)
                //        || (IsVisibleInNewForm(field.Name, list) != null)
                //        || (IsVisibleInEditForm(field.Name, list) != null)
                //        || (IsVisibleInDisplayForm(field.Name, list) != null))
                //    {
                //                                                                                                          IsHidden(field.StaticName, list),
                //                                                                                                          IsVisibleInNewForm(field.StaticName, list),
                //                                                                                                          IsVisibleInEditForm(field.StaticName, list),
                //                                                                                                          IsVisibleInDisplayForm(field.StaticName, list)));
                //    }

                //}
            }

            //Insertion des données
            if (list.Data.Count > 0)
            {
                foreach (var data in list.Data)
                {
                    if (data.Keys.Count > 0)
                    {
                    }
                }
            }

            var views = GetViews(list, feature);

            if (views.Count > 0)
            {
                //Création des vues
                foreach (var view in views)
                {
                }
            }
        }
 public FeaturePair(string tag, CustomFeature feature)
 {
     this.tag     = tag;
     this.feature = feature;
 }
Beispiel #29
0
 private static void CreateRoleDefinitions(CustomFeature feature)
 {
 }