Machichara configuration implemented

main
Inga 🏳‍🌈 14 years ago
parent 8c73972527
commit 198675202b
  1. 2
      Builder/IISMainHandler/build.txt
  2. 1
      Common/Common.csproj
  3. 1
      Common/TableManager.cs
  4. 18
      Common/dataobjects/AccountSettings.cs
  5. 8
      Common/dataobjects/AnonymousUserSettings.cs
  6. 7
      Common/dataobjects/IUserSettings.cs
  7. 70
      Common/dataobjects/Machichara.cs
  8. 1
      IISMainHandler/handlers/AbstractGetHandler.cs
  9. 1
      IISMainHandler/handlers/request/AbstractPostHandler.cs
  10. 3
      IISMainHandler/handlers/request/SettingsHandler.cs
  11. 1
      IISMainHandler/handlers/response/SettingsHandler.cs
  12. 0
      static/images/machichara/hexsex-preview.gif
  13. 0
      static/js/machichara/complex.js
  14. 4
      static/js/machichara/hexsex-specific.js
  15. 29
      templates/Full/Settings.xslt
  16. 11
      templates/Full/elems/Main.xslt

@ -97,6 +97,7 @@
<Compile Include="dataobjects\IUserSettings.cs" />
<Compile Include="dataobjects\AnonymousUserSettings.cs" />
<Compile Include="dataobjects\LocalNetwork.cs" />
<Compile Include="dataobjects\Machichara.cs" />
<Compile Include="dataobjects\Moderator.cs" />
<Compile Include="dataobjects\PMConversation.cs" />
<Compile Include="dataobjects\PMMessage.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,

@ -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<int, int?> accountid2id = new Dictionary<int, int?>();
@ -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<string, AbstractFieldValue> dataToUpdate = new Dictionary<string,AbstractFieldValue> {
{ 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<string, AbstractFieldValue> dataToInsert = new Dictionary<string,AbstractFieldValue>(dataToUpdate) {
{ TableSpec.FIELD_ACCOUNTID, new ScalarFieldValue(account.id.ToString()) },

@ -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;

@ -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)
);
}

@ -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<Machichara> {
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<string, string> data) {
this._name = data[TableSpec.FIELD_NAME];
}
private static readonly object allMachicharas_Locker = new object();
public static IEnumerable<Machichara> allMachicharas {
get {
return
from id in Cache<List<int>>.instance.get(
allMachicharas_Locker,
() => {
List<int> 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<IEnumerable<int>>.instance.delete(allMachicharas_Locker);
}
public XElement exportToXml() {
return new XElement("machichara",
new XElement("id", this.id),
new XElement("name", this.name)
);
}
}
}

@ -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(),
};

@ -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(),
};

@ -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);

@ -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())
};
}
}

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

@ -0,0 +1,4 @@
function machicharaInit() {
simpleMachichara("/static/images/machichara/hexsex-preview.gif");
}

@ -19,6 +19,10 @@ function changeSkin(newSkin) {
}
}
}
function changeMachichara(newMachichara) {
document.getElementById("machicharaPreview").src = "/static/images/machichara/" + newMachichara + "-preview.gif";
}
]]></xsl:text>
</script>
<table width="95%" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
@ -95,6 +99,20 @@ function changeSkin(newSkin) {
</xsl:apply-templates>
</select>
</p>
<p>
<xsl:text>Machi-chara:</xsl:text>
<br/>
<select name="machicharaId">
<xsl:attribute name="onChange">changeMachichara(this.options[this.selectedIndex].innerText);</xsl:attribute>
<xsl:apply-templates select="machicharas/machichara" mode="machicharaOption">
<xsl:with-param name="currentMachichara"><xsl:value-of select="settings/machicharaId"/></xsl:with-param>
</xsl:apply-templates>
</select>
<br/>
<img id="machicharaPreview" border="0">
<xsl:attribute name="src">/static/images/machichara/<xsl:value-of select="machichara/name"/>-preview.gif</xsl:attribute>
</img>
</p>
<input type="submit" name="buttlogin" value="Îòïðàâèòü!" class="buttons" />
</form>
</td>
@ -116,4 +134,15 @@ function changeSkin(newSkin) {
</option>
</xsl:template>
<xsl:template match="machichara" mode="machicharaOption">
<xsl:param name="currentMachichara"/>
<option>
<xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if test="id=$currentMachichara">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="name"/>
</option>
</xsl:template>
</xsl:stylesheet>

@ -11,7 +11,16 @@
</link>
<link rel="shortcut icon" href="/static/favicons/smirk.ico" type="image/x-icon" />
<script language="Javascript" type="text/javascript" src="/static/js/common.js"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript" src="/static/js/machichara/complex.js?v1"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript" src="/static/js/machichara/simple.js?v1"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript" src="/static/js/machichara/simple.js?v1">
<xsl:attribute name="src">
<xsl:text>/static/js/machichara/</xsl:text>
<xsl:value-of select="machichara/name"/>
<xsl:text>-specific.js</xsl:text>
</xsl:attribute>
<xsl:text> </xsl:text>
</script>
<title>
<xsl:call-template name="specificTitle"/>
<xsl:text> - </xsl:text>
@ -19,7 +28,7 @@
</title>
</head>
<body>
<xsl:attribute name="onLoad">simpleMachichara("/static/images/machichara/simple/hexsex.gif");</xsl:attribute>
<xsl:attribute name="onLoad">machicharaInit();</xsl:attribute>
<xsl:if test="not(get/param[@name='headers'] = 'false')">
<xsl:call-template name="header"/>
</xsl:if>

Loading…
Cancel
Save