From 91bbd641496f094316d3b0c067844d6a72164db5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Apr 2020 00:10:56 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 40 ++++++++++++++++++-------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index b7a0367..0ec0f39 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -160,6 +160,8 @@ namespace AyaNova.PlugIn.V8 private Dictionary TagMap = new Dictionary(); private Dictionary CustomFieldLocaleKeys = new Dictionary();//holds custom field Raven as key and v7 custom text for that field for later export private string ImportTag = "v7-import"; + List InUseLocales = new List(); + /// /// Dump the objects into a temporary directory as a series of JSON files /// then zip it all up into a single archive file and then erase the temporary folder @@ -178,6 +180,7 @@ namespace AyaNova.PlugIn.V8 Map.Clear(); TagMap.Clear(); CustomFieldLocaleKeys.Clear(); + InUseLocales.Clear(); //admin user (not exported but is there already) Map.Add(User.AdministratorID, 1); @@ -288,6 +291,7 @@ namespace AyaNova.PlugIn.V8 User admin = User.GetItem(User.AdministratorID); progress.Op("Administrator account"); + InUseLocales.Add(admin.DefaultLanguage); //Attachments and wiki string AdminWikiContent = null; var hasWiki = WikiPage.HasWiki(User.AdministratorID); @@ -332,6 +336,9 @@ namespace AyaNova.PlugIn.V8 User c = User.GetItem(i.ID); + if (!InUseLocales.Contains(c.DefaultLanguage)) + InUseLocales.Add(c.DefaultLanguage); + dynamic d = new JObject(); d.name = c.FirstName + " " + c.LastName; progress.Op("User " + d.name); @@ -384,7 +391,7 @@ namespace AyaNova.PlugIn.V8 //Custom fields? if (ShouldExportCustom) d.customFields = CustomFieldData(c, DateCustomFields); - + var a = await util.PostAsync("User", d.ToString()); long RavenId = util.IdFromResponse(a); Map.Add(c.ID, RavenId); @@ -425,7 +432,7 @@ namespace AyaNova.PlugIn.V8 #region locales private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress) { - + //Skip stock locales already handled in Raven List SkipLocales = new List(); SkipLocales.Add("Deutsch"); @@ -445,9 +452,18 @@ namespace AyaNova.PlugIn.V8 //todo: do the language ones by fetching the equivalent language and then bring over from here (if modified) //maybe there's a way to tell if the stock locales have been edited and skip them if not? Modified date? - + //no, need to checksum them I think + + //todo: determine what users are set to for locales and only import those ones!!! + + + //todo: somehow identify where a custom list not of our own comes from originally so can start with that list + //i.e. someone may have started with spanish then customized some of it so we need to also start with spanish and customize + //likely if can matchup some parts of it then we would know or at least guess. + //Not sure what but maybe something they can't modify, like an internal error or something? + //need a key translator so can give old and get new then just update it's value - + dynamic d = new JObject(); d.id = 1; d.name = i.Locale; @@ -815,7 +831,7 @@ namespace AyaNova.PlugIn.V8 var config = new ReverseMarkdown.Config { - UnknownTags = ReverseMarkdown.Config.UnknownTagsOption.Bypass, + UnknownTags = ReverseMarkdown.Config.UnknownTagsOption.Bypass, GithubFlavored = true, // generate GitHub flavoured markdown, supported for BR, PRE and table tags RemoveComments = true, // will ignore all comments, (narrator: "It doesn't") SmartHrefHandling = true // remove markdown output for links where appropriate @@ -825,15 +841,15 @@ namespace AyaNova.PlugIn.V8 string res = converter.Convert(content); //strip out comment and style chunk that is left behind by above tool //style is an artifact of the rtf2html converter used by v7 - int nStart=res.IndexOf(""); - if (nStart!=-1 && nEnd!=-1) + if (nStart != -1 && nEnd != -1) { - res = res.Substring(0, nStart) + res.Substring(nEnd+3); - // res = newRes; + res = res.Substring(0, nStart) + res.Substring(nEnd + 3); + // res = newRes; } - - + + return res; } @@ -1307,7 +1323,7 @@ and this one } #endregion globalsettings - + #region Seeds private class GZSeeds