Name-based designs switching implemented

main
Inga 🏳‍🌈 14 years ago
parent c88473d8c6
commit 50f386d5f5
  1. 2
      Builder/IISMainHandler/build.txt
  2. 39
      IISMainHandler/WebContext.cs
  3. 26
      templates/Modern/elems/Header.xslt

@ -96,28 +96,39 @@ namespace FLocal.IISHandler {
return this.userSettings.isPostVisible(post);
}
public WebContext(HttpContext httpcontext) {
this.httpcontext = httpcontext;
this.requestTime = DateTime.Now;
private designs.IDesign detectDesign() {
switch(this.httprequest.Url.Port % 1000) {
case 445:
this.design = new designs.Raw();
break;
return new designs.Raw();
case 447:
this.design = new designs.Lite();
break;
return new designs.Lite();
case 449:
this.design = new designs.Rss();
break;
return new designs.Rss();
case 451:
this.design = new designs.Classic();
break;
return new designs.Classic();
case 443:
default:
this.design = new designs.Modern();
break;
string[] parts = this.httprequest.Url.Host.Split('.');
switch(parts[0].ToLower()) {
case "raw":
return new designs.Raw();
case "lite":
return new designs.Lite();
case "rss":
return new designs.Rss();
case "classic":
return new designs.Classic();
case "modern":
default:
return new designs.Modern();
}
}
}
public WebContext(HttpContext httpcontext) {
this.httpcontext = httpcontext;
this.requestTime = DateTime.Now;
this.design = this.detectDesign();
HttpCookie sessionCookie = this.httprequest.Cookies["session"];
if(sessionCookie != null && sessionCookie.Value != null && sessionCookie.Value != "") {

@ -51,20 +51,16 @@
<xsl:variable name="rssRelativeLink">
<xsl:call-template name="rssRelativeLink"/>
</xsl:variable>
<xsl:variable name="prefix">
<xsl:text>https://</xsl:text>
<!--xsl:value-of select="url/host"/-->
<xsl:text>full.forum.hn</xsl:text>
<xsl:variable name="postfix">
<xsl:text>.forum.hn</xsl:text>
<xsl:text>:</xsl:text>
<xsl:if test="url/port &gt;= 1000">
<xsl:value-of select="floor(url/port div 1000)"/>
</xsl:if>
<xsl:value-of select="url/port"/>
</xsl:variable>
<a>
<xsl:if test="$isClassicEnabled='true'">
<xsl:attribute name="href">
<xsl:value-of select="$prefix"/>
<xsl:text>451</xsl:text>
<xsl:text>https://classic</xsl:text>
<xsl:value-of select="$postfix"/>
<xsl:value-of select="currentUrl"/>
</xsl:attribute>
</xsl:if>
@ -78,8 +74,8 @@
<a>
<xsl:if test="$isLiteEnabled='true'">
<xsl:attribute name="href">
<xsl:value-of select="$prefix"/>
<xsl:text>447</xsl:text>
<xsl:text>https://lite</xsl:text>
<xsl:value-of select="$postfix"/>
<xsl:value-of select="currentUrl"/>
</xsl:attribute>
</xsl:if>
@ -97,8 +93,8 @@
<a>
<xsl:if test="$isRssEnabled='true'">
<xsl:attribute name="href">
<xsl:value-of select="$prefix"/>
<xsl:text>449</xsl:text>
<xsl:text>https://rss</xsl:text>
<xsl:value-of select="$postfix"/>
<xsl:value-of select="$rssRelativeLink"/>
</xsl:attribute>
</xsl:if>
@ -115,8 +111,8 @@
<xsl:if test="$isRssEnabled='true'">
<link rel="alternate" type="application/rss+xml" title="RSS">
<xsl:attribute name="href">
<xsl:value-of select="$prefix"/>
<xsl:text>449</xsl:text>
<xsl:text>https://rss</xsl:text>
<xsl:value-of select="$postfix"/>
<xsl:value-of select="$rssRelativeLink"/>
</xsl:attribute>
</link>

Loading…
Cancel
Save