Pageouter reversed url logic improved

main
Inga 🏳‍🌈 14 years ago
parent f24546d935
commit 502704789c
  1. 2
      Builder/IISMainHandler/build.txt
  2. 16
      IISMainHandler/PageOuter.cs
  3. 2
      templates/Full/Thread.xslt
  4. 17
      templates/Full/elems/Main.xslt

@ -48,16 +48,16 @@ namespace FLocal.IISHandler {
}
public static PageOuter createFromUrl(FLocal.Common.URL.AbstractUrl url, long perPage, Dictionary<char, Func<string, long>> customAction) {
string[] requestParts = url.remainder.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
int offset = 0;
bool reversed = (requestParts.Length > (offset+1)) && (requestParts[offset+1].ToLower() == "reversed");
if(requestParts.Length > offset) {
if(requestParts[offset].ToLower() == "all") {
if(url.remainder.Contains("/")) throw new WrongUrlException();
string[] requestParts = url.remainder.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
bool reversed = (requestParts.Length > 1) && (requestParts[1].ToLower() == "reversed");
if(requestParts.Length > 0) {
if(requestParts[0].ToLower() == "all") {
return new PageOuter(perPage, reversed);
} else if(Char.IsDigit(requestParts[offset][0])) {
return new PageOuter(long.Parse(requestParts[offset]), perPage, perPage, reversed);
} else if(Char.IsDigit(requestParts[0][0])) {
return new PageOuter(long.Parse(requestParts[0]), perPage, perPage, reversed);
} else {
return new PageOuter(customAction[requestParts[offset][0]](requestParts[offset].Substring(1)), perPage, perPage, reversed);
return new PageOuter(customAction[requestParts[0][0]](requestParts[0].Substring(1)), perPage, perPage, reversed);
}
} else {
return new PageOuter(0, perPage, perPage, reversed);

@ -7,7 +7,7 @@
</xsl:template>
<xsl:template name="isLiteEnabled">true</xsl:template>
<xsl:template name="isRssEnabled">true</xsl:template>
<xsl:template name="rssRelativeLink"><xsl:value-of select="/root/currentBaseUrl"/>0/reversed</xsl:template>
<xsl:template name="rssRelativeLink"><xsl:value-of select="/root/currentBaseUrl"/>0-reversed</xsl:template>
<xsl:template name="specific">
<xsl:if test="not(get/param[@name='headers'] = 'false')">
<xsl:call-template name="threadInfo"/>

@ -234,11 +234,14 @@
<xsl:param name="baseLink">
<xsl:value-of select="/root/currentBaseUrl"/>
</xsl:param>
<xsl:variable name="postfix">
<xsl:if test="isReversed='true'">-reversed</xsl:if>
</xsl:variable>
<xsl:text> </xsl:text>
<xsl:apply-templates select="pages/page" mode="withoutCurrent">
<xsl:with-param name="baseLink"><xsl:value-of select="$baseLink"/></xsl:with-param>
<xsl:with-param name="postfix">
<xsl:if test="isReversed='true'">/reversed</xsl:if>
<xsl:value-of select="$postfix"/>
</xsl:with-param>
<xsl:with-param name="selected">
<xsl:choose>
@ -256,7 +259,11 @@
<xsl:choose>
<xsl:when test="unlimited='false'">
<a>
<xsl:attribute name="href"><xsl:value-of select="$baseLink"/>all</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="$baseLink"/>
<xsl:text>all</xsl:text>
<xsl:value-of select="$postfix"/>
</xsl:attribute>
<xsl:text>âñå</xsl:text>
</a>
</xsl:when>
@ -268,7 +275,11 @@
<xsl:if test="next">
<xsl:text>&#8201;|&#8201;</xsl:text>
<a rel="next">
<xsl:attribute name="href"><xsl:value-of select="$baseLink"/><xsl:value-of select="next"/></xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="$baseLink"/>
<xsl:value-of select="next"/>
<xsl:value-of select="$postfix"/>
</xsl:attribute>
<xsl:text>Ñëåäóþùàÿ ñòðàíèöà</xsl:text>
</a>
</xsl:if>

Loading…
Cancel
Save