WORK IN PROGRESS, GET STABLE SOURCE FROM DOWNLOAD TAB
Fixes 26253 and 26254. Preview related issues [TFS Changeset #64070]
This commit is contained in:
@@ -269,7 +269,7 @@ namespace umbraco
|
||||
if (updateSitemapProvider && SiteMap.Provider is presentation.nodeFactory.UmbracoSiteMapProvider)
|
||||
{
|
||||
presentation.nodeFactory.UmbracoSiteMapProvider prov = (presentation.nodeFactory.UmbracoSiteMapProvider)SiteMap.Provider;
|
||||
prov.UpdateNode(new umbraco.presentation.nodeFactory.Node(d.Id));
|
||||
prov.UpdateNode(new umbraco.presentation.nodeFactory.Node(d.Id, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,31 @@ namespace umbraco.presentation.nodeFactory {
|
||||
initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Special constructor for by-passing published vs. preview xml to use
|
||||
/// when updating the SiteMapProvider
|
||||
/// </summary>
|
||||
/// <param name="NodeId"></param>
|
||||
/// <param name="forcePublishedXml"></param>
|
||||
public Node(int NodeId, bool forcePublishedXml) {
|
||||
if (forcePublishedXml) {
|
||||
if (NodeId != -1)
|
||||
_pageXmlNode = content.Instance.XmlContent.GetElementById(NodeId.ToString());
|
||||
else
|
||||
{
|
||||
_pageXmlNode = content.Instance.XmlContent.DocumentElement;
|
||||
|
||||
}
|
||||
initializeStructure();
|
||||
initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Use Node(int NodeId) if not forcing published xml");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Node(int NodeId) {
|
||||
if (NodeId != -1)
|
||||
_pageXmlNode = ((IHasXmlNode)library.GetXmlNodeById(NodeId.ToString()).Current).GetNode();
|
||||
@@ -379,12 +404,14 @@ namespace umbraco.presentation.nodeFactory {
|
||||
}
|
||||
|
||||
// load data
|
||||
foreach (XmlNode n in _pageXmlNode.SelectNodes("./data"))
|
||||
string dataXPath = UmbracoSettings.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]";
|
||||
foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath))
|
||||
_properties.Add(new Property(n));
|
||||
|
||||
// load children
|
||||
string childXPath = UmbracoSettings.UseLegacyXmlSchema ? "node" : "* [@isDoc]";
|
||||
XPathNavigator nav = _pageXmlNode.CreateNavigator();
|
||||
XPathExpression expr = nav.Compile("./node");
|
||||
XPathExpression expr = nav.Compile(childXPath);
|
||||
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);
|
||||
XPathNodeIterator iterator = nav.Select(expr);
|
||||
while (iterator.MoveNext()) {
|
||||
@@ -443,7 +470,9 @@ namespace umbraco.presentation.nodeFactory {
|
||||
// For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes)
|
||||
if (PropertyXmlData.Attributes.GetNamedItem("versionID") != null)
|
||||
_version = new Guid(PropertyXmlData.Attributes.GetNamedItem("versionID").Value);
|
||||
_alias = PropertyXmlData.Attributes.GetNamedItem("alias").Value;
|
||||
_alias = UmbracoSettings.UseLegacyXmlSchema ?
|
||||
PropertyXmlData.Attributes.GetNamedItem("alias").Value :
|
||||
PropertyXmlData.Name;
|
||||
_value = xmlHelper.GetNodeValue(PropertyXmlData);
|
||||
} else
|
||||
throw new ArgumentNullException("Property xml source is null");
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace umbraco.presentation.preview
|
||||
{
|
||||
PreviewSet = previewSet;
|
||||
PreviewsetPath = IO.IOHelper.MapPath(
|
||||
Path.Combine(IO.SystemDirectories.Preview, PreviewSet + ".config"));
|
||||
Path.Combine(IO.SystemDirectories.Preview, m_userId.ToString() + "_" + PreviewSet + ".config"));
|
||||
}
|
||||
|
||||
public void LoadPreviewset()
|
||||
@@ -69,6 +69,18 @@ namespace umbraco.presentation.preview
|
||||
|
||||
public void SavePreviewSet()
|
||||
{
|
||||
// check for old preview sets and try to clean
|
||||
foreach (FileInfo file in new DirectoryInfo(IO.IOHelper.MapPath(IO.SystemDirectories.Preview)).GetFiles(m_userId + "_*.config"))
|
||||
{
|
||||
try
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
catch {
|
||||
Log.Add(LogTypes.Error, User.GetUser(m_userId), -1, String.Format("Couldn't delete preview set: {0}", file.Name));
|
||||
}
|
||||
}
|
||||
|
||||
XmlContent.Save(PreviewsetPath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user