This commit is contained in:
@@ -248,8 +248,9 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
progress.Op("Exporting objects");
|
||||
//BIZ objects
|
||||
if (progress.KeepGoing)
|
||||
await ExportLocales(progress);
|
||||
|
||||
//if (progress.KeepGoing)
|
||||
// await ExportLocales(progress);
|
||||
|
||||
if (progress.KeepGoing)
|
||||
await ExportUsers(progress);
|
||||
@@ -304,7 +305,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
|
||||
|
||||
#region Object Export methods
|
||||
#region BIZ OBJECT Export methods
|
||||
|
||||
#region users
|
||||
private async System.Threading.Tasks.Task ExportUsers(ProgressForm progress)
|
||||
@@ -324,13 +325,14 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
User admin = User.GetItem(User.AdministratorID);
|
||||
progress.Op("Administrator account");
|
||||
var adminTid=new TypeAndID(RootObjectTypes.User, User.AdministratorID);
|
||||
//Attachments and wiki
|
||||
string AdminWikiContent = null;
|
||||
var hasWiki = WikiPage.HasWiki(User.AdministratorID);
|
||||
if (hasWiki)
|
||||
{
|
||||
await ExportAttachments(new TypeAndID(RootObjectTypes.User, User.AdministratorID), progress);
|
||||
AdminWikiContent = GetWikiContent(new TypeAndID(RootObjectTypes.User, admin.ID));
|
||||
await ExportAttachments(adminTid, progress);
|
||||
AdminWikiContent = GetWikiContent(adminTid);
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +344,7 @@ namespace AyaNova.PlugIn.V8
|
||||
adminCustomFields = CustomFieldData(admin, DateCustomFields);
|
||||
}
|
||||
|
||||
//check if we need to do anything with the manager account
|
||||
//check if we need to do anything with the manager account itself
|
||||
if (hasWiki || adminCustomFields != null)
|
||||
{
|
||||
//yes, so fetch it and modify it and put it back again
|
||||
@@ -352,6 +354,8 @@ namespace AyaNova.PlugIn.V8
|
||||
d.customFields = CustomFieldData(admin, DateCustomFields);
|
||||
await util.PutAsync("User/1", d.ToString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion admin export
|
||||
@@ -369,6 +373,8 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
User c = User.GetItem(i.ID);
|
||||
|
||||
var UserTID=new TypeAndID(RootObjectTypes.User, c.ID);
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = c.FirstName + " " + c.LastName;
|
||||
progress.Op("User " + d.name);
|
||||
@@ -414,8 +420,8 @@ namespace AyaNova.PlugIn.V8
|
||||
var hasWiki = WikiPage.HasWiki(c.ID);
|
||||
if (hasWiki)
|
||||
{
|
||||
await ExportAttachments(new TypeAndID(RootObjectTypes.User, c.ID), progress);
|
||||
d.wiki = GetWikiContent(new TypeAndID(RootObjectTypes.User, c.ID));
|
||||
await ExportAttachments(UserTID, progress);
|
||||
d.wiki = GetWikiContent(UserTID);
|
||||
}
|
||||
|
||||
//Custom fields?
|
||||
@@ -439,7 +445,10 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
|
||||
//Attachments / FILES
|
||||
await ExportAttachments(new TypeAndID(RootObjectTypes.User, c.ID), progress);
|
||||
await ExportAttachments(UserTID, progress);
|
||||
|
||||
//docs
|
||||
await ExportDocs(UserTID, c.Docs, progress);
|
||||
|
||||
}
|
||||
|
||||
@@ -844,8 +853,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
//--------------------------------------------
|
||||
#endregion object export
|
||||
|
||||
|
||||
|
||||
#region Custom fields exporter
|
||||
|
||||
|
||||
@@ -1025,22 +1033,36 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
}
|
||||
#endregion attachments
|
||||
|
||||
|
||||
|
||||
#region Assigned docs exporter
|
||||
private async System.Threading.Tasks.Task ExportAttachments(TypeAndID tid, AssignedDocs docs, ProgressForm progress)
|
||||
private async System.Threading.Tasks.Task<List<string>> ExportDocs(TypeAndID tid, AssignedDocs docs, ProgressForm progress)
|
||||
{
|
||||
if (!ExportAssignedDocs) return;
|
||||
List<string> NonFileUrls = new List<string>();
|
||||
|
||||
if (docs.Count == 0) return;
|
||||
if (!ExportAssignedDocs) return NonFileUrls;
|
||||
|
||||
if (docs.Count == 0) return NonFileUrls;
|
||||
|
||||
|
||||
//iterate the files
|
||||
foreach (AssignedDoc doc in docs)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
|
||||
if (af == null) continue;
|
||||
if (!progress.KeepGoing) return NonFileUrls;
|
||||
|
||||
//is it a local file?
|
||||
if (!new Uri(doc.URL).IsFile)
|
||||
{
|
||||
NonFileUrls.Add(doc.Description + "("+ImportTag+ ")\n" + doc.URL+"\n");
|
||||
continue;
|
||||
}
|
||||
//can we see it?
|
||||
if (!File.Exists(doc.URL))
|
||||
{
|
||||
NonFileUrls.Add(ImportTag + " - Assigned doc. file not found:\n" + doc.Description + "\n" + doc.URL + "\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
progress.SubOp("Wikifile: \"" + af.Name + "\" " + AyaBizUtils.FileSizeDisplay((decimal)af.FileSize));
|
||||
|
||||
@@ -1085,10 +1107,12 @@ namespace AyaNova.PlugIn.V8
|
||||
//Map it for later processing of wiki
|
||||
var ravenId = a.ObjectResponse["data"][0]["id"].Value<long>();
|
||||
Map.Add(af.ID, ravenId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
progress.SubOp("");
|
||||
|
||||
return NonFileUrls;
|
||||
}
|
||||
#endregion assigned docs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user