wsp-10294 In System settings added option to configure the paging. Enable/
disable and the amount of packages per page. At the home page of a customer the paging itself has been added as well.
This commit is contained in:
parent
33dfcc2814
commit
12725bbbf6
12 changed files with 192 additions and 71 deletions
|
@ -1,35 +1,7 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.18051
|
||||
' Runtime Version:4.0.30319.34014
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const string SETUP_SETTINGS = "SetupSettings";
|
||||
public const string WPI_SETTINGS = "WpiSettings";
|
||||
public const string FILEMANAGER_SETTINGS = "FileManagerSettings";
|
||||
public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings";
|
||||
|
||||
// key to access to wpi main & custom feed in wpi settings
|
||||
public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl";
|
||||
|
|
|
@ -294,3 +294,6 @@ p.warningText {font-size:14px; color:Red; text-align:center;}
|
|||
.Hidden {display: none;}
|
||||
.LinkText {color:#428bca;}
|
||||
.WrapText { white-space: normal;}
|
||||
.activePageBlock, .pageBlock { display: inline-block; height: 24px; margin: 0 2px; width: 26px; font-size: 11px; line-height: 23px; text-align: center; white-space:nowrap; }
|
||||
.activePageBlock { border: none; color: #222; font-weight: 600; }
|
||||
.pageBlock { border: 1px solid #e6e6e6; border-radius: 1px; cursor: pointer; }
|
|
@ -162,4 +162,13 @@
|
|||
<data name="litFileManagerEditableExtensions.Text" xml:space="preserve">
|
||||
<value>(One (1) extension per line)</value>
|
||||
</data>
|
||||
<data name="lclPackageDisplaySettings.Text" xml:space="preserve">
|
||||
<value>Package Display Settings</value>
|
||||
</data>
|
||||
<data name="lclPackagePackagesPerPage.Text" xml:space="preserve">
|
||||
<value>Display packages per page</value>
|
||||
</data>
|
||||
<data name="lclPackageUsePaging" xml:space="preserve">
|
||||
<value>Use paging on package overview</value>
|
||||
</data>
|
||||
</root>
|
|
@ -28,12 +28,14 @@
|
|||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Caching;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using System.Collections;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
|
@ -162,6 +164,21 @@ namespace WebsitePanel.Portal
|
|||
return ES.Services.Packages.GetRawMyPackages(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
|
||||
public Hashtable GetMyPackages(int index, int PackagesPerPage)
|
||||
{
|
||||
Hashtable ret = new Hashtable();
|
||||
|
||||
DataTable table = ES.Services.Packages.GetRawMyPackages(PanelSecurity.SelectedUserId).Tables[0];
|
||||
System.Collections.Generic.IEnumerable<DataRow> dr = table.AsEnumerable().Skip(PackagesPerPage * index - PackagesPerPage).Take(PackagesPerPage);
|
||||
|
||||
DataSet set = new DataSet();
|
||||
set.Tables.Add(dr.CopyToDataTable());
|
||||
|
||||
ret.Add("DataSet", set);
|
||||
ret.Add("RowCount", table.Rows.Count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#region Packages Paged ODS Methods
|
||||
DataSet dsPackagesPaged;
|
||||
|
||||
|
|
|
@ -41,6 +41,22 @@
|
|||
</table>
|
||||
</asp:Panel>
|
||||
|
||||
|
||||
<wsp:CollapsiblePanel id="lclPackageDisplaySettings" runat="server"
|
||||
TargetControlID="PackageDisplaySettings" meta:resourcekey="lclPackageDisplaySettings" Text="Package Display Settings"/>
|
||||
<asp:Panel ID="PackageDisplaySettings" runat="server" Height="0" style="overflow:hidden;">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px;"><asp:Localize runat="server" meta:resourcekey="lclPackageUsePaging" /></td>
|
||||
<td><asp:CheckBox runat="server" ID="chkPackageUsePaging" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px;"><asp:Localize runat="server" meta:resourcekey="lclPackagePackagesPerPage" /></td>
|
||||
<td><asp:TextBox runat="server" ID="txtPackagePackagesPerPage" Width="80px" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</asp:Panel>
|
||||
|
||||
<wsp:CollapsiblePanel id="lclWpiSettings" runat="server"
|
||||
TargetControlID="WpiPanel" meta:resourcekey="lclWpiSettings" Text="Web Platform Installer Settings"/>
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace WebsitePanel.Portal
|
|||
public const string SMTP_PASSWORD = "SmtpPassword";
|
||||
public const string SMTP_ENABLE_SSL = "SmtpEnableSsl";
|
||||
public const string BACKUPS_PATH = "BackupsPath";
|
||||
public const string PACKAGE_USE_PAGING = "PackageUsePaging";
|
||||
public const string PACKAGES_PER_PAGE = "PackagesPerPage";
|
||||
public const string FILE_MANAGER_EDITABLE_EXTENSIONS = "EditableExtensions";
|
||||
|
||||
/*
|
||||
|
@ -95,6 +97,15 @@ namespace WebsitePanel.Portal
|
|||
txtBackupsPath.Text = settings["BackupsPath"];
|
||||
}
|
||||
|
||||
// PACKAGE DISPLAY
|
||||
settings = ES.Services.System.GetSystemSettings(
|
||||
WSP.SystemSettings.PACKAGE_DISPLAY_SETTINGS);
|
||||
|
||||
if(settings != null)
|
||||
{
|
||||
chkPackageUsePaging.Checked = Utils.ParseBool(settings[PACKAGE_USE_PAGING], false);
|
||||
txtPackagePackagesPerPage.Text = settings[PACKAGES_PER_PAGE];
|
||||
}
|
||||
|
||||
// WPI
|
||||
settings = ES.Services.System.GetSystemSettings(WSP.SystemSettings.WPI_SETTINGS);
|
||||
|
@ -174,6 +185,18 @@ namespace WebsitePanel.Portal
|
|||
return;
|
||||
}
|
||||
|
||||
settings = new WSP.SystemSettings();
|
||||
settings[PACKAGE_USE_PAGING] = chkPackageUsePaging.Checked.ToString();
|
||||
settings[PACKAGES_PER_PAGE] = txtPackagePackagesPerPage.Text;
|
||||
|
||||
result = ES.Services.System.SetSystemSettings(
|
||||
WSP.SystemSettings.PACKAGE_DISPLAY_SETTINGS, settings);
|
||||
|
||||
if(result < 0) {
|
||||
ShowResultMessage(result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// WPI
|
||||
/*
|
||||
|
|
|
@ -1,31 +1,3 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
@ -139,6 +111,42 @@ namespace WebsitePanel.Portal {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtBackupsPath;
|
||||
|
||||
/// <summary>
|
||||
/// lclPackageDisplaySettings control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel lclPackageDisplaySettings;
|
||||
|
||||
/// <summary>
|
||||
/// PackageDisplaySettings control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel PackageDisplaySettings;
|
||||
|
||||
/// <summary>
|
||||
/// chkPackageUsePaging control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox chkPackageUsePaging;
|
||||
|
||||
/// <summary>
|
||||
/// txtPackagePackagesPerPage control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtPackagePackagesPerPage;
|
||||
|
||||
/// <summary>
|
||||
/// lclWpiSettings control.
|
||||
/// </summary>
|
||||
|
|
|
@ -60,6 +60,14 @@
|
|||
</asp:Panel>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
<asp:Repeater ID="packagePaging" runat="server" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lnkPage" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
|
||||
CssClass='<%# (Convert.ToBoolean(Eval("Enabled"))) ? "pageBlock" : "activePageBlock" %>'
|
||||
OnClick="Page_Changed" OnClientClick='<%# !Convert.ToBoolean(Eval("Enabled")) ? "return false;" : "" %>'>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
<asp:Panel ID="EmptyPackagesList" runat="server" Visible="false" CssClass="FormBody">
|
||||
<asp:Literal ID="litEmptyList" runat="server" EnableViewState="false"></asp:Literal>
|
||||
</asp:Panel>
|
||||
|
|
|
@ -36,6 +36,7 @@ using System.Web.UI;
|
|||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using WSP = WebsitePanel.EnterpriseServer;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using System.Xml;
|
||||
|
@ -47,8 +48,21 @@ namespace WebsitePanel.Portal
|
|||
{
|
||||
XmlNodeList xmlIcons = null;
|
||||
|
||||
bool UsePaging = false;
|
||||
int PackagesPerPage;
|
||||
int currentPage = 1;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// PACKAGE DISPLAY SETTINGS
|
||||
WSP.SystemSettings settings = ES.Services.System.GetSystemSettings(
|
||||
WSP.SystemSettings.PACKAGE_DISPLAY_SETTINGS);
|
||||
if(Utils.ParseBool(settings[SystemSettings.PACKAGE_USE_PAGING], false))
|
||||
{
|
||||
UsePaging = true;
|
||||
PackagesPerPage = Utils.ParseInt(settings[SystemSettings.PACKAGES_PER_PAGE]);
|
||||
}
|
||||
|
||||
// check for user
|
||||
bool isUser = PanelSecurity.SelectedUser.Role == UserRole.User;
|
||||
|
||||
|
@ -59,9 +73,10 @@ namespace WebsitePanel.Portal
|
|||
{
|
||||
// USER
|
||||
UserPackagesPanel.Visible = true;
|
||||
if(!UsePaging)
|
||||
{
|
||||
PackagesList.DataSource = new PackagesHelper().GetMyPackages();
|
||||
PackagesList.DataBind();
|
||||
|
||||
if (PackagesList.Items.Count == 0)
|
||||
{
|
||||
litEmptyList.Text = GetLocalizedString("gvPackages.Empty");
|
||||
|
@ -69,6 +84,15 @@ namespace WebsitePanel.Portal
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!IsPostBack)
|
||||
{
|
||||
ListPackagesWithPaging();
|
||||
packagePaging.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ADMINS, RESELLERS
|
||||
ResellerPackagesPanel.Visible = true;
|
||||
|
@ -223,5 +247,36 @@ namespace WebsitePanel.Portal
|
|||
{
|
||||
return node.Attributes[name] != null ? node.Attributes[name].Value : null;
|
||||
}
|
||||
|
||||
private void ListPackagesWithPaging()
|
||||
{
|
||||
Hashtable ht = new PackagesHelper().GetMyPackages(currentPage, PackagesPerPage);
|
||||
PackagesList.DataSource = ht["DataSet"];
|
||||
PackagesList.DataBind();
|
||||
if(PackagesList.Items.Count == 0) {
|
||||
litEmptyList.Text = GetLocalizedString("gvPackages.Emtpy");
|
||||
EmptyPackagesList.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int pageCount = (int)Math.Ceiling(Convert.ToDecimal(ht["RowCount"]) / Convert.ToDecimal(PackagesPerPage));
|
||||
List<ListItem> pages = new List<ListItem>();
|
||||
if(pageCount > 0)
|
||||
{
|
||||
for(int i = 1; i <= pageCount; i++)
|
||||
{
|
||||
pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
|
||||
}
|
||||
}
|
||||
packagePaging.DataSource = pages;
|
||||
packagePaging.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
public void Page_Changed(Object sender, EventArgs e)
|
||||
{
|
||||
currentPage = Utils.ParseInt(((LinkButton)sender).CommandArgument);
|
||||
ListPackagesWithPaging();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,6 +48,15 @@ namespace WebsitePanel.Portal {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Repeater PackagesList;
|
||||
|
||||
/// <summary>
|
||||
/// packagePaging control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Repeater packagePaging;
|
||||
|
||||
/// <summary>
|
||||
/// EmptyPackagesList control.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue