This commit is contained in:
2020-04-29 23:29:53 +00:00
parent d6ca437a00
commit 00369a05ee

View File

@@ -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<string> SkipLocales = new List<string>();
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("<!--");
int nEnd = 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
* <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css">
<!--
span.st1
{
font-family: Arial;
font-size: 39pt;
color: #000000;
}
span.st2
{
font-family: Arial;
font-size: 8pt;
color: #000000;
}
span.st3
{
font-family: Arial;
font-size: 6pt;
color: #000000;
}
span.st4
{
font-family: Arial;
font-size: 150pt;
color: #000000;
}
span.st5
{
font-family: Arial;
font-size: 8pt;
color: #ff0000;
}
span.st6
{
font-family: Arial;
font-size: 8pt;
color: #00ff00;
}
span.st7
{
font-family: Arial;
font-size: 8pt;
color: #000080;
}
span.st8
{
font-family: Symbol;
font-size: 8pt;
color: #000080;
}
span.st9
{
font-family: Consolas;
font-size: 8pt;
color: #000000;
}
span.st10
{
font-family: Comic Sans MS;
font-size: 8pt;
color: #000000;
}
span.st11
{
font-family: Comic Sans MS;
font-size: 16pt;
color: #000000;
}
span.st12
{
font-family: Arial;
font-size: 32pt;
color: #000000;
}
span.st13
{
font-family: Times New Roman;
font-size: 12pt;
color: #000000;
}
-->
</style>
</head>
<body>
<div><span class="st1"><b><u>Here is a title</u></b></span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2">This document has all possible options on it except for picking every single font size so instead</span><span class="st3"> here is the smallest font size which is 6</span></div>
<div><span class="st3">and here is the</span><span class="st4"> largest font size which is 150</span></div>
<div><span class="st3"></span>&nbsp;</div>
<div><span class="st2"><i>italics </i>and <u>underlined </u>and <b>bold</b></span></div>
<div><span class="st2"><b></b></span>&nbsp;</div>
<div><span class="st2"><b></b></span><span class="st5"><b>red </b></span></div>
<div><span class="st2"><b></b></span>&nbsp;</div>
<div><span class="st6"><b>green </b></span></div>
<div><span class="st2"><b></b></span>&nbsp;</div>
<div><span class="st2"><b></b></span><span class="st7"><b>blue</b></span></div>
<div><span class="st7"><b></b></span>&nbsp;</div>
<div><span class="st7"><b></b></span></div>
<ul style="list-style-type: none">
<li><span class="st8"><b>·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span><span class="st7"><b>List one</b></span></li>
<li><span class="st7"><b></b></span><span class="st8"><b>·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span><span class="st7"><b>list two </b></span></li>
<li><span class="st7"><b></b></span><span class="st8"><b>·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span><span class="st7"><b>list three</b></span></li>
</ul><div><span class="st7"><b></b></span></div>
<div><span class="st7"><b></b></span>&nbsp;</div>
<div><span class="st2"><b></b></span>&nbsp;</div>
<div><span class="st2"><b></b></span>&nbsp;</div>
<div><span class="st2">Arial font</span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span><span class="st9">Consolas font</span></div>
<div><span class="st9"></span>&nbsp;</div>
<div><span class="st9"></span><span class="st10">Comic &nbsp;sans</span></div>
<div><span class="st10"></span>&nbsp;</div>
<div><span class="st10"></span><span class="st11">font size 16 double default size whih is 8 </span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span><span class="st12">font size 32 which is quadruple default of 8</span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2">This block is</span></div>
<div><span class="st2">left aligned</span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span>&nbsp;</div>
<div align="center"><span class="st2">this block is </span></div>
<div align="center"><span class="st2">center aligned</span></div>
<div><span class="st2"></span>&nbsp;</div>
<div align="right"><span class="st2">This block is </span></div>
<div align="right"><span class="st2">right aligned</span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2"> &nbsp;<img src="[ATTACH:4]"></span><span class="st13">Wiki page - User: AyaNova Administrator</span></div>
<div><span class="st13"></span>&nbsp;</div>
<div><span class="st13">and more:</span></div>
<div><span class="st13"></span><span class="st2"> <img src="[ATTACH:4]"></span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st2">and more</span></div>
<div><span class="st2"> &nbsp;<img src="[ATTACH:4]"></span></div>
<div><span class="st2"></span>&nbsp;</div>
<div><span class="st13"></span></div></body>
</html>
========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css">
<!--
span.st1
{
font-family: Times New Roman;
font-size: 20pt;
color: #000000;
}
span.st2
{
font-family: Times New Roman;
font-size: 18pt;
color: #000000;
}
span.st3
{
font-family: Times New Roman;
font-size: 10pt;
color: #000000;
}
span.st4
{
font-family: Times New Roman;
font-size: 24pt;
color: #000000;
}
span.st5
{
font-family: Times New Roman;
font-size: 12pt;
color: #000000;
}
-->
</style>
</head>
<body>
<div><span class="st1">Wiki page - User: Eva Alexander - ALL REGIONS</span></div>
<div><span class="st2"></span><span class="st3">Here is some under title text</span></div>
<div><span class="st3"></span>&nbsp;</div>
<div><span class="st3"></span><span class="st4">Here is another title</span></div>
<div><span class="st3"></span>&nbsp;</div>
<div><span class="st3">Here is some more under title text.</span></div>
<div><span class="st3">Some more lines</span></div>
<div><span class="st3">like this one</span></div>
<div><span class="st3">and this one</span></div>
<div><span class="st3"></span>&nbsp;</div>
<div><span class="st5"></span></div></body>
</html>
=-=-=-==-
*
*
*
output
* Untitled document<!--<br>span.st1
{
font-family: Arial;
font-size: 39pt;
color: #000000;
}<br>span.st2
{
font-family: Arial;
font-size: 8pt;
color: #000000;
}<br>span.st3
{
font-family: Arial;
font-size: 6pt;
color: #000000;
}<br>span.st4
{
font-family: Arial;
font-size: 150pt;
color: #000000;
}<br>span.st5
{
font-family: Arial;
font-size: 8pt;
color: #ff0000;
}<br>span.st6
{
font-family: Arial;
font-size: 8pt;
color: #00ff00;
}<br>span.st7
{
font-family: Arial;
font-size: 8pt;
color: #000080;
}<br>span.st8
{
font-family: Symbol;
font-size: 8pt;
color: #000080;
}<br>span.st9
{
font-family: Consolas;
font-size: 8pt;
color: #000000;
}<br>span.st10
{
font-family: Comic Sans MS;
font-size: 8pt;
color: #000000;
}<br>span.st11
{
font-family: Comic Sans MS;
font-size: 16pt;
color: #000000;
}<br>span.st12
{
font-family: Arial;
font-size: 32pt;
color: #000000;
}<br>span.st13
{
font-family: Times New Roman;
font-size: 12pt;
color: #000000;
}<br>-->
**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<!--<br>span.st1
{
font-family: Times New Roman;
font-size: 20pt;
color: #000000;
}<br>span.st2
{
font-family: Times New Roman;
font-size: 18pt;
color: #000000;
}<br>span.st3
{
font-family: Times New Roman;
font-size: 10pt;
color: #000000;
}<br>span.st4
{
font-family: Times New Roman;
font-size: 24pt;
color: #000000;
}<br>span.st5
{
font-family: Times New Roman;
font-size: 12pt;
color: #000000;
}<br>-->
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<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
//Skip stock locales already handled in Raven
List<string> SkipLocales = new List<string>();
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