From 502704789c5d6c6d3538b8c8afb34cb5afa35754 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 19 Sep 2010 10:01:24 +0000 Subject: [PATCH] Pageouter reversed url logic improved --- Builder/IISMainHandler/build.txt | 2 +- IISMainHandler/PageOuter.cs | 16 ++++++++-------- templates/Full/Thread.xslt | 2 +- templates/Full/elems/Main.xslt | 17 ++++++++++++++--- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index e7814ff..5bb1b74 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -1415 \ No newline at end of file +1423 \ No newline at end of file diff --git a/IISMainHandler/PageOuter.cs b/IISMainHandler/PageOuter.cs index b379c42..99dfccd 100644 --- a/IISMainHandler/PageOuter.cs +++ b/IISMainHandler/PageOuter.cs @@ -48,16 +48,16 @@ namespace FLocal.IISHandler { } public static PageOuter createFromUrl(FLocal.Common.URL.AbstractUrl url, long perPage, Dictionary> 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); diff --git a/templates/Full/Thread.xslt b/templates/Full/Thread.xslt index 0d639ec..3cf0169 100644 --- a/templates/Full/Thread.xslt +++ b/templates/Full/Thread.xslt @@ -7,7 +7,7 @@ true true - 0/reversed + 0-reversed diff --git a/templates/Full/elems/Main.xslt b/templates/Full/elems/Main.xslt index 08faf3b..fe032f2 100644 --- a/templates/Full/elems/Main.xslt +++ b/templates/Full/elems/Main.xslt @@ -234,11 +234,14 @@ + + -reversed + - /reversed + @@ -256,7 +259,11 @@ - all + + + all + + все @@ -268,7 +275,11 @@  |