mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding MaxPageSize to ISite
This commit is contained in:
@@ -76,7 +76,12 @@ namespace Orchard.Tests.Stubs {
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int PageSize{
|
||||
public int PageSize {
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int MaxPageSize {
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace Orchard.Core.Settings.Drivers {
|
||||
|
||||
var previousBaseUrl = model.Site.BaseUrl;
|
||||
var previousSuperUser = model.Site.SuperUser;
|
||||
var previousMaxPageSize = model.Site.MaxPageSize;
|
||||
|
||||
updater.TryUpdateModel(model, Prefix, null, null);
|
||||
|
||||
@@ -90,6 +91,7 @@ namespace Orchard.Core.Settings.Drivers {
|
||||
}
|
||||
else {
|
||||
model.Site.SuperUser = previousSuperUser;
|
||||
model.Site.MaxPageSize = previousMaxPageSize;
|
||||
}
|
||||
|
||||
// ensure the base url is absolute if provided
|
||||
|
||||
@@ -50,6 +50,11 @@ namespace Orchard.Core.Settings.Models {
|
||||
set { this.Store(x => x.PageSize, value); }
|
||||
}
|
||||
|
||||
public int MaxPageSize {
|
||||
get { return this.Retrieve(x => x.MaxPageSize); }
|
||||
set { this.Store(x => x.MaxPageSize, value); }
|
||||
}
|
||||
|
||||
public string SiteTimeZone {
|
||||
get { return this.Retrieve(x => x.SiteTimeZone); }
|
||||
set { this.Store(x => x.SiteTimeZone, value); }
|
||||
|
||||
@@ -51,6 +51,11 @@ namespace Orchard.Core.Settings.ViewModels {
|
||||
set { Site.PageSize = value; }
|
||||
}
|
||||
|
||||
public int MaxPageSize {
|
||||
get { return Site.MaxPageSize; }
|
||||
set { Site.MaxPageSize = value; }
|
||||
}
|
||||
|
||||
public string BaseUrl {
|
||||
get { return Site.BaseUrl; }
|
||||
set { Site.BaseUrl = value; }
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
@Html.EditorFor(x => x.PageTitleSeparator)
|
||||
@Html.ValidationMessage("PageTitleSeparator", "*")
|
||||
</div>
|
||||
@if (AuthorizedFor(Orchard.Security.StandardPermissions.SiteOwner)) {
|
||||
<div>
|
||||
<label for="SuperUser">@T("Super user")</label>
|
||||
@Html.EditorFor(x => x.SuperUser)
|
||||
@Html.ValidationMessage("SuperUser", "*")
|
||||
<span class="hint">@T("Enter an existing account name, or nothing if you don't want a Super user account")</span>
|
||||
</div>
|
||||
}
|
||||
@if (AuthorizedFor(Orchard.Security.StandardPermissions.SiteOwner)) {
|
||||
<div>
|
||||
<label for="SuperUser">@T("Super user")</label>
|
||||
@Html.EditorFor(x => x.SuperUser)
|
||||
@Html.ValidationMessage("SuperUser", "*")
|
||||
<span class="hint">@T("Enter an existing account name, or nothing if you don't want a Super user account")</span>
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<label for="SiteDebugMode">@T("Resource Debug Mode")</label>
|
||||
@Html.DropDownList("ResourceDebugMode", resourceDebugMode)
|
||||
@@ -63,4 +63,11 @@
|
||||
@Html.TextBoxFor(m => m.PageSize, new { @class = "text small" })
|
||||
<span class="hint">@T("Determines the default number of items that are shown per page.")</span>
|
||||
</div>
|
||||
@if (AuthorizedFor(Orchard.Security.StandardPermissions.SiteOwner)) {
|
||||
<div>
|
||||
<label for="MaxPageSize">@T("Maximum number of items per page")</label>
|
||||
@Html.TextBoxFor(m => m.MaxPageSize, new {@class = "text small"})
|
||||
<span class="hint">@T("Determines the maximum number of items that are shown per page. Leave 0 for unlimited.")</span>
|
||||
</div>
|
||||
}
|
||||
</fieldset>
|
||||
@@ -191,6 +191,11 @@ namespace Orchard.Setup {
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int MaxPageSize {
|
||||
get { return SiteSettingsPart.DefaultPageSize; }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string BaseUrl {
|
||||
get { return ""; }
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ namespace Orchard.Tokens.Tests {
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int MaxPageSize {
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
public string SiteTimeZone {
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Orchard.Settings {
|
||||
string SiteCalendar { get; set; }
|
||||
ResourceDebugMode ResourceDebugMode { get; set; }
|
||||
int PageSize { get; set; }
|
||||
int MaxPageSize { get; set; }
|
||||
string BaseUrl { get; }
|
||||
string SiteTimeZone { get; }
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace Orchard.UI.Navigation {
|
||||
public Pager(ISite site, int? page, int? pageSize) {
|
||||
Page = (int) (page != null ? (page > 0 ? page : PageDefault) : PageDefault);
|
||||
PageSize = pageSize ?? site.PageSize;
|
||||
|
||||
if (site.MaxPageSize > 0 && PageSize > site.MaxPageSize) {
|
||||
PageSize = site.MaxPageSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user