📄 folderrepeater.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using CommunityServer.Components;
using CommunityServer.Controls;
using CommunityServer.Files.Components;
namespace CommunityServer.Files.Controls
{
/// <summary>
/// Provides the Gallery implementation of SectionRepeater
/// </summary>
public class FolderRepeater : SectionRepeater
{
#region Public Properties
[DefaultValue( 1 )]
public virtual Int32 CurrentPage
{
get
{
Object state = ViewState["CurrentPage"];
if(state != null)
return (Int32)state;
return 1;
}
set
{ ViewState["CurrentPage"] = value; }
}
[DefaultValue( 10 )]
public virtual Int32 ItemsPerPage
{
get
{
Object state = ViewState["ItemsPerPage"];
if(state != null)
return (Int32)state;
return 10;
}
set
{ ViewState["ItemsPerPage"] = value; }
}
[DefaultValue( 0 )]
public virtual Int32 TotalFolders
{
get
{
Object state = ViewState["TotalFolders"];
if(state != null)
return (Int32)state;
return 0;
}
set
{ ViewState["TotalFolders"] = value; }
}
[DefaultValue( false )]
public virtual bool Paginate
{
get
{
Object state = ViewState["Paginate"];
if(state != null)
return (bool)state;
return false;
}
set
{ ViewState["Paginate"] = value; }
}
#endregion
/// <summary>
/// Returns the Folders for the current GroupID
/// </summary>
/// <returns></returns>
protected override ArrayList GetSections()
{
ArrayList folders;
switch(this.Mode)
{
case ControlUserMode.Moderator:
folders = Moderate.GetFoldersByGroupID(GroupID);
break;
default:
folders = Folders.GetFoldersByGroupID(GroupID, IgnorePermissions, true, FlushSections);
break;
}
if(Paginate)
{
// Calculate pagination
TotalFolders = folders.Count;
int pageCount = folders.Count;
pageCount -= (CurrentPage-1)*ItemsPerPage;
if(pageCount > ItemsPerPage)
pageCount = ItemsPerPage;
// Grab the items for the current page
Folder[] pageItems = new Folder[pageCount];
folders.CopyTo((CurrentPage-1)*ItemsPerPage, pageItems, 0, pageCount);
return new ArrayList(pageItems);
}
else
return folders;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -