Removes some unused code which relate to the pageID too

This commit is contained in:
Sebastiaan Janssen
2018-09-25 21:37:00 +02:00
parent c3e85796d8
commit 6dfb0f0711
4 changed files with 5 additions and 119 deletions

View File

@@ -1411,9 +1411,6 @@
<DependentUpon>nodeSorter.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\Web\UI\ContentPage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UmbracoApplication.cs" />
<Compile Include="UmbracoContext.cs" />
<Compile Include="UmbracoModule.cs" />

View File

@@ -253,15 +253,14 @@ namespace Umbraco.Web
/// </summary>
public int? PageId
{
// TODO - this is dirty old legacy tricks, we should clean it up at some point
// also, what is a "custom page" and when should this be either null, or different
// from PublishedContentRequest.PublishedContent.Id ??
// SD: Have found out it can be different when rendering macro contents in the back office, but really youshould just be able
// to pass a page id to the macro renderer instead but due to all the legacy bits that's real difficult.
get
{
try
{
// This was changed but the comments used to refer to
// macros in the backoffice not working with this Id
// it's probably not a problem any more though. Old comment:
// https://github.com/umbraco/Umbraco-CMS/blob/7a615133ff9de84ee667fb7794169af65e2b4d7a/src/Umbraco.Web/UmbracoContext.cs#L256
return Current.PublishedRequest.PublishedContent.Id;
}
catch

View File

@@ -3,18 +3,13 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Xml;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Editors;
using Umbraco.Web.Routing;
using Umbraco.Core.Configuration;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
using Umbraco.Web.Composing;
namespace umbraco
@@ -146,55 +141,7 @@ namespace umbraco
_elements.Add("path", path);
_elements.Add("splitpath", _splitpath);
}
void populatePageData(XmlNode node)
{
string s;
DateTime dt;
Guid guid;
int i;
if (int.TryParse(attrValue(node, "id"), out i))
_elements["pageID"] = this._pageId = i;
if ((s = attrValue(node, "nodeName")) != null)
_elements["pageName"] = this._pageName = s;
if (int.TryParse(attrValue(node, "parentId"), out i))
_elements["parentId"] = this._parentId = i;
if (int.TryParse(attrValue(node, "nodeType"), out i))
_elements["nodeType"] = this._nodeType = i;
if ((s = attrValue(node, "nodeTypeAlias")) != null)
_elements["nodeTypeAlias"] = this._nodeTypeAlias = s;
if ((s = attrValue(node, "writerName")) != null)
_elements["writerName"] = this._writerName = s;
if ((s = attrValue(node, "creatorName")) != null)
_elements["creatorName"] = this._creatorName = s;
if (DateTime.TryParse(attrValue(node, "createDate"), out dt))
_elements["createDate"] = this._createDate = dt;
if (DateTime.TryParse(attrValue(node, "updateDate"), out dt))
_elements["updateDate"] = this._updateDate = dt;
if (Guid.TryParse(attrValue(node, "pageVersion"), out guid))
_elements["pageVersion"] = this._pageVersion = guid;
if ((s = attrValue(node, "path")) != null)
{
_elements["path"] = this._path = s;
_elements["splitpath"] = this._splitpath = _path.Split(',');
}
}
string attrValue(XmlNode node, string attributeName)
{
var attr = node.Attributes.GetNamedItem(attributeName);
var value = attr != null ? attr.Value : null;
return value;
}
/// <summary>
/// Puts the properties of the node into the elements table
/// </summary>
@@ -217,42 +164,6 @@ namespace umbraco
}
}
}
void populateElementData(XmlNode node)
{
string xpath = "./* [not(@isDoc)]";
foreach (XmlNode data in node.SelectNodes(xpath))
{
// ignore empty elements
if (data.ChildNodes.Count == 0)
continue;
string alias = data.Name;
string value = data.FirstChild.Value;
// moved to PublishedContentRequest + UmbracoModule
//if (alias == "umbracoRedirect")
//{
// int i;
// if (int.TryParse(value, out i))
// HttpContext.Current.Response.Redirect(library.NiceUrl(int.Parse(data.FirstChild.Value)), true);
//}
if (_elements.ContainsKey(alias))
{
Current.Logger.Debug<page>(
string.Format("Aliases must be unique, an element with alias \"{0}\" has already been loaded!", alias));
}
else
{
_elements[alias] = value;
Current.Logger.Debug<page>(
string.Format("Load element \"{0}\"", alias));
}
}
}
#endregion
#region Public properties

View File

@@ -1,21 +0,0 @@
using System;
namespace umbraco.presentation.Web.UI
{
/// <summary>
/// Summary description for ContentPage.
/// </summary>
public class ContentPage : System.Web.UI.Page
{
private int _id = 0;
public int UmbracoNodeId
{
set { _id = value; }
get {return _id;}
}
public ContentPage()
{
}
}
}