This commit is contained in:
Virtuworks 2015-05-26 13:07:36 -04:00
commit 79710f9706
9 changed files with 128 additions and 31 deletions

View file

@ -57,6 +57,8 @@ namespace WebsitePanel.EnterpriseServer
public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPswResetEnabled";
public const string WEBDAV_PASSWORD_RESET_LINK_LIFE_SPAN = "WebdavPswdResetLinkLifeSpan";
public const string WEBDAV_OWA_ENABLED_KEY = "WebdavOwaEnabled";
public const string WEBDAV_OWA_URL = "WebdavOwaUrl";
// key to access to wpi main & custom feed in wpi settings
public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl";

View file

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.WebDavPortal.WebConfigSections;
namespace WebsitePanel.WebDav.Core.Config.Entities
@ -11,15 +12,30 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
public OfficeOnlineCollection()
{
IsEnabled = ConfigSection.OfficeOnline.IsEnabled;
Url = ConfigSection.OfficeOnline.Url;
NewFilePath = ConfigSection.OfficeOnline.CobaltNewFilePath;
CobaltFileTtl = ConfigSection.OfficeOnline.CobaltFileTtl;
_officeExtensions = ConfigSection.OfficeOnline.Cast<OfficeOnlineElement>().ToList();
}
public bool IsEnabled { get; private set; }
public string Url { get; private set; }
public bool IsEnabled {
get
{
return GetWebdavSystemSettigns().GetValueOrDefault(EnterpriseServer.SystemSettings.WEBDAV_OWA_ENABLED_KEY, false);
}
}
public string Url
{
get
{
return GetWebdavSystemSettigns().GetValueOrDefault(EnterpriseServer.SystemSettings.WEBDAV_OWA_URL, string.Empty);
}
}
private SystemSettings GetWebdavSystemSettigns()
{
return WspContext.Services.Organizations.GetWebDavSystemSettings() ?? new SystemSettings();
}
public string NewFilePath { get; private set; }
public int CobaltFileTtl { get; private set; }

View file

@ -6,25 +6,9 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
[ConfigurationCollection(typeof(OfficeOnlineElement))]
public class OfficeOnlineElementCollection : ConfigurationElementCollection
{
private const string UrlKey = "url";
private const string IsEnabledKey = "isEnabled";
private const string CobaltFileTtlKey = "cobaltFileTtl";
private const string CobaltNewFilePathKey = "cobaltNewFilePath";
[ConfigurationProperty(UrlKey, IsKey = true, IsRequired = true)]
public string Url
{
get { return this[UrlKey].ToString(); }
set { this[UrlKey] = value; }
}
[ConfigurationProperty(IsEnabledKey, IsKey = true, IsRequired = true, DefaultValue = false)]
public bool IsEnabled
{
get { return Boolean.Parse(this[IsEnabledKey].ToString()); }
set { this[IsEnabledKey] = value; }
}
[ConfigurationProperty(CobaltNewFilePathKey, IsKey = true, IsRequired = true)]
public string CobaltNewFilePath
{

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
@ -15,18 +16,23 @@ namespace WebsitePanel.WebDavPortal.FileOperations
{
public class FileOpenerManager
{
private readonly IDictionary<string, FileOpenerType> _officeOperationTypes = new Dictionary<string, FileOpenerType>();
private readonly IDictionary<string, FileOpenerType> _operationTypes = new Dictionary<string, FileOpenerType>();
private readonly Lazy<IDictionary<string, FileOpenerType>> _officeOperationTypes = new Lazy<IDictionary<string, FileOpenerType>>(
() =>
{
if (WebDavAppConfigManager.Instance.OfficeOnline.IsEnabled)
{
return
WebDavAppConfigManager.Instance.OfficeOnline.ToDictionary(x => x.Extension,
y => FileOpenerType.OfficeOnline);
}
return new Dictionary<string, FileOpenerType>();
});
public FileOpenerManager()
{
if (WebDavAppConfigManager.Instance.OfficeOnline.IsEnabled)
{
_officeOperationTypes.AddRange(
WebDavAppConfigManager.Instance.OfficeOnline.ToDictionary(x => x.Extension,
y => FileOpenerType.OfficeOnline));
}
_operationTypes.AddRange(
WebDavAppConfigManager.Instance.FileOpener.ToDictionary(x => x.Extension,
y => FileOpenerType.Open));
@ -94,7 +100,7 @@ namespace WebsitePanel.WebDavPortal.FileOperations
get
{
FileOpenerType result;
if (_officeOperationTypes.TryGetValue(fileExtension, out result) && CheckBrowserSupport())
if (_officeOperationTypes.Value.TryGetValue(fileExtension, out result) && CheckBrowserSupport())
{
return result;
}

View file

@ -87,7 +87,7 @@
<add browser="InternetExplorer;IE" version="8" />
<add browser="Safari" version="4" />
</owaSupportedBrowsers>
<officeOnline isEnabled="True" url="https://owa.websitepanel.net" cobaltFileTtl="1" cobaltNewFilePath="~/Content/OwaFiles/New">
<officeOnline cobaltFileTtl="1" cobaltNewFilePath="~/Content/OwaFiles/New">
<add extension=".doc" OwaView="wv/wordviewerframe.aspx?" OwaEditor="wv/wordviewerframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&amp;" OwaNewFileView="we/wordeditorframe.aspx?new=1&amp;" />
<add extension=".docx" OwaView="wv/wordviewerframe.aspx?" OwaEditor="we/wordeditorframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&amp;" OwaNewFileView="we/wordeditorframe.aspx?new=1&amp;" />
<add extension=".xls" OwaView="x/_layouts/xlviewerinternal.aspx?" OwaEditor="x/_layouts/xlviewerinternal.aspx?edit=1&amp;" OwaMobileView="x/_layouts/mobile/mXL.aspx?wdMobileHost=3&amp;" OwaNewFileView="x/_layouts/xlviewerinternal.aspx?new=1&amp;" />

View file

@ -195,4 +195,16 @@
<data name="lblPasswordResetLinkLifeSpan.Text" xml:space="preserve">
<value>Password Reset Link Life Span (hours):</value>
</data>
<data name="OwaSettings.Text" xml:space="preserve">
<value>Office Web Apps</value>
</data>
<data name="locEnableOwa.Text" xml:space="preserve">
<value>Enable OWA:</value>
</data>
<data name="chkEnableOwa.Text" xml:space="preserve">
<value>Yes</value>
</data>
<data name="locOwaUrl.Text" xml:space="preserve">
<value>OWA URL:</value>
</data>
</root>

View file

@ -104,6 +104,22 @@
</table>
</asp:Panel>
<wsp:CollapsiblePanel ID="OwaSettings" runat="server" TargetControlID="PanelOwaSettings" meta:resourcekey="OwaSettings" Text="Office Web Apps" />
<asp:Panel ID="PanelOwaSettings" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="SubHead"><asp:Localize ID="locEnableOwa" runat="server" meta:resourcekey="locEnableOwa" /></td>
<td class="Normal">
<asp:CheckBox ID="chkEnableOwa" runat="server" Text="Yes" meta:resourcekey="chkEnableOwa" />
</td>
</tr>
<tr>
<td class="SubHead" style="width:200px;"><asp:Localize ID="locOwaUrl" runat="server" meta:resourcekey="locOwaUrl" />
<td><asp:TextBox runat="server" ID="txtOwaUrl" Width="450px" /></td>
</tr>
</table>
</asp:Panel>
<wsp:CollapsiblePanel ID="TwilioSettings" runat="server" TargetControlID="PanelTwilioSettings" meta:resourcekey="TwilioSettings" Text="Webdav Portal" />
<asp:Panel ID="PanelTwilioSettings" runat="server" Height="0" style="overflow:hidden;">
<table>

View file

@ -167,6 +167,9 @@ namespace WebsitePanel.Portal
chkEnablePasswordReset.Checked = Utils.ParseBool(settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false);
txtWebdavPortalUrl.Text = settings[WEBDAV_PORTAL_URL];
txtPasswordResetLinkLifeSpan.Text = settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_LINK_LIFE_SPAN];
chkEnableOwa.Checked = Utils.ParseBool(settings[WSP.SystemSettings.WEBDAV_OWA_ENABLED_KEY], false);
txtOwaUrl.Text = settings[WSP.SystemSettings.WEBDAV_OWA_URL];
}
// Twilio portal
@ -264,6 +267,10 @@ namespace WebsitePanel.Portal
settings[WEBDAV_PORTAL_URL] = txtWebdavPortalUrl.Text;
settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY] = chkEnablePasswordReset.Checked.ToString();
settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_LINK_LIFE_SPAN] = txtPasswordResetLinkLifeSpan.Text;
settings[WSP.SystemSettings.WEBDAV_OWA_ENABLED_KEY] = chkEnableOwa.Checked.ToString();
settings[WSP.SystemSettings.WEBDAV_OWA_URL] = txtOwaUrl.Text;
result = ES.Services.System.SetSystemSettings(WSP.SystemSettings.WEBDAV_PORTAL_SETTINGS, settings);
if (result < 0)

View file

@ -300,6 +300,60 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtWebdavPortalUrl;
/// <summary>
/// OwaSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel OwaSettings;
/// <summary>
/// PanelOwaSettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel PanelOwaSettings;
/// <summary>
/// locEnableOwa control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locEnableOwa;
/// <summary>
/// chkEnableOwa control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkEnableOwa;
/// <summary>
/// locOwaUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locOwaUrl;
/// <summary>
/// txtOwaUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtOwaUrl;
/// <summary>
/// TwilioSettings control.
/// </summary>