This commit is contained in:
@@ -160,6 +160,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
||||||
private Dictionary<string, string> CustomFieldLocaleKeys = new Dictionary<string, string>();//holds custom field Raven as key and v7 custom text for that field for later export
|
private Dictionary<string, string> CustomFieldLocaleKeys = new Dictionary<string, string>();//holds custom field Raven as key and v7 custom text for that field for later export
|
||||||
private string ImportTag = "v7-import";
|
private string ImportTag = "v7-import";
|
||||||
|
List<string> InUseLocales = new List<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dump the objects into a temporary directory as a series of JSON files
|
/// 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
|
/// 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();
|
Map.Clear();
|
||||||
TagMap.Clear();
|
TagMap.Clear();
|
||||||
CustomFieldLocaleKeys.Clear();
|
CustomFieldLocaleKeys.Clear();
|
||||||
|
InUseLocales.Clear();
|
||||||
|
|
||||||
//admin user (not exported but is there already)
|
//admin user (not exported but is there already)
|
||||||
Map.Add(User.AdministratorID, 1);
|
Map.Add(User.AdministratorID, 1);
|
||||||
@@ -288,6 +291,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
User admin = User.GetItem(User.AdministratorID);
|
User admin = User.GetItem(User.AdministratorID);
|
||||||
progress.Op("Administrator account");
|
progress.Op("Administrator account");
|
||||||
|
|
||||||
|
InUseLocales.Add(admin.DefaultLanguage);
|
||||||
//Attachments and wiki
|
//Attachments and wiki
|
||||||
string AdminWikiContent = null;
|
string AdminWikiContent = null;
|
||||||
var hasWiki = WikiPage.HasWiki(User.AdministratorID);
|
var hasWiki = WikiPage.HasWiki(User.AdministratorID);
|
||||||
@@ -332,6 +336,9 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
User c = User.GetItem(i.ID);
|
User c = User.GetItem(i.ID);
|
||||||
|
|
||||||
|
if (!InUseLocales.Contains(c.DefaultLanguage))
|
||||||
|
InUseLocales.Add(c.DefaultLanguage);
|
||||||
|
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.name = c.FirstName + " " + c.LastName;
|
d.name = c.FirstName + " " + c.LastName;
|
||||||
progress.Op("User " + d.name);
|
progress.Op("User " + d.name);
|
||||||
@@ -384,7 +391,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//Custom fields?
|
//Custom fields?
|
||||||
if (ShouldExportCustom)
|
if (ShouldExportCustom)
|
||||||
d.customFields = CustomFieldData(c, DateCustomFields);
|
d.customFields = CustomFieldData(c, DateCustomFields);
|
||||||
|
|
||||||
var a = await util.PostAsync("User", d.ToString());
|
var a = await util.PostAsync("User", d.ToString());
|
||||||
long RavenId = util.IdFromResponse(a);
|
long RavenId = util.IdFromResponse(a);
|
||||||
Map.Add(c.ID, RavenId);
|
Map.Add(c.ID, RavenId);
|
||||||
@@ -425,7 +432,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region locales
|
#region locales
|
||||||
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportLocales(ProgressForm progress)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Skip stock locales already handled in Raven
|
//Skip stock locales already handled in Raven
|
||||||
List<string> SkipLocales = new List<string>();
|
List<string> SkipLocales = new List<string>();
|
||||||
SkipLocales.Add("Deutsch");
|
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)
|
//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?
|
//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
|
//need a key translator so can give old and get new then just update it's value
|
||||||
|
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.id = 1;
|
d.id = 1;
|
||||||
d.name = i.Locale;
|
d.name = i.Locale;
|
||||||
@@ -815,7 +831,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
var config = new ReverseMarkdown.Config
|
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
|
GithubFlavored = true, // generate GitHub flavoured markdown, supported for BR, PRE and table tags
|
||||||
RemoveComments = true, // will ignore all comments, (narrator: "It doesn't")
|
RemoveComments = true, // will ignore all comments, (narrator: "It doesn't")
|
||||||
SmartHrefHandling = true // remove markdown output for links where appropriate
|
SmartHrefHandling = true // remove markdown output for links where appropriate
|
||||||
@@ -825,15 +841,15 @@ namespace AyaNova.PlugIn.V8
|
|||||||
string res = converter.Convert(content);
|
string res = converter.Convert(content);
|
||||||
//strip out comment and style chunk that is left behind by above tool
|
//strip out comment and style chunk that is left behind by above tool
|
||||||
//style is an artifact of the rtf2html converter used by v7
|
//style is an artifact of the rtf2html converter used by v7
|
||||||
int nStart=res.IndexOf("<!--");
|
int nStart = res.IndexOf("<!--");
|
||||||
int nEnd = res.IndexOf("-->");
|
int nEnd = res.IndexOf("-->");
|
||||||
if (nStart!=-1 && nEnd!=-1)
|
if (nStart != -1 && nEnd != -1)
|
||||||
{
|
{
|
||||||
res = res.Substring(0, nStart) + res.Substring(nEnd+3);
|
res = res.Substring(0, nStart) + res.Substring(nEnd + 3);
|
||||||
// res = newRes;
|
// res = newRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1307,7 +1323,7 @@ and this one
|
|||||||
}
|
}
|
||||||
#endregion globalsettings
|
#endregion globalsettings
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Seeds
|
#region Seeds
|
||||||
private class GZSeeds
|
private class GZSeeds
|
||||||
|
|||||||
Reference in New Issue
Block a user