From 00369a05ee0f81b1ce8895b61883700b9dcbbef8 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 29 Apr 2020 23:29:53 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 517 +++++++++++++++++++++++-- 1 file changed, 488 insertions(+), 29 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index 1dcb262..b7a0367 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -187,9 +187,13 @@ namespace AyaNova.PlugIn.V8 /* TODO: * - * wiki / attached docs * locales * + * todo: once have moved beyond what's in the v8 import stuff then need to remove all that, though maybe comment out some bits as some may be useful for import / export?? + * + * TODO: User, fixup translationID, headofficeid, clientid vendorid, phone1, phone2, pagermaxtext + * + * * * * @@ -221,7 +225,7 @@ namespace AyaNova.PlugIn.V8 progress.Op("Exporting objects"); //BIZ objects await ExportUsers(progress); - // await ExportLocales(progress); + await ExportLocales(progress); @@ -265,8 +269,6 @@ namespace AyaNova.PlugIn.V8 #region Object Export methods - - #region users private async System.Threading.Tasks.Task ExportUsers(ProgressForm progress) { @@ -420,6 +422,44 @@ namespace AyaNova.PlugIn.V8 } #endregion clients + #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"); + SkipLocales.Add("English"); + SkipLocales.Add("Español"); + SkipLocales.Add("Français"); + + LocaleList l = LocaleList.GetList(); + progress.Append("Exporting " + l.Count.ToString() + " Locales"); + foreach (LocaleList.LocaleListInfo i in l) + { + if (!SkipLocales.Contains(i.Locale)) + { + LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale); + //todo: all locales except English default need to be dealt with + //above skiplocales is incorrect + + //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? + + //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; + var a = util.PostAsync("Translation/Duplicate", d.ToString()); + + + + } + } + } + #endregion locales + #region TAG ITEMS #region Unitmodelcategories private void ExportUnitModelCategories(ProgressForm progress) @@ -760,6 +800,7 @@ namespace AyaNova.PlugIn.V8 } //todo: fixup font size, try to convert to heading tags instead + //figure out how to remove the inline style tag as it comes through for some reason //TODO: Convert to Markdown format //found 2 likely candidate libs to do this @@ -776,19 +817,460 @@ namespace AyaNova.PlugIn.V8 { UnknownTags = ReverseMarkdown.Config.UnknownTagsOption.Bypass, GithubFlavored = true, // generate GitHub flavoured markdown, supported for BR, PRE and table tags - RemoveComments = true, // will ignore all comments + RemoveComments = true, // will ignore all comments, (narrator: "It doesn't") SmartHrefHandling = true // remove markdown output for links where appropriate }; var converter = new ReverseMarkdown.Converter(config); 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) + { + res = res.Substring(0, nStart) + res.Substring(nEnd+3); + // res = newRes; + } + return res; } + #region sample before and after + /* + * INPUT + * + + +Untitled document + + + + +
Here is a title
+
 
+
This document has all possible options on it except for picking every single font size so instead here is the smallest font size which is 6
+
and here is the largest font size which is 150
+
 
+
italics and underlined and bold
+
 
+
red
+
 
+
green
+
 
+
blue
+
 
+
+
    +
  • ·      List one
  • +
  • ·      list two
  • +
  • ·      list three
  • +
+
 
+
 
+
 
+
Arial font
+
 
+
Consolas font
+
 
+
Comic  sans
+
 
+
font size 16 double default size whih is 8
+
 
+
font size 32 which is quadruple default of 8
+
 
+
 
+
This block is
+
left aligned
+
 
+
 
+
this block is
+
center aligned
+
 
+
This block is
+
right aligned
+
 
+
 
+
 
+
 Wiki page - User: AyaNova Administrator
+
 
+
and more:
+
+
 
+
and more
+
 
+
 
+
+ + +======================================== + + + + +Untitled document + + + + +
Wiki page - User: Eva Alexander - ALL REGIONS
+
Here is some under title text
+
 
+
Here is another title
+
 
+
Here is some more under title text.
+
Some more lines
+
like this one
+
and this one
+
 
+
+ +=-=-=-==- + + * + * + * + output + * Untitled document + +**Here is a title** +This document has all possible options on it except for picking every single font size so instead here is the smallest font size which is 6 + +and here is the largest font size which is 150 + + + +*italics*and underlined and **bold** + + + +**red** + + + +**green** + + + +**blue** + + + + + +- **·****List one** +- **·****list two** +- **·****list three** + + + + + + + + + + +Arial font + + + +Consolas font + + + +Comic  sans + + + +font size 16 double default size whih is 8 + + + +font size 32 which is quadruple default of 8 + + + + + +This block is + +left aligned + + + + + +this block is + +center aligned + + + +This block is + +right aligned + + + + + + + +![]([ATTACH:4])Wiki page - User: AyaNova Administrator + + + +and more: + +![]([ATTACH:4]) + + + +and more + +![]([ATTACH:4]) + + + + +========================= +Untitled document + +Wiki page - User: Eva Alexander - ALL REGIONS + +Here is some under title text + + + +Here is another title + + + +Here is some more under title text. + +Some more lines + +like this one + +and this one + + + + + + * + */ + #endregion sample + #endregion wiki @@ -825,30 +1307,7 @@ namespace AyaNova.PlugIn.V8 } #endregion globalsettings - #region locales - private void ExportLocales(ProgressForm progress) - { - // List objectExcludeProperties = new List(standardExcludePropertiesList); - - //Skip stock locales already handled in Raven - List SkipLocales = new List(); - SkipLocales.Add("Deutsch"); - SkipLocales.Add("English"); - SkipLocales.Add("Español"); - SkipLocales.Add("Français"); - - LocaleList l = LocaleList.GetList(); - progress.Append("Dumping " + l.Count.ToString() + " Locales"); - foreach (LocaleList.LocaleListInfo i in l) - { - if (!SkipLocales.Contains(i.Locale)) - { - LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale); - //DumpObjectToFolder(tempArchiveFolder, lt.LT, "translation." + EnsureValidFileName(i.Locale), objectExcludeProperties, TypeAndID.Empty, "GZTW.AyaNova.BLL.Translation"); - } - } - } - #endregion locales + #region Seeds private class GZSeeds