fix #3255 - behavior when moving pages to other parents
This commit is contained in:
		| @ -40,9 +40,9 @@ | ||||
|                             <Label Class="col-sm-3" For="insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages" ResourceKey="Insert">Insert: </Label> | ||||
|                             <div class="col-sm-9"> | ||||
|                                 <select id="insert" class="form-select" @bind="@_insert" required> | ||||
|                                     <option value="<<">@Localizer["AtBeginning"]</option> | ||||
|                                     @if (_children != null && _children.Count > 0) | ||||
|                                     { | ||||
|                                         <option value="<<">@Localizer["AtBeginning"]</option> | ||||
|                                         <option value="<">@Localizer["Before"]</option> | ||||
|                                         <option value=">">@Localizer["After"]</option> | ||||
|                                     } | ||||
| @ -257,7 +257,14 @@ | ||||
|                 _themes = ThemeService.GetThemeControls(PageState.Site.Themes); | ||||
|                 _containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype); | ||||
|                 _containertype = PageState.Site.DefaultContainerType; | ||||
|                 _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); | ||||
|                 _children = new List<Page>(); | ||||
|                 foreach (Page p in PageState.Pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid)))) | ||||
|                 { | ||||
|                     if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                     { | ||||
|                         _children.Add(p); | ||||
|                     } | ||||
|                 } | ||||
|                 ThemeSettings(); | ||||
|                 _initialized = true; | ||||
|             } | ||||
| @ -279,28 +286,15 @@ | ||||
| 		try | ||||
| 		{ | ||||
| 			_parentid = (string)e.Value; | ||||
| 			_children = new List<Page>(); | ||||
| 			if (_parentid == "-1") | ||||
| 			{ | ||||
| 				foreach (Page p in PageState.Pages.Where(item => item.ParentId == null)) | ||||
| 				{ | ||||
| 					if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
| 					{ | ||||
| 						_children.Add(p); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				foreach (Page p in PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid))) | ||||
| 				{ | ||||
| 					if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
| 					{ | ||||
| 						_children.Add(p); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			StateHasChanged(); | ||||
|             _children = new List<Page>(); | ||||
|             foreach (Page p in PageState.Pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid)))) | ||||
|             { | ||||
|                 if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                 { | ||||
|                     _children.Add(p); | ||||
|                 } | ||||
|             } | ||||
|             StateHasChanged(); | ||||
| 		} | ||||
| 		catch (Exception ex) | ||||
| 		{ | ||||
|  | ||||
| @ -48,13 +48,16 @@ | ||||
|                                         { | ||||
|                                             <option value="="><@Localizer["ThisLocation.Keep"]></option> | ||||
|                                         } | ||||
|                                         <option value="<<">@Localizer["ToBeginning"]</option> | ||||
|                                         @if (_children != null && _children.Count > 0) | ||||
|                                         { | ||||
|                                             <option value="<<">@Localizer["ToBeginning"]</option> | ||||
|                                             <option value="<">@Localizer["Before"]</option> | ||||
|                                             <option value=">">@Localizer["After"]</option> | ||||
|                                         } | ||||
|                                         <option value=">>">@Localizer["ToEnd"]</option> | ||||
|                                         @if (_parentid != _currentparentid) | ||||
|                                         { | ||||
|                                             <option value=">>">@Localizer["ToEnd"]</option> | ||||
|                                         } | ||||
|                                     </select> | ||||
|                                     @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) | ||||
|                                     { | ||||
| @ -324,7 +327,6 @@ | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); | ||||
|             _pageId = Int32.Parse(PageState.QueryString["id"]); | ||||
|             _page = await PageService.GetPageAsync(_pageId); | ||||
|             _icons = await SystemService.GetIconsAsync(); | ||||
| @ -342,6 +344,14 @@ | ||||
|                     _parentid = _page.ParentId.ToString(); | ||||
|                     _parent = PageState.Pages.FirstOrDefault(item => item.PageId == _page.ParentId); | ||||
|                 } | ||||
|                 _children = new List<Page>(); | ||||
|                 foreach (Page p in PageState.Pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid)))) | ||||
|                 { | ||||
|                     if (p.PageId != _pageId && UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                     { | ||||
|                         _children.Add(p); | ||||
|                     } | ||||
|                 } | ||||
|                 _currentparentid = _parentid; | ||||
|                 _isnavigation = _page.IsNavigation.ToString(); | ||||
|                 _isclickable = _page.IsClickable.ToString(); | ||||
| @ -417,34 +427,14 @@ | ||||
|         { | ||||
|             _parentid = (string)e.Value; | ||||
|             _children = new List<Page>(); | ||||
|             if (_parentid == "-1") | ||||
|             foreach (Page p in PageState.Pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid)))) | ||||
|             { | ||||
|                 foreach (Page p in PageState.Pages.Where(item => item.ParentId == null)) | ||||
|                 if (p.PageId != _pageId && UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                 { | ||||
|                     if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                     { | ||||
|                         _children.Add(p); | ||||
|                     } | ||||
|                     _children.Add(p); | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 foreach (Page p in PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid))) | ||||
|                 { | ||||
|                     if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList)) | ||||
|                     { | ||||
|                         _children.Add(p); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if (_parentid == _currentparentid) | ||||
|             { | ||||
|                 _insert = "="; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _insert = ">>"; | ||||
|             } | ||||
|             _insert = (_parentid == _currentparentid) ? "=" : ">>"; | ||||
|             StateHasChanged(); | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 sbwalker
					sbwalker