diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs index 76778a16..d41e70b9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs @@ -42,6 +42,7 @@ namespace WebsitePanel.EnterpriseServer public const string BACKUP_SETTINGS = "BackupSettings"; public const string SETUP_SETTINGS = "SetupSettings"; public const string WPI_SETTINGS = "WpiSettings"; + public const string FILEMANAGER_SETTINGS = "FileManagerSettings"; // key to access to wpi main & custom feed in wpi settings public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/FilesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/FilesProxy.cs index 984321d9..7064e1c4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/FilesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/FilesProxy.cs @@ -58,7 +58,9 @@ namespace WebsitePanel.EnterpriseServer { [System.Web.Services.WebServiceBindingAttribute(Name="esFilesSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))] public partial class esFiles : Microsoft.Web.Services3.WebServicesClientProtocol { - + + private System.Threading.SendOrPostCallback GetFileManagerSettingsOperationCompleted; + private System.Threading.SendOrPostCallback GetFilesOperationCompleted; private System.Threading.SendOrPostCallback GetFilesByMaskOperationCompleted; @@ -110,6 +112,9 @@ namespace WebsitePanel.EnterpriseServer { this.Url = "http://localhost/EnterpriseServer/esFiles.asmx"; } + /// + public event GetFileManagerSettingsCompletedEventHandler GetFileManagerSettingsCompleted; + /// public event GetFilesCompletedEventHandler GetFilesCompleted; @@ -178,6 +183,52 @@ namespace WebsitePanel.EnterpriseServer { /// public event ExecuteSyncActionsCompletedEventHandler ExecuteSyncActionsCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFileManagerSettings", 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 SystemSettings GetFileManagerSettings() + { + object[] results = this.Invoke("GetFileManagerSettings", new Object[] {}); + return ((SystemSettings)(results[0])); + } + + /// + public System.IAsyncResult BeginGetFileManagerSettings(System.AsyncCallback callback, object asyncState) + { + return this.BeginInvoke("GetFileManagerSettings", new Object[] {}, callback, asyncState); + } + + /// + public SystemSettings EndGetFileManagerSettings(System.IAsyncResult asyncResult) + { + object[] results = this.EndInvoke(asyncResult); + return ((SystemSettings)(results[0])); + } + + /// + public void GetFileManagerSettingsAsync() + { + this.GetFileManagerSettingsAsync(null); + } + + /// + public void GetFileManagerSettingsAsync(object userState) + { + if ((this.GetFileManagerSettingsOperationCompleted == null)) + { + this.GetFileManagerSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFileManagerSettingsOperationCompleted); + } + this.InvokeAsync("GetFileManagerSettings", new Object[] {}, this.GetFileManagerSettingsOperationCompleted, userState); + } + + private void OnGetFileManagerSettingsOperationCompleted(object arg) + { + if ((this.GetFileManagerSettingsCompleted != null)) + { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetFileManagerSettingsCompleted(this, new GetFileManagerSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFiles", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -1260,7 +1311,33 @@ namespace WebsitePanel.EnterpriseServer { - + public delegate void GetFileManagerSettingsCompletedEventHandler(object sender, GetFileManagerSettingsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetFileManagerSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + + private object[] results; + + internal GetFileManagerSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) + { + this.results = results; + } + + /// + public SystemSettings Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((SystemSettings)(this.results[0])); + } + } + } /// diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs index 74dd8d78..913941f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs @@ -45,6 +45,11 @@ namespace WebsitePanel.EnterpriseServer { public class FilesController { + public static SystemSettings GetFileManagerSettings() + { + return SystemController.GetSystemSettingsInternal(SystemSettings.FILEMANAGER_SETTINGS, false); + } + public static OS.OperatingSystem GetOS(int packageId) { int sid = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esFiles.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esFiles.asmx.cs index 14b2b455..7663d4a8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esFiles.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esFiles.asmx.cs @@ -50,6 +50,12 @@ namespace WebsitePanel.EnterpriseServer [ToolboxItem(false)] public class esFiles : System.Web.Services.WebService { + [WebMethod] + public SystemSettings GetFileManagerSettings() + { + return FilesController.GetFileManagerSettings(); + } + [WebMethod] public static string GetHomeFolder(int packageId) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx index feb70193..d0dd8013 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Save Settings @@ -153,4 +153,13 @@ Custom feeds: + + File Manager + + + Editable Extensions: + + + (One (1) extension per line) + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/FileManager.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/FileManager.ascx.cs index b8fe38e6..301c869f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/FileManager.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/FileManager.ascx.cs @@ -33,12 +33,14 @@ using System.Text; using System.Web; using System.Web.UI.WebControls; using WebsitePanel.Providers.OS; +using System.Linq; +using System.Text.RegularExpressions; namespace WebsitePanel.Portal { public partial class FileManager : WebsitePanelModuleBase { - string ALLOWED_EDIT_EXTENSIONS = ".txt.htm.html.php.pl.sql.cs.vb.ascx.aspx.inc.asp.config.xml.xsl.xslt.xsd.Master.htaccess.htpasswd.cshtml.vbhtml"; + public static string ALLOWED_EDIT_EXTENSIONS = ".txt,.htm,.html,.php,.pl,.sql,.cs,.vb,.ascx,.aspx,.inc,.asp,.config,.xml,.xsl,.xslt,.xsd,.master,.htaccess,.htpasswd,.cshtml,.vbhtml,.ini,.config"; protected void Page_Load(object sender, EventArgs e) { @@ -204,12 +206,16 @@ function SetCreateZipFocus() if (file.IsDirectory) return false; + // Get the Editable Extensions from the System Settings + // If it has not yet been set, we will use the original WebsitePanel allowed editable extensions + EnterpriseServer.SystemSettings settings = ES.Services.Files.GetFileManagerSettings(); + if (!String.IsNullOrEmpty(settings["EditableExtensions"])) + { + ALLOWED_EDIT_EXTENSIONS = settings["EditableExtensions"]; + } + string ext = Path.GetExtension(file.Name); - //allow to edit Master pages - if (ext == ".Master") - return true; - else - return ALLOWED_EDIT_EXTENSIONS.IndexOf(ext.ToLower()) != -1; + return ALLOWED_EDIT_EXTENSIONS.Split(',').ToArray().Contains(ext); } #region Path methods diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx index 55b85a1a..24542dbe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx @@ -58,6 +58,18 @@ + + + + + + + + + +
+
// This code was generated by a tool. @@ -175,6 +147,51 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.UserControls.EditFeedsList wpiEditFeedsList; + /// + /// HeaderFileManagerSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel HeaderFileManagerSettings; + + /// + /// PanelFileManagereSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PanelFileManagereSettings; + + /// + /// lblFileManagerEditableExtensions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblFileManagerEditableExtensions; + + /// + /// txtFileManagerEditableExtensions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFileManagerEditableExtensions; + + /// + /// litFileManagerEditableExtensions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litFileManagerEditableExtensions; + /// /// btnSaveSettings control. ///