From ddcdf77f53f15479be9f60e2eaccc2f37f5a0338 Mon Sep 17 00:00:00 2001 From: Dario Solera Date: Fri, 9 Apr 2010 15:59:10 +0000 Subject: [PATCH] Fixed transclusion issue. --- Core/Formatter.cs | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/Core/Formatter.cs b/Core/Formatter.cs index d42311a..f052dea 100644 --- a/Core/Formatter.cs +++ b/Core/Formatter.cs @@ -2369,27 +2369,6 @@ namespace ScrewTurn.Wiki { Match match; - // Format {CLOUD} tag (it has to be in Phase3 because on page rebind the cache is not cleared) - // --> When rebidning a page, the cache is now cleared - /*match = CloudRegex.Match(sb.ToString()); - string cloudMarkup = BuildCloud(DetectNamespaceInfo(current)); - while(match.Success) { - sb.Remove(match.Index, match.Length); - sb.Insert(match.Index, cloudMarkup); - match = CloudRegex.Match(sb.ToString(), match.Index + cloudMarkup.Length); - }*/ - - // Format {NAMESPACE} tag - // --> Now processed with {INCOMING/OUTGOING} - /*string ns = Tools.DetectCurrentNamespace(); - if(string.IsNullOrEmpty(ns)) ns = "<root>"; - match = NamespaceRegex.Match(sb.ToString()); - while(match.Success) { - sb.Remove(match.Index, match.Length); - sb.Insert(match.Index, ns); - match = NamespaceRegex.Match(sb.ToString(), match.Index + 11); - }*/ - // Format other Phase3 special tags match = Phase3SpecialTagRegex.Match(sb.ToString()); while(match.Success) { @@ -2477,7 +2456,7 @@ namespace ScrewTurn.Wiki { match = SignRegex.Match(sb.ToString()); } - // Transclusion (intra-Wiki) + // Transclusion match = TransclusionRegex.Match(sb.ToString()); while(match.Success) { sb.Remove(match.Index, match.Length); @@ -2492,12 +2471,13 @@ namespace ScrewTurn.Wiki { } } PageInfo info = Pages.FindPage(pageName); - string currentUsername = SessionFacade.GetCurrentUsername(); - string[] currentGroups = SessionFacade.GetCurrentGroupNames(); - bool canView = AuthChecker.CheckActionForPage(info, Actions.ForPages.ReadPage, currentUsername, currentGroups); - if(canView) { - if(info != null && (current != null && info.FullName != current.FullName)) { // Avoid circular transclusion! + if(info != null && (current != null && info.FullName != current.FullName)) { // Avoid circular transclusion! + string currentUsername = SessionFacade.GetCurrentUsername(); + string[] currentGroups = SessionFacade.GetCurrentGroupNames(); + + bool canView = AuthChecker.CheckActionForPage(info, Actions.ForPages.ReadPage, currentUsername, currentGroups); + if(canView) { dummy = new StringBuilder(); dummy.Append(@"
"); dummy.Append(FormattingPipeline.FormatWithPhase3( @@ -2508,15 +2488,16 @@ namespace ScrewTurn.Wiki { sb.Insert(match.Index, dummy.ToString()); } else { - string formatterErrorString = @"FORMATTER ERROR (Transcluded inexistent page or this same page)"; + string formatterErrorString = @"PERMISSION ERROR (You are not allowed to see transcluded page)"; sb.Insert(match.Index, formatterErrorString); } } else { - string formatterErrorString = @"PERMISSION ERROR (You are not allowed to see transcluded page)"; + string formatterErrorString = @"FORMATTER ERROR (Transcluded inexistent page or this same page)"; sb.Insert(match.Index, formatterErrorString); } + match = TransclusionRegex.Match(sb.ToString()); }