Fixes 26838 and 26857. Issues with urls and publish status when using the new schema
[TFS Changeset #65723]
This commit is contained in:
@@ -609,7 +609,12 @@ namespace umbraco.cms.businesslogic.web
|
||||
_updated = dr.GetDateTime("updateDate");
|
||||
}
|
||||
dr.Close();
|
||||
_published = (SqlHelper.ExecuteScalar<int>("select Count(published) as tmp from cmsDocument where published = 1 And nodeId =" + Id) > 0);
|
||||
_published = HasPublishedVersion();
|
||||
}
|
||||
|
||||
public bool HasPublishedVersion()
|
||||
{
|
||||
return (SqlHelper.ExecuteScalar<int>("select Count(published) as tmp from cmsDocument where published = 1 And nodeId =" + Id) > 0);
|
||||
}
|
||||
|
||||
protected void InitializeDocument(User InitUser, User InitWriter, string InitText, int InitTemplate,
|
||||
|
||||
@@ -85,15 +85,14 @@ namespace umbraco {
|
||||
}
|
||||
|
||||
public static string CreateXPathQuery(string url, bool checkDomain) {
|
||||
string childContainerName = UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME;
|
||||
|
||||
string _tempQuery = "";
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && checkDomain)
|
||||
{
|
||||
_tempQuery = "/root/" + childContainerName + "/*";
|
||||
_tempQuery = "/root" + getChildContainerName() + "/*";
|
||||
}
|
||||
else if (checkDomain)
|
||||
_tempQuery = "/root/" + childContainerName;
|
||||
_tempQuery = "/root" + getChildContainerName();
|
||||
|
||||
|
||||
string[] requestRawUrl = url.Split("/".ToCharArray());
|
||||
@@ -131,8 +130,8 @@ namespace umbraco {
|
||||
{
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
if (_tempQuery == "")
|
||||
_tempQuery = "/root/" + childContainerName + "/*";
|
||||
_tempQuery = "/root/" + childContainerName + "/* [" + _urlName +
|
||||
_tempQuery = "/root" + getChildContainerName() + "/*";
|
||||
_tempQuery = "/root" + getChildContainerName() + "/* [" + _urlName +
|
||||
" = \"" + requestRawUrl[0].Replace(".aspx", "").ToLower() + "\"] | " + _tempQuery;
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
rootAdded = true;
|
||||
@@ -142,13 +141,13 @@ namespace umbraco {
|
||||
for (int i = 0; i <= requestRawUrl.GetUpperBound(0); i++)
|
||||
{
|
||||
if (requestRawUrl[i] != "")
|
||||
_tempQuery += "/" + childContainerName + "/* [" + _urlName + " = \"" + requestRawUrl[i].Replace(".aspx", "").ToLower() +
|
||||
_tempQuery += getChildContainerName() + "/* [" + _urlName + " = \"" + requestRawUrl[i].Replace(".aspx", "").ToLower() +
|
||||
"\"]";
|
||||
}
|
||||
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 2)
|
||||
{
|
||||
_tempQuery += " | " + pageXPathQueryStart + "/" + childContainerName + "/* [" + _urlName + " = \"" +
|
||||
_tempQuery += " | " + pageXPathQueryStart + getChildContainerName() + "/* [" + _urlName + " = \"" +
|
||||
requestRawUrl[1].Replace(".aspx", "").ToLower() + "\"]";
|
||||
}
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
@@ -163,6 +162,14 @@ namespace umbraco {
|
||||
return _tempQuery;
|
||||
}
|
||||
|
||||
private static string getChildContainerName()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME))
|
||||
return "/" + UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public requestHandler(XmlDocument umbracoContent, String url) {
|
||||
HttpContext.Current.Trace.Write("request handler", "current url '" + url + "'");
|
||||
bool getByID = false;
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace umbraco.cms.presentation
|
||||
protected uicontrols.TabView TabView1;
|
||||
protected System.Web.UI.WebControls.TextBox documentName;
|
||||
private cms.businesslogic.web.Document _document;
|
||||
private bool _documentHasPublishedVersion = false;
|
||||
protected System.Web.UI.WebControls.Literal jsIds;
|
||||
private LiteralControl dp = new LiteralControl();
|
||||
private DateTimePicker dpRelease = new DateTimePicker();
|
||||
@@ -66,6 +67,8 @@ namespace umbraco.cms.presentation
|
||||
|
||||
//_document = new cms.businesslogic.web.Document(int.Parse(Request.QueryString["id"]));
|
||||
_document = new Document(true, id);
|
||||
// we need to check if there's a published version of this document
|
||||
_documentHasPublishedVersion = _document.HasPublishedVersion();
|
||||
|
||||
// Check publishing permissions
|
||||
if (!base.getUser().GetPermissions(_document.Path).Contains(ActionPublish.Instance.Letter.ToString()))
|
||||
@@ -88,7 +91,7 @@ namespace umbraco.cms.presentation
|
||||
|
||||
|
||||
System.Web.UI.WebControls.PlaceHolder publishStatus = new PlaceHolder();
|
||||
if (_document.Published)
|
||||
if (_documentHasPublishedVersion)
|
||||
{
|
||||
littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToShortDateString() + " ";
|
||||
|
||||
@@ -324,7 +327,7 @@ namespace umbraco.cms.presentation
|
||||
|
||||
private void updateLinks()
|
||||
{
|
||||
if (_document.Published)
|
||||
if (_documentHasPublishedVersion)
|
||||
{
|
||||
l.Text = "<a href=\"" + library.NiceUrl(_document.Id) + "\" target=\"_blank\">" + library.NiceUrl(_document.Id) + "</a>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user