Port-based designs switching implemented; Raw design implemented

main
Inga 🏳‍🌈 15 years ago
parent 1d58254625
commit 6a817505da
  1. 2
      Builder/IISMainHandler/build.txt
  2. 1
      IISMainHandler/IISMainHandler.csproj
  3. 21
      IISMainHandler/WebContext.cs
  4. 7
      IISMainHandler/designs/Classic.cs
  5. 4
      IISMainHandler/designs/IDesign.cs
  6. 7
      IISMainHandler/designs/Lite.cs
  7. 17
      IISMainHandler/designs/Raw.cs
  8. 9
      IISMainHandler/handlers/RootHandler.cs
  9. 38
      templates/Full/Root.xslt
  10. 8
      templates/copy.xslt

@ -50,6 +50,7 @@
<Compile Include="designs\Classic.cs" />
<Compile Include="designs\IDesign.cs" />
<Compile Include="designs\Lite.cs" />
<Compile Include="designs\Raw.cs" />
<Compile Include="exceptions\RedirectException.cs" />
<Compile Include="exceptions\WrongUrlException.cs" />
<Compile Include="Extensions.cs" />

@ -51,11 +51,7 @@ namespace FLocal.IISHandler {
}
}
public designs.IDesign design {
get {
return new designs.Classic();
}
}
public readonly designs.IDesign design;
public override string formatDateTime(DateTime dateTime) {
return dateTime.ToString();
@ -109,11 +105,24 @@ namespace FLocal.IISHandler {
} else {
this.userSettings = new AnonymousUserSettings();
}
switch(this.httprequest.Url.Port % 1000) {
case 445:
this.design = new designs.Raw();
break;
case 447:
this.design = new designs.Lite();
break;
case 443:
default:
this.design = new designs.Classic();
break;
}
}
public string Transform(string templateName, System.Xml.Linq.XDocument data) {
//TODO: this should work according to design!
return TemplateEngine.Compile(this.design.fsname + this.config.DirSeparator + templateName, data);
return TemplateEngine.Compile(this.design.GetFSName(templateName), data);
}
public XElement exportSession() {

@ -5,10 +5,9 @@ using System.Text;
namespace FLocal.IISHandler.designs {
class Classic : IDesign {
public string fsname {
get {
return "Full";
}
public string GetFSName(string template) {
return System.IO.Path.Combine("Full", template);
}
string FLocal.Common.IOutputParams.preprocessBodyIntermediate(string bodyIntermediate) {

@ -6,9 +6,7 @@ using System.Text;
namespace FLocal.IISHandler.designs {
interface IDesign : Common.IOutputParams {
string fsname {
get;
}
string GetFSName(string template);
}
}

@ -5,10 +5,9 @@ using System.Text;
namespace FLocal.IISHandler.designs {
class Lite : IDesign {
public string fsname {
get {
return "Lite";
}
public string GetFSName(string template) {
return System.IO.Path.Combine("Lite", template);
}
string FLocal.Common.IOutputParams.preprocessBodyIntermediate(string bodyIntermediate) {

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLocal.IISHandler.designs {
class Raw : IDesign {
public string GetFSName(string template) {
return "copy.xslt";
}
string FLocal.Common.IOutputParams.preprocessBodyIntermediate(string bodyIntermediate) {
return bodyIntermediate;
}
}
}

@ -16,7 +16,14 @@ namespace FLocal.IISHandler.handlers {
}
override protected IEnumerable<XElement> getSpecificData(WebContext context) {
return new XElement[0];
Uri url = context.httprequest.Url;
return new XElement[] {
new XElement(
"url",
new XElement("host", url.Host),
new XElement("port", url.Port)
),
};
}
}

@ -47,12 +47,46 @@
</xsl:otherwise>
</xsl:choose>
<table cellpadding="1" cellspacing="0" width="100%" class="tableborders" height="100%">
<xsl:variable name="prefix">
<xsl:text>https://</xsl:text>
<xsl:value-of select="url/host"/>
<xsl:text>:</xsl:text>
<xsl:if test="url/port &gt;= 1000">
<xsl:value-of select="floor(port div 1000)"/>
</xsl:if>
</xsl:variable>
<tr class="menubar">
<td align="left" width="50%" id="decor">
<a href="/Boards/">Ôîðóì</a>&#160;|&#160;<a href="/Boards/">Ëàéò</a>&#160;|&#160;<a href="/Boards/">SL</a>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>443/Boards/</xsl:attribute>
<xsl:text>Ęëŕńńč÷ĺńęčé</xsl:text>
</a>
<xsl:text>&#160;|&#160;</xsl:text>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>447/Boards/</xsl:attribute>
<xsl:text>Ëŕéň</xsl:text>
</a>
<xsl:text>&#160;|&#160;</xsl:text>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>445/Boards/</xsl:attribute>
<xsl:text>Ńűđîé XML</xsl:text>
</a>
</td>
<td align="right" width="50%">
<a href="/Boards/">SL</a>&#160;|&#160;<a href="/Boards/">Lite</a>&#160;|&#160;<a href="/Boards/">Forum</a>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>445/Boards/</xsl:attribute>
<xsl:text>Raw XML</xsl:text>
</a>
<xsl:text>&#160;|&#160;</xsl:text>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>447/Boards/</xsl:attribute>
<xsl:text>Lite</xsl:text>
</a>
<xsl:text>&#160;|&#160;</xsl:text>
<a>
<xsl:attribute name="href"><xsl:value-of select="$prefix"/>443/Boards/</xsl:attribute>
<xsl:text>Classic</xsl:text>
</a>
</td>
</tr>
<tr class="menubar">

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="no" encoding="UCS-2"/>
<xsl:template match="/root">
<xsl:copy-of select="/"/>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save