From 33e862d4a8811173dd5e67c271b344e1fa912869 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 27 Feb 2015 14:35:52 -0500 Subject: [PATCH 01/55] Added tag build-2.1.0.597 for changeset 976df1a41021 From d611121564dc514f121b523369beca2e7de2d14d Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Sun, 1 Mar 2015 17:58:41 +0100 Subject: [PATCH 02/55] Fix for allowing all chars to be used when generating random password --- .../DesktopModules/WebsitePanel/Scripts/RandomPassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js index f34f443f..57c95fa3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Scripts/RandomPassword.js @@ -65,7 +65,7 @@ function nchar(num) { function getRandomChars(_charsRange, _length, _target) { var _arr = []; var l1 = _charsRange[0]; - var rest = _charsRange[1] - _charsRange[0]; + var rest = _charsRange[1] - _charsRange[0] + 1; // while (_arr.length < _length) { var charCode = Math.floor(Math.random() * rest); From eb50917965715eb1a11017211fa1c583eae3a4bb Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sun, 1 Mar 2015 12:15:45 -0500 Subject: [PATCH 03/55] Added tag build-2.1.0.598 for changeset ddb349e1b083 From e717a1578156faf991f49fb2409ec4e9e158500d Mon Sep 17 00:00:00 2001 From: me Date: Mon, 2 Mar 2015 13:55:12 +0400 Subject: [PATCH 04/55] fix typo for wsp-10317 Add enable\disable users ability for smart mail integration + multi-actions --- .../SmarterMail100_EditForwarding .ascx | 1 - .../SmarterMail100_EditForwarding.ascx | 1 + ... .ascx.cs => SmarterMail100_EditForwarding.ascx.cs} | 0 ... => SmarterMail100_EditForwarding.ascx.designer.cs} | 0 .../WebsitePanel/WebsitePanel.Portal.Modules.csproj | 10 +++++----- 5 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/{SmarterMail100_EditForwarding .ascx.cs => SmarterMail100_EditForwarding.ascx.cs} (100%) rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/{SmarterMail100_EditForwarding .ascx.designer.cs => SmarterMail100_EditForwarding.ascx.designer.cs} (100%) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx deleted file mode 100644 index b54ae91c..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx +++ /dev/null @@ -1 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SmarterMail100_EditForwarding .ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.SmarterMail100_EditForwarding" %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx new file mode 100644 index 00000000..c882fc85 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx @@ -0,0 +1 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SmarterMail100_EditForwarding.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.SmarterMail100_EditForwarding" %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx.cs similarity index 100% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx.cs rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx.designer.cs similarity index 100% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding .ascx.designer.cs rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/SmarterMail100_EditForwarding.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index e5fa35b0..c3f7651c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -264,12 +264,12 @@ SmarterMail100_EditDomain_Throttling.ascx - - SmarterMail100_EditForwarding .ascx + + SmarterMail100_EditForwarding.ascx ASPXCodeBehind - - SmarterMail100_EditForwarding .ascx + + SmarterMail100_EditForwarding.ascx SmarterMail100_EditGroup.ascx @@ -4461,7 +4461,7 @@ - + From 6bf818f1d8680ef958af3df9ab1281ca039b9929 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 2 Mar 2015 02:11:38 -0800 Subject: [PATCH 05/55] web portal es tab view added --- WebsitePanel/Database/update_db.sql | 144 ++++++++ .../EnterpriseStorageProxy.cs | 320 ++++++++++++++++++ .../Data/DataProvider.cs | 63 ++++ .../EnterpriseStorageController.cs | 154 +++++++++ .../esEnterpriseStorage.asmx.cs | 30 ++ .../Config/Entities/SessionKeysCollection.cs | 10 + .../WebConfigSections/SessionKeysElement.cs | 1 + .../Owa/WopiServer.cs | 4 +- .../Authorization/Enums/WebDavPermissions.cs | 4 +- .../WebDavAuthorizationService.cs | 48 +++ .../Controllers/FileSystemController.cs | 2 +- .../WebsitePanel.WebDavPortal/Web.config | 1 + .../ESModule_ControlsHierarchy.config | 1 + .../App_Data/WebsitePanel_Modules.config | 3 + ...riseStorageFolderGeneralSettings.ascx.resx | 3 + ...eFolderSettingsFolderPermissions.ascx.resx | 135 ++++++++ ...eStorageFolderSettingsOwaEditing.ascx.resx | 135 ++++++++ ...nterpriseStorageFolderGeneralSettings.ascx | 107 +++--- ...rpriseStorageFolderGeneralSettings.ascx.cs | 7 +- ...rageFolderGeneralSettings.ascx.designer.cs | 82 ++--- ...torageFolderSettingsFolderPermissions.ascx | 55 +++ ...ageFolderSettingsFolderPermissions.ascx.cs | 86 +++++ ...SettingsFolderPermissions.ascx.designer.cs | 132 ++++++++ ...rpriseStorageFolderSettingsOwaEditing.ascx | 54 +++ ...iseStorageFolderSettingsOwaEditing.ascx.cs | 80 +++++ ...eFolderSettingsOwaEditing.ascx.designer.cs | 132 ++++++++ .../EnterpriseStorageEditFolderTabs.ascx.resx | 129 +++++++ .../EnterpriseStorageOwaUsersList.ascx.resx | 156 +++++++++ .../EnterpriseStorageEditFolderTabs.ascx | 31 ++ .../EnterpriseStorageEditFolderTabs.ascx.cs | 52 +++ ...riseStorageEditFolderTabs.ascx.designer.cs | 24 ++ .../EnterpriseStorageOwaUsersList.ascx | 114 +++++++ .../EnterpriseStorageOwaUsersList.ascx.cs | 214 ++++++++++++ ...rpriseStorageOwaUsersList.ascx.designer.cs | 159 +++++++++ .../WebsitePanel.Portal.Modules.csproj | 36 ++ 35 files changed, 2592 insertions(+), 116 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 54df0493..270e1dcc 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -8729,3 +8729,147 @@ AND SI.ItemName = @ItemName AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupName)) RETURN GO + + +--ES OWA Editing +IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'EnterpriseFoldersOwaPermissions') +CREATE TABLE EnterpriseFoldersOwaPermissions +( + ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, + ItemID INT NOT NULL, + FolderID INT NOT NULL, + AccountID INT NOT NULL +) +GO + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_EnterpriseFoldersOwaPermissions_AccountId') +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] +DROP CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_AccountId] +GO + +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] WITH CHECK ADD CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_AccountId] FOREIGN KEY([AccountID]) +REFERENCES [dbo].[ExchangeAccounts] ([AccountID]) +ON DELETE CASCADE +GO + +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_EnterpriseFoldersOwaPermissions_FolderId') +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] +DROP CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_FolderId] +GO + +ALTER TABLE [dbo].[EnterpriseFoldersOwaPermissions] WITH CHECK ADD CONSTRAINT [FK_EnterpriseFoldersOwaPermissions_FolderId] FOREIGN KEY([FolderID]) +REFERENCES [dbo].[EnterpriseFolders] ([EnterpriseFolderID]) +ON DELETE CASCADE +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteAllEnterpriseFolderOwaUsers') +DROP PROCEDURE DeleteAllEnterpriseFolderOwaUsers +GO +CREATE PROCEDURE [dbo].[DeleteAllEnterpriseFolderOwaUsers] +( + @ItemID int, + @FolderID int +) +AS +DELETE FROM EnterpriseFoldersOwaPermissions +WHERE ItemId = @ItemID AND FolderID = @FolderID +GO + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddEnterpriseFolderOwaUser') +DROP PROCEDURE AddEnterpriseFolderOwaUser +GO +CREATE PROCEDURE [dbo].[AddEnterpriseFolderOwaUser] +( + @ESOwsaUserId INT OUTPUT, + @ItemID INT, + @FolderID INT, + @AccountID INT +) +AS +INSERT INTO EnterpriseFoldersOwaPermissions +( + ItemID , + FolderID, + AccountID +) +VALUES +( + @ItemID, + @FolderID, + @AccountID +) + +SET @ESOwsaUserId = SCOPE_IDENTITY() + +RETURN +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetEnterpriseFolderOwaUsers') +DROP PROCEDURE GetEnterpriseFolderOwaUsers +GO +CREATE PROCEDURE [dbo].[GetEnterpriseFolderOwaUsers] +( + @ItemID INT, + @FolderID INT +) +AS +SELECT + EA.AccountID, + EA.ItemID, + EA.AccountType, + EA.AccountName, + EA.DisplayName, + EA.PrimaryEmailAddress, + EA.MailEnabledPublicFolder, + EA.MailboxPlanId, + EA.SubscriberNumber, + EA.UserPrincipalName + FROM EnterpriseFoldersOwaPermissions AS EFOP + LEFT JOIN ExchangeAccounts AS EA ON EA.AccountID = EFOP.AccountID + WHERE EFOP.ItemID = @ItemID AND EFOP.FolderID = @FolderID +GO + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetEnterpriseFolderId') +DROP PROCEDURE GetEnterpriseFolderId +GO +CREATE PROCEDURE [dbo].[GetEnterpriseFolderId] +( + @ItemID INT, + @FolderName varchar(max) +) +AS +SELECT TOP 1 + EnterpriseFolderID + FROM EnterpriseFolders + WHERE ItemId = @ItemID AND FolderName = @FolderName +GO + + + + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetUserEnterpriseFolderWithOwaEditPermission') +DROP PROCEDURE GetUserEnterpriseFolderWithOwaEditPermission +GO +CREATE PROCEDURE [dbo].[GetUserEnterpriseFolderWithOwaEditPermission] +( + @ItemID INT, + @AccountID INT +) +AS +SELECT + EF.FolderName + FROM EnterpriseFoldersOwaPermissions AS EFOP + LEFT JOIN [dbo].[EnterpriseFolders] AS EF ON EF.EnterpriseFolderID = EFOP.FolderID + WHERE EFOP.ItemID = @ItemID AND EFOP.AccountID = @AccountID +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs index 87682b0f..ef29192f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs @@ -81,6 +81,16 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SetEnterpriseFolderSettingsOperationCompleted; + private System.Threading.SendOrPostCallback SetEnterpriseFolderGeneralSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback SetEnterpriseFolderPermissionSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback GetFolderOwaAccountsOperationCompleted; + + private System.Threading.SendOrPostCallback SetFolderOwaAccountsOperationCompleted; + + private System.Threading.SendOrPostCallback GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted; + private System.Threading.SendOrPostCallback GetStatisticsOperationCompleted; private System.Threading.SendOrPostCallback GetStatisticsByOrganizationOperationCompleted; @@ -169,6 +179,21 @@ namespace WebsitePanel.EnterpriseServer { /// public event SetEnterpriseFolderSettingsCompletedEventHandler SetEnterpriseFolderSettingsCompleted; + /// + public event SetEnterpriseFolderGeneralSettingsCompletedEventHandler SetEnterpriseFolderGeneralSettingsCompleted; + + /// + public event SetEnterpriseFolderPermissionSettingsCompletedEventHandler SetEnterpriseFolderPermissionSettingsCompleted; + + /// + public event GetFolderOwaAccountsCompletedEventHandler GetFolderOwaAccountsCompleted; + + /// + public event SetFolderOwaAccountsCompletedEventHandler SetFolderOwaAccountsCompleted; + + /// + public event GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler GetUserEnterpriseFolderWithOwaEditPermissionCompleted; + /// public event GetStatisticsCompletedEventHandler GetStatisticsCompleted; @@ -1223,6 +1248,237 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderGeneralSettings", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { + this.Invoke("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}); + } + + /// + public System.IAsyncResult BeginSetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}, callback, asyncState); + } + + /// + public void EndSetEnterpriseFolderGeneralSettings(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { + this.SetEnterpriseFolderGeneralSettingsAsync(itemId, folder, directoyBrowsingEnabled, quota, quotaType, null); + } + + /// + public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, object userState) { + if ((this.SetEnterpriseFolderGeneralSettingsOperationCompleted == null)) { + this.SetEnterpriseFolderGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderGeneralSettingsOperationCompleted); + } + this.InvokeAsync("SetEnterpriseFolderGeneralSettings", new object[] { + itemId, + folder, + directoyBrowsingEnabled, + quota, + quotaType}, this.SetEnterpriseFolderGeneralSettingsOperationCompleted, userState); + } + + private void OnSetEnterpriseFolderGeneralSettingsOperationCompleted(object arg) { + if ((this.SetEnterpriseFolderGeneralSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetEnterpriseFolderGeneralSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderPermissionSetting" + + "s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) { + this.Invoke("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}); + } + + /// + public System.IAsyncResult BeginSetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}, callback, asyncState); + } + + /// + public void EndSetEnterpriseFolderPermissionSettings(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions) { + this.SetEnterpriseFolderPermissionSettingsAsync(itemId, folder, permissions, null); + } + + /// + public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions, object userState) { + if ((this.SetEnterpriseFolderPermissionSettingsOperationCompleted == null)) { + this.SetEnterpriseFolderPermissionSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderPermissionSettingsOperationCompleted); + } + this.InvokeAsync("SetEnterpriseFolderPermissionSettings", new object[] { + itemId, + folder, + permissions}, this.SetEnterpriseFolderPermissionSettingsOperationCompleted, userState); + } + + private void OnSetEnterpriseFolderPermissionSettingsOperationCompleted(object arg) { + if ((this.SetEnterpriseFolderPermissionSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetEnterpriseFolderPermissionSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFolderOwaAccounts", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder) { + object[] results = this.Invoke("GetFolderOwaAccounts", new object[] { + itemId, + folder}); + return ((OrganizationUser[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetFolderOwaAccounts(int itemId, SystemFile folder, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetFolderOwaAccounts", new object[] { + itemId, + folder}, callback, asyncState); + } + + /// + public OrganizationUser[] EndGetFolderOwaAccounts(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((OrganizationUser[])(results[0])); + } + + /// + public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder) { + this.GetFolderOwaAccountsAsync(itemId, folder, null); + } + + /// + public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder, object userState) { + if ((this.GetFolderOwaAccountsOperationCompleted == null)) { + this.GetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFolderOwaAccountsOperationCompleted); + } + this.InvokeAsync("GetFolderOwaAccounts", new object[] { + itemId, + folder}, this.GetFolderOwaAccountsOperationCompleted, userState); + } + + private void OnGetFolderOwaAccountsOperationCompleted(object arg) { + if ((this.GetFolderOwaAccountsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetFolderOwaAccountsCompleted(this, new GetFolderOwaAccountsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetFolderOwaAccounts", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users) { + this.Invoke("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}); + } + + /// + public System.IAsyncResult BeginSetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}, callback, asyncState); + } + + /// + public void EndSetFolderOwaAccounts(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users) { + this.SetFolderOwaAccountsAsync(itemId, folder, users, null); + } + + /// + public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users, object userState) { + if ((this.SetFolderOwaAccountsOperationCompleted == null)) { + this.SetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetFolderOwaAccountsOperationCompleted); + } + this.InvokeAsync("SetFolderOwaAccounts", new object[] { + itemId, + folder, + users}, this.SetFolderOwaAccountsOperationCompleted, userState); + } + + private void OnSetFolderOwaAccountsOperationCompleted(object arg) { + if ((this.SetFolderOwaAccountsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetFolderOwaAccountsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetUserEnterpriseFolderWithOwaEditPe" + + "rmission", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds) { + object[] results = this.Invoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}); + return ((string[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}, callback, asyncState); + } + + /// + public string[] EndGetUserEnterpriseFolderWithOwaEditPermission(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string[])(results[0])); + } + + /// + public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds) { + this.GetUserEnterpriseFolderWithOwaEditPermissionAsync(itemId, accountIds, null); + } + + /// + public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds, object userState) { + if ((this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted == null)) { + this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted); + } + this.InvokeAsync("GetUserEnterpriseFolderWithOwaEditPermission", new object[] { + itemId, + accountIds}, this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted, userState); + } + + private void OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted(object arg) { + if ((this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted(this, new GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetStatistics", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public OrganizationStatistics GetStatistics(int itemId) { @@ -2053,6 +2309,70 @@ namespace WebsitePanel.EnterpriseServer { [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void SetEnterpriseFolderSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetEnterpriseFolderGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetEnterpriseFolderPermissionSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetFolderOwaAccountsCompletedEventHandler(object sender, GetFolderOwaAccountsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetFolderOwaAccountsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetFolderOwaAccountsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public OrganizationUser[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((OrganizationUser[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetFolderOwaAccountsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler(object sender, GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetStatisticsCompletedEventHandler(object sender, GetStatisticsCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 1d903a9c..49501ef1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -4543,6 +4543,69 @@ namespace WebsitePanel.EnterpriseServer ); } + public static void DeleteAllEnterpriseFolderOwaUsers(int itemId, int folderId) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteAllEnterpriseFolderOwaUsers", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId) + ); + } + + public static int AddEnterpriseFolderOwaUser(int itemId, int folderId, int accountId) + { + SqlParameter id = new SqlParameter("@ESOwsaUserId", SqlDbType.Int); + id.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddEnterpriseFolderOwaUser", + id, + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId), + new SqlParameter("@AccountId", accountId) + ); + + // read identity + return Convert.ToInt32(id.Value); + } + + public static IDataReader GetEnterpriseFolderOwaUsers(int itemId, int folderId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetEnterpriseFolderOwaUsers", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderID", folderId) + ); + } + + public static IDataReader GetEnterpriseFolderId(int itemId, string folderName) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetEnterpriseFolderId", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@FolderName", folderName) + ); + } + + public static IDataReader GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int accountId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetUserEnterpriseFolderWithOwaEditPermission", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@AccountID", accountId) + ); + } + #endregion #region Support Service Levels diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index d7fbc832..6402a7b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -152,6 +152,16 @@ namespace WebsitePanel.EnterpriseServer StartESBackgroundTaskInternal("SET_ENTERPRISE_FOLDER_SETTINGS", itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType); } + public static void SetESGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + SetESGeneralSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, directoyBrowsingEnabled, quota, quotaType); + } + + public static void SetESFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) + { + SetESFolderPermissionSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, permissions); + } + public static int AddWebDavAccessToken(WebDavAccessToken accessToken) { return DataProvider.AddWebDavAccessToken(accessToken); @@ -257,6 +267,69 @@ namespace WebsitePanel.EnterpriseServer return rootFolders; } + protected static void SetESGeneralSettingsInternal(string taskName, int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + // load organization + var org = OrganizationController.GetOrganization(itemId); + + try + { + TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId); + + EnterpriseStorageController.SetFRSMQuotaOnFolder(itemId, folder.Name, quota, quotaType); + EnterpriseStorageController.SetDirectoryBrowseEnabled(itemId, folder.Url, directoyBrowsingEnabled); + } + catch (Exception ex) + { + // log error + TaskManager.WriteError(ex, "Error executing enterprise storage background task"); + } + finally + { + // complete task + try + { + TaskManager.CompleteTask(); + } + catch (Exception) + { + } + } + } + + protected static void SetESFolderPermissionSettingsInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions) + { + // load organization + var org = OrganizationController.GetOrganization(itemId); + + new Thread(() => + { + try + { + TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId); + + EnterpriseStorageController.SetFolderPermission(itemId, folder.Name, permissions); + } + catch (Exception ex) + { + // log error + TaskManager.WriteError(ex, "Error executing enterprise storage background task"); + } + finally + { + // complete task + try + { + TaskManager.CompleteTask(); + } + catch (Exception) + { + } + } + + }).Start(); + } + protected static void StartESBackgroundTaskInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) { // load organization @@ -1265,6 +1338,87 @@ namespace WebsitePanel.EnterpriseServer return null; } + public static OrganizationUser[] GetFolderOwaAccounts(int itemId, string folderName) + { + try + { + var folderId = GetFolderId(itemId, folderName); + + var users = ObjectUtils.CreateListFromDataReader(DataProvider.GetEnterpriseFolderOwaUsers(itemId, folderId)); + + return users.ToArray(); + } + catch (Exception ex) + { + throw ex; + } + } + + public static void SetFolderOwaAccounts(int itemId, string folderName, OrganizationUser[] users) + { + try + { + var folderId = GetFolderId(itemId, folderName); + + DataProvider.DeleteAllEnterpriseFolderOwaUsers(itemId, folderId); + + foreach (var user in users) + { + DataProvider.AddEnterpriseFolderOwaUser(itemId, folderId, user.AccountId); + } + } + catch (Exception ex) + { + throw ex; + } + } + + protected static int GetFolderId(int itemId, string folderName) + { + try + { + GetFolder(itemId, folderName); + + var dataReader = DataProvider.GetEnterpriseFolderId(itemId, folderName); + + while (dataReader.Read()) + { + return (int)dataReader[0]; + } + + return -1; + } + catch (Exception ex) + { + throw ex; + } + } + + public static List GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List accountIds) + { + try + { + var result = new List(); + + + foreach (var accountId in accountIds) + { + var reader = DataProvider.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountId); + + while (reader.Read()) + { + result.Add(Convert.ToString(reader["FolderName"])); + } + } + + return result.Distinct().ToList(); + } + catch (Exception ex) + { + throw ex; + } + } + #region WebDav portal public static string GetWebDavPortalUserSettingsByAccountId(int accountId) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs index 6668b40b..f5ba338b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs @@ -196,6 +196,36 @@ namespace WebsitePanel.EnterpriseServer EnterpriseStorageController.StartSetEnterpriseFolderSettingsBackgroundTask(itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType); } + [WebMethod] + public void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) + { + EnterpriseStorageController.SetESGeneralSettings(itemId, folder, directoyBrowsingEnabled, quota, quotaType); + } + + [WebMethod] + public void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) + { + EnterpriseStorageController.SetESFolderPermissionSettings(itemId, folder, permissions); + } + + [WebMethod] + public OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder) + { + return EnterpriseStorageController.GetFolderOwaAccounts(itemId, folder.Name); + } + + [WebMethod] + public void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users) + { + EnterpriseStorageController.SetFolderOwaAccounts(itemId, folder.Name, users); + } + + [WebMethod] + public List GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List accountIds) + { + return EnterpriseStorageController.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountIds); + } + #endregion #region Statistics diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs index f9337401..1a45b059 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/Entities/SessionKeysCollection.cs @@ -45,6 +45,16 @@ namespace WebsitePanel.WebDav.Core.Config.Entities } } + public string OwaEditFoldersSessionKey + { + get + { + SessionKeysElement sessionKey = + _sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.OwaEditFoldersSessionKey); + return sessionKey != null ? sessionKey.Value : null; + } + } + public string WebDavRootFoldersPermissions { get diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs index ca2a44fd..76a0e7e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Config/WebConfigSections/SessionKeysElement.cs @@ -14,6 +14,7 @@ namespace WebsitePanel.WebDav.Core.Config.WebConfigSections public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey"; public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey"; public const string ItemIdSessionKey = "ItemId"; + public const string OwaEditFoldersSessionKey = "OwaEditFoldersSession"; [ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)] public string Key diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs index 547f930c..dada9bab 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Owa/WopiServer.cs @@ -34,7 +34,9 @@ namespace WebsitePanel.WebDav.Core.Owa { var resource = _webDavManager.GetResource(path); - var readOnly = _webDavAuthorizationService.GetPermissions(WspContext.User, path).HasFlag(WebDavPermissions.Write) == false; + var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, path); + + var readOnly = permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false; var cFileInfo = new CheckFileInfo { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs index b3c9a52e..dd25dc50 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/Enums/WebDavPermissions.cs @@ -8,6 +8,8 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization.Enums Empty = 0, None = 1, Read = 2, - Write = 4 + Write = 4, + OwaRead = 8, + OwaEdit = 16 } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs index f0c285f3..d3fe710c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Security/Authorization/WebDavAuthorizationService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; +using Cobalt; using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.WebDav.Core.Config; @@ -54,6 +55,17 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization } } + var owaEditFolders = GetOwaFoldersWithEditPermission(principal); + + if (owaEditFolders.Contains(rootFolder)) + { + resultPermissions |= WebDavPermissions.OwaEdit; + } + else + { + resultPermissions |= WebDavPermissions.OwaRead; + } + return resultPermissions; } @@ -105,5 +117,41 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization return groups ?? new ExchangeAccount[0]; } + + private IEnumerable GetOwaFoldersWithEditPermission(WspPrincipal principal) + { + var folders = HttpContext.Current.Session != null ? HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] as IEnumerable : null; + + if (folders != null) + { + return folders; + } + + var accountsIds = new List(); + + accountsIds.Add(principal.AccountId); + + var groups = GetUserSecurityGroups(principal); + + accountsIds.AddRange(groups.Select(x=>x.AccountId)); + + try + { + folders = WspContext.Services.EnterpriseStorage.GetUserEnterpriseFolderWithOwaEditPermission(principal.ItemId, accountsIds.ToArray()); + } + catch (Exception) + { + //TODO remove try catch when es &portal will be updated + return new List(); + } + + + if (HttpContext.Current.Session != null) + { + HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] = folders; + } + + return folders; + } } } \ 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 c4c8591b..dbb50095 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -318,7 +318,7 @@ namespace WebsitePanel.WebDavPortal.Controllers { var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart); - if (permissions.HasFlag(WebDavPermissions.Write) == false || Request.Browser.IsMobileDevice) + if (permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false || Request.Browser.IsMobileDevice) { return new RedirectToRouteResult(FileSystemRouteNames.ViewOfficeOnline, null); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config index 265b5f6e..3f07e5e5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config @@ -52,6 +52,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index f4e2aa27..ff127dbd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -135,6 +135,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index b78fd5a1..4f2a314a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -563,6 +563,9 @@ + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx index 371dc3d8..38060605 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx @@ -168,4 +168,7 @@ Soft + + General Settings + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx new file mode 100644 index 00000000..5052b0b5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsFolderPermissions.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Updating folder settings...'); + + + Save Changes + + + Folder Permissions + + + Permissions + + + Edit Folder + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx new file mode 100644 index 00000000..33677cf3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShowProgressDialog('Updating folder settings...'); + + + Save Changes + + + Office Web App Editing + + + Users + + + Edit Folder + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx index 84cc95b7..37ced623 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx @@ -1,8 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderGeneralSettings.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderGeneralSettings" %> + <%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/EnterpriseStoragePermissions.ascx" TagName="ESPermissions" TagPrefix="wsp"%> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" Namespace="WebsitePanel.Portal.ExchangeServer.UserControls" Assembly="WebsitePanel.Portal.Modules" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> @@ -16,62 +19,62 @@ - +
+ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +
- - -
- - - -
- - -
-
-
 
- -
 
-
- - -
-
 
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+ + +
+
+
 
+ +
 
+ - -
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs index 315780f2..ca4b3d1e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs @@ -107,11 +107,7 @@ namespace WebsitePanel.Portal.ExchangeServer break; } - var esPermissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(PanelRequest.ItemID,folder.Name); - chkDirectoryBrowsing.Checked = ES.Services.EnterpriseStorage.GetDirectoryBrowseEnabled(PanelRequest.ItemID, folder.Url); - - permissions.SetPermissions(esPermissions); } catch (Exception ex) { @@ -159,10 +155,9 @@ namespace WebsitePanel.Portal.ExchangeServer } } - ES.Services.EnterpriseStorage.SetEnterpriseFolderSettings( + ES.Services.EnterpriseStorage.SetEnterpriseFolderGeneralSettings( PanelRequest.ItemID, folder, - permissions.GetPemissions(), chkDirectoryBrowsing.Checked, (int)(decimal.Parse(txtFolderSize.Text) * OneGb), rbtnQuotaSoft.Checked ? QuotaType.Soft : QuotaType.Hard); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs index dc276b18..4488393f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, 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. @@ -76,6 +48,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Literal litFolderName; + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + /// /// messageBox control. /// @@ -85,6 +66,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + /// + /// colFolderGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colFolderGeneralSettings; + + /// + /// panelFolderGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderGeneralSettings; + /// /// locFolderName control. /// @@ -211,33 +210,6 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.CheckBox chkDirectoryBrowsing; - /// - /// PermissionsPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel; - - /// - /// PermissionsSection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize PermissionsSection; - - /// - /// permissions control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions; - /// /// btnSave control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx new file mode 100644 index 00000000..8bddadca --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx @@ -0,0 +1,55 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderSettingsFolderPermissions" %> + + +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStoragePermissions.ascx" TagName="ESPermissions" TagPrefix="wsp"%> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" Namespace="WebsitePanel.Portal.ExchangeServer.UserControls" Assembly="WebsitePanel.Portal.Modules" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + +
+
+ + +
+
 
+
+ +
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs new file mode 100644 index 00000000..219a9f4c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.ExchangeServer +{ + public partial class EnterpriseStorageFolderSettingsFolderPermissions : WebsitePanelModuleBase + { + #region Constants + + private const int OneGb = 1024; + + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (!ES.Services.EnterpriseStorage.CheckUsersDomainExists(PanelRequest.ItemID)) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + + BindSettings(); + } + } + + private void BindSettings() + { + try + { + // get settings + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + SystemFile folder = ES.Services.EnterpriseStorage.GetEnterpriseFolder( + PanelRequest.ItemID, PanelRequest.FolderID); + + litFolderName.Text = string.Format("{0}", folder.Name); + + // bind form + var esPermissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(PanelRequest.ItemID,folder.Name); + + permissions.SetPermissions(esPermissions); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENETERPRISE_STORAGE_GET_FOLDER_SETTINGS", ex); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + SystemFile folder = new SystemFile { Name = PanelRequest.FolderID }; + + if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID)) + { + ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID); + } + + ES.Services.EnterpriseStorage.SetEnterpriseFolderPermissionSettings( + PanelRequest.ItemID, + folder, + permissions.GetPemissions()); + + + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_UPDATE_FOLDER_SETTINGS", ex); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs new file mode 100644 index 00000000..503327d4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer { + + + public partial class EnterpriseStorageFolderSettingsFolderPermissions { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// litFolderName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFolderName; + + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// colFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colFolderPermissions; + + /// + /// panelFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderPermissions; + + /// + /// PermissionsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl PermissionsPanel; + + /// + /// PermissionsSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize PermissionsSection; + + /// + /// permissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStoragePermissions permissions; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx new file mode 100644 index 00000000..5a88b08e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx @@ -0,0 +1,54 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageFolderSettingsOwaEditing.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.EnterpriseStorageFolderSettingsOwaEditing" %> + + +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStorageOwaUsersList.ascx" TagName="OwaUsers" TagPrefix="wsp"%> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnterpriseStorageEditFolderTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> + + + +
+
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + +
+
+ + +
+
 
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs new file mode 100644 index 00000000..108c1c24 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.OS; + +namespace WebsitePanel.Portal.ExchangeServer +{ + public partial class EnterpriseStorageFolderSettingsOwaEditing : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (!ES.Services.EnterpriseStorage.CheckUsersDomainExists(PanelRequest.ItemID)) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + + BindSettings(); + } + } + + private void BindSettings() + { + try + { + // get settings + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + SystemFile folder = ES.Services.EnterpriseStorage.GetEnterpriseFolder( + PanelRequest.ItemID, PanelRequest.FolderID); + + litFolderName.Text = string.Format("{0}", folder.Name); + + // bind form + var esPermissions = ES.Services.EnterpriseStorage.GetFolderOwaAccounts(PanelRequest.ItemID, folder); + + owaUsers.SetUsers(esPermissions); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENETERPRISE_STORAGE_GET_FOLDER_SETTINGS", ex); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + SystemFile folder = new SystemFile { Name = PanelRequest.FolderID }; + + if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID)) + { + ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID); + } + + ES.Services.EnterpriseStorage.SetFolderOwaAccounts( + PanelRequest.ItemID, + folder, + owaUsers.GetUsers()); + + + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", + "ItemID=" + PanelRequest.ItemID)); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_UPDATE_FOLDER_SETTINGS", ex); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs new file mode 100644 index 00000000..b927b94e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer { + + + public partial class EnterpriseStorageFolderSettingsOwaEditing { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// litFolderName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFolderName; + + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs tabs; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// colOwaEditing control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel colOwaEditing; + + /// + /// panelFolderPermissions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelFolderPermissions; + + /// + /// OwaUsersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl OwaUsersPanel; + + /// + /// locOwaEditingSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locOwaEditingSection; + + /// + /// owaUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList owaUsers; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx new file mode 100644 index 00000000..da04d0f8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageEditFolderTabs.ascx.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Folder Permissions + + + General Settings + + + Office Web App Editing + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx new file mode 100644 index 00000000..47a2f1e3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/EnterpriseStorageOwaUsersList.ascx.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add... + + + Add Accounts + + + Cancel + + + Delete + + + Display Name + + + E-mail Address + + + Display Name + + + Email + + + No accounts found. + + + The list of users is empty. Click "Add..." button. + + + Users + + + Enabled Users + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx new file mode 100644 index 00000000..1fdcdd00 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx @@ -0,0 +1,31 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageEditFolderTabs.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageEditFolderTabs" %> + + + + + +
+ + + + + <%# Eval("Name") %> + + + + + + <%# Eval("Name") %> + + + +
+
+ + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs new file mode 100644 index 00000000..2065b00c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Portal.Code.UserControls; + +namespace WebsitePanel.Portal.ExchangeServer.UserControls +{ + public partial class EnterpriseStorageEditFolderTabs : WebsitePanelControlBase + { + public string SelectedTab { get; set; } + + protected void Page_Load(object sender, EventArgs e) + { + BindTabs(); + } + + private void BindTabs() + { + List tabsList = new List(); + tabsList.Add(CreateTab("enterprisestorage_folder_settings", "Tab.GeneralSettings")); + tabsList.Add(CreateTab("enterprisestorage_folder_settings_folder_permissions", "Tab.FolderPermissions")); + tabsList.Add(CreateTab("enterprisestorage_folder_settings_owa_editing", "Tab.OwaEditPermissions")); + + int idx = 0; + + foreach (Tab tab in tabsList) + { + if (String.Compare(tab.Id, SelectedTab, true) == 0) + { + break; + } + + idx++; + } + + esTabs.SelectedIndex = idx; + esTabs.DataSource = tabsList; + esTabs.DataBind(); + } + + private Tab CreateTab(string id, string text) + { + return new Tab(id,GetLocalizedString(text), + HostModule.EditUrl("AccountID", PanelRequest.AccountID.ToString(), id, + "SpaceID=" + PanelSecurity.PackageId.ToString(), + "ItemID=" + PanelRequest.ItemID.ToString(), "FolderID=" + PanelRequest.FolderID)); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs new file mode 100644 index 00000000..8d176214 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageEditFolderTabs.ascx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer.UserControls { + + + public partial class EnterpriseStorageEditFolderTabs { + + /// + /// esTabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DataList esTabs; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx new file mode 100644 index 00000000..a5b8246c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx @@ -0,0 +1,114 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseStorageOwaUsersList.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.EnterpriseStorageOwaUsersList" %> + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs new file mode 100644 index 00000000..3d39c38c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal.ExchangeServer.UserControls +{ + public partial class EnterpriseStorageOwaUsersList : WebsitePanelControlBase + { + public const string DirectionString = "DirectionString"; + + protected enum SelectedState + { + All, + Selected, + Unselected + } + + public void SetUsers(OrganizationUser[] users) + { + BindAccounts(users, false); + } + + public OrganizationUser[] GetUsers() + { + return GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.All).ToArray(); + } + + protected void Page_Load(object sender, EventArgs e) + { + // register javascript + if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) + { + string script = @" function SelectAllCheckboxes(box) + { + var state = box.checked; + var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT""); + for(i = 0; i < elm.length; i++) + if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled) + elm[i].checked = state; + }"; + Page.ClientScript.RegisterClientScriptBlock(typeof(EnterpriseStorageOwaUsersList), "SelectAllCheckboxes", + script, true); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + // bind all accounts + BindPopupAccounts(); + + // show modal + AddAccountsModal.Show(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.Unselected); + + BindAccounts(selectedAccounts.ToArray(), false); + } + + protected void btnAddSelected_Click(object sender, EventArgs e) + { + List selectedAccounts = GetGridViewAccounts(); + + BindAccounts(selectedAccounts.ToArray(), true); + + } + + public string GetAccountImage(int accountTypeId) + { + string imgName = string.Empty; + + ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId; + switch (accountType) + { + case ExchangeAccountType.Room: + imgName = "room_16.gif"; + break; + case ExchangeAccountType.Equipment: + imgName = "equipment_16.gif"; + break; + default: + imgName = "admin_16.png"; + break; + } + + return GetThemedImage("Exchange/" + imgName); + } + + protected void BindPopupAccounts() + { + OrganizationUser[] accounts = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", null, 0, Int32.MaxValue).PageUsers; + + accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray(); + + Array.Sort(accounts, CompareAccount); + + if (Direction == SortDirection.Ascending) + { + Array.Reverse(accounts); + Direction = SortDirection.Descending; + } + else + Direction = SortDirection.Ascending; + + gvPopupAccounts.DataSource = accounts; + gvPopupAccounts.DataBind(); + } + + protected void BindAccounts(OrganizationUser[] newUsers, bool preserveExisting) + { + // get binded addresses + List users = new List(); + if (preserveExisting) + users.AddRange(GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState.All)); + + // add new accounts + if (newUsers != null) + { + foreach (OrganizationUser newUser in newUsers) + { + // check if exists + bool exists = false; + foreach (OrganizationUser user in users) + { + if (String.Compare(user.AccountName, newUser.AccountName, true) == 0) + { + exists = true; + break; + } + } + + if (exists) + continue; + + users.Add(newUser); + } + } + + gvUsers.DataSource = users; + gvUsers.DataBind(); + } + + protected List GetGridViewUsers(EnterpriseStorageOwaUsersList.SelectedState state) + { + List users = new List(); + for (int i = 0; i < gvUsers.Rows.Count; i++) + { + GridViewRow row = gvUsers.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + OrganizationUser user = new OrganizationUser(); + user.AccountName = (string)gvUsers.DataKeys[i][0]; + user.DisplayName = ((Literal)row.FindControl("litAccount")).Text; + user.AccountId = Convert.ToInt32(((HiddenField)row.FindControl("hdnAccountId")).Value); + + if (state == EnterpriseStorageOwaUsersList.SelectedState.All || + (state == EnterpriseStorageOwaUsersList.SelectedState.Selected && chkSelect.Checked) || + (state == EnterpriseStorageOwaUsersList.SelectedState.Unselected && !chkSelect.Checked)) + users.Add(user); + } + + return users; + } + + protected List GetGridViewAccounts() + { + List accounts = new List(); + for (int i = 0; i < gvPopupAccounts.Rows.Count; i++) + { + GridViewRow row = gvPopupAccounts.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect == null) + continue; + + if (chkSelect.Checked) + { + accounts.Add(new OrganizationUser + { + AccountName = (string)gvPopupAccounts.DataKeys[i][0], + DisplayName = ((Literal)row.FindControl("litDisplayName")).Text, + AccountId = Convert.ToInt32(((HiddenField)row.FindControl("hdnAccountId")).Value) + }); + } + } + + return accounts; + + } + + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) + { + BindPopupAccounts(); + } + + protected SortDirection Direction + { + get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; } + set { ViewState[DirectionString] = value; } + } + + protected static int CompareAccount(OrganizationUser user1, OrganizationUser user2) + { + return string.Compare(user1.DisplayName, user2.DisplayName); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs new file mode 100644 index 00000000..d9681b0e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer.UserControls { + + + public partial class EnterpriseStorageOwaUsersList { + + /// + /// UsersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel UsersUpdatePanel; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + + /// + /// gvUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvUsers; + + /// + /// AddAccountsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AddAccountsPanel; + + /// + /// headerAddAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize headerAddAccounts; + + /// + /// AddAccountsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AddAccountsUpdatePanel; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// ddlSearchColumn control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvPopupAccounts control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPopupAccounts; + + /// + /// btnAddSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddSelected; + + /// + /// btnCancelAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelAdd; + + /// + /// btnAddAccountsFake control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddAccountsFake; + + /// + /// AddAccountsModal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index e5fa35b0..f989847b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -211,6 +211,20 @@ + + EnterpriseStorageFolderSettingsFolderPermissions.ascx + ASPXCodeBehind + + + EnterpriseStorageFolderSettingsFolderPermissions.ascx + + + EnterpriseStorageFolderSettingsOwaEditing.ascx + ASPXCodeBehind + + + EnterpriseStorageFolderSettingsOwaEditing.ascx + OrganizationDeletedUsers.ascx ASPXCodeBehind @@ -229,6 +243,20 @@ OrganizationDeletedUserGeneralSettings.ascx ASPXCodeBehind + + EnterpriseStorageEditFolderTabs.ascx + ASPXCodeBehind + + + EnterpriseStorageEditFolderTabs.ascx + + + EnterpriseStorageOwaUsersList.ascx + ASPXCodeBehind + + + EnterpriseStorageOwaUsersList.ascx + SmarterMail100_EditAccount.ascx ASPXCodeBehind @@ -4455,7 +4483,11 @@ + + + + @@ -4499,6 +4531,10 @@ Designer + + + + From 6dc1d0c259ff9180dede4db9800b086f0b2165ac Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 2 Mar 2015 05:10:53 -0800 Subject: [PATCH 06/55] webdav portal root quote added --- .../Sources/WebsitePanel.WebDav.Core/IFolder.cs | 4 ++-- .../Sources/WebsitePanel.WebDav.Core/IResource.cs | 1 + .../Managers/WebDavManager.cs | 6 +++--- .../WebsitePanel.WebDavPortal/Content/Site.css | 10 ++++++++++ .../Controllers/FileSystemController.cs | 4 ++-- .../Profiles/Webdav/ResourceTableItemProfile.cs | 2 ++ .../Models/FileSystem/ResourceTableItemModel.cs | 3 +++ .../Scripts/appScripts/fileBrowsing.js | 15 ++++++++++++--- 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs index f37b9f94..52b32743 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IFolder.cs @@ -295,11 +295,11 @@ namespace WebsitePanel.WebDav.Core { XmlResponseList = XmlDoc.GetElementsByTagName("d:response"); } - var children = new WebDavHierarchyItem[XmlResponseList.Count]; + var children = new WebDavResource[XmlResponseList.Count]; int counter = 0; foreach (XmlNode XmlCurrentResponse in XmlResponseList) { - var item = new WebDavHierarchyItem(); + var item = new WebDavResource(); item.SetCredentials(_credentials); foreach (XmlNode XmlCurrentNode in XmlCurrentResponse.ChildNodes) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs index d1545431..34f4f81a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs @@ -50,6 +50,7 @@ namespace WebsitePanel.WebDav.Core SendChunked = false; AllowWriteStreamBuffering = false; + IsRootItem = item.IsRootItem; SetCredentials(credentials); SetHierarchyItem(item); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs index 98ea32ec..4d1ab904 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs @@ -50,9 +50,9 @@ namespace WebsitePanel.WebDav.Core.Managers children = ConnectToWebDavServer().Select(x => new WebDavResource { Href = new Uri(x.Url), - ItemType = ItemType.Folder, - ContentLength = x.Size, - AllocatedSpace = x.FRSMQuotaMB, + ItemType = ItemType.Folder, + ContentLength = x.Size * 1024 * 1024, + AllocatedSpace = x.FRSMQuotaMB * 1024 * 1024, IsRootItem = true }).ToArray(); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index f539d480..9137665c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -295,6 +295,16 @@ tr.selected-file { display: block; } +.column-name { + position: relative; +} + +.column-name #quota { + position: absolute; + right: 0px; + top: 20%; +} + /* Theme Mods */ input,div{border-radius:0px!important;} diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs index dbb50095..46beea31 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -151,11 +151,11 @@ namespace WebsitePanel.WebDavPortal.Controllers if (string.IsNullOrEmpty(dtRequest.Search.Value) == false) { - folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Select(x => new WebDavResource(null, x)); + folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Cast(); } else { - folderItems = _webdavManager.OpenFolder(pathPart).Select(x=>new WebDavResource(null, x)); + folderItems = _webdavManager.OpenFolder(pathPart).Cast(); } var tableItems = Mapper.Map, IEnumerable>(folderItems).ToList(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs index a20e44b3..cc712682 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs @@ -45,7 +45,9 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav .ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified)) .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt"))) + .ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem)) .ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength)) + .ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace)) .ForMember(ti => ti.IsFolder, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder)); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs index 24ac5e13..2d2121cf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs @@ -12,11 +12,14 @@ namespace WebsitePanel.WebDavPortal.Models.FileSystem public bool IsTargetBlank { get; set; } public bool IsFolder { get; set; } public long Size { get; set; } + public bool IsRoot { get; set; } + public long Quota { get; set; } public string Type { get; set; } public DateTime LastModified { get; set; } public string LastModifiedFormated { get; set; } public string IconHref { get; set; } + public override dynamic this[int index] { get diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js index 10478859..ec557926 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js @@ -86,10 +86,11 @@ WspFileBrowser.prototype = { "columnDefs": [ { "render": function(data, type, row) { - return '' + - '' + + return '
' + + '' + row.DisplayName + - ''; + '' + (row.IsRoot ? '' + wsp.fileBrowser.bytesToSize(row.Size) + ' / ' + wsp.fileBrowser.bytesToSize(row.Quota) + '' : '') + +'
'; }, "targets": 0 }, @@ -186,6 +187,14 @@ WspFileBrowser.prototype = { } }); }; + }, + + bytesToSize: function(bytes) { + if (bytes == 0) return '0 Byte'; + var k = 1024; + var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + var i = Math.floor(Math.log(bytes) / Math.log(k)); + return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i]; } }; From b51b6ee201edf7c62a60d4f3b6b3501d4ce1039c Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 2 Mar 2015 10:29:07 -0500 Subject: [PATCH 07/55] Added tag build-2.1.0.599 for changeset fe670172cd10 From ef3d4d2e5089bac193d918d2450dd65161061a9c Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 2 Mar 2015 12:20:48 -0500 Subject: [PATCH 08/55] Added tag build-2.1.0.600 for changeset e2e05db39b2b From 716855ae0551656dc29f6644a7168c6d8522ef21 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Mon, 2 Mar 2015 23:44:26 +0400 Subject: [PATCH 09/55] fix import existing resources for old dns providers (including SimpleDNS) --- .../DnsServers/DnsServerController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs index d659f9aa..bab622ac 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs @@ -32,6 +32,7 @@ using System.Collections.Specialized; using System.Globalization; using System.Linq; using System.Xml; +using System.Text; using System.Xml.Serialization; using WebsitePanel.Providers; using WebsitePanel.Providers.DNS; @@ -385,7 +386,9 @@ namespace WebsitePanel.EnterpriseServer var idn = new IdnMapping(); if (itemType == typeof(DnsZone)) - items.AddRange(dns.GetZones().Select(z => idn.GetUnicode(z))); + items.AddRange(dns.GetZones().Select(z => + Encoding.UTF8.GetByteCount(z) == z.Length ? // IsASCII + idn.GetUnicode(z) : z )); return items; } From 170cdc035827041909ea8f883cb4751084820558 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 2 Mar 2015 20:15:58 -0500 Subject: [PATCH 10/55] Remove Duplicate Handlers --- WebsitePanel/Sources/WebsitePanel.Server/Web.config | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Web.config b/WebsitePanel/Sources/WebsitePanel.Server/Web.config index d9d1bde5..0dcd0c7d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.Server/Web.config @@ -5,17 +5,6 @@
- - - -
-
-
-
- -
- - From d7af90326c21dc19eaa9d978f7c286f20b408d08 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 2 Mar 2015 20:29:52 -0500 Subject: [PATCH 11/55] Added tag build-2.1.0.601 for changeset 8ccdc857fa3f From 6af59c8cc86a6dd4da0efa6a2a8d015ca639975b Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 2 Mar 2015 22:48:46 -0500 Subject: [PATCH 12/55] Added tag build-2.1.0.602 for changeset 28e4e60c0e5c From 839f6cda2b7198e05e6a193c0374e91574aeb444 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 2 Mar 2015 23:46:37 -0800 Subject: [PATCH 13/55] owa editing groups added --- .../EnterpriseStorageFolderSettingsOwaEditing.ascx.resx | 2 +- .../EnterpriseStorageFolderSettingsOwaEditing.ascx | 2 +- .../UserControls/EnterpriseStorageOwaUsersList.ascx.cs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx index 33677cf3..012d8bf8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderSettingsOwaEditing.ascx.resx @@ -127,7 +127,7 @@ Office Web App Editing - Users + Users And Groups Edit Folder diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx index 5a88b08e..07ed6c6c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx @@ -34,7 +34,7 @@
- +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs index 3d39c38c..bf79f327 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/EnterpriseStorageOwaUsersList.ascx.cs @@ -94,7 +94,8 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls protected void BindPopupAccounts() { - OrganizationUser[] accounts = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", null, 0, Int32.MaxValue).PageUsers; + ExchangeAccount[] accounts = ES.Services.EnterpriseStorage.SearchESAccounts(PanelRequest.ItemID, + ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", ""); accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray(); @@ -206,7 +207,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls set { ViewState[DirectionString] = value; } } - protected static int CompareAccount(OrganizationUser user1, OrganizationUser user2) + protected static int CompareAccount(ExchangeAccount user1, ExchangeAccount user2) { return string.Compare(user1.DisplayName, user2.DisplayName); } From 0ebe24141ee12bd94f0f62b8c8d826670a04a4ed Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 3 Mar 2015 06:41:52 -0800 Subject: [PATCH 14/55] webdav portal search view added --- .../OS/SystemFile.cs | 1 + .../Windows2012.cs | 6 +- .../Extensions/UriExtensions.cs | 2 +- .../WebsitePanel.WebDav.Core/IItemContent.cs | 1 + .../WebsitePanel.WebDav.Core/IResource.cs | 2 + .../Interfaces/Managers/IWebDavManager.cs | 1 + .../Managers/WebDavManager.cs | 15 +-- .../App_Start/RouteConfig.cs | 12 ++ .../App_Start/Routes/FileSystemRouteNames.cs | 3 + .../Content/Site.css | 43 ++++++- .../Controllers/FileSystemController.cs | 31 ++++- .../Webdav/ResourceTableItemProfile.cs | 1 + .../FileSystem/ResourceTableItemModel.cs | 5 +- .../Resources/UI.Designer.cs | 36 ++++++ .../Resources/UI.resx | 12 ++ .../Scripts/appScripts/authentication.js | 11 +- .../Scripts/appScripts/fileBrowsing.js | 109 +++++++++++++++--- .../Views/FileSystem/ShowContent.cshtml | 6 - .../ShowContentSearchResultTable.cshtml | 28 +++++ .../FileSystem/_ShowContentBigIcons.cshtml | 15 --- .../Views/FileSystem/_ShowContentTable.cshtml | 5 - .../FileSystem/_ShowContentTopMenu.cshtml | 89 +++++++++----- .../Views/Shared/_Layout.cshtml | 9 +- .../WebsitePanel.WebDavPortal.csproj | 1 + 24 files changed, 345 insertions(+), 99 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs index 830bccab..83d68d90 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/SystemFile.cs @@ -145,6 +145,7 @@ namespace WebsitePanel.Providers.OS } public string RelativeUrl { get; set; } + public string Summary { get; set; } public string DriveLetter { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs index e5ff425c..b2eed0b3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs @@ -304,7 +304,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder); rootFolder = Path.Combine(rootFolder, organizationId); - var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})", + var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType, System.Search.AutoSummary FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})", searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray())); conn.Open(); @@ -318,7 +318,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage var file = new SystemFile {Name = reader[0] as string}; file.Changed = file.CreatedDate = reader[1] is DateTime ? (DateTime)reader[1] : new DateTime(); - file.Size = reader[2] is long ? (long) reader[2] : 0; + file.Size = reader[2] is Decimal ? Convert.ToInt64((Decimal) reader[2]) : 0; var kind = reader[3] is IEnumerable ? ((IEnumerable)reader[3]).Cast().ToList() : null; var itemType = reader[5] as string ?? string.Empty; @@ -342,6 +342,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage } } + file.Summary = reader[6] as string; + result.Add(file); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs index 3f6bd4c6..8ba4aeeb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Extensions/UriExtensions.cs @@ -3,7 +3,7 @@ using System.Linq; namespace WebsitePanel.WebDav.Core.Extensions { - static class UriExtensions + public static class UriExtensions { public static Uri Append(this Uri uri, params string[] paths) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs index 399aeba0..681efa2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IItemContent.cs @@ -9,6 +9,7 @@ namespace WebsitePanel.WebDav.Core long ContentLength { get; } long AllocatedSpace { get; set; } string ContentType { get; } + string Summary { get; set; } void Download(string filename); byte[] Download(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs index 34f4f81a..1a099ebf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/IResource.cs @@ -89,6 +89,8 @@ namespace WebsitePanel.WebDav.Core } } + public string Summary { get; set; } + /// /// Downloads content of the resource to a file specified by filename /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs index fd1fdc3a..bf634dd8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Interfaces/Managers/IWebDavManager.cs @@ -19,5 +19,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Managers string GetFileUrl(string path); void DeleteResource(string path); void LockFile(string path); + string GetFileFolderPath(string path); } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs index 4d1ab904..d3f837a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs @@ -103,7 +103,7 @@ namespace WebsitePanel.WebDav.Core.Managers public bool IsFile(string path) { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); if (string.IsNullOrWhiteSpace(folder)) { @@ -124,7 +124,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -212,7 +212,7 @@ namespace WebsitePanel.WebDav.Core.Managers path = RemoveLeadingFromPath(path, "edit"); path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId); - string folderPath = GetFileFolder(path); + string folderPath = GetFileFolderPath(path); OpenFolder(folderPath); @@ -232,7 +232,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -250,7 +250,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -270,7 +270,7 @@ namespace WebsitePanel.WebDav.Core.Managers { try { - string folder = GetFileFolder(path); + string folder = GetFileFolderPath(path); var resourceName = GetResourceName(path); @@ -345,6 +345,7 @@ namespace WebsitePanel.WebDav.Core.Managers webDavitem.SetLastModified(file.Changed); webDavitem.ContentLength = file.Size; webDavitem.AllocatedSpace = file.FRSMQuotaMB; + webDavitem.Summary = file.Summary; convertResult.Add(webDavitem); } @@ -372,7 +373,7 @@ namespace WebsitePanel.WebDav.Core.Managers targetStream.Write(buffer, 0, n); } - private string GetFileFolder(string path) + public string GetFileFolderPath(string path) { path = path.TrimEnd('/'); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs index 1a5981a4..a5dc75e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/RouteConfig.cs @@ -46,6 +46,18 @@ namespace WebsitePanel.WebDavPortal #region Enterprise storage + routes.MapRoute( + name: FileSystemRouteNames.SearchFiles, + url: "storage/search/{org}/{*pathPart}", + defaults: new { controller = "FileSystem", action = "SearchFiles", pathPart = UrlParameter.Optional } + ); + + routes.MapRoute( + name: FileSystemRouteNames.SearchFilesContent, + url: "storage/ajax/search/{org}/{*pathPart}", + defaults: new { controller = "FileSystem", action = "SearchFilesContent", pathPart = UrlParameter.Optional } + ); + routes.MapRoute( name: FileSystemRouteNames.ChangeWebDavViewType, url: "storage/change-view-type/{viewType}", diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs index 23ac46e2..9a6832b2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Start/Routes/FileSystemRouteNames.cs @@ -21,5 +21,8 @@ namespace WebsitePanel.WebDavPortal.UI.Routes public const string DeleteFiles = "DeleteFilesRoute"; public const string DownloadFile = "DownloadFileRoute"; + + public const string SearchFiles = "SearchFilesRoute"; + public const string SearchFilesContent = "SearchFilesPostRoute"; } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css index 9137665c..988dabfa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Content/Site.css @@ -60,6 +60,17 @@ tr.selected-file { .table-icon { height: 30px; + vertical-align: top; +} + +.column-name .file-info { + display: inline-block; + padding-left: 5px; + width: 90%; +} + +.table-icon.search { + height: 45px; } .noselect { @@ -77,6 +88,8 @@ tr.selected-file { #webdav-items-table .file-link { padding-left: 5px; + padding-top: 5px; + display: inline-block; vertical-align: middle !important; } @@ -86,6 +99,11 @@ tr.selected-file { height: 32px; } +#summary.summary { + font-size: 11px; + color: rgb(152, 152, 152); +} + .drag-and-drop-area input { /* IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; @@ -252,16 +270,29 @@ tr.selected-file { width: 200px; } -.search-block { - float: right; +.breadcrumb-wsp { + display: inline-block; + padding-top: 5px; } -.search-block input, .search-block label { +.search-block { + float: right; + margin-right: 10px !important; + width: 36%; +} + +.search-block input{ + display: inline-block; + font-weight: normal; +} + +.search-block label { display: inline-block; width: initial; font-weight: normal; } + .elements-container { padding-top: 10px; } @@ -371,4 +402,10 @@ div#breadcrumb_wrapper a:last-child { .header-portal-title { float: none; display: inline-block; +} + +@media (min-width: 768px) { + .navbar-right { + margin-right: 0; + } } \ 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 46beea31..9d4016e1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/FileSystemController.cs @@ -35,6 +35,7 @@ using WebsitePanel.WebDavPortal.Models.Common.Enums; using WebsitePanel.WebDavPortal.Models.FileSystem; using WebsitePanel.WebDavPortal.UI; using WebsitePanel.WebDavPortal.UI.Routes; +using WebsitePanel.WebDav.Core.Extensions; namespace WebsitePanel.WebDavPortal.Controllers @@ -143,7 +144,6 @@ namespace WebsitePanel.WebDavPortal.Controllers } } - [HttpGet] public ActionResult GetContentDetails(string org, string pathPart, [ModelBinder(typeof (JqueryDataTableModelBinder))] JqueryDataTableRequest dtRequest) { @@ -160,7 +160,7 @@ namespace WebsitePanel.WebDavPortal.Controllers var tableItems = Mapper.Map, IEnumerable>(folderItems).ToList(); - FillContentModel(tableItems); + FillContentModel(tableItems, org); var orders = dtRequest.Orders.ToList(); orders.Insert(0, new JqueryDataTableOrder{Column = 3, Ascending = false}); @@ -184,6 +184,24 @@ namespace WebsitePanel.WebDavPortal.Controllers return PartialView("_ResourseCollectionPartial", result); } + public ActionResult SearchFiles(string org, string pathPart, string searchValue) + { + if (string.IsNullOrEmpty(searchValue)) + { + return RedirectToRoute(FileSystemRouteNames.ShowContentPath); + } + + var model = new ModelForWebDav + { + UrlSuffix = pathPart, + Permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart), + UserSettings = _userSettingsManager.GetUserSettings(WspContext.User.AccountId), + SearchValue = searchValue + }; + + return View("ShowContentSearchResultTable", model); + } + [HttpGet] public ActionResult DownloadFile(string org, string pathPart) { @@ -329,17 +347,17 @@ namespace WebsitePanel.WebDavPortal.Controllers } #endregion - private void FillContentModel(IEnumerable items) + private void FillContentModel(IEnumerable items, string organizationId) { foreach (var item in items) { var opener = _openerManager[Path.GetExtension(item.DisplayName)]; + var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/'); switch (opener) { case FileOpenerType.OfficeOnline: { - var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/'); item.Url = string.Concat(Url.RouteUrl(FileSystemRouteNames.EditOfficeOnline, new {org = WspContext.User.OrganizationId, pathPart = ""}), pathPart); break; } @@ -350,6 +368,11 @@ namespace WebsitePanel.WebDavPortal.Controllers } } + var folderPath = Server.UrlDecode(_webdavManager.GetFileFolderPath(pathPart)); + + item.FolderUrlAbsoluteString = Server.UrlDecode(Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new {org = organizationId, pathPart = folderPath}, Request.Url.Scheme)); + item.FolderUrlLocalString = Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new { org = organizationId, pathPart = folderPath }); + if (Request.Browser.IsMobileDevice) { item.IsTargetBlank = false; diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs index cc712682..17d1b07e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Mapping/Profiles/Webdav/ResourceTableItemProfile.cs @@ -45,6 +45,7 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav .ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified)) .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt"))) + .ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary)) .ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem)) .ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength)) .ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace)) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs index 2d2121cf..bc605c28 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Models/FileSystem/ResourceTableItemModel.cs @@ -18,7 +18,10 @@ namespace WebsitePanel.WebDavPortal.Models.FileSystem public DateTime LastModified { get; set; } public string LastModifiedFormated { get; set; } public string IconHref { get; set; } - + public string FolderUrlAbsoluteString { get; set; } + public string FolderUrlLocalString { get; set; } + public string FolderName { get; set; } + public string Summary { get; set; } public override dynamic this[int index] { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs index e3836593..0aa9d823 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs @@ -150,6 +150,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to File. + /// + public static string File { + get { + return ResourceManager.GetString("File", resourceCulture); + } + } + /// /// Looks up a localized string similar to File Upload. /// @@ -168,6 +177,15 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Info. + /// + public static string Info { + get { + return ResourceManager.GetString("Info", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} items was removed.. /// @@ -258,6 +276,24 @@ namespace WebsitePanel.WebDavPortal.Resources { } } + /// + /// Looks up a localized string similar to Search Documents. + /// + public static string SearchDocuments { + get { + return ResourceManager.GetString("SearchDocuments", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Search Results. + /// + public static string SearchResults { + get { + return ResourceManager.GetString("SearchResults", resourceCulture); + } + } + /// /// Looks up a localized string similar to Select files to upload. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx index 5cb4b1a3..7d3fbf56 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx @@ -147,12 +147,18 @@ Error + + File + File Upload Gb + + Info + {0} items was removed. @@ -183,6 +189,12 @@ Search + + Search Documents + + + Search Results + Select files to upload diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js index 3752ad1e..35a5b8ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/authentication.js @@ -1,18 +1,19 @@ -function CheckAuthenticationExpiration(authcookieName, logoutUrl) { - var c = $.cookie(authcookieName); - +function CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl) { + var c = $.cookie(authTimeOutCookieName); + if (c != null && c != "" && !isNaN(c)) { var now = new Date(); var ms = parseInt(c, 10); var expiration = new Date().setTime(ms); if (now > expiration) { + $.removeCookie(authTimeOutCookieName, { path: '/' }); window.location.replace(logoutUrl); } } } -function StartAuthExpirationCheckTimer(authcookieName, logoutUrl) { +function StartAuthExpirationCheckTimer(authTimeOutCookieName, authCookieName, logoutUrl) { setInterval(function() { - CheckAuthenticationExpiration(authcookieName, logoutUrl); + CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl); }, 20000); } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js index ec557926..f14edab4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Scripts/appScripts/fileBrowsing.js @@ -1,6 +1,12 @@ function WspFileBrowser() { - this.settings = { deletionBlockSelector: ".file-actions-menu .file-deletion", deletionUrl: "storage/files-group-action/delete" }; - this.table = null; + this.settings = { + deletionBlockSelector: ".file-actions-menu .file-deletion", + deletionUrl: "storage/files-group-action/delete", + textDateModified: "Date modified", + textSize: "Size" + }; + this.itemsTable = null; + this.searchTable = null; } WspFileBrowser.prototype = { @@ -34,7 +40,8 @@ WspFileBrowser.prototype = { }).get(); }, - deleteSelectedItems: function(e) { + deleteSelectedItems: function (e) { + $.ajax({ type: 'POST', url: wsp.fileBrowser.settings.deletionUrl, @@ -45,7 +52,7 @@ WspFileBrowser.prototype = { wsp.fileBrowser.clearDeletedItems(model.DeletedFiles); wsp.fileBrowser.refreshDeletionBlock(); - wsp.fileBrowser.refreshDataTable(); + wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable); wsp.dialogs.hideProcessDialog(); }, @@ -53,7 +60,7 @@ WspFileBrowser.prototype = { wsp.messages.addErrorMessage(errorThrown); wsp.fileBrowser.refreshDeletionBlock(); - wsp.fileBrowser.refreshDataTable(); + wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable); wsp.dialogs.hideProcessDialog(); } @@ -79,10 +86,11 @@ WspFileBrowser.prototype = { }, initDataTable: function (tableId, ajaxUrl) { - this.table = $(tableId).dataTable({ + this.itemsTable = $(tableId).dataTable({ "ajax": ajaxUrl, "processing": false, "serverSide": true, + "dom": 'rtlp', "columnDefs": [ { "render": function(data, type, row) { @@ -128,18 +136,87 @@ WspFileBrowser.prototype = { $(tableId).removeClass('dataTable'); - var oTable = this.table; - $(tableId+'_filter input').unbind(); - $(tableId+'_filter input').bind('keyup', function (e) { - if (e.keyCode == 13) { - oTable.fnFilter(this.value); - } - }); + //var oTable = this.table; + + //$(searchInputId).bind('keyup', function (e) { + // if (e.keyCode == 13) { + // oTable.fnFilter(this.value); + // } + //}); + + //$(searchInputId).keydown(function (event) { + // if (event.keyCode == 13) { + // event.preventDefault(); + // return false; + // } + + // return true; + //}); + }, - refreshDataTable: function () { - if (this.table != null) { - this.table.fnDraw(false); + initSearchDataTable: function (tableId, ajaxUrl, initSearch) { + + var settings = this.settings; + var classThis = this; + + this.searchTable = $(tableId).dataTable({ + "ajax": ajaxUrl, + "processing": false, + "serverSide": true, + "oSearch": { "sSearch": initSearch }, + "dom": 'rtlp', + "columnDefs": [ + { + "render": function (data, type, row) { + return '
' + + '' + + '
' + + '' + + row.DisplayName + + '' + + '
' + (row.Summary ? (row.Summary + '').substring(0, 500) + '...' : '') + '
' + + '' + + '
' + + '
'; + }, + "targets": 0 + }, + { + "render": function (data, type, row) { + return '
' +settings.textDateModified+': '+ row.LastModifiedFormated+ '
' + + '
' + settings.textSize + ': ' + classThis.bytesToSize(row.Size) + '
'; + }, + "orderable": false, + "width": "25%", + "targets": 1 + } + ], + "createdRow": function (row, data, index) { + $(row).addClass('element-container'); + }, + "fnPreDrawCallback": function () { + // gather info to compose a message + wsp.dialogs.showProcessDialog(); + return true; + }, + "fnDrawCallback": function () { + // in case your overlay needs to be put away automatically you can put it here + wsp.dialogs.hideProcessDialog(); + } + }); + + $(tableId).removeClass('dataTable'); + + }, + + refreshDataTable: function (table) { + if (table != null) { + table.fnDraw(false); } }, diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml index b36be144..af490ffc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContent.cshtml @@ -53,9 +53,3 @@ else } } - -@section popups -{ - @Html.Partial("_ProcessDialog", null) - @Html.Partial("_ConfirmDialog") -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml new file mode 100644 index 00000000..f75107fc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/ShowContentSearchResultTable.cshtml @@ -0,0 +1,28 @@ +@using WebsitePanel.WebDavPortal.Resources +@using WebsitePanel.WebDavPortal.UI.Routes +@model WebsitePanel.WebDavPortal.Models.ModelForWebDav + + +@Html.Partial("_ShowContentTopMenu", Model) + +
+ + + + + + + +
@UI.File@UI.Details
+
+ +@section scripts +{ + +} + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml index e87f9c2d..8591768f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentBigIcons.cshtml @@ -3,21 +3,6 @@ @using WebsitePanel.WebDavPortal.UI.Routes @model WebsitePanel.WebDavPortal.Models.ModelForWebDav -
- - -
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml index 8aed098b..a729ca02 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTable.cshtml @@ -15,8 +15,3 @@
-@section popups -{ - @Html.Partial("_ProcessDialog", null) - @Html.Partial("_ConfirmDialog") -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml index 4a6089ff..0a31a28c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml @@ -10,42 +10,69 @@ @if (Model != null) { string header = WspContext.User.OrganizationId; - @header string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < elements.Length; i++) - { - / - @elements[i] - } - } -
-
- @if (Model.Permissions.HasFlag(WebDavPermissions.Write)) - { -
+ @Html.Partial("_ProcessDialog", null) + @Html.Partial("_ConfirmDialog") + @RenderSection("popups", required: false)
@@ -62,9 +65,9 @@ @Scripts.Render("~/bundles/authScripts") } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj index 9327be8f..6ccbc782 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj @@ -459,6 +459,7 @@ + From a4cb95e2db86a717e4b0da5f0afeebcc9941fe57 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 3 Mar 2015 07:01:01 -0800 Subject: [PATCH 15/55] webdav portal fix --- .../Views/FileSystem/_ShowContentTopMenu.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml index 0a31a28c..496ac682 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/FileSystem/_ShowContentTopMenu.cshtml @@ -10,7 +10,7 @@ @if (Model != null) { string header = WspContext.User.OrganizationId; - string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); + string[] elements = string.IsNullOrEmpty(Model.UrlSuffix)? new string[0]: Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);