diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index fb9a769..96a2d52 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -1233 \ No newline at end of file +1237 \ No newline at end of file diff --git a/Common/dataobjects/Restriction.cs b/Common/dataobjects/Restriction.cs index b7bd023..1d2fcfc 100644 --- a/Common/dataobjects/Restriction.cs +++ b/Common/dataobjects/Restriction.cs @@ -81,6 +81,20 @@ namespace FLocal.Common.dataobjects { ).ToDictionary(); } + public XElement exportToXml(UserContext context) { + return new XElement("restriction", + this.user.exportToXmlForViewing(context), + this.board.exportToXmlSimple(context, Board.SubboardsOptions.None), + new XElement("layers", + from kvp in this.data + select PostLayer.LoadById(kvp.Key).exportToXml( + context, + new XElement("restrictionExpires", kvp.Value.ToXml()) + ) + ) + ); + } + private static readonly Dictionary> restrictionId_cache = new Dictionary>(); public static Restriction GetRestriction(User user, Board board) { @@ -171,11 +185,11 @@ namespace FLocal.Common.dataobjects { select Restriction.LoadById(int.Parse(stringId)).id; } } - public static IEnumerable GetRestrictions(User user) { + public static IEnumerable GetRestrictions(User user) { if(!byUser_cache.ContainsKey(user.id)) { byUser_Recalculate(user.id); } - return from id in byUser_cache[user.id] select Restriction.LoadById(id).board; + return from id in byUser_cache[user.id] select Restriction.LoadById(id); } public static void RecalculateRestrictions(Board board, User user) { diff --git a/IISMainHandler/handlers/response/UserInfoHandler.cs b/IISMainHandler/handlers/response/UserInfoHandler.cs index 51f8cda..222ac9d 100644 --- a/IISMainHandler/handlers/response/UserInfoHandler.cs +++ b/IISMainHandler/handlers/response/UserInfoHandler.cs @@ -23,6 +23,7 @@ namespace FLocal.IISHandler.handlers.response { override protected IEnumerable getUserSpecificData(WebContext context, User user) { return new XElement[] { new XElement("punishments", from punishment in user.getPunishments(Diapasone.unlimited) select punishment.exportToXml(context)), + new XElement("restrictions", from restriction in Restriction.GetRestrictions(user) select restriction.exportToXml(context)), }; } diff --git a/templates/Full/UserInfo.xslt b/templates/Full/UserInfo.xslt index 751a08f..d0c4e9f 100644 --- a/templates/Full/UserInfo.xslt +++ b/templates/Full/UserInfo.xslt @@ -132,6 +132,27 @@ + + + Restrictions + + + + + + + + + + +
РазделОграничение
+
+ + Нет + +
+ + Комментарий @@ -170,4 +191,26 @@ + + + + + /Board// + + + + + + + + + + +
+ Запрещено использование слоя + + до + +
+ \ No newline at end of file