|
|
@ -221,7 +221,7 @@ namespace FLocal.Common.dataobjects { |
|
|
|
return new XElement("post", |
|
|
|
return new XElement("post", |
|
|
|
new XElement("id", this.id), |
|
|
|
new XElement("id", this.id), |
|
|
|
new XElement("poster", this.poster.exportToXmlForViewing(context)), |
|
|
|
new XElement("poster", this.poster.exportToXmlForViewing(context)), |
|
|
|
new XElement("bodyShort", context.isPostVisible(this) ? this.bodyShort : ""), |
|
|
|
new XElement("bodyShort", context.isPostVisible(this) == PostVisibilityEnum.VISIBLE ? this.bodyShort : ""), |
|
|
|
new XElement("title", this.title) |
|
|
|
new XElement("title", this.title) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -232,41 +232,53 @@ namespace FLocal.Common.dataobjects { |
|
|
|
|
|
|
|
|
|
|
|
public XElement exportToXml(UserContext context, params XElement[] additional) { |
|
|
|
public XElement exportToXml(UserContext context, params XElement[] additional) { |
|
|
|
|
|
|
|
|
|
|
|
if(!context.isPostVisible(this)) return null; |
|
|
|
XElement result = null; |
|
|
|
|
|
|
|
|
|
|
|
XElement result = new XElement("post", |
|
|
|
switch(context.isPostVisible(this)) { |
|
|
|
new XElement("id", this.id), |
|
|
|
case PostVisibilityEnum.UNVISIBLE: |
|
|
|
new XElement("poster", |
|
|
|
return null; |
|
|
|
this.poster.exportToXmlForViewing( |
|
|
|
case PostVisibilityEnum.HIDDEN: |
|
|
|
context, |
|
|
|
result = new XElement("post", |
|
|
|
new XElement("isModerator", Moderator.isModerator(this.poster, this.thread).ToPlainString()), |
|
|
|
new XElement("hidden"), |
|
|
|
new XElement("isAdministrator", (this.thread.board.administrator.userId == this.poster.id).ToPlainString()) |
|
|
|
new XElement("id", this.id) |
|
|
|
) |
|
|
|
); |
|
|
|
), |
|
|
|
break; |
|
|
|
new XElement("postDate", this.postDate.ToXml()), |
|
|
|
case PostVisibilityEnum.VISIBLE: |
|
|
|
new XElement("layerId", this.layerId), |
|
|
|
result = new XElement("post", |
|
|
|
new XElement("layerName", this.layer.name), |
|
|
|
new XElement("id", this.id), |
|
|
|
new XElement("title", this.title), |
|
|
|
new XElement("poster", |
|
|
|
new XElement("body", context.outputParams.preprocessBodyIntermediate(this.body)), |
|
|
|
this.poster.exportToXmlForViewing( |
|
|
|
//this.XMLBody(context), |
|
|
|
context, |
|
|
|
new XElement("bodyShort", this.bodyShort), |
|
|
|
new XElement("isModerator", Moderator.isModerator(this.poster, this.thread).ToPlainString()), |
|
|
|
new XElement("threadId", this.threadId), |
|
|
|
new XElement("isAdministrator", (this.thread.board.administrator.userId == this.poster.id).ToPlainString()) |
|
|
|
new XElement("isPunishmentEnabled", ((context.account != null) && Moderator.isModerator(context.account, this.thread)).ToPlainString()), |
|
|
|
) |
|
|
|
new XElement("isOwner", ((context.account != null) && (this.poster.id == context.account.user.id)).ToPlainString()), |
|
|
|
), |
|
|
|
new XElement( |
|
|
|
new XElement("postDate", this.postDate.ToXml()), |
|
|
|
"specific", |
|
|
|
new XElement("layerId", this.layerId), |
|
|
|
new XElement( |
|
|
|
new XElement("layerName", this.layer.name), |
|
|
|
"changeInfo", |
|
|
|
new XElement("title", this.title), |
|
|
|
new XElement("lastChangeDate", this.lastChangeDate.ToXml()), |
|
|
|
new XElement("body", context.outputParams.preprocessBodyIntermediate(this.body)), |
|
|
|
new XElement("revision", this.revision.ToString()) |
|
|
|
//this.XMLBody(context), |
|
|
|
) |
|
|
|
new XElement("bodyShort", this.bodyShort), |
|
|
|
) |
|
|
|
new XElement("threadId", this.threadId), |
|
|
|
); |
|
|
|
new XElement("isPunishmentEnabled", ((context.account != null) && Moderator.isModerator(context.account, this.thread)).ToPlainString()), |
|
|
|
if(this.totalPunishments > 0) { |
|
|
|
new XElement("isOwner", ((context.account != null) && (this.poster.id == context.account.user.id)).ToPlainString()), |
|
|
|
result.Add(from punishment in punishments select new XElement("specific", punishment.exportToXml(context))); |
|
|
|
new XElement( |
|
|
|
} |
|
|
|
"specific", |
|
|
|
if(this.parentPostId.HasValue) { |
|
|
|
new XElement( |
|
|
|
result.Add(new XElement("parentPost", this.parentPost.exportToXmlBase(context))); |
|
|
|
"changeInfo", |
|
|
|
|
|
|
|
new XElement("lastChangeDate", this.lastChangeDate.ToXml()), |
|
|
|
|
|
|
|
new XElement("revision", this.revision.ToString()) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if(this.totalPunishments > 0) { |
|
|
|
|
|
|
|
result.Add(from punishment in punishments select new XElement("specific", punishment.exportToXml(context))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(this.parentPostId.HasValue) { |
|
|
|
|
|
|
|
result.Add(new XElement("parentPost", this.parentPost.exportToXmlBase(context))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if(additional.Length > 0) { |
|
|
|
if(additional.Length > 0) { |
|
|
|
result.Add(additional); |
|
|
|
result.Add(additional); |
|
|
|