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); return this.userSettings.isPostVisible(post);
} }
public WebContext(HttpContext httpcontext) { private designs.IDesign detectDesign() {
this.httpcontext = httpcontext;
this.requestTime = DateTime.Now;
switch(this.httprequest.Url.Port % 1000) { switch(this.httprequest.Url.Port % 1000) {
case 445: case 445:
this.design = new designs.Raw(); return new designs.Raw();
break;
case 447: case 447:
this.design = new designs.Lite(); return new designs.Lite();
break;
case 449: case 449:
this.design = new designs.Rss(); return new designs.Rss();
break;
case 451: case 451:
this.design = new designs.Classic(); return new designs.Classic();
break;
case 443: case 443:
default: default:
this.design = new designs.Modern(); string[] parts = this.httprequest.Url.Host.Split('.');
break; 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"]; HttpCookie sessionCookie = this.httprequest.Cookies["session"];
if(sessionCookie != null && sessionCookie.Value != null && sessionCookie.Value != "") { if(sessionCookie != null && sessionCookie.Value != null && sessionCookie.Value != "") {

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

Loading…
Cancel
Save