Fixed theme detection when opening a namespace with incorrect casing.

This commit is contained in:
Dario Solera 2009-10-19 07:18:43 +00:00
parent 462716961d
commit ab22f73cbb
3 changed files with 6 additions and 6 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.1.403")]
[assembly: AssemblyFileVersion("3.0.1.403")]
[assembly: AssemblyVersion("3.0.1.404")]
[assembly: AssemblyFileVersion("3.0.1.404")]

View file

@ -763,6 +763,7 @@ namespace ScrewTurn.Wiki {
/// <param name="nspace">The namespace (<c>null</c> for the root).</param>
/// <returns>The theme name.</returns>
public static string GetTheme(string nspace) {
if(!string.IsNullOrEmpty(nspace)) nspace = Pages.FindNamespace(nspace).Name;
string propertyName = "Theme" + (!string.IsNullOrEmpty(nspace) ? "-" + nspace : "");
return GetString(Provider.GetSetting(propertyName), "Default");
}
@ -773,6 +774,7 @@ namespace ScrewTurn.Wiki {
/// <param name="nspace">The namespace (<c>null</c> for the root).</param>
/// <param name="theme">The theme name.</param>
public static void SetTheme(string nspace, string theme) {
if(!string.IsNullOrEmpty(nspace)) nspace = Pages.FindNamespace(nspace).Name;
string propertyName = "Theme" + (!string.IsNullOrEmpty(nspace) ? "-" + nspace : "");
Provider.SetSetting(propertyName, theme);
}

View file

@ -31,9 +31,6 @@ namespace ScrewTurn.Wiki {
string nspace = GetCurrentNamespace();
if(!string.IsNullOrEmpty(nspace)) pageName = pageName.Substring(nspace.Length + 1); // Trim Namespace. from pageName
//HttpContext.Current.Response.Filter =
// new ScrewTurn.Wiki.RelativeUrlFilterStream(HttpContext.Current.Response.Filter, nspace);
string queryString = ""; // Empty or begins with ampersand, not question mark
try {
// This might throw exceptions if 3rd-party modules interfer with the request pipeline
@ -53,7 +50,7 @@ namespace ScrewTurn.Wiki {
else if(ext.Equals("aspx")) {
// System page requested, redirect to the root of the application
// For example: http://www.server.com/Namespace.Edit.aspx?Page=MainPage -> http://www.server.com/Edit.aspx?Page=MainPage&NS=Namespace
if(!string.IsNullOrEmpty(nspace)) { // Needed to avoid infinite loops
if(!string.IsNullOrEmpty(nspace)) {
if(!queryString.Contains("NS=")) {
HttpContext.Current.RewritePath("~/" + Tools.UrlEncode(pageName) + "." + ext + "?NS=" + Tools.UrlEncode(nspace) + queryString);
}
@ -122,6 +119,7 @@ namespace ScrewTurn.Wiki {
if(string.IsNullOrEmpty(nspace)) nspace = null;
if(nspace == null) nspace = GetCurrentNamespace();
if(string.IsNullOrEmpty(nspace)) nspace = null;
else nspace = Pages.FindNamespace(nspace).Name;
if(nspace != null) {
string tempStringLower = tempString.ToLowerInvariant();