WORK IN PROGRESS, GET THE STABLE SOURCE FROM THE DOWNLOADS TAB

Fixing preview issues

[TFS Changeset #64062]
This commit is contained in:
hartvig
2010-02-18 16:48:57 +00:00
parent d7ee456c00
commit aa28e473b6
4 changed files with 24 additions and 9 deletions

View File

@@ -67,6 +67,19 @@ namespace umbraco.presentation
}
}
/// <summary>
/// Gets the current logged in Umbraco user (editor).
/// </summary>
/// <value>The Umbraco user object or null</value>
public virtual User UmbracoUser
{
get
{
return BasePages.UmbracoEnsuredPage.CurrentUser;
}
}
/// <summary>
/// Determines whether the current user is in a preview mode
/// </summary>
@@ -74,7 +87,8 @@ namespace umbraco.presentation
{
get
{
return !String.IsNullOrEmpty(StateHelper.GetCookieValue("PreviewSet"));
return !String.IsNullOrEmpty(StateHelper.GetCookieValue("PreviewSet")) &&
UmbracoUser != null;
}
}
@@ -147,7 +161,7 @@ namespace umbraco.presentation
{
if (m_Response == null)
{
m_Response = new UmbracoResponse(this.m_HttpContext.Response);
m_Response = new UmbracoResponse(this.m_HttpContext.Response);
}
return m_Response;
}
@@ -163,7 +177,7 @@ namespace umbraco.presentation
{
if (m_Request == null)
{
m_Request = new UmbracoRequest(this.m_HttpContext.Request);
m_Request = new UmbracoRequest(this.m_HttpContext.Request);
}
return m_Request;
}

View File

@@ -262,7 +262,8 @@ namespace umbraco
// check if document *is* published, it could be unpublished by an event
if (d.Published)
{
AppendDocumentXml(d.Id, d.Level, d.Parent.Id, getPreviewOrPublishedNode(d, xmlContentCopy, false), xmlContentCopy);
int parentId = d.Level == 1 ? -1 : d.Parent.Id;
AppendDocumentXml(d.Id, d.Level, parentId, getPreviewOrPublishedNode(d, xmlContentCopy, false), xmlContentCopy);
// update sitemapprovider
if (updateSitemapProvider && SiteMap.Provider is presentation.nodeFactory.UmbracoSiteMapProvider)

View File

@@ -1386,6 +1386,8 @@ namespace umbraco
/// <returns>Returns the string without starting and endning paragraph tags</returns>
public static string RemoveFirstParagraphTag(string text)
{
if (String.IsNullOrEmpty(text))
return "";
text = text.Trim().Replace("\n", string.Empty).Replace("\r", string.Empty);
if (text.Length > 5)
{

View File

@@ -33,8 +33,8 @@ namespace umbraco.presentation.preview
m_userId = user.Id;
// clone xml
XmlContent = (XmlDocument) content.Instance.XmlContent.Clone();
XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();
// inject current document xml
int parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;
content.AppendDocumentXml(documentObject.Id, documentObject.Level, parentId, documentObject.ToPreviewXml(XmlContent), XmlContent);
@@ -58,9 +58,7 @@ namespace umbraco.presentation.preview
{
PreviewSet = previewSet;
PreviewsetPath = IO.IOHelper.MapPath(
Path.Combine(
Path.Combine(IO.SystemDirectories.Data, "previews"),
PreviewSet + ".config"));
Path.Combine(IO.SystemDirectories.Preview, PreviewSet + ".config"));
}
public void LoadPreviewset()