[completed: 586] Resolved paging bug in AdminPages.aspx.

This commit is contained in:
Dario Solera 2011-04-22 17:53:17 +02:00
parent f16f67cff2
commit 2e1eb1813d
5 changed files with 38 additions and 13 deletions

View file

@ -66,6 +66,7 @@ namespace ScrewTurn.Wiki {
private IList<PageInfo> GetPages() {
NamespaceInfo nspace = Pages.FindNamespace(lstNamespace.SelectedValue);
List<PageInfo> pages = Pages.GetPages(nspace);
var orphanPages = Pages.GetOrphanedPages(pages);
List<PageInfo> result = new List<PageInfo>(pages.Count);
@ -73,10 +74,13 @@ namespace ScrewTurn.Wiki {
foreach(PageInfo page in pages) {
if(NameTools.GetLocalName(page.FullName).ToLower(System.Globalization.CultureInfo.CurrentCulture).Contains(filter)) {
result.Add(page);
if(chkOrphansOnly.Checked && !orphanPages.Contains(page.FullName)) continue;
else result.Add(page);
}
}
result.Sort(new PageNameComparer());
return result;
}
@ -190,6 +194,8 @@ namespace ScrewTurn.Wiki {
bool canSetPermissions = AdminMaster.CanManagePermissions(currentUser, currentGroups);
bool canDeletePages = AuthChecker.CheckActionForNamespace(nspace, Actions.ForNamespaces.DeletePages, currentUser, currentGroups);
var orphanPages = Pages.GetOrphanedPages(currentPages);
for(int i = rangeBegin; i <= rangeEnd; i++) {
PageInfo page = currentPages[i];
@ -204,17 +210,13 @@ namespace ScrewTurn.Wiki {
if(!canDeletePages && !canManagePage) canManageDiscussion = AuthChecker.CheckActionForPage(page, Actions.ForPages.ManageDiscussion, currentUser, currentGroups);
bool canSelect = canManagePage | canDeletePages | canManageDiscussion;
int incomingLinks = Pages.GetPageIncomingLinks(page).Length;
if(chkOrphansOnly.Checked && incomingLinks > 0) continue;
PageContent firstContent = null;
List<int> baks = Pages.GetBackups(page);
if(baks.Count == 0) firstContent = currentContent;
else firstContent = Pages.GetBackupContent(page, baks[0]);
result.Add(new PageRow(page, currentContent, firstContent,
Pages.GetMessageCount(page), baks.Count, incomingLinks == 0,
Pages.GetMessageCount(page), baks.Count, orphanPages.Contains(page.FullName),
canEdit, canSelect, canSetPermissions, txtCurrentPage.Value == page.FullName));
}