ModernSkin setting implemented

main
Inga 🏳‍🌈 14 years ago
parent b84035351b
commit b8b77c7f38
  1. 2
      Builder/IISMainHandler/build.txt
  2. 1
      Common/Common.csproj
  3. 18
      Common/dataobjects/AccountSettings.cs
  4. 8
      Common/dataobjects/AnonymousUserSettings.cs
  5. 5
      Common/dataobjects/IUserSettings.cs
  6. 70
      Common/dataobjects/ModernSkin.cs
  7. 1
      IISMainHandler/handlers/AbstractGetHandler.cs
  8. 1
      IISMainHandler/handlers/request/AbstractPostHandler.cs
  9. 3
      IISMainHandler/handlers/request/SettingsHandler.cs
  10. 1
      IISMainHandler/handlers/response/SettingsHandler.cs
  11. 2
      static/css/modern/global.css
  12. 16
      static/css/modern/high-contrast.css
  13. 20
      templates/Full/Settings.xslt
  14. 24
      templates/Modern/Settings.xslt
  15. 8
      templates/Modern/elems/Main.xslt

@ -101,6 +101,7 @@
<Compile Include="dataobjects\LocalNetwork.cs" /> <Compile Include="dataobjects\LocalNetwork.cs" />
<Compile Include="dataobjects\Machichara.cs" /> <Compile Include="dataobjects\Machichara.cs" />
<Compile Include="dataobjects\Moderator.cs" /> <Compile Include="dataobjects\Moderator.cs" />
<Compile Include="dataobjects\ModernSkin.cs" />
<Compile Include="dataobjects\PMConversation.cs" /> <Compile Include="dataobjects\PMConversation.cs" />
<Compile Include="dataobjects\PMMessage.cs" /> <Compile Include="dataobjects\PMMessage.cs" />
<Compile Include="dataobjects\Poll.cs" /> <Compile Include="dataobjects\Poll.cs" />

@ -21,6 +21,7 @@ namespace FLocal.Common.dataobjects {
public const string FIELD_USERSPERPAGE = "UsersPerPage"; public const string FIELD_USERSPERPAGE = "UsersPerPage";
public const string FIELD_BOARDSVIEWSETTINGS = "BoardsViewSettings"; public const string FIELD_BOARDSVIEWSETTINGS = "BoardsViewSettings";
public const string FIELD_SKINID = "SkinId"; public const string FIELD_SKINID = "SkinId";
public const string FIELD_MODERNSKINID = "ModernSkinId";
public const string FIELD_MACHICHARAID = "MachicharaId"; public const string FIELD_MACHICHARAID = "MachicharaId";
public static readonly TableSpec instance = new TableSpec(); public static readonly TableSpec instance = new TableSpec();
public string name { get { return TABLE; } } public string name { get { return TABLE; } }
@ -90,6 +91,19 @@ namespace FLocal.Common.dataobjects {
} }
} }
private int _modernSkinId;
public int modernSkinId {
get {
this.LoadIfNotLoaded();
return this._modernSkinId;
}
}
public ModernSkin modernSkin {
get {
return ModernSkin.LoadById(this.modernSkinId);
}
}
private int _machicharaId; private int _machicharaId;
public int machicharaId { public int machicharaId {
get { get {
@ -118,6 +132,7 @@ namespace FLocal.Common.dataobjects {
this._usersPerPage = int.Parse(data[TableSpec.FIELD_USERSPERPAGE]); this._usersPerPage = int.Parse(data[TableSpec.FIELD_USERSPERPAGE]);
this._boardsViewSettings = data[TableSpec.FIELD_BOARDSVIEWSETTINGS]; this._boardsViewSettings = data[TableSpec.FIELD_BOARDSVIEWSETTINGS];
this._skinId = int.Parse(data[TableSpec.FIELD_SKINID]); this._skinId = int.Parse(data[TableSpec.FIELD_SKINID]);
this._modernSkinId = int.Parse(data[TableSpec.FIELD_MODERNSKINID]);
this._machicharaId = int.Parse(data[TableSpec.FIELD_MACHICHARAID]); this._machicharaId = int.Parse(data[TableSpec.FIELD_MACHICHARAID]);
} }
@ -158,13 +173,14 @@ namespace FLocal.Common.dataobjects {
} }
} }
public static void Save(Account account, int postsPerPage, int threadsPerPage, int usersPerPage, int uploadsPerPage, Skin skin, Machichara machichara) { public static void Save(Account account, int postsPerPage, int threadsPerPage, int usersPerPage, int uploadsPerPage, Skin skin, ModernSkin modernSkin, Machichara machichara) {
Dictionary<string, AbstractFieldValue> dataToUpdate = new Dictionary<string,AbstractFieldValue> { Dictionary<string, AbstractFieldValue> dataToUpdate = new Dictionary<string,AbstractFieldValue> {
{ TableSpec.FIELD_POSTSPERPAGE, new ScalarFieldValue(postsPerPage.ToString()) }, { TableSpec.FIELD_POSTSPERPAGE, new ScalarFieldValue(postsPerPage.ToString()) },
{ TableSpec.FIELD_THREADSPERPAGE, new ScalarFieldValue(threadsPerPage.ToString()) }, { TableSpec.FIELD_THREADSPERPAGE, new ScalarFieldValue(threadsPerPage.ToString()) },
{ TableSpec.FIELD_USERSPERPAGE, new ScalarFieldValue(usersPerPage.ToString()) }, { TableSpec.FIELD_USERSPERPAGE, new ScalarFieldValue(usersPerPage.ToString()) },
{ TableSpec.FIELD_UPLOADSPERPAGE, new ScalarFieldValue(uploadsPerPage.ToString()) }, { TableSpec.FIELD_UPLOADSPERPAGE, new ScalarFieldValue(uploadsPerPage.ToString()) },
{ TableSpec.FIELD_SKINID, new ScalarFieldValue(skin.id.ToString()) }, { TableSpec.FIELD_SKINID, new ScalarFieldValue(skin.id.ToString()) },
{ TableSpec.FIELD_MODERNSKINID, new ScalarFieldValue(modernSkin.id.ToString()) },
{ TableSpec.FIELD_MACHICHARAID, new ScalarFieldValue(machichara.id.ToString()) }, { TableSpec.FIELD_MACHICHARAID, new ScalarFieldValue(machichara.id.ToString()) },
}; };
Dictionary<string, AbstractFieldValue> dataToInsert = new Dictionary<string,AbstractFieldValue>(dataToUpdate) { Dictionary<string, AbstractFieldValue> dataToInsert = new Dictionary<string,AbstractFieldValue>(dataToUpdate) {

@ -11,6 +11,7 @@ namespace FLocal.Common.dataobjects {
var allSkins = Skin.allSkins.ToArray(); var allSkins = Skin.allSkins.ToArray();
//this._skinId = allSkins[Util.RandomInt(0, allSkins.Length)].id; //this._skinId = allSkins[Util.RandomInt(0, allSkins.Length)].id;
this._skinId = 28; this._skinId = 28;
this._modernSkinId = 1;
this._machicharaId = 2; this._machicharaId = 2;
} }
@ -45,6 +46,13 @@ namespace FLocal.Common.dataobjects {
} }
} }
private int _modernSkinId;
public ModernSkin modernSkin {
get {
return ModernSkin.LoadById(this._modernSkinId);
}
}
private int _machicharaId; private int _machicharaId;
public Machichara machichara { public Machichara machichara {
get { get {

@ -27,6 +27,10 @@ namespace FLocal.Common.dataobjects {
get; get;
} }
ModernSkin modernSkin {
get;
}
Machichara machichara { Machichara machichara {
get; get;
} }
@ -44,6 +48,7 @@ namespace FLocal.Common.dataobjects {
new XElement("usersPerPage", settings.usersPerPage), new XElement("usersPerPage", settings.usersPerPage),
new XElement("uploadsPerPage", settings.uploadsPerPage), new XElement("uploadsPerPage", settings.uploadsPerPage),
new XElement("skinId", settings.skin.id), new XElement("skinId", settings.skin.id),
new XElement("modernSkinId", settings.modernSkin.id),
new XElement("machicharaId", settings.machichara.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 ModernSkin : SqlObject<ModernSkin> {
public class TableSpec : ISqlObjectTableSpec {
public const string TABLE = "ModernSkins";
public const string FIELD_ID = "Id";
public const string FIELD_NAME = "SkinName";
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 allSkins_Locker = new object();
public static IEnumerable<ModernSkin> allSkins {
get {
return
from id in Cache<List<int>>.instance.get(
allSkins_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();
ModernSkin.LoadByIds(ids);
return ids;
}
)
let skin = ModernSkin.LoadById(id)
orderby skin.id
select skin;
}
}
internal static void allSkins_Reset() {
Cache<IEnumerable<int>>.instance.delete(allSkins_Locker);
}
public XElement exportToXml() {
return new XElement("modernSkin",
new XElement("id", this.id),
new XElement("name", this.name)
);
}
}
}

@ -28,6 +28,7 @@ namespace FLocal.IISHandler.handlers {
new XElement("current", DateTime.Now.ToXml()), new XElement("current", DateTime.Now.ToXml()),
context.exportSession(), context.exportSession(),
context.userSettings.skin.exportToXml(), context.userSettings.skin.exportToXml(),
context.userSettings.modernSkin.exportToXml(),
context.userSettings.machichara.exportToXml(), context.userSettings.machichara.exportToXml(),
context.exportRequestParameters(), context.exportRequestParameters(),
}; };

@ -33,6 +33,7 @@ namespace FLocal.IISHandler.handlers.request {
new XElement("title", Config.instance.AppInfo), new XElement("title", Config.instance.AppInfo),
new XElement("timestamp", DateTime.Now.Ticks.ToString()), new XElement("timestamp", DateTime.Now.Ticks.ToString()),
context.userSettings.skin.exportToXml(), context.userSettings.skin.exportToXml(),
context.userSettings.modernSkin.exportToXml(),
context.userSettings.machichara.exportToXml(), context.userSettings.machichara.exportToXml(),
context.exportSession(), context.exportSession(),
context.exportRequestParameters(), context.exportRequestParameters(),

@ -25,6 +25,7 @@ namespace FLocal.IISHandler.handlers.request {
int usersPerPage = int.Parse(context.httprequest.Form["usersPerPage"]); int usersPerPage = int.Parse(context.httprequest.Form["usersPerPage"]);
int uploadsPerPage = int.Parse(context.httprequest.Form["uploadsPerPage"]); int uploadsPerPage = int.Parse(context.httprequest.Form["uploadsPerPage"]);
Skin skin = Skin.LoadById(int.Parse(context.httprequest.Form["skinId"])); Skin skin = Skin.LoadById(int.Parse(context.httprequest.Form["skinId"]));
ModernSkin modernSkin = ModernSkin.LoadById(int.Parse(context.httprequest.Form["modernSkinId"]));
Machichara machichara = Machichara.LoadById(int.Parse(context.httprequest.Form["machicharaId"])); Machichara machichara = Machichara.LoadById(int.Parse(context.httprequest.Form["machicharaId"]));
if((postsPerPage < 1) || (postsPerPage > 200)) throw new FLocalException("wrong number for postsPerPage"); if((postsPerPage < 1) || (postsPerPage > 200)) throw new FLocalException("wrong number for postsPerPage");
@ -34,7 +35,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."); 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, machichara); AccountSettings.Save(context.session.account, postsPerPage, threadsPerPage, usersPerPage, uploadsPerPage, skin, modernSkin, machichara);
if(newPassword != null && newPassword != "") { if(newPassword != null && newPassword != "") {
context.account.updatePassword(newPassword); context.account.updatePassword(newPassword);

@ -24,6 +24,7 @@ namespace FLocal.IISHandler.handlers.response {
return new XElement[] { return new XElement[] {
settings.exportToXml(context), settings.exportToXml(context),
new XElement("skins", from skin in Skin.allSkins select skin.exportToXml()), new XElement("skins", from skin in Skin.allSkins select skin.exportToXml()),
new XElement("modernSkins", from modernSkin in ModernSkin.allSkins select modernSkin.exportToXml()),
new XElement("machicharas", from machichara in Machichara.allMachicharas select machichara.exportToXml()) new XElement("machicharas", from machichara in Machichara.allMachicharas select machichara.exportToXml())
}; };
} }

@ -98,7 +98,7 @@ input {
[nobr] { [nobr] {
white-space: nowrap; white-space: nowrap;
} }
.postcontainer, .pmcontainer { .postcontainer, .pmcontainer, .uploadcontainer {
border-style:none none solid none; border-style:none none solid none;
border-width:0 0 1px 0; border-width:0 0 1px 0;
padding-bottom:5pt; padding-bottom:5pt;

@ -15,7 +15,7 @@ PRE{background-color:#303030;font-size:0.9em;BORDER:#999999 1px solid;PADDING: 0
.confluent{COLOR:black;} .confluent{COLOR:black;}
.postcontainer, .pmcontainer { .postcontainer, .pmcontainer, .uploadcontainer {
border-color:#808080; border-color:#808080;
} }
.pmcontainer.unread { .pmcontainer.unread {
@ -50,20 +50,6 @@ blockquote {
background-color:#1C281C; background-color:#1C281C;
} }
.tablesurround{BACKGROUND:#191919;margin-top:-0.1em;margin-bottom:-0.1em}
.tableborders{BACKGROUND:#191919}
.tdheader{FONT-WEIGHT:bold;font-size:1em;BACKGROUND:#333333;color:#ffffff}
.tdheader a{font-size:1em;color:#dddddd;text-decoration:underline}
.tdheader a:hover{color:#BBBBBB;text-decoration:none}
.tdheader a:visited{color:#999999;text-decoration:underline}
.tdheader a:active{color:#000000;text-decoration:underline}
.lighttable{BACKGROUND:#141414;color:#cccccc}
.darktable{BACKGROUND:black}
.cleartable{BACKGROUND:black}
.alternatetable{BACKGROUND:black}
.subjecttable{BACKGROUND:black}
.footertable{BACKGROUND:#666666}
.header, .header a { .header, .header a {
color:#BFBFBF; color:#BFBFBF;
} }

@ -89,6 +89,15 @@ function changeMachichara(newMachichara) {
<xsl:attribute name="value"><xsl:value-of select="settings/uploadsPerPage"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="settings/uploadsPerPage"/></xsl:attribute>
</input> </input>
</p> </p>
<p>
<xsl:text>Öâåòîâàÿ ñõåìà äèçàéíà Modern:</xsl:text>
<br/>
<select name="modernSkinId">
<xsl:apply-templates select="modernSkins/modernSkin" mode="skinOption">
<xsl:with-param name="currentSkin"><xsl:value-of select="settings/modernSkinId"/></xsl:with-param>
</xsl:apply-templates>
</select>
</p>
<p> <p>
<xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text> <xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text>
<br/> <br/>
@ -134,6 +143,17 @@ function changeMachichara(newMachichara) {
</option> </option>
</xsl:template> </xsl:template>
<xsl:template match="modernSkin" mode="skinOption">
<xsl:param name="currentSkin"/>
<option>
<xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if test="id=$currentSkin">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="name"/>
</option>
</xsl:template>
<xsl:template match="machichara" mode="machicharaOption"> <xsl:template match="machichara" mode="machicharaOption">
<xsl:param name="currentMachichara"/> <xsl:param name="currentMachichara"/>
<option> <option>

@ -14,7 +14,7 @@ function changeSkin(newSkin) {
newLink.setAttribute("skin", "skin"); newLink.setAttribute("skin", "skin");
newLink.setAttribute("rel", "stylesheet"); newLink.setAttribute("rel", "stylesheet");
newLink.setAttribute("type", "text/css"); newLink.setAttribute("type", "text/css");
newLink.setAttribute("href", "/static/css/" + newSkin + ".css"); newLink.setAttribute("href", "/static/css/modern/" + newSkin + ".css");
link.parentNode.replaceChild(newLink, link); link.parentNode.replaceChild(newLink, link);
} }
} }
@ -92,8 +92,17 @@ function changeMachichara(newMachichara) {
<p> <p>
<xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text> <xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text>
<br/> <br/>
<select name="skinId"> <select name="modernSkinId">
<xsl:attribute name="onChange">changeSkin(this.options[this.selectedIndex].innerText);</xsl:attribute> <xsl:attribute name="onChange">changeSkin(this.options[this.selectedIndex].innerText);</xsl:attribute>
<xsl:apply-templates select="modernSkins/modernSkin" mode="skinOption">
<xsl:with-param name="currentSkin"><xsl:value-of select="settings/modernSkinId"/></xsl:with-param>
</xsl:apply-templates>
</select>
</p>
<p>
<xsl:text>Öâĺňîâŕ˙ ńőĺěŕ äë˙ ęëŕńńč÷ĺńęîăî číňĺđôĺéńŕ č ëŕéňŕ:</xsl:text>
<br/>
<select name="skinId">
<xsl:apply-templates select="skins/skin" mode="skinOption"> <xsl:apply-templates select="skins/skin" mode="skinOption">
<xsl:with-param name="currentSkin"><xsl:value-of select="settings/skinId"/></xsl:with-param> <xsl:with-param name="currentSkin"><xsl:value-of select="settings/skinId"/></xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
@ -134,6 +143,17 @@ function changeMachichara(newMachichara) {
</option> </option>
</xsl:template> </xsl:template>
<xsl:template match="modernSkin" mode="skinOption">
<xsl:param name="currentSkin"/>
<option>
<xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if test="id=$currentSkin">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="name"/>
</option>
</xsl:template>
<xsl:template match="machichara" mode="machicharaOption"> <xsl:template match="machichara" mode="machicharaOption">
<xsl:param name="currentMachichara"/> <xsl:param name="currentMachichara"/>
<option> <option>

@ -7,18 +7,18 @@
<html> <html>
<head> <head>
<meta http-equiv="x-ua-compatible" content="IE=8"/> <meta http-equiv="x-ua-compatible" content="IE=8"/>
<link rel="stylesheet" href="/static/css/modern/global.css?v4.2" type="text/css" /> <link rel="stylesheet" href="/static/css/modern/global.css?v5" type="text/css" />
<xsl:comment>[if lte IE 7]&gt;<![CDATA[ <xsl:comment>[if lte IE 7]&gt;<![CDATA[
<link rel="stylesheet" href="/static/css/modern/iefixes.css?v4.2" type="text/css" /> <link rel="stylesheet" href="/static/css/modern/iefixes.css?v5" type="text/css" />
]]>&lt;![endif]</xsl:comment> ]]>&lt;![endif]</xsl:comment>
<link rel="stylesheet" type="text/css" skin="skin"> <link rel="stylesheet" type="text/css" skin="skin">
<xsl:attribute name="href">/static/css/modern/penartur.css?v4.2</xsl:attribute> <xsl:attribute name="href">/static/css/modern/<xsl:value-of select="modernSkin/name"/>.css?v5</xsl:attribute>
</link> </link>
<link rel="shortcut icon" href="/static/favicons/smirk.ico" type="image/x-icon" /> <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/common.js"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript" src="/static/js/modern.js"><xsl:text> </xsl:text></script> <script language="Javascript" type="text/javascript" src="/static/js/modern.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/complex.js?v1"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript" src="/static/js/machichara/simple.js?v4.2"><xsl:text> </xsl:text></script> <script language="Javascript" type="text/javascript" src="/static/js/machichara/simple.js?v5"><xsl:text> </xsl:text></script>
<script language="Javascript" type="text/javascript"> <script language="Javascript" type="text/javascript">
<xsl:attribute name="src"> <xsl:attribute name="src">
<xsl:text>/static/js/machichara/</xsl:text> <xsl:text>/static/js/machichara/</xsl:text>

Loading…
Cancel
Save