diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 5f798c1..f44396c 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -1136 \ No newline at end of file +1149 \ No newline at end of file diff --git a/Common/Common.csproj b/Common/Common.csproj index f7812db..27e1cb8 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -100,6 +100,7 @@ + diff --git a/Common/dataobjects/Account.cs b/Common/dataobjects/Account.cs index 31162e9..cbf92c5 100644 --- a/Common/dataobjects/Account.cs +++ b/Common/dataobjects/Account.cs @@ -184,11 +184,13 @@ namespace FLocal.Common.dataobjects { new Dictionary { { User.TableSpec.FIELD_AVATARID, new ScalarFieldValue(null) }, { User.TableSpec.FIELD_BIOGRAPHY, new ScalarFieldValue("") }, + { User.TableSpec.FIELD_BIOGRAPHYUBB, new ScalarFieldValue("") }, { User.TableSpec.FIELD_LOCATION, new ScalarFieldValue("") }, { User.TableSpec.FIELD_NAME, new ScalarFieldValue(name) }, { User.TableSpec.FIELD_REGDATE, new ScalarFieldValue(DateTime.Now.ToUTCString()) }, { User.TableSpec.FIELD_SHOWPOSTSTOUSERS, new ScalarFieldValue(User.ENUM_SHOWPOSTSTOUSERS_ALL) }, { User.TableSpec.FIELD_SIGNATURE, new ScalarFieldValue("") }, + { User.TableSpec.FIELD_SIGNATUREUBB, new ScalarFieldValue("") }, { User.TableSpec.FIELD_TITLE, new ScalarFieldValue("novice") }, { User.TableSpec.FIELD_TOTALPOSTS, new ScalarFieldValue("0") }, { User.TableSpec.FIELD_USERGROUPID, new ScalarFieldValue("1") }, diff --git a/Common/dataobjects/User.cs b/Common/dataobjects/User.cs index 28eb356..12c741b 100644 --- a/Common/dataobjects/User.cs +++ b/Common/dataobjects/User.cs @@ -6,6 +6,7 @@ using System.Xml.Linq; using FLocal.Core; using FLocal.Core.DB; using FLocal.Core.DB.conditions; +using FLocal.Common.actions; namespace FLocal.Common.dataobjects { public class User : SqlObject { @@ -15,18 +16,27 @@ namespace FLocal.Common.dataobjects { public const string ENUM_SHOWPOSTSTOUSERS_PRIVELEGED = "Priveleged"; public const string ENUM_SHOWPOSTSTOUSERS_NONE = "None"; + public struct UserData { + public string title; + public string location; + public string signatureUbb; + public string biographyUbb; + } + public class TableSpec : ISqlObjectTableSpec { public const string TABLE = "Users"; public const string FIELD_ID = "Id"; public const string FIELD_REGDATE = "RegDate"; public const string FIELD_TOTALPOSTS = "TotalPosts"; public const string FIELD_SIGNATURE = "Signature"; + public const string FIELD_SIGNATUREUBB = "SignatureUbb"; public const string FIELD_TITLE = "Title"; public const string FIELD_LOCATION = "Location"; public const string FIELD_NAME = "Name"; public const string FIELD_USERGROUPID = "UserGroupId"; public const string FIELD_SHOWPOSTSTOUSERS = "ShowPostsToUsers"; public const string FIELD_BIOGRAPHY = "Biography"; + public const string FIELD_BIOGRAPHYUBB = "BiographyUbb"; public const string FIELD_AVATARID = "AvatarId"; public static readonly TableSpec instance = new TableSpec(); public string name { get { return TABLE; } } @@ -60,6 +70,14 @@ namespace FLocal.Common.dataobjects { } } + private string _signatureUbb; + public string signatureUbb { + get { + this.LoadIfNotLoaded(); + return this._signatureUbb; + } + } + private string _title; public string title { get { @@ -113,6 +131,14 @@ namespace FLocal.Common.dataobjects { } } + private string _biographyUbb; + public string biographyUbb { + get { + this.LoadIfNotLoaded(); + return this._biographyUbb; + } + } + private int? _avatarId; public int? avatarId { get { @@ -147,12 +173,14 @@ namespace FLocal.Common.dataobjects { this._regDate = new DateTime(long.Parse(data[TableSpec.FIELD_REGDATE])); this._totalPosts = int.Parse(data[TableSpec.FIELD_TOTALPOSTS]); this._signature = data[TableSpec.FIELD_SIGNATURE]; + this._signatureUbb = data[TableSpec.FIELD_SIGNATUREUBB]; this._title = data[TableSpec.FIELD_TITLE]; this._location = data[TableSpec.FIELD_LOCATION]; this._name = data[TableSpec.FIELD_NAME]; this._userGroupId = int.Parse(data[TableSpec.FIELD_USERGROUPID]); this._showPostsToUsers = data[TableSpec.FIELD_SHOWPOSTSTOUSERS]; this._biography = data[TableSpec.FIELD_BIOGRAPHY]; + this._biographyUbb = data[TableSpec.FIELD_BIOGRAPHYUBB]; this._avatarId = Util.ParseInt(data[TableSpec.FIELD_AVATARID]); } @@ -161,7 +189,10 @@ namespace FLocal.Common.dataobjects { new XElement("id", this.id), new XElement("regDate", this.regDate.ToXml()), new XElement("totalPosts", this.totalPosts), - new XElement("signature", this.signature), + new XElement("signature", context.outputParams.preprocessBodyIntermediate(this.signature)), + new XElement("signatureUbb", this.signatureUbb), + new XElement("biography", context.outputParams.preprocessBodyIntermediate(this.biography)), + new XElement("biographyUbb", this.biographyUbb), new XElement("title", this.title), new XElement("location", this.location), new XElement("name", this.name), @@ -276,5 +307,22 @@ namespace FLocal.Common.dataobjects { ); } + public void UpdateData(UserData newData) { + ChangeSetUtil.ApplyChanges( + new UpdateChange( + TableSpec.instance, + new Dictionary { + { TableSpec.FIELD_LOCATION, new ScalarFieldValue(newData.location) }, + { TableSpec.FIELD_TITLE, new ScalarFieldValue(newData.title) }, + { TableSpec.FIELD_BIOGRAPHYUBB, new ScalarFieldValue(newData.biographyUbb) }, + { TableSpec.FIELD_BIOGRAPHY, new ScalarFieldValue(UBBParser.UBBToIntermediate(newData.biographyUbb)) }, + { TableSpec.FIELD_SIGNATUREUBB, new ScalarFieldValue(newData.signatureUbb) }, + { TableSpec.FIELD_SIGNATURE, new ScalarFieldValue(UBBParser.UBBToIntermediate(newData.signatureUbb)) }, + }, + this.id + ) + ); + } + } } diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index cdee7ac..f2fc524 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -100,6 +100,8 @@ namespace FLocal.IISHandler { } case "settings": return new handlers.response.SettingsHandler(); + case "userdata": + return new handlers.response.UserDataHandler(); case "conversations": if(context.requestParts.Length == 2) { return new handlers.response.ConversationsHandler(); @@ -224,6 +226,8 @@ namespace FLocal.IISHandler { return new handlers.request.CreateThreadHandler(); case "settings": return new handlers.request.SettingsHandler(); + case "userdata": + return new handlers.request.UserDataHandler(); case "sendpm": return new handlers.request.SendPMHandler(); case "markthreadasread": diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj index 41a908a..bed0671 100644 --- a/IISMainHandler/IISMainHandler.csproj +++ b/IISMainHandler/IISMainHandler.csproj @@ -144,6 +144,8 @@ + + diff --git a/IISMainHandler/handlers/request/UserDataHandler.cs b/IISMainHandler/handlers/request/UserDataHandler.cs new file mode 100644 index 0000000..6e51d5a --- /dev/null +++ b/IISMainHandler/handlers/request/UserDataHandler.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using FLocal.Core; +using FLocal.Common.dataobjects; + +namespace FLocal.IISHandler.handlers.request { + class UserDataHandler : AbstractPostHandler { + + protected override string templateName { + get { + return "result/SettingsSaved.xslt"; + } + } + + protected override XElement[] Do(WebContext context) { + + User.UserData newData = new User.UserData { + location = context.httprequest.Form["location"], + title = context.httprequest.Form["title"], + signatureUbb = context.httprequest.Form["signature"], + biographyUbb = context.httprequest.Form["biography"], + }; + + context.account.user.UpdateData(newData); + + return new XElement[0]; + } + + } +} diff --git a/IISMainHandler/handlers/response/UserDataHandler.cs b/IISMainHandler/handlers/response/UserDataHandler.cs new file mode 100644 index 0000000..09e9ce9 --- /dev/null +++ b/IISMainHandler/handlers/response/UserDataHandler.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; +using System.Xml.Linq; +using FLocal.Core; +using FLocal.Common; +using FLocal.Common.dataobjects; + +namespace FLocal.IISHandler.handlers.response { + + class UserDataHandler : AbstractGetHandler { + + override protected string templateName { + get { + return "UserData.xslt"; + } + } + + override protected IEnumerable getSpecificData(WebContext context) { + return new XElement[] { + context.account.user.exportToXmlForViewing(context), + }; + } + } + +} \ No newline at end of file diff --git a/templates/Full/UserData.xslt b/templates/Full/UserData.xslt new file mode 100644 index 0000000..e43b7c7 --- /dev/null +++ b/templates/Full/UserData.xslt @@ -0,0 +1,75 @@ + + + + Ëè÷íûå äàííûå + + + + + +
+ + + + + + + + + + +
+ Èçìåíåíèå ëè÷íûõ äàííûõ +
+ ??? +
+
+

+ Òèòóë +
+ + + +

+

+ Èç: +
+ + + +

+

+ Áèîãðàôèÿ: +
+ +

+

+ Ïîäïèñü: +
+ +

+ +
+
+
+
+ +
\ No newline at end of file diff --git a/templates/Full/UserInfo.xslt b/templates/Full/UserInfo.xslt index 5a3311e..bd6d5c4 100644 --- a/templates/Full/UserInfo.xslt +++ b/templates/Full/UserInfo.xslt @@ -112,7 +112,7 @@ Áèîãðàôèÿ - + @@ -152,7 +152,7 @@ Ïîäïèñü - + diff --git a/templates/Full/elems/MyHeader.xslt b/templates/Full/elems/MyHeader.xslt index 9a6bb75..80ca133 100644 --- a/templates/Full/elems/MyHeader.xslt +++ b/templates/Full/elems/MyHeader.xslt @@ -45,6 +45,14 @@ | + + /My/UserData/ + Ëè÷íûå äàííûå + + true + + + | /do/Logout/?sessionKey= diff --git a/templates/Full/elems/PostInfo.xslt b/templates/Full/elems/PostInfo.xslt index 96217fa..43cc9e1 100644 --- a/templates/Full/elems/PostInfo.xslt +++ b/templates/Full/elems/PostInfo.xslt @@ -138,7 +138,7 @@
-
+
diff --git a/templates/Lite/UserInfo.xslt b/templates/Lite/UserInfo.xslt index 5a3311e..bd6d5c4 100644 --- a/templates/Lite/UserInfo.xslt +++ b/templates/Lite/UserInfo.xslt @@ -112,7 +112,7 @@ Áèîãðàôèÿ - + @@ -152,7 +152,7 @@ Ïîäïèñü - +