webdav portal fixes
This commit is contained in:
parent
682e4ac18a
commit
c78570eb11
15 changed files with 177 additions and 14 deletions
|
@ -0,0 +1,38 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebsitePanel.WebDav.Core.Config.WebConfigSections;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||
{
|
||||
public class OpenerCollection : AbstractConfigCollection, IReadOnlyCollection<OpenerElement>
|
||||
{
|
||||
private readonly IList<OpenerElement> _targetBlankMimeTypeExtensions;
|
||||
|
||||
public OpenerCollection()
|
||||
{
|
||||
_targetBlankMimeTypeExtensions = ConfigSection.TypeOpener.Cast<OpenerElement>().ToList();
|
||||
}
|
||||
|
||||
public IEnumerator<OpenerElement> GetEnumerator()
|
||||
{
|
||||
return _targetBlankMimeTypeExtensions.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _targetBlankMimeTypeExtensions.Count; }
|
||||
}
|
||||
|
||||
public bool Contains(string extension)
|
||||
{
|
||||
return _targetBlankMimeTypeExtensions.Any(x => x.Extension == extension);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,5 +14,6 @@ namespace WebsitePanel.WebDav.Core.Config
|
|||
OfficeOnlineCollection OfficeOnline { get; }
|
||||
OwaSupportedBrowsersCollection OwaSupportedBrowsers { get; }
|
||||
FilesToIgnoreCollection FilesToIgnore { get; }
|
||||
OpenerCollection FileOpener { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||
{
|
||||
public class OpenerElement : ConfigurationElement
|
||||
{
|
||||
private const string ExtensionKey = "extension";
|
||||
private const string MemeTypeKey = "mimeType";
|
||||
private const string TargetBlankKey = "isTargetBlank";
|
||||
|
||||
[ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)]
|
||||
public string Extension
|
||||
{
|
||||
get { return this[ExtensionKey].ToString(); }
|
||||
set { this[ExtensionKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(MemeTypeKey, IsKey = true, IsRequired = true)]
|
||||
public string MimeType
|
||||
{
|
||||
get { return this[MemeTypeKey].ToString(); }
|
||||
set { this[MemeTypeKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(TargetBlankKey, IsKey = true, IsRequired = true)]
|
||||
public bool IstargetBlank
|
||||
{
|
||||
get { return Convert.ToBoolean(this[TargetBlankKey]); }
|
||||
set { this[TargetBlankKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||
{
|
||||
[ConfigurationCollection(typeof(OpenerElement))]
|
||||
public class OpenerElementCollection : ConfigurationElementCollection
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new OpenerElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((OpenerElement)element).Extension;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
private const string OwaSupportedBrowsersKey = "owaSupportedBrowsers";
|
||||
private const string OfficeOnlineKey = "officeOnline";
|
||||
private const string FilesToIgnoreKey = "filesToIgnore";
|
||||
private const string TypeOpenerKey = "typeOpener";
|
||||
|
||||
public const string SectionName = "webDavExplorerConfigurationSettings";
|
||||
|
||||
|
@ -99,6 +100,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
set { this[OfficeOnlineKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(TypeOpenerKey, IsDefaultCollection = false)]
|
||||
public OpenerElementCollection TypeOpener
|
||||
{
|
||||
get { return (OpenerElementCollection)this[TypeOpenerKey]; }
|
||||
set { this[TypeOpenerKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(FilesToIgnoreKey, IsDefaultCollection = false)]
|
||||
public FilesToIgnoreElementCollection FilesToIgnore
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace WebsitePanel.WebDav.Core.Config
|
|||
OfficeOnline = new OfficeOnlineCollection();
|
||||
OwaSupportedBrowsers = new OwaSupportedBrowsersCollection();
|
||||
FilesToIgnore = new FilesToIgnoreCollection();
|
||||
FileOpener = new OpenerCollection();
|
||||
}
|
||||
|
||||
public static WebDavAppConfigManager Instance
|
||||
|
@ -60,5 +61,6 @@ namespace WebsitePanel.WebDav.Core.Config
|
|||
public OfficeOnlineCollection OfficeOnline { get; private set; }
|
||||
public OwaSupportedBrowsersCollection OwaSupportedBrowsers { get; private set; }
|
||||
public FilesToIgnoreCollection FilesToIgnore { get; private set; }
|
||||
public OpenerCollection FileOpener { get; private set; }
|
||||
}
|
||||
}
|
|
@ -83,7 +83,6 @@ namespace WebsitePanel.WebDav.Core
|
|||
{
|
||||
{
|
||||
var property = _properties.FirstOrDefault(x => x.Name.Name == "getcontenttype");
|
||||
|
||||
return property == null ? MediaTypeNames.Application.Octet : property.StringValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
<Compile Include="Config\Entities\OfficeOnlineCollection.cs" />
|
||||
<Compile Include="Config\Entities\OwaSupportedBrowsersCollection.cs" />
|
||||
<Compile Include="Config\Entities\SessionKeysCollection.cs" />
|
||||
<Compile Include="Config\Entities\OpenerCollection.cs" />
|
||||
<Compile Include="Config\Entities\WebsitePanelConstantUserParameters.cs" />
|
||||
<Compile Include="Config\IWebDavAppConfig.cs" />
|
||||
<Compile Include="Config\WebConfigSections\ApplicationNameElement.cs" />
|
||||
|
@ -119,10 +120,12 @@
|
|||
<Compile Include="Config\WebConfigSections\FilesToIgnoreElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OfficeOnlineElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OfficeOnlineElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OpenerElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OwaSupportedBrowsersElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OwaSupportedBrowsersElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\SessionKeysElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\SessionKeysElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\OpenerElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\UserDomainElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\WebDavExplorerConfigurationSettingsSection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\WebdavRootElement.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue