webdav portal fixes

This commit is contained in:
vfedosevich 2015-02-26 03:27:37 -08:00
parent 682e4ac18a
commit c78570eb11
15 changed files with 177 additions and 14 deletions

View file

@ -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);
}
}
}

View file

@ -14,5 +14,6 @@ namespace WebsitePanel.WebDav.Core.Config
OfficeOnlineCollection OfficeOnline { get; }
OwaSupportedBrowsersCollection OwaSupportedBrowsers { get; }
FilesToIgnoreCollection FilesToIgnore { get; }
OpenerCollection FileOpener { get; }
}
}

View file

@ -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; }
}
}
}

View file

@ -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;
}
}
}

View file

@ -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
{

View file

@ -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; }
}
}

View file

@ -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;
}
}

View file

@ -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" />