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); }
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); }
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); }
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); }
private static void CreateListTemplates(CustomFeature feature) { if (feature.ListTemplates.Count > 0) { foreach (var list in feature.ListTemplates.OrderBy(l => l.DeployOrder)) { } } }
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) { } } }
private static void UploadCode(CustomFeature feature) { if (!String.IsNullOrEmpty(feature.CodePath)) { var files = Directory.GetFiles(feature.CodePath, "*.*", SearchOption.AllDirectories); foreach (var file in files) { } } }
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) { } } }
private static void ConfigureWorkflows(CustomFeature feature) { if (feature.Workflows.Count > 0) { Output.SubTitle("Configuration des flux de travail"); foreach (var workflow in feature.Workflows) { } } }
private static void ConfigureReports(CustomFeature feature) { if (feature.Reports.Count > 0) { Output.SubTitle("Configuration des rapports"); foreach (var report in feature.Reports) { } } }
private static void ConfigureEvents(CustomFeature feature) { if (feature.Events.Count > 0) { Output.SubTitle("Configuration des évnènements"); foreach (var evt in feature.Events) { } } }
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); }
private static void ConfigureAlerts(CustomFeature feature) { if (feature.Alerts.Count > 0) { Output.SubTitle("Configuration des alertes"); foreach (var alert in feature.Alerts) { } } }
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) { } } }
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) { } } }
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); } } }
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); }
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); }
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); }
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); }
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); }
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); }
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); } } } }
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."); }
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; }
private static void CreateRoleDefinitions(CustomFeature feature) { }