fix #3936 - parent page default when adding new pages
This commit is contained in:
parent
ad12d42b35
commit
f893cf268b
|
@ -256,9 +256,8 @@
|
|||
{
|
||||
_pageId = Int32.Parse(PageState.QueryString["id"]);
|
||||
_parent = await PageService.GetPageAsync(_pageId);
|
||||
if (_parent != null && !UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
|
||||
if (_parent != null)
|
||||
{
|
||||
// non-admins are authorized to create child pages of current page
|
||||
_parentid = _parent.PageId.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -376,6 +375,15 @@
|
|||
page.SiteId = PageState.Page.SiteId;
|
||||
page.Name = _name;
|
||||
|
||||
if (_parentid == "-1")
|
||||
{
|
||||
page.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
page.ParentId = Int32.Parse(_parentid);
|
||||
}
|
||||
|
||||
// path can be a link to an external url
|
||||
if (!_path.Contains("://"))
|
||||
{
|
||||
|
@ -400,7 +408,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == Int32.Parse(_parentid));
|
||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
|
||||
if (parent.Path == string.Empty)
|
||||
{
|
||||
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
||||
|
@ -417,15 +425,6 @@
|
|||
page.Path = _path;
|
||||
}
|
||||
|
||||
if (_parentid == "-1")
|
||||
{
|
||||
page.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
page.ParentId = Int32.Parse(_parentid);
|
||||
}
|
||||
|
||||
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
||||
if (_pages.Any(item => item.Path == page.Path))
|
||||
{
|
||||
|
|
|
@ -518,6 +518,15 @@
|
|||
|
||||
_page.Name = _name;
|
||||
|
||||
if (_parentid == "-1")
|
||||
{
|
||||
_page.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_page.ParentId = Int32.Parse(_parentid);
|
||||
}
|
||||
|
||||
// path can be a link to an external url
|
||||
if (!_path.Contains("://"))
|
||||
{
|
||||
|
@ -542,7 +551,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == Int32.Parse(_parentid));
|
||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId);
|
||||
if (parent.Path == string.Empty)
|
||||
{
|
||||
_page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
||||
|
@ -559,15 +568,6 @@
|
|||
_page.Path = _path;
|
||||
}
|
||||
|
||||
if (_parentid == "-1")
|
||||
{
|
||||
_page.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_page.ParentId = Int32.Parse(_parentid);
|
||||
}
|
||||
|
||||
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
||||
if (_pages.Any(item => item.Path == _page.Path && item.PageId != _page.PageId))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user