diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index a41bc3f..28a0b01 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -1350 \ No newline at end of file +1356 \ No newline at end of file diff --git a/Common/Common.csproj b/Common/Common.csproj index cb37d15..de2a991 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -97,6 +97,7 @@ + diff --git a/Common/TableManager.cs b/Common/TableManager.cs index 3979455..4a46834 100644 --- a/Common/TableManager.cs +++ b/Common/TableManager.cs @@ -16,6 +16,7 @@ namespace FLocal.Common { dataobjects.Category.TableSpec.instance, dataobjects.Invite.TableSpec.instance, dataobjects.LocalNetwork.TableSpec.instance, + dataobjects.Machichara.TableSpec.instance, dataobjects.Moderator.TableSpec.instance, dataobjects.PMConversation.TableSpec.instance, dataobjects.PMMessage.TableSpec.instance, diff --git a/Common/dataobjects/AccountSettings.cs b/Common/dataobjects/AccountSettings.cs index 1f2681f..48e5ede 100644 --- a/Common/dataobjects/AccountSettings.cs +++ b/Common/dataobjects/AccountSettings.cs @@ -21,6 +21,7 @@ namespace FLocal.Common.dataobjects { public const string FIELD_USERSPERPAGE = "UsersPerPage"; public const string FIELD_BOARDSVIEWSETTINGS = "BoardsViewSettings"; public const string FIELD_SKINID = "SkinId"; + public const string FIELD_MACHICHARAID = "MachicharaId"; public static readonly TableSpec instance = new TableSpec(); public string name { get { return TABLE; } } public string idName { get { return FIELD_ID; } } @@ -89,6 +90,19 @@ namespace FLocal.Common.dataobjects { } } + private int _machicharaId; + public int machicharaId { + get { + this.LoadIfNotLoaded(); + return this._machicharaId; + } + } + public Machichara machichara { + get { + return Machichara.LoadById(this.machicharaId); + } + } + public bool isPostVisible(Post post) { if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_NONE) return false; if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_PRIVELEGED) return false; @@ -104,6 +118,7 @@ namespace FLocal.Common.dataobjects { this._usersPerPage = int.Parse(data[TableSpec.FIELD_USERSPERPAGE]); this._boardsViewSettings = data[TableSpec.FIELD_BOARDSVIEWSETTINGS]; this._skinId = int.Parse(data[TableSpec.FIELD_SKINID]); + this._machicharaId = int.Parse(data[TableSpec.FIELD_MACHICHARAID]); } private static Dictionary accountid2id = new Dictionary(); @@ -143,13 +158,14 @@ namespace FLocal.Common.dataobjects { } } - public static void Save(Account account, int postsPerPage, int threadsPerPage, int usersPerPage, int uploadsPerPage, Skin skin) { + public static void Save(Account account, int postsPerPage, int threadsPerPage, int usersPerPage, int uploadsPerPage, Skin skin, Machichara machichara) { Dictionary dataToUpdate = new Dictionary { { TableSpec.FIELD_POSTSPERPAGE, new ScalarFieldValue(postsPerPage.ToString()) }, { TableSpec.FIELD_THREADSPERPAGE, new ScalarFieldValue(threadsPerPage.ToString()) }, { TableSpec.FIELD_USERSPERPAGE, new ScalarFieldValue(usersPerPage.ToString()) }, { TableSpec.FIELD_UPLOADSPERPAGE, new ScalarFieldValue(uploadsPerPage.ToString()) }, { TableSpec.FIELD_SKINID, new ScalarFieldValue(skin.id.ToString()) }, + { TableSpec.FIELD_MACHICHARAID, new ScalarFieldValue(machichara.id.ToString()) }, }; Dictionary dataToInsert = new Dictionary(dataToUpdate) { { TableSpec.FIELD_ACCOUNTID, new ScalarFieldValue(account.id.ToString()) }, diff --git a/Common/dataobjects/AnonymousUserSettings.cs b/Common/dataobjects/AnonymousUserSettings.cs index d983785..558b65a 100644 --- a/Common/dataobjects/AnonymousUserSettings.cs +++ b/Common/dataobjects/AnonymousUserSettings.cs @@ -11,6 +11,7 @@ namespace FLocal.Common.dataobjects { var allSkins = Skin.allSkins.ToArray(); //this._skinId = allSkins[Util.RandomInt(0, allSkins.Length)].id; this._skinId = 28; + this._machicharaId = 2; } public int threadsPerPage { @@ -44,6 +45,13 @@ namespace FLocal.Common.dataobjects { } } + private int _machicharaId; + public Machichara machichara { + get { + return Machichara.LoadById(this._machicharaId); + } + } + public bool isPostVisible(Post post) { if(post.poster.showPostsToUsers != User.ENUM_SHOWPOSTSTOUSERS_ALL) return false; if(post.layer.name != PostLayer.NAME_NORMAL) return false; diff --git a/Common/dataobjects/IUserSettings.cs b/Common/dataobjects/IUserSettings.cs index fe83bed..f255d0c 100644 --- a/Common/dataobjects/IUserSettings.cs +++ b/Common/dataobjects/IUserSettings.cs @@ -27,6 +27,10 @@ namespace FLocal.Common.dataobjects { get; } + Machichara machichara { + get; + } + bool isPostVisible(Post post); } @@ -39,7 +43,8 @@ namespace FLocal.Common.dataobjects { new XElement("threadsPerPage", settings.threadsPerPage), new XElement("usersPerPage", settings.usersPerPage), new XElement("uploadsPerPage", settings.uploadsPerPage), - new XElement("skinId", settings.skin.id) + new XElement("skinId", settings.skin.id), + new XElement("machicharaId", settings.machichara.id) ); } diff --git a/Common/dataobjects/Machichara.cs b/Common/dataobjects/Machichara.cs new file mode 100644 index 0000000..7124a9d --- /dev/null +++ b/Common/dataobjects/Machichara.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using FLocal.Core; +using FLocal.Core.DB; +using FLocal.Core.DB.conditions; + +namespace FLocal.Common.dataobjects { + public class Machichara : SqlObject { + + public class TableSpec : ISqlObjectTableSpec { + public const string TABLE = "Machicharas"; + public const string FIELD_ID = "Id"; + public const string FIELD_NAME = "Name"; + public static readonly TableSpec instance = new TableSpec(); + public string name { get { return TABLE; } } + public string idName { get { return FIELD_ID; } } + public void refreshSqlObject(int id) { Refresh(id); } + } + + protected override ISqlObjectTableSpec table { get { return TableSpec.instance; } } + + private string _name; + public string name { + get { + this.LoadIfNotLoaded(); + return this._name; + } + } + + protected override void doFromHash(Dictionary data) { + this._name = data[TableSpec.FIELD_NAME]; + } + + private static readonly object allMachicharas_Locker = new object(); + public static IEnumerable allMachicharas { + get { + return + from id in Cache>.instance.get( + allMachicharas_Locker, + () => { + List ids = (from stringId in Config.instance.mainConnection.LoadIdsByConditions( + TableSpec.instance, + new FLocal.Core.DB.conditions.EmptyCondition(), + Diapasone.unlimited + ) select int.Parse(stringId)).ToList(); + Machichara.LoadByIds(ids); + return ids; + } + ) + let machichara = Machichara.LoadById(id) + orderby machichara.id + select machichara; + } + } + internal static void allMachicharas_Reset() { + Cache>.instance.delete(allMachicharas_Locker); + } + + public XElement exportToXml() { + return new XElement("machichara", + new XElement("id", this.id), + new XElement("name", this.name) + ); + } + + } +} diff --git a/IISMainHandler/handlers/AbstractGetHandler.cs b/IISMainHandler/handlers/AbstractGetHandler.cs index ccedb6b..0fa041e 100644 --- a/IISMainHandler/handlers/AbstractGetHandler.cs +++ b/IISMainHandler/handlers/AbstractGetHandler.cs @@ -26,6 +26,7 @@ namespace FLocal.IISHandler.handlers { new XElement("current", DateTime.Now.ToXml()), context.exportSession(), context.userSettings.skin.exportToXml(), + context.userSettings.machichara.exportToXml(), new XElement("currentUrl", "/" + String.Join("/", context.requestParts) + "/"), context.exportRequestParameters(), }; diff --git a/IISMainHandler/handlers/request/AbstractPostHandler.cs b/IISMainHandler/handlers/request/AbstractPostHandler.cs index 9f64d98..74cb38c 100644 --- a/IISMainHandler/handlers/request/AbstractPostHandler.cs +++ b/IISMainHandler/handlers/request/AbstractPostHandler.cs @@ -33,6 +33,7 @@ namespace FLocal.IISHandler.handlers.request { new XElement("title", Config.instance.AppInfo), new XElement("timestamp", DateTime.Now.Ticks.ToString()), context.userSettings.skin.exportToXml(), + context.userSettings.machichara.exportToXml(), context.exportSession(), context.exportRequestParameters(), }; diff --git a/IISMainHandler/handlers/request/SettingsHandler.cs b/IISMainHandler/handlers/request/SettingsHandler.cs index 0f0b618..78b06b6 100644 --- a/IISMainHandler/handlers/request/SettingsHandler.cs +++ b/IISMainHandler/handlers/request/SettingsHandler.cs @@ -25,6 +25,7 @@ namespace FLocal.IISHandler.handlers.request { int usersPerPage = int.Parse(context.httprequest.Form["usersPerPage"]); int uploadsPerPage = int.Parse(context.httprequest.Form["uploadsPerPage"]); Skin skin = Skin.LoadById(int.Parse(context.httprequest.Form["skinId"])); + Machichara machichara = Machichara.LoadById(int.Parse(context.httprequest.Form["machicharaId"])); if((postsPerPage < 1) || (postsPerPage > 200)) throw new FLocalException("wrong number for postsPerPage"); if((threadsPerPage < 1) || (threadsPerPage > 200)) throw new FLocalException("wrong number for threadsPerPage"); @@ -33,7 +34,7 @@ namespace FLocal.IISHandler.handlers.request { if(!context.account.checkPassword(currentPassword)) throw new FLocalException("Wrong password. You should enter your current password in order to change settings."); - AccountSettings.Save(context.session.account, postsPerPage, threadsPerPage, usersPerPage, uploadsPerPage, skin); + AccountSettings.Save(context.session.account, postsPerPage, threadsPerPage, usersPerPage, uploadsPerPage, skin, machichara); if(newPassword != null && newPassword != "") { context.account.updatePassword(newPassword); diff --git a/IISMainHandler/handlers/response/SettingsHandler.cs b/IISMainHandler/handlers/response/SettingsHandler.cs index 06981a6..f194833 100644 --- a/IISMainHandler/handlers/response/SettingsHandler.cs +++ b/IISMainHandler/handlers/response/SettingsHandler.cs @@ -24,6 +24,7 @@ namespace FLocal.IISHandler.handlers.response { return new XElement[] { settings.exportToXml(context), new XElement("skins", from skin in Skin.allSkins select skin.exportToXml()), + new XElement("machicharas", from machichara in Machichara.allMachicharas select machichara.exportToXml()) }; } } diff --git a/static/images/machichara/simple/hexsex.gif b/static/images/machichara/hexsex-preview.gif similarity index 100% rename from static/images/machichara/simple/hexsex.gif rename to static/images/machichara/hexsex-preview.gif diff --git a/static/js/machichara/complex.js b/static/js/machichara/complex.js new file mode 100644 index 0000000..e69de29 diff --git a/static/js/machichara/hexsex-specific.js b/static/js/machichara/hexsex-specific.js new file mode 100644 index 0000000..b1643e3 --- /dev/null +++ b/static/js/machichara/hexsex-specific.js @@ -0,0 +1,4 @@ + +function machicharaInit() { + simpleMachichara("/static/images/machichara/hexsex-preview.gif"); +} \ No newline at end of file diff --git a/templates/Full/Settings.xslt b/templates/Full/Settings.xslt index 9740ead..733c181 100644 --- a/templates/Full/Settings.xslt +++ b/templates/Full/Settings.xslt @@ -19,6 +19,10 @@ function changeSkin(newSkin) { } } } + +function changeMachichara(newMachichara) { + document.getElementById("machicharaPreview").src = "/static/images/machichara/" + newMachichara + "-preview.gif"; +} ]]> @@ -95,6 +99,20 @@ function changeSkin(newSkin) {

+

+ Machi-chara: +
+ +
+ + /static/images/machichara/-preview.gif + +

@@ -116,4 +134,15 @@ function changeSkin(newSkin) { + + + + + \ No newline at end of file diff --git a/templates/Full/elems/Main.xslt b/templates/Full/elems/Main.xslt index 485ddc7..287af67 100644 --- a/templates/Full/elems/Main.xslt +++ b/templates/Full/elems/Main.xslt @@ -11,7 +11,16 @@ + + <xsl:call-template name="specificTitle"/> <xsl:text> - </xsl:text> @@ -19,7 +28,7 @@ - simpleMachichara("/static/images/machichara/simple/hexsex.gif"); + machicharaInit();