Merge pull request #4082 from sbwalker/dev
remove changes to allow path to support urls - urls should be specified as redirects
This commit is contained in:
@ -385,45 +385,34 @@
|
|||||||
page.ParentId = Int32.Parse(_parentid);
|
page.ParentId = Int32.Parse(_parentid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// path can be a link to an external url
|
if (string.IsNullOrEmpty(_path))
|
||||||
if (!_path.Contains("://"))
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_path))
|
_path = _name;
|
||||||
{
|
}
|
||||||
_path = _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
(_path, string parameters) = Utilities.ParsePath(_path);
|
if (_path.Contains("/"))
|
||||||
|
{
|
||||||
if (_path.Contains("/"))
|
if (_path.EndsWith("/") && _path != "/")
|
||||||
{
|
{
|
||||||
if (_path.EndsWith("/") && _path != "/")
|
_path = _path.Substring(0, _path.Length - 1);
|
||||||
{
|
|
||||||
_path = _path.Substring(0, _path.Length - 1);
|
|
||||||
}
|
|
||||||
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
|
||||||
}
|
}
|
||||||
if (_parentid == "-1")
|
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
||||||
{
|
}
|
||||||
page.Path = Utilities.GetFriendlyUrl(_path);
|
if (_parentid == "-1")
|
||||||
}
|
{
|
||||||
else
|
page.Path = Utilities.GetFriendlyUrl(_path);
|
||||||
{
|
|
||||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
|
|
||||||
if (parent.Path == string.Empty)
|
|
||||||
{
|
|
||||||
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
page.Path += parameters;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
page.Path = _path;
|
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
|
||||||
|
if (parent.Path == string.Empty)
|
||||||
|
{
|
||||||
|
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
||||||
@ -497,14 +486,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!page.Path.Contains("://"))
|
NavigationManager.NavigateTo(page.Path); // redirect to new page created
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(page.Path); // redirect to new page created
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -380,7 +380,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_path.Contains("/") & !_path.Contains("://"))
|
if (_path.Contains("/"))
|
||||||
{
|
{
|
||||||
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
||||||
}
|
}
|
||||||
@ -529,45 +529,34 @@
|
|||||||
_page.ParentId = Int32.Parse(_parentid);
|
_page.ParentId = Int32.Parse(_parentid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// path can be a link to an external url
|
if (string.IsNullOrEmpty(_path))
|
||||||
if (!_path.Contains("://"))
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_path))
|
_path = _name;
|
||||||
{
|
}
|
||||||
_path = _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
(_path, string parameters) = Utilities.ParsePath(_path);
|
if (_path.Contains("/"))
|
||||||
|
{
|
||||||
if (_path.Contains("/"))
|
if (_path.EndsWith("/") && _path != "/")
|
||||||
{
|
{
|
||||||
if (_path.EndsWith("/") && _path != "/")
|
_path = _path.Substring(0, _path.Length - 1);
|
||||||
{
|
|
||||||
_path = _path.Substring(0, _path.Length - 1);
|
|
||||||
}
|
|
||||||
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
|
||||||
}
|
}
|
||||||
if (_parentid == "-1")
|
_path = _path.Substring(_path.LastIndexOf("/") + 1);
|
||||||
{
|
}
|
||||||
_page.Path = Utilities.GetFriendlyUrl(_path);
|
if (_parentid == "-1")
|
||||||
}
|
{
|
||||||
else
|
_page.Path = Utilities.GetFriendlyUrl(_path);
|
||||||
{
|
|
||||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId);
|
|
||||||
if (parent.Path == string.Empty)
|
|
||||||
{
|
|
||||||
_page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_page.Path += parameters;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_page.Path = _path;
|
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId);
|
||||||
|
if (parent.Path == string.Empty)
|
||||||
|
{
|
||||||
|
_page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
var _pages = await PageService.GetPagesAsync(PageState.Site.SiteId);
|
||||||
@ -658,14 +647,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!_page.Path.Contains("://"))
|
NavigationManager.NavigateTo(NavigateUrl(), true); // redirect to page being edited
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl(), true); // redirect to page being edited
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user