From 12725bbbf6db75c6ab69acca926f90df5a1d2611 Mon Sep 17 00:00:00 2001 From: Christiaan Swiers Date: Mon, 5 Jan 2015 16:41:30 +0100 Subject: [PATCH 001/108] 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. --- WebsitePanel/Sources/VersionInfo.cs | 30 +------- WebsitePanel/Sources/VersionInfo.vb | 10 +-- .../System/SystemSettings.cs | 3 +- .../App_Themes/Default/Styles/Skin.css | 5 +- .../SystemSettings.ascx.resx | 9 +++ .../Code/Helpers/PackagesHelper.cs | 17 +++++ .../WebsitePanel/SystemSettings.ascx | 16 +++++ .../WebsitePanel/SystemSettings.ascx.cs | 23 +++++++ .../SystemSettings.ascx.designer.cs | 64 +++++++++-------- .../WebsitePanel/UserSpaces.ascx | 8 +++ .../WebsitePanel/UserSpaces.ascx.cs | 69 +++++++++++++++++-- .../WebsitePanel/UserSpaces.ascx.designer.cs | 9 +++ 12 files changed, 192 insertions(+), 71 deletions(-) diff --git a/WebsitePanel/Sources/VersionInfo.cs b/WebsitePanel/Sources/VersionInfo.cs index eafbfbf3..df25dde8 100644 --- a/WebsitePanel/Sources/VersionInfo.cs +++ b/WebsitePanel/Sources/VersionInfo.cs @@ -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. - //------------------------------------------------------------------------------ // // 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. diff --git a/WebsitePanel/Sources/VersionInfo.vb b/WebsitePanel/Sources/VersionInfo.vb index bf02a9da..d14bcc16 100644 --- a/WebsitePanel/Sources/VersionInfo.vb +++ b/WebsitePanel/Sources/VersionInfo.vb @@ -1,7 +1,7 @@ '------------------------------------------------------------------------------ ' ' 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. @@ -15,9 +15,9 @@ Imports System Imports System.Reflection Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices - diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs index 14cd1dfe..5375fd69 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs @@ -43,7 +43,8 @@ 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"; public const string FEED_ULS_KEY = "FeedUrls"; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css index 36f2ac89..dc9bab11 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Skin.css @@ -293,4 +293,7 @@ UL.ActionButtons LI {margin-bottom: 12px;} p.warningText {font-size:14px; color:Red; text-align:center;} .Hidden {display: none;} .LinkText {color:#428bca;} -.WrapText { white-space: normal;} \ No newline at end of file +.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; } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx index d0dd8013..4c601438 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx @@ -162,4 +162,13 @@ (One (1) extension per line) + + Package Display Settings + + + Display packages per page + + + Use paging on package overview + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/PackagesHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/PackagesHelper.cs index a4c7f180..328a1b07 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/PackagesHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/PackagesHelper.cs @@ -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 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; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx index 24542dbe..c222013d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx @@ -41,6 +41,22 @@ + + + + + + + + + + + + +
+
+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs index 151adbf9..e26e82a9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs @@ -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 /* diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs index b5894df1..cb3bf389 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.designer.cs @@ -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. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -139,6 +111,42 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.TextBox txtBackupsPath; + /// + /// lclPackageDisplaySettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel lclPackageDisplaySettings; + + /// + /// PackageDisplaySettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PackageDisplaySettings; + + /// + /// chkPackageUsePaging control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkPackageUsePaging; + + /// + /// txtPackagePackagesPerPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPackagePackagesPerPage; + /// /// lclWpiSettings control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx index de03cce4..67162da1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx @@ -60,6 +60,14 @@ + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.cs index 849ec12e..6ba28a05 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.cs @@ -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; @@ -56,16 +70,26 @@ namespace WebsitePanel.Portal xmlIcons = this.Module.SelectNodes("Group"); if (isUser && xmlIcons != null) - { + { // USER UserPackagesPanel.Visible = true; - PackagesList.DataSource = new PackagesHelper().GetMyPackages(); - PackagesList.DataBind(); - - if (PackagesList.Items.Count == 0) + if(!UsePaging) + { + PackagesList.DataSource = new PackagesHelper().GetMyPackages(); + PackagesList.DataBind(); + if (PackagesList.Items.Count == 0) + { + litEmptyList.Text = GetLocalizedString("gvPackages.Empty"); + EmptyPackagesList.Visible = true; + } + } + else { - litEmptyList.Text = GetLocalizedString("gvPackages.Empty"); - EmptyPackagesList.Visible = true; + if(!IsPostBack) + { + ListPackagesWithPaging(); + packagePaging.Visible = true; + } } } else @@ -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 pages = new List(); + 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(); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.designer.cs index cc9a065a..7b9b8440 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserSpaces.ascx.designer.cs @@ -48,6 +48,15 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.Repeater PackagesList; + /// + /// packagePaging control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater packagePaging; + /// /// EmptyPackagesList control. /// From c32aafcaac0d002487b40859a631d86e3f488603 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 6 Jan 2015 05:58:18 -0800 Subject: [PATCH 002/108] Domain expiration sub domain fix --- .../SchedulerTasks/DomainExpirationTask.cs | 13 ++++++------- .../Servers/ServerController.cs | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs index b6c9c613..5ca21217 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2015, Outercurve Foundation. +// Copyright (c) 2015, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -57,7 +57,7 @@ namespace WebsitePanel.EnterpriseServer { BackgroundTask topTask = TaskManager.TopTask; var domainUsers = new Dictionary(); - var checkedDomains = new List(); + var checkedDomains = new List(); var expiredDomains = new List(); var nonExistenDomains = new List(); var allDomains = new List(); @@ -101,12 +101,12 @@ namespace WebsitePanel.EnterpriseServer foreach (var domain in domains) { - if (checkedDomains.Contains(domain.DomainId)) + if (checkedDomains.Any(x=> x.DomainId == domain.DomainId)) { continue; } - checkedDomains.Add(domain.DomainId); + checkedDomains.Add(domain); ServerController.UpdateDomainWhoisData(domain); @@ -124,12 +124,11 @@ namespace WebsitePanel.EnterpriseServer } } - var subDomains = allDomains.Where(x => x.ExpirationDate == null || CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); - allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); + var subDomains = allDomains.Where(x => !checkedDomains.Any(z => z.DomainId == x.DomainId)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); foreach (var subDomain in subDomains) { - var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; + var mainDomain = checkedDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; if (mainDomain != null) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs index d0d17ade..c9aec104 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs @@ -2709,6 +2709,7 @@ namespace WebsitePanel.EnterpriseServer domain.CreationDate = ParseDate(creationDateString); domain.ExpirationDate = ParseDate(expirationDateString); domain.RegistrarName = ParseWhoisDomainInfo(whoisResult.Raw, _registrarNamePatterns); + domain.LastUpdateDate = DateTime.Now; DataProvider.UpdateWhoisDomainInfo(domain.DomainId, domain.CreationDate, domain.ExpirationDate, DateTime.Now, domain.RegistrarName); } @@ -2727,6 +2728,7 @@ namespace WebsitePanel.EnterpriseServer domain.CreationDate = creationDate; domain.ExpirationDate = expirationDate; domain.RegistrarName = registrarName; + domain.LastUpdateDate = DateTime.Now; return domain; } From 8f31f63054df3778ec73978a12fbee2f43ccee1c Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 6 Jan 2015 06:17:11 -0800 Subject: [PATCH 003/108] Domain expiration task subdomains fix --- .../SchedulerTasks/DomainExpirationTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs index 5ca21217..be4f50a3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -124,7 +124,7 @@ namespace WebsitePanel.EnterpriseServer } } - var subDomains = allDomains.Where(x => !checkedDomains.Any(z => z.DomainId == x.DomainId)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); + var subDomains = allDomains.Where(x => !checkedDomains.Any(z => z.DomainId == x.DomainId && z.ExpirationDate != null)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); foreach (var subDomain in subDomains) { From 9a3609fcbcd4a5505705d56bcf9aa846035de5cf Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 7 Jan 2015 08:50:45 -0500 Subject: [PATCH 004/108] Added tag build-2.1.0.525 for changeset 522b3e8c5ceb From 2ec10f698830563da1d566e4711331b79a9a9e5c Mon Sep 17 00:00:00 2001 From: "a.skorina" Date: Fri, 9 Jan 2015 11:48:38 +0300 Subject: [PATCH 005/108] webdav portal web.config file added to ignore --- .../Config/Entities/ElementsRendering.cs | 7 ++++++- .../Controllers/FileSystemController.cs | 3 ++- WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config | 2 +- .../WebConfigSections/ElementsRenderingElement.cs | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ElementsRendering.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ElementsRendering.cs index 04a1105d..c5703a8a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ElementsRendering.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ElementsRendering.cs @@ -1,14 +1,19 @@ -namespace WebsitePanel.WebDavPortal.Config.Entities +using System.Collections.Generic; +using System.Linq; + +namespace WebsitePanel.WebDavPortal.Config.Entities { public class ElementsRendering : AbstractConfigCollection { public int DefaultCount { get; private set; } public int AddElementsCount { get; private set; } + public List ElementsToIgnore { get; private set; } public ElementsRendering() { DefaultCount = ConfigSection.ElementsRendering.DefaultCount; AddElementsCount = ConfigSection.ElementsRendering.AddElementsCount; + ElementsToIgnore = ConfigSection.ElementsRendering.ElementsToIgnore.Split(',').ToList(); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs index c8d77ab4..482a1fea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -41,7 +41,8 @@ namespace WebsitePanel.WebDavPortal.Controllers try { webDavManager.OpenFolder(pathPart); - IEnumerable children = webDavManager.GetChildren(); + IEnumerable children = webDavManager.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/'))); + var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart }; Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config index 8fdb594d..c45fcad6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config @@ -24,7 +24,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/ElementsRenderingElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/ElementsRenderingElement.cs index 996d4a30..a5a9a6ce 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/ElementsRenderingElement.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/ElementsRenderingElement.cs @@ -6,6 +6,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections { private const string DefaultCountKey = "defaultCount"; private const string AddElementsCountKey = "addElementsCount"; + private const string ElementsToIgnoreKey = "elementsToIgnoreKey"; [ConfigurationProperty(DefaultCountKey, IsKey = true, IsRequired = true, DefaultValue = 30)] public int DefaultCount @@ -20,5 +21,12 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections get { return (int)this[AddElementsCountKey]; } set { this[AddElementsCountKey] = value; } } + + [ConfigurationProperty(ElementsToIgnoreKey, IsKey = true, IsRequired = true, DefaultValue = "")] + public string ElementsToIgnore + { + get { return (string)this[ElementsToIgnoreKey]; } + set { this[ElementsToIgnoreKey] = value; } + } } } \ No newline at end of file From e4785dabca2533e36630fb23de1bc6d545fafae0 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 9 Jan 2015 04:52:51 -0800 Subject: [PATCH 006/108] webdav portal group permission fix added logout button --- .../App_Start/RouteConfig.cs | 13 +++++++++++++ .../WebsitePanel.WebDavPortal/Content/Site.css | 15 ++++++++++++++- .../Controllers/AccountController.cs | 13 ++++++++++++- .../Models/AccountModel.cs | 6 +++++- .../Models/WebDavManager.cs | 16 ++++++++++++---- .../UI/Routes/AccountRouteNames.cs | 13 +++++++++++++ .../Views/Shared/_Layout.cshtml | 6 ++++-- .../WebsitePanel.WebDavPortal.csproj | 2 ++ 8 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebDavPortal/UI/Routes/AccountRouteNames.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs index c7b92062..3316d657 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs @@ -1,5 +1,6 @@ using System.Web.Mvc; using System.Web.Routing; +using WebsitePanel.WebDavPortal.UI.Routes; namespace WebsitePanel.WebDavPortal { @@ -9,6 +10,18 @@ namespace WebsitePanel.WebDavPortal { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + routes.MapRoute( + name: AccountRouteNames.Logout, + url: "account/logout", + defaults: new { controller = "Account", action = "Logout" } + ); + + routes.MapRoute( + name: AccountRouteNames.Login, + url: "account/login", + defaults: new { controller = "Account", action = "Login" } + ); + routes.MapRoute( name: "Office365DocumentRoute", url: "office365/{org}/{*pathPart}", diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index 20e5c6b1..2389aea4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -32,4 +32,17 @@ textarea { color: red; font-weight: bold; padding-top: 5px; - } \ No newline at end of file + } + +#username { + display:inline-block; +} + +#logout { + font-size: 1.2em; + color: #9d9d9d; +} + +#logout :hover { + color: white; +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs index 242cd617..b95f91d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs @@ -22,6 +22,7 @@ using WebsitePanel.WebDavPortal.Models; using System.Collections.Generic; using WebsitePanel.Providers.OS; using WebDAV; +using WebsitePanel.WebDavPortal.UI.Routes; namespace WebsitePanel.WebDavPortal.Controllers { @@ -50,7 +51,9 @@ namespace WebsitePanel.WebDavPortal.Controllers if (isAuthenticated) { Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = exchangeAccount.ItemId; - + + model.Groups = ES.Services.Organizations.GetSecurityGroupsByMember(exchangeAccount.ItemId, exchangeAccount.AccountId); + try { Session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] = model; @@ -65,6 +68,14 @@ namespace WebsitePanel.WebDavPortal.Controllers return View(new AccountModel { LdapError = "The user name or password is incorrect" }); } + [HttpGet] + public ActionResult Logout() + { + Session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] = null; + + return RedirectToRoute(AccountRouteNames.Login); + } + private void AutheticationToServicesUsingWebsitePanelUser() { var crypto = _kernel.Get(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/AccountModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/AccountModel.cs index 72956e73..2ad1e6a8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/AccountModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/AccountModel.cs @@ -1,4 +1,6 @@ -using System.ComponentModel.DataAnnotations; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using WebsitePanel.Providers.HostedSolution; namespace WebsitePanel.WebDavPortal.Models { @@ -21,6 +23,8 @@ namespace WebsitePanel.WebDavPortal.Models } } + public IEnumerable Groups { get; set; } + public string LdapError { get; set; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/WebDavManager.cs index 05f578d8..319a54bb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/WebDavManager.cs @@ -40,7 +40,7 @@ namespace WebsitePanel.WebDavPortal.Models _itemId = itemId; IKernel _kernel = new StandardKernel(new NinjectSettings { AllowNullInjection = true }, new WebDavExplorerAppModule()); var accountModel = _kernel.Get(); - _rootFolders = ConnectToWebDavServer(accountModel.UserName); + _rootFolders = ConnectToWebDavServer(accountModel); if (_rootFolders.Any()) { @@ -126,14 +126,22 @@ namespace WebsitePanel.WebDavPortal.Models } } - private IList ConnectToWebDavServer(string userName) + private IList ConnectToWebDavServer(AccountModel user) { var rootFolders = new List(); foreach (var folder in ES.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId)) { var permissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name); - if (permissions.Any(x => x.DisplayName == userName)) - rootFolders.Add(folder); + + foreach (var permission in permissions) + { + if ((!permission.IsGroup && permission.DisplayName == user.UserName) + || (permission.IsGroup && user.Groups.Any(x=> x.DisplayName == permission.DisplayName))) + { + rootFolders.Add(folder); + break; + } + } } return rootFolders; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/UI/Routes/AccountRouteNames.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/UI/Routes/AccountRouteNames.cs new file mode 100644 index 00000000..035fde95 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/UI/Routes/AccountRouteNames.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebsitePanel.WebDavPortal.UI.Routes +{ + public class AccountRouteNames + { + public const string Logout = "AccountLogout"; + public const string Login = "AccountLogin"; + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml index 6162ed3a..a03b50f7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml @@ -2,6 +2,7 @@ @using WebsitePanel.WebDavPortal.Config @using WebsitePanel.WebDavPortal.DependencyInjection @using WebsitePanel.WebDavPortal.Models +@using WebsitePanel.WebDavPortal.UI.Routes; @@ -28,9 +29,10 @@ var account = kernel.Get(); if (account != null) { - + + } - } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj index 5b2ea9ec..f49ff0d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj @@ -179,6 +179,7 @@ + @@ -289,6 +290,7 @@ GlobalResourceProxyGenerator Resource.errors.designer.cs + Designer From 6e6b2abd8a82b399cf48ea8a1c301143ac32174c Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 9 Jan 2015 23:29:10 -0800 Subject: [PATCH 007/108] webdav portal home link added to logo --- .../WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs | 8 ++++++-- .../WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml | 2 +- .../WebsitePanel.WebDavPortal.csproj | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs index 3316d657..65491262 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs @@ -10,6 +10,8 @@ namespace WebsitePanel.WebDavPortal { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + #region Account + routes.MapRoute( name: AccountRouteNames.Logout, url: "account/logout", @@ -20,7 +22,9 @@ namespace WebsitePanel.WebDavPortal name: AccountRouteNames.Login, url: "account/login", defaults: new { controller = "Account", action = "Login" } - ); + ); + + #endregion routes.MapRoute( name: "Office365DocumentRoute", @@ -29,7 +33,7 @@ namespace WebsitePanel.WebDavPortal ); routes.MapRoute( - name: "FilePathRoute", + name: FileSystemRouteNames.FilePath, url: "{org}/{*pathPart}", defaults: new { controller = "FileSystem", action = "ShowContent", pathPart = UrlParameter.Optional }, constraints: new { org = new WebsitePanel.WebDavPortal.Constraints.OrganizationRouteConstraint() } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml index a03b50f7..323bb3a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Shared/_Layout.cshtml @@ -21,7 +21,7 @@ - @Html.ActionLink(WebDavAppConfigManager.Instance.ApplicationName, "Login", "Account", new { area = "" }, new { @class = "navbar-brand" }) + @Html.RouteLink(WebDavAppConfigManager.Instance.ApplicationName, FileSystemRouteNames.FilePath, new { pathPart = string.Empty }, new { @class = "navbar-brand" })