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\Machichara.cs" />
<Compile Include="dataobjects\Moderator.cs" />
<Compile Include="dataobjects\ModernSkin.cs" />
<Compile Include="dataobjects\PMConversation.cs" />
<Compile Include="dataobjects\PMMessage.cs" />
<Compile Include="dataobjects\Poll.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_MODERNSKINID = "ModernSkinId";
public const string FIELD_MACHICHARAID = "MachicharaId";
public static readonly TableSpec instance = new TableSpec();
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;
public int machicharaId {
get {
@ -118,6 +132,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._modernSkinId = int.Parse(data[TableSpec.FIELD_MODERNSKINID]);
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> {
{ 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_MODERNSKINID, new ScalarFieldValue(modernSkin.id.ToString()) },
{ TableSpec.FIELD_MACHICHARAID, new ScalarFieldValue(machichara.id.ToString()) },
};
Dictionary<string, AbstractFieldValue> dataToInsert = new Dictionary<string,AbstractFieldValue>(dataToUpdate) {

@ -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._modernSkinId = 1;
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;
public Machichara machichara {
get {

@ -27,6 +27,10 @@ namespace FLocal.Common.dataobjects {
get;
}
ModernSkin modernSkin {
get;
}
Machichara machichara {
get;
}
@ -44,6 +48,7 @@ namespace FLocal.Common.dataobjects {
new XElement("usersPerPage", settings.usersPerPage),
new XElement("uploadsPerPage", settings.uploadsPerPage),
new XElement("skinId", settings.skin.id),
new XElement("modernSkinId", settings.modernSkin.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()),
context.exportSession(),
context.userSettings.skin.exportToXml(),
context.userSettings.modernSkin.exportToXml(),
context.userSettings.machichara.exportToXml(),
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.modernSkin.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"]));
ModernSkin modernSkin = ModernSkin.LoadById(int.Parse(context.httprequest.Form["modernSkinId"]));
Machichara machichara = Machichara.LoadById(int.Parse(context.httprequest.Form["machicharaId"]));
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.");
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 != "") {
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("modernSkins", from modernSkin in ModernSkin.allSkins select modernSkin.exportToXml()),
new XElement("machicharas", from machichara in Machichara.allMachicharas select machichara.exportToXml())
};
}

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

@ -15,7 +15,7 @@ PRE{background-color:#303030;font-size:0.9em;BORDER:#999999 1px solid;PADDING: 0
.confluent{COLOR:black;}
.postcontainer, .pmcontainer {
.postcontainer, .pmcontainer, .uploadcontainer {
border-color:#808080;
}
.pmcontainer.unread {
@ -50,20 +50,6 @@ blockquote {
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 {
color:#BFBFBF;
}

@ -89,6 +89,15 @@ function changeMachichara(newMachichara) {
<xsl:attribute name="value"><xsl:value-of select="settings/uploadsPerPage"/></xsl:attribute>
</input>
</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>
<xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text>
<br/>
@ -134,6 +143,17 @@ function changeMachichara(newMachichara) {
</option>
</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:param name="currentMachichara"/>
<option>

@ -14,7 +14,7 @@ function changeSkin(newSkin) {
newLink.setAttribute("skin", "skin");
newLink.setAttribute("rel", "stylesheet");
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);
}
}
@ -92,8 +92,17 @@ function changeMachichara(newMachichara) {
<p>
<xsl:text>Öâåòîâàÿ ñõåìà:</xsl:text>
<br/>
<select name="skinId">
<select name="modernSkinId">
<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:with-param name="currentSkin"><xsl:value-of select="settings/skinId"/></xsl:with-param>
</xsl:apply-templates>
@ -134,6 +143,17 @@ function changeMachichara(newMachichara) {
</option>
</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:param name="currentMachichara"/>
<option>

@ -7,18 +7,18 @@
<html>
<head>
<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[
<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>
<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 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/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/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">
<xsl:attribute name="src">
<xsl:text>/static/js/machichara/</xsl:text>

Loading…
Cancel
Save