Created new LookupByIdQuery ILookup which is now the first thing that is looked up. Have cleaned up

all of the default.aspx stuff so that no routing logic takes place there, all routing logic now takes
place entirely in the module.
This commit is contained in:
Shannon Deminick
2012-08-30 08:26:01 +07:00
parent 05ebc8d2f9
commit b511ae3a1a
20 changed files with 278 additions and 330 deletions

View File

@@ -0,0 +1,30 @@
namespace Umbraco.Web.Routing
{
/// <summary>
/// This looks up a document by checking for the umbPageId of a request/query string
/// </summary>
/// <remarks>
/// This is used by library.RenderTemplate and also some of the macro rendering functionality like in
/// insertMacro.aspx and macroResultWrapper.aspx
/// </remarks>
internal class LookupByPageIdQuery : IDocumentLookup
{
public bool TrySetDocument(DocumentRequest docRequest)
{
int pageId;
if (int.TryParse(docRequest.RoutingContext.UmbracoContext.HttpContext.Request["umbPageID"], out pageId))
{
var doc = docRequest.RoutingContext.PublishedContentStore.GetDocumentById(
docRequest.RoutingContext.UmbracoContext,
pageId);
if (doc != null)
{
docRequest.Document = doc;
return true;
}
}
return false;
}
}
}