Replaced references of PageID with the UmbracoContext calls.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Umbraco.Tests.PublishedContent
|
|||||||
request.Culture = new CultureInfo("en-AU");
|
request.Culture = new CultureInfo("en-AU");
|
||||||
publishedRouter.ConfigureRequest(request);
|
publishedRouter.ConfigureRequest(request);
|
||||||
|
|
||||||
Assert.AreEqual(1, umbracoContext.HttpContext.Items["pageID"]);
|
Assert.AreEqual(1, umbracoContext.PageId);
|
||||||
Assert.AreEqual(request.UmbracoPage.Elements.Count, ((Hashtable) umbracoContext.HttpContext.Items["pageElements"]).Count);
|
Assert.AreEqual(request.UmbracoPage.Elements.Count, ((Hashtable) umbracoContext.HttpContext.Items["pageElements"]).Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ namespace Umbraco.Web.Editors
|
|||||||
|
|
||||||
var legacyPage = new global::umbraco.page(doc, _variationContextAccessor);
|
var legacyPage = new global::umbraco.page(doc, _variationContextAccessor);
|
||||||
|
|
||||||
UmbracoContext.HttpContext.Items["pageID"] = doc.Id;
|
|
||||||
UmbracoContext.HttpContext.Items["pageElements"] = legacyPage.Elements;
|
UmbracoContext.HttpContext.Items["pageElements"] = legacyPage.Elements;
|
||||||
UmbracoContext.HttpContext.Items[global::Umbraco.Core.Constants.Conventions.Url.AltTemplate] = null;
|
UmbracoContext.HttpContext.Items[global::Umbraco.Core.Constants.Conventions.Url.AltTemplate] = null;
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ namespace Umbraco.Web.Routing
|
|||||||
frequest.UmbracoPage = new page(frequest);
|
frequest.UmbracoPage = new page(frequest);
|
||||||
|
|
||||||
// used by many legacy objects
|
// used by many legacy objects
|
||||||
frequest.UmbracoContext.HttpContext.Items["pageID"] = frequest.PublishedContent.Id;
|
|
||||||
frequest.UmbracoContext.HttpContext.Items["pageElements"] = frequest.UmbracoPage.Elements;
|
frequest.UmbracoContext.HttpContext.Items["pageElements"] = frequest.UmbracoPage.Elements;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -257,8 +256,7 @@ namespace Umbraco.Web.Routing
|
|||||||
// handlers like default.aspx will want it and most macros currently need it
|
// handlers like default.aspx will want it and most macros currently need it
|
||||||
request.UmbracoPage = new page(request);
|
request.UmbracoPage = new page(request);
|
||||||
|
|
||||||
// these two are used by many legacy objects
|
// this is used by many legacy objects
|
||||||
request.UmbracoContext.HttpContext.Items["pageID"] = request.PublishedContent.Id;
|
|
||||||
request.UmbracoContext.HttpContext.Items["pageElements"] = request.UmbracoPage.Elements;
|
request.UmbracoContext.HttpContext.Items["pageElements"] = request.UmbracoPage.Elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,6 @@ namespace Umbraco.Web.Templates
|
|||||||
// handlers like default.aspx will want it and most macros currently need it
|
// handlers like default.aspx will want it and most macros currently need it
|
||||||
request.UmbracoPage = new page(request);
|
request.UmbracoPage = new page(request);
|
||||||
//now, set the new ones for this page execution
|
//now, set the new ones for this page execution
|
||||||
_umbracoContext.HttpContext.Items["pageID"] = request.PublishedContent.Id;
|
|
||||||
_umbracoContext.HttpContext.Items["pageElements"] = request.UmbracoPage.Elements;
|
_umbracoContext.HttpContext.Items["pageElements"] = request.UmbracoPage.Elements;
|
||||||
_umbracoContext.HttpContext.Items[Core.Constants.Conventions.Url.AltTemplate] = null;
|
_umbracoContext.HttpContext.Items[Core.Constants.Conventions.Url.AltTemplate] = null;
|
||||||
_umbracoContext.PublishedRequest = request;
|
_umbracoContext.PublishedRequest = request;
|
||||||
@@ -214,8 +213,8 @@ namespace Umbraco.Web.Templates
|
|||||||
private void SaveExistingItems()
|
private void SaveExistingItems()
|
||||||
{
|
{
|
||||||
//Many objects require that these legacy items are in the http context items... before we render this template we need to first
|
//Many objects require that these legacy items are in the http context items... before we render this template we need to first
|
||||||
//save the values in them so that we can re-set them after we render so the rest of the execution works as per normal.
|
//save the values in them so that we can re-set them after we render so the rest of the execution works as per normal
|
||||||
_oldPageId = _umbracoContext.HttpContext.Items["pageID"];
|
_oldPageId = _umbracoContext.PageId;
|
||||||
_oldPageElements = _umbracoContext.HttpContext.Items["pageElements"];
|
_oldPageElements = _umbracoContext.HttpContext.Items["pageElements"];
|
||||||
_oldPublishedRequest = _umbracoContext.PublishedRequest;
|
_oldPublishedRequest = _umbracoContext.PublishedRequest;
|
||||||
_oldAltTemplate = _umbracoContext.HttpContext.Items[Umbraco.Core.Constants.Conventions.Url.AltTemplate];
|
_oldAltTemplate = _umbracoContext.HttpContext.Items[Umbraco.Core.Constants.Conventions.Url.AltTemplate];
|
||||||
@@ -227,7 +226,6 @@ namespace Umbraco.Web.Templates
|
|||||||
private void RestoreItems()
|
private void RestoreItems()
|
||||||
{
|
{
|
||||||
_umbracoContext.PublishedRequest = _oldPublishedRequest;
|
_umbracoContext.PublishedRequest = _oldPublishedRequest;
|
||||||
_umbracoContext.HttpContext.Items["pageID"] = _oldPageId;
|
|
||||||
_umbracoContext.HttpContext.Items["pageElements"] = _oldPageElements;
|
_umbracoContext.HttpContext.Items["pageElements"] = _oldPageElements;
|
||||||
_umbracoContext.HttpContext.Items[Umbraco.Core.Constants.Conventions.Url.AltTemplate] = _oldAltTemplate;
|
_umbracoContext.HttpContext.Items[Umbraco.Core.Constants.Conventions.Url.AltTemplate] = _oldAltTemplate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,8 +262,7 @@ namespace Umbraco.Web
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//TODO: this should be done with a wrapper: http://issues.umbraco.org/issue/U4-61
|
return Current.PublishedRequest.PublishedContent.Id;
|
||||||
return int.Parse(HttpContext.Items["pageID"].ToString());
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ namespace umbraco.presentation.Web.UI
|
|||||||
|
|
||||||
public int UmbracoNodeId
|
public int UmbracoNodeId
|
||||||
{
|
{
|
||||||
set
|
set { _id = value; }
|
||||||
{
|
|
||||||
_id = value;
|
|
||||||
System.Web.HttpContext.Current.Items["pageID"] = _id;
|
|
||||||
}
|
|
||||||
get {return _id;}
|
get {return _id;}
|
||||||
}
|
}
|
||||||
public ContentPage()
|
public ContentPage()
|
||||||
|
|||||||
@@ -203,9 +203,9 @@ namespace umbraco.presentation.templateControls
|
|||||||
return nodeIdInt;
|
return nodeIdInt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PageElements["pageID"] != null)
|
else if (UmbracoContext.Current.PageId != null)
|
||||||
{
|
{
|
||||||
return int.Parse(PageElements["pageID"].ToString());
|
return UmbracoContext.Current.PageId.Value;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace umbraco.presentation.templateControls
|
|||||||
|
|
||||||
// set pageId to int.MinValue if no pageID was found,
|
// set pageId to int.MinValue if no pageID was found,
|
||||||
// e.g. if the macro was rendered on a custom (non-Umbraco) page
|
// e.g. if the macro was rendered on a custom (non-Umbraco) page
|
||||||
var pageId = Context.Items["pageID"] == null ? int.MinValue : int.Parse(Context.Items["pageID"].ToString());
|
var pageId = UmbracoContext.Current.PageId == null ? int.MinValue : UmbracoContext.Current.PageId.Value;
|
||||||
|
|
||||||
if ((string.IsNullOrEmpty(Language) == false && Text != "") || string.IsNullOrEmpty(FileLocation) == false) {
|
if ((string.IsNullOrEmpty(Language) == false && Text != "") || string.IsNullOrEmpty(FileLocation) == false) {
|
||||||
var tempMacro = new MacroModel();
|
var tempMacro = new MacroModel();
|
||||||
|
|||||||
Reference in New Issue
Block a user