Initial project's source code check-in.
This commit is contained in:
commit
b03b0b373f
4573 changed files with 981205 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Web.UI;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
// embedded resources
|
||||
[assembly: WebResource("WebsitePanel.Portal.Scripts.AjaxUtils.js", "application/x-javascript")]
|
||||
[assembly: WebResource("WebsitePanel.Portal.Scripts.RandomPassword.js", "application/x-javascript")]
|
|
@ -0,0 +1,242 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using WebsitePanel.EnterpriseServer.HostedSolution;
|
||||
using Microsoft.Web.Services3;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
// ES.Services
|
||||
|
||||
public class ES
|
||||
{
|
||||
public static ES Services
|
||||
{
|
||||
get
|
||||
{
|
||||
ES services = (ES)HttpContext.Current.Items["WebServices"];
|
||||
|
||||
if (services == null)
|
||||
{
|
||||
services = new ES();
|
||||
HttpContext.Current.Items["WebServices"] = services;
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
public esCRM CRM
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetCachedProxy<esCRM>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public esVirtualizationServer VPS
|
||||
{
|
||||
get { return GetCachedProxy<esVirtualizationServer>(); }
|
||||
}
|
||||
|
||||
public esVirtualizationServerForPrivateCloud VPSPC
|
||||
{
|
||||
get { return GetCachedProxy<esVirtualizationServerForPrivateCloud>(); }
|
||||
}
|
||||
|
||||
public esBlackBerry BlackBerry
|
||||
{
|
||||
get { return GetCachedProxy<esBlackBerry>(); }
|
||||
}
|
||||
|
||||
public esOCS OCS
|
||||
{
|
||||
get { return GetCachedProxy<esOCS>(); }
|
||||
}
|
||||
|
||||
public esOrganizations Organizations
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetCachedProxy<esOrganizations>();
|
||||
}
|
||||
}
|
||||
|
||||
public esSystem System
|
||||
{
|
||||
get { return GetCachedProxy<esSystem>(); }
|
||||
}
|
||||
|
||||
public esApplicationsInstaller ApplicationsInstaller
|
||||
{
|
||||
get { return GetCachedProxy<esApplicationsInstaller>(); }
|
||||
}
|
||||
|
||||
public esWebApplicationGallery WebApplicationGallery
|
||||
{
|
||||
get { return GetCachedProxy<esWebApplicationGallery>(); }
|
||||
}
|
||||
|
||||
public esAuditLog AuditLog
|
||||
{
|
||||
get { return GetCachedProxy<esAuditLog>(); }
|
||||
}
|
||||
|
||||
public esAuthentication Authentication
|
||||
{
|
||||
get { return GetCachedProxy<esAuthentication>(false); }
|
||||
}
|
||||
|
||||
public esComments Comments
|
||||
{
|
||||
get { return GetCachedProxy<esComments>(); }
|
||||
}
|
||||
|
||||
public esDatabaseServers DatabaseServers
|
||||
{
|
||||
get { return GetCachedProxy<esDatabaseServers>(); }
|
||||
}
|
||||
|
||||
public esFiles Files
|
||||
{
|
||||
get { return GetCachedProxy<esFiles>(); }
|
||||
}
|
||||
|
||||
public esFtpServers FtpServers
|
||||
{
|
||||
get { return GetCachedProxy<esFtpServers>(); }
|
||||
}
|
||||
|
||||
public esMailServers MailServers
|
||||
{
|
||||
get { return GetCachedProxy<esMailServers>(); }
|
||||
}
|
||||
|
||||
public esOperatingSystems OperatingSystems
|
||||
{
|
||||
get { return GetCachedProxy<esOperatingSystems>(); }
|
||||
}
|
||||
|
||||
public esPackages Packages
|
||||
{
|
||||
get { return GetCachedProxy<esPackages>(); }
|
||||
}
|
||||
|
||||
public esScheduler Scheduler
|
||||
{
|
||||
get { return GetCachedProxy<esScheduler>(); }
|
||||
}
|
||||
|
||||
public esTasks Tasks
|
||||
{
|
||||
get { return GetCachedProxy<esTasks>(); }
|
||||
}
|
||||
|
||||
public esServers Servers
|
||||
{
|
||||
get { return GetCachedProxy<esServers>(); }
|
||||
}
|
||||
|
||||
public esStatisticsServers StatisticsServers
|
||||
{
|
||||
get { return GetCachedProxy<esStatisticsServers>(); }
|
||||
}
|
||||
|
||||
public esUsers Users
|
||||
{
|
||||
get { return GetCachedProxy<esUsers>(); }
|
||||
}
|
||||
|
||||
public esWebServers WebServers
|
||||
{
|
||||
get { return GetCachedProxy<esWebServers>(); }
|
||||
}
|
||||
|
||||
public esSharePointServers SharePointServers
|
||||
{
|
||||
get { return GetCachedProxy<esSharePointServers>(); }
|
||||
}
|
||||
|
||||
public esHostedSharePointServers HostedSharePointServers
|
||||
{
|
||||
get { return GetCachedProxy<esHostedSharePointServers>(); }
|
||||
}
|
||||
|
||||
public esImport Import
|
||||
{
|
||||
get { return GetCachedProxy<esImport>(); }
|
||||
}
|
||||
|
||||
public esBackup Backup
|
||||
{
|
||||
get { return GetCachedProxy<esBackup>(); }
|
||||
}
|
||||
|
||||
public esExchangeServer ExchangeServer
|
||||
{
|
||||
get { return GetCachedProxy<esExchangeServer>(); }
|
||||
}
|
||||
|
||||
public esExchangeHostedEdition ExchangeHostedEdition
|
||||
{
|
||||
get { return GetCachedProxy<esExchangeHostedEdition>(); }
|
||||
}
|
||||
|
||||
protected ES()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual T GetCachedProxy<T>()
|
||||
{
|
||||
return GetCachedProxy<T>(true);
|
||||
}
|
||||
|
||||
protected virtual T GetCachedProxy<T>(bool secureCalls)
|
||||
{
|
||||
Type t = typeof(T);
|
||||
string key = t.FullName + ".ServiceProxy";
|
||||
T proxy = (T)HttpContext.Current.Items[key];
|
||||
if (proxy == null)
|
||||
{
|
||||
proxy = (T)Activator.CreateInstance(t);
|
||||
HttpContext.Current.Items[key] = proxy;
|
||||
}
|
||||
|
||||
object p = proxy;
|
||||
|
||||
// configure proxy
|
||||
PortalUtils.ConfigureEnterpriseServerProxy((WebServicesClientProtocol)p, secureCalls);
|
||||
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public enum MessageBoxType
|
||||
{
|
||||
Information,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for MessageBoxControl
|
||||
/// </summary>
|
||||
public interface IMessageBoxControl
|
||||
{
|
||||
void RenderMessage(MessageBoxType messageType, string message, string description,
|
||||
Exception ex, params string[] additionalParameters);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal.Code.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Exposes functionality that is required to be implemented by scheduler task views.
|
||||
/// </summary>
|
||||
public interface ISchedulerTaskView
|
||||
{
|
||||
/// <summary>
|
||||
/// When implemented sets scheduler task parameters on view.
|
||||
/// </summary>
|
||||
/// <param name="parameters">Parameters list to be set on view.</param>
|
||||
void SetParameters(ScheduleTaskParameterInfo[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// When implemented gets scheduler task parameters from view.
|
||||
/// </summary>
|
||||
/// <returns>Parameters list filled from view.</returns>
|
||||
ScheduleTaskParameterInfo[] GetParameters();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PanelFormatter.
|
||||
/// </summary>
|
||||
public class PanelFormatter
|
||||
{
|
||||
public static string GetYesNo(bool flag)
|
||||
{
|
||||
return PortalUtils.GetSharedLocalizedString(Utils.ModuleName, "YesNo." + flag.ToString());
|
||||
}
|
||||
|
||||
public static string GetLocalizedResourceGroupName(string groupName)
|
||||
{
|
||||
return PortalUtils.GetSharedLocalizedString(Utils.ModuleName, String.Format("ResourceGroup.{0}", groupName));
|
||||
}
|
||||
|
||||
public static string GetDisplaySizeInBytes(long size)
|
||||
{
|
||||
if (size >= 0x400 && size < 0x100000)
|
||||
// kilobytes
|
||||
return Convert.ToString((int)Math.Round(((float)size / 1024))) + "K";
|
||||
else if (size >= 0x100000 && size < 0x40000000)
|
||||
// megabytes
|
||||
return Convert.ToString((int)Math.Round(((float)size / 1024 / 1024))) + "M";
|
||||
else if (size >= 0x40000000 && size < 0x10000000000)
|
||||
// gigabytes
|
||||
return Convert.ToString((int)Math.Round(((float)size / 1024 / 1024 / 1024))) + "G";
|
||||
else
|
||||
return size.ToString();
|
||||
}
|
||||
|
||||
public static string GetUserRoleName(int roleId)
|
||||
{
|
||||
string roleKey = ((UserRole)roleId).ToString();
|
||||
return PortalUtils.GetSharedLocalizedString(Utils.ModuleName, "PanelRole." + roleKey);
|
||||
}
|
||||
|
||||
public static string GetAccountStatusName(int statusId)
|
||||
{
|
||||
string statusKey = ((UserStatus)statusId).ToString();
|
||||
return PortalUtils.GetSharedLocalizedString(Utils.ModuleName, "AccountStatus." + statusKey);
|
||||
}
|
||||
|
||||
public static string GetPackageStatusName(int statusId)
|
||||
{
|
||||
string statusKey = ((PackageStatus)statusId).ToString();
|
||||
return PortalUtils.GetSharedLocalizedString(Utils.ModuleName, "PackageStatus." + statusKey);
|
||||
}
|
||||
|
||||
public static string FormatDate(DateTime date)
|
||||
{
|
||||
return date.ToString("d");
|
||||
}
|
||||
|
||||
public static DateTime ParseDate(string strDate, DateTime defValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DateTime.Parse(strDate);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatMoney(decimal val)
|
||||
{
|
||||
NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
|
||||
nfi.CurrencySymbol = "";
|
||||
|
||||
return val.ToString("C", nfi);
|
||||
}
|
||||
|
||||
public static decimal ParseMoney(string val)
|
||||
{
|
||||
return ParseMoney(val, 0);
|
||||
}
|
||||
|
||||
public static decimal ParseMoney(string val, decimal defaultValue)
|
||||
{
|
||||
NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
|
||||
decimal result = defaultValue;
|
||||
try { result = Decimal.Parse(val, nfi); }
|
||||
catch { /* do nothing */ }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Reflection;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Globals.
|
||||
/// </summary>
|
||||
public class PanelGlobals
|
||||
{
|
||||
public const string UsernameDefaultAllowedRegExp = @"a-zA-Z0-9_\.";
|
||||
public const string MetaCharacters2Escape = @".\+-()<>{}[]|*$^&?!";
|
||||
|
||||
public static string WebsitePanelRootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return PortalUtils.ApplicationPath
|
||||
+ "/DesktopModules/WebsitePanel/";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PanelRequest.
|
||||
/// </summary>
|
||||
public class PanelRequest
|
||||
{
|
||||
public static int GetInt(string key)
|
||||
{
|
||||
return GetInt(key, 0);
|
||||
}
|
||||
|
||||
public static int GetInt(string key, int defaultValue)
|
||||
{
|
||||
int result = defaultValue;
|
||||
try { result = Int32.Parse(HttpContext.Current.Request[key]); }
|
||||
catch { /* do nothing */ }
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int UserID
|
||||
{
|
||||
get { return GetInt("UserID"); }
|
||||
}
|
||||
|
||||
public static int AccountID
|
||||
{
|
||||
get { return GetInt("AccountID"); }
|
||||
}
|
||||
|
||||
public static int PeerID
|
||||
{
|
||||
get { return GetInt("PeerID"); }
|
||||
}
|
||||
|
||||
public static int ServerId
|
||||
{
|
||||
get { return GetInt("ServerID"); }
|
||||
}
|
||||
|
||||
public static string PoolId
|
||||
{
|
||||
get { return HttpContext.Current.Request["PoolID"]; }
|
||||
}
|
||||
|
||||
public static string DeviceId
|
||||
{
|
||||
get { return HttpContext.Current.Request["DeviceID"]; }
|
||||
}
|
||||
|
||||
public static int ServiceId
|
||||
{
|
||||
get { return GetInt("ServiceID"); }
|
||||
}
|
||||
|
||||
public static string TaskID
|
||||
{
|
||||
get { return HttpContext.Current.Request["TaskID"]; }
|
||||
}
|
||||
|
||||
public static int GroupID
|
||||
{
|
||||
get { return GetInt("GroupID"); }
|
||||
}
|
||||
|
||||
public static int AddressID
|
||||
{
|
||||
get { return GetInt("AddressID"); }
|
||||
}
|
||||
|
||||
public static string Addresses
|
||||
{
|
||||
get { return HttpContext.Current.Request["Addresses"]; }
|
||||
}
|
||||
|
||||
public static int ResourceID
|
||||
{
|
||||
get { return GetInt("ResourceID"); }
|
||||
}
|
||||
|
||||
public static int PlanID
|
||||
{
|
||||
get { return GetInt("PlanID"); }
|
||||
}
|
||||
|
||||
public static int AddonID
|
||||
{
|
||||
get { return GetInt("AddonID"); }
|
||||
}
|
||||
|
||||
public static int PackageID
|
||||
{
|
||||
get { return GetInt("PackageID", -1); }
|
||||
}
|
||||
|
||||
public static int PackageAddonID
|
||||
{
|
||||
get { return GetInt("PackageAddonID"); }
|
||||
}
|
||||
|
||||
public static int ItemID
|
||||
{
|
||||
get { return GetInt("ItemID"); }
|
||||
}
|
||||
|
||||
public static int RegistrationID
|
||||
{
|
||||
get { return GetInt("RegistrationID"); }
|
||||
}
|
||||
|
||||
public static int DomainID
|
||||
{
|
||||
get { return GetInt("DomainID"); }
|
||||
}
|
||||
|
||||
public static int InstallationID
|
||||
{
|
||||
get { return GetInt("InstallationID"); }
|
||||
}
|
||||
|
||||
public static int ScheduleID
|
||||
{
|
||||
get { return GetInt("ScheduleID"); }
|
||||
}
|
||||
|
||||
public static string RecordID
|
||||
{
|
||||
get { return HttpContext.Current.Request["RecordID"]; }
|
||||
}
|
||||
|
||||
public static string InstanceID
|
||||
{
|
||||
get { return HttpContext.Current.Request["InstanceID"]; }
|
||||
}
|
||||
|
||||
|
||||
public static string VirtDir
|
||||
{
|
||||
get { return HttpContext.Current.Request["VirtDir"] != null ? HttpContext.Current.Request["VirtDir"].Trim().Replace("__DOT__", ".") : ""; }
|
||||
}
|
||||
|
||||
public static string Path
|
||||
{
|
||||
get { return HttpContext.Current.Request["Path"] != null ? HttpContext.Current.Request["Path"] : ""; }
|
||||
}
|
||||
|
||||
public static string ApplicationID
|
||||
{
|
||||
get { return HttpContext.Current.Request["ApplicationID"] != null ? HttpContext.Current.Request["ApplicationID"].Trim() : ""; }
|
||||
}
|
||||
|
||||
public static string Name
|
||||
{
|
||||
get { return HttpContext.Current.Request["Name"] != null
|
||||
? HttpContext.Current.Request["Name"].Trim() : ""; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,294 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PanelSecurity.
|
||||
/// </summary>
|
||||
public class PanelSecurity
|
||||
{
|
||||
public static int PackageId
|
||||
{
|
||||
get
|
||||
{
|
||||
HttpRequest request = HttpContext.Current.Request;
|
||||
string sSpaceId = request[PortalUtils.SPACE_ID_PARAM];
|
||||
if (!String.IsNullOrEmpty(sSpaceId))
|
||||
{
|
||||
return Utils.ParseInt(sSpaceId, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#region Recently Switched Users
|
||||
public static UserInfo[] GetRecentlySwitchedUsers()
|
||||
{
|
||||
return GetRecentlySwitchedUsersInternal().ToArray();
|
||||
}
|
||||
|
||||
private static List<UserInfo> GetRecentlySwitchedUsersInternal()
|
||||
{
|
||||
List<UserInfo> users = new List<UserInfo>();
|
||||
|
||||
// get existing list
|
||||
string[] pairs = GetRecentlySwitchedUsersArray();
|
||||
foreach (string pair in pairs)
|
||||
{
|
||||
string[] parts = pair.Split('=');
|
||||
UserInfo user = new UserInfo();
|
||||
user.UserId = Utils.ParseInt(parts[0], 0);
|
||||
user.Username = parts[1];
|
||||
users.Add(user);
|
||||
}
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
public static void AddRecentlySwitchedUser(int userId)
|
||||
{
|
||||
// get existing list
|
||||
List<UserInfo> users = GetRecentlySwitchedUsersInternal();
|
||||
|
||||
// check if the user exists
|
||||
UserInfo existUser = null;
|
||||
foreach (UserInfo user in users)
|
||||
{
|
||||
if (user.UserId == userId)
|
||||
{
|
||||
existUser = user;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (existUser != null)
|
||||
{
|
||||
// move user to the top of the list
|
||||
users.Remove(existUser);
|
||||
users.Insert(0, existUser);
|
||||
}
|
||||
else
|
||||
{
|
||||
// read new user
|
||||
UserInfo newUser = ES.Services.Users.GetUserById(userId);
|
||||
if (newUser == null)
|
||||
return;
|
||||
|
||||
if (users.Count == 10)
|
||||
{
|
||||
// remove last user
|
||||
users.RemoveAt(9);
|
||||
}
|
||||
|
||||
// insert new
|
||||
users.Insert(0, newUser);
|
||||
}
|
||||
|
||||
// save results
|
||||
List<string> pairs = new List<string>();
|
||||
foreach (UserInfo user in users)
|
||||
{
|
||||
pairs.Add(user.UserId.ToString() + "=" + user.Username);
|
||||
}
|
||||
string s = String.Join("*", pairs.ToArray());
|
||||
|
||||
string key = "RecentlySwitchedUsers" + LoggedUserId;
|
||||
HttpContext.Current.Items[key] = s;
|
||||
|
||||
HttpCookie cookie = new HttpCookie(key, s);
|
||||
HttpContext.Current.Response.Cookies.Remove(key);
|
||||
HttpContext.Current.Response.Cookies.Add(cookie);
|
||||
}
|
||||
|
||||
private static string[] GetRecentlySwitchedUsersArray()
|
||||
{
|
||||
string[] users = new string[] { };
|
||||
|
||||
string key = "RecentlySwitchedUsers" + LoggedUserId;
|
||||
HttpCookie cookie = HttpContext.Current.Request.Cookies[key];
|
||||
|
||||
if (HttpContext.Current.Items[key] != null)
|
||||
users = ((string)HttpContext.Current.Items[key]).Split('*');
|
||||
else if (cookie != null)
|
||||
users = cookie.Value.Split('*');
|
||||
|
||||
return users;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Selected user
|
||||
public static int SelectedUserId
|
||||
{
|
||||
get
|
||||
{
|
||||
HttpRequest request = HttpContext.Current.Request;
|
||||
string sUserId = request[PortalUtils.USER_ID_PARAM];
|
||||
if (!String.IsNullOrEmpty(sUserId))
|
||||
{
|
||||
return Utils.ParseInt(sUserId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// try to get from current space
|
||||
int spaceId = PackageId;
|
||||
if (spaceId > 0)
|
||||
{
|
||||
// load space
|
||||
// check context
|
||||
PackageInfo space = (PackageInfo)HttpContext.Current.Items["WebsitePanelSelectedSpace"];
|
||||
if (space != null)
|
||||
{
|
||||
return space.UserId;
|
||||
}
|
||||
else
|
||||
{
|
||||
space = ES.Services.Packages.GetPackage(spaceId);
|
||||
if (space != null)
|
||||
{
|
||||
// place to cache
|
||||
HttpContext.Current.Items["WebsitePanelSelectedSpace"] = space;
|
||||
|
||||
// return
|
||||
return space.UserId;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return EffectiveUserId;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static UserInfo SelectedUser
|
||||
{
|
||||
get
|
||||
{
|
||||
UserInfo user = (UserInfo)HttpContext.Current.Items["WebsitePanelSelectedUser"];
|
||||
if (user == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
user = ES.Services.Users.GetUserById(SelectedUserId);
|
||||
}
|
||||
catch { }
|
||||
|
||||
// create <empty> user
|
||||
if (user == null)
|
||||
{
|
||||
user = new UserInfo();
|
||||
user.UserId = -1;
|
||||
user.FirstName = "Unknown";
|
||||
user.LastName = "User";
|
||||
user.Role = UserRole.User;
|
||||
user.IsDemo = true;
|
||||
user.Email = "";
|
||||
user.Username = "Unknown";
|
||||
}
|
||||
|
||||
// add to context
|
||||
HttpContext.Current.Items["WebsitePanelSelectedUser"] = user;
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Logged user
|
||||
public static int LoggedUserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LoggedUser != null) ? LoggedUser.UserId : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static UserInfo LoggedUser
|
||||
{
|
||||
get
|
||||
{
|
||||
UserInfo user = (UserInfo)HttpContext.Current.Items["WebsitePanelLoggedUser"];
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
// load ES settings
|
||||
try
|
||||
{
|
||||
user = PortalUtils.GetCurrentUser();
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
// add to context
|
||||
HttpContext.Current.Items["WebsitePanelLoggedUser"] = user;
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Effective user
|
||||
public static int EffectiveUserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LoggedUser != null && LoggedUser.IsPeer) ? LoggedUser.OwnerId : LoggedUserId;
|
||||
}
|
||||
}
|
||||
|
||||
public static UserInfo EffectiveUser
|
||||
{
|
||||
get
|
||||
{
|
||||
UserInfo user = (UserInfo)HttpContext.Current.Items["WebsitePanelEffectiveUser"];
|
||||
if (user == null)
|
||||
{
|
||||
user = ES.Services.Users.GetUserById(EffectiveUserId);
|
||||
|
||||
// add to context
|
||||
HttpContext.Current.Items["WebsitePanelEffectiveUser"] = user;
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Utils.
|
||||
/// </summary
|
||||
public class Utils
|
||||
{
|
||||
public const string ModuleName = "WebsitePanel";
|
||||
|
||||
public const Int32 MAX_DIR_LENGTH = 248;
|
||||
public const Int32 MAX_FILE_LENGTH = 260;
|
||||
|
||||
public const int CHANGE_PASSWORD_REDIRECT_TIMEOUT = 7000;
|
||||
|
||||
public static DateTime ParseDate(string val)
|
||||
{
|
||||
try { return DateTime.Parse(val); }
|
||||
catch { /* do nothing */ }
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
public static int ParseInt(string val)
|
||||
{
|
||||
return ParseInt(val, 0);
|
||||
}
|
||||
|
||||
public static int ParseInt(object val, int defaultValue)
|
||||
{
|
||||
int result = defaultValue;
|
||||
try { result = Int32.Parse(val.ToString()); }
|
||||
catch { /* do nothing */ }
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool ParseBool(string val, bool defaultValue)
|
||||
{
|
||||
bool result = defaultValue;
|
||||
try { result = Boolean.Parse(val); }
|
||||
catch { /* do nothing */ }
|
||||
return result;
|
||||
}
|
||||
|
||||
public static decimal ParseDecimal(string val, decimal defaultValue)
|
||||
{
|
||||
decimal result = defaultValue;
|
||||
try { result = Decimal.Parse(val); }
|
||||
catch { /* do nothing */ }
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string FormatDateTime(DateTime dt)
|
||||
{
|
||||
return dt == DateTime.MinValue ? "" : dt.ToString();
|
||||
}
|
||||
|
||||
public static string FixRelativePath(string path)
|
||||
{
|
||||
string reversed = path.Replace("/", "\\");
|
||||
return Regex.Replace(reversed, @"\.\\|\.\.|\\\\|\?|\:|\""|\<|\>|\||%|\$", "");
|
||||
}
|
||||
|
||||
public static String NormalizeString(String inString, Boolean pathSymbolsForbidden, Char substitute, Int32 maxLength)
|
||||
{
|
||||
inString = Regex.Replace(inString, "[^\\w\\s.-]+", substitute.ToString());
|
||||
|
||||
if ((inString).Length > maxLength)
|
||||
inString = inString.Remove(maxLength, inString.Length - maxLength);
|
||||
|
||||
return inString;
|
||||
}
|
||||
|
||||
public static string[] ParseDelimitedString(string str, params char[] delimiter)
|
||||
{
|
||||
string[] parts = str.Split(delimiter);
|
||||
ArrayList list = new ArrayList();
|
||||
foreach (string part in parts)
|
||||
if (part.Trim() != "" && !list.Contains(part.Trim()))
|
||||
list.Add(part);
|
||||
return (string[])list.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
public static string ReplaceStringVariable(string str, string variable, string value)
|
||||
{
|
||||
Regex re = new Regex("\\[" + variable + "\\]+", RegexOptions.IgnoreCase);
|
||||
return re.Replace(str, value);
|
||||
}
|
||||
|
||||
public static byte[] ConvertStreamToBytes(Stream stream)
|
||||
{
|
||||
long length = stream.Length;
|
||||
byte[] content = new byte[length];
|
||||
stream.Read(content, 0, (int)length);
|
||||
stream.Close();
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Builds list of items from supplied group string.
|
||||
/// </summary>
|
||||
/// <param name="group">Group string.</param>
|
||||
/// <returns>List of items.</returns>
|
||||
public static List<KeyValuePair<string, string>> ParseGroup(string group)
|
||||
{
|
||||
List<KeyValuePair<string, string>> items = new List<KeyValuePair<string, string>>();
|
||||
string[] vals = group.Split(';');
|
||||
foreach (string v in vals)
|
||||
{
|
||||
string itemValue = v;
|
||||
string itemText = v;
|
||||
|
||||
int eqIdx = v.IndexOf("=");
|
||||
if (eqIdx != -1)
|
||||
{
|
||||
itemValue = v.Substring(0, eqIdx);
|
||||
itemText = v.Substring(eqIdx + 1);
|
||||
}
|
||||
|
||||
items.Add(new KeyValuePair<string, string>(itemText, itemValue));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
public static void SelectListItem(ListControl ctrl, object value)
|
||||
{
|
||||
// unselect currently selected item
|
||||
if (ctrl.SelectedIndex != -1)
|
||||
ctrl.SelectedItem.Selected = false;
|
||||
|
||||
string val = (value != null) ? value.ToString() : "";
|
||||
ListItem item = ctrl.Items.FindByValue(val);
|
||||
if (item != null) item.Selected = true;
|
||||
}
|
||||
|
||||
public static void SaveListControlState(ListControl ctrl)
|
||||
{
|
||||
HttpResponse response = HttpContext.Current.Response;
|
||||
|
||||
// build cookie value
|
||||
ArrayList selValues = new ArrayList();
|
||||
foreach (ListItem item in ctrl.Items)
|
||||
{
|
||||
if (item.Selected)
|
||||
selValues.Add(item.Value);
|
||||
}
|
||||
|
||||
string cookieVal = String.Join(",", (string[])selValues.ToArray(typeof(string)));
|
||||
|
||||
// create cookie
|
||||
HttpCookie cookie = new HttpCookie(ctrl.UniqueID, cookieVal);
|
||||
response.Cookies.Add(cookie);
|
||||
}
|
||||
|
||||
public static void LoadListControlState(ListControl ctrl)
|
||||
{
|
||||
HttpRequest request = HttpContext.Current.Request;
|
||||
|
||||
// get cookie
|
||||
HttpCookie cookie = request.Cookies[ctrl.UniqueID];
|
||||
if (cookie == null)
|
||||
return;
|
||||
|
||||
// reset all items
|
||||
foreach (ListItem item in ctrl.Items)
|
||||
item.Selected = false;
|
||||
|
||||
string[] vals = cookie.Value.Split(new char[] { ',' });
|
||||
foreach (string val in vals)
|
||||
{
|
||||
ListItem item = ctrl.Items.FindByValue(val);
|
||||
if (item != null) item.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static string EllipsisString(string str, int maxLen)
|
||||
{
|
||||
if (String.IsNullOrEmpty(str) || str.Length <= maxLen)
|
||||
return str;
|
||||
|
||||
return str.Substring(0, maxLen) + "...";
|
||||
}
|
||||
|
||||
public static string GetRandomString(int length)
|
||||
{
|
||||
string ptrn = "abcdefghjklmnpqrstwxyz0123456789";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
byte[] randomBytes = new byte[4];
|
||||
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
|
||||
rng.GetBytes(randomBytes);
|
||||
|
||||
// Convert 4 bytes into a 32-bit integer value.
|
||||
int seed = (randomBytes[0] & 0x7f) << 24 |
|
||||
randomBytes[1] << 16 |
|
||||
randomBytes[2] << 8 |
|
||||
randomBytes[3];
|
||||
|
||||
|
||||
Random rnd = new Random(seed);
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
sb.Append(ptrn[rnd.Next(ptrn.Length - 1)]);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class WebPortalPageTitleProvider : WebsitePanel.WebPortal.PageTitleProvider
|
||||
{
|
||||
public override string ProcessPageTitle(string title)
|
||||
{
|
||||
string result = title;
|
||||
|
||||
// user
|
||||
if (title.IndexOf("{user}") != -1)
|
||||
{
|
||||
UserInfo user = PanelSecurity.SelectedUser;
|
||||
if (user != null)
|
||||
result = result.Replace("{user}", user.Username);
|
||||
}
|
||||
|
||||
// space
|
||||
if (title.IndexOf("{space}") != -1)
|
||||
{
|
||||
if (PanelSecurity.PackageId > 0)
|
||||
{
|
||||
// space
|
||||
PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);
|
||||
if (package != null)
|
||||
result = result.Replace("{space}", package.PackageName);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.WebPortal;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class WebPortalThemeProvider : PortalThemeProvider
|
||||
{
|
||||
public override string GetTheme()
|
||||
{
|
||||
return PortalUtils.CurrentTheme;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,392 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for WebsitePanelControlBase
|
||||
/// </summary>
|
||||
public class WebsitePanelControlBase : WebPortalControlBase
|
||||
{
|
||||
// disable controls flag
|
||||
protected bool DisableControls = false;
|
||||
protected List<Control> ExcludeDisableControls = new List<Control>();
|
||||
|
||||
private Control hostModule = null;
|
||||
public WebsitePanelModuleBase HostModule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hostModule == null)
|
||||
{
|
||||
// find nearest parent
|
||||
hostModule = this.Parent;
|
||||
while (true)
|
||||
{
|
||||
if (hostModule == null || hostModule is WebsitePanelModuleBase)
|
||||
break;
|
||||
|
||||
hostModule = hostModule.Parent;
|
||||
}
|
||||
}
|
||||
return (WebsitePanelModuleBase)hostModule;
|
||||
}
|
||||
}
|
||||
|
||||
public string TaskID
|
||||
{
|
||||
get { return (string)Context.Items["WebsitePanelAtlasTaskID"]; }
|
||||
}
|
||||
|
||||
public string AsyncTaskID
|
||||
{
|
||||
get { return (string)Context.Items["WebsitePanelAtlasAsyncTaskID"]; }
|
||||
set { Context.Items["WebsitePanelAtlasAsyncTaskID"] = value; }
|
||||
}
|
||||
|
||||
public string AsyncTaskTitle
|
||||
{
|
||||
get { return (string)Context.Items["WebsitePanelAtlasAsyncTaskTitle"]; }
|
||||
set { Context.Items["WebsitePanelAtlasAsyncTaskTitle"] = value; }
|
||||
}
|
||||
|
||||
public virtual void RedirectToBrowsePage()
|
||||
{
|
||||
Response.Redirect(NavigateURL(), true);
|
||||
}
|
||||
|
||||
public void RedirectAccountHomePage(int userId)
|
||||
{
|
||||
Response.Redirect(NavigateURL(PortalUtils.USER_ID_PARAM, userId.ToString()));
|
||||
}
|
||||
|
||||
public void RedirectAccountHomePage()
|
||||
{
|
||||
RedirectAccountHomePage(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
|
||||
public void RedirectSpaceHomePage()
|
||||
{
|
||||
Response.Redirect(NavigateURL(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString()));
|
||||
}
|
||||
|
||||
public void LocalizeGridView(GridView grid)
|
||||
{
|
||||
foreach (DataControlField column in grid.Columns)
|
||||
{
|
||||
// localize header text
|
||||
string key = column.HeaderText;
|
||||
if (key != null && key != "")
|
||||
{
|
||||
string localizedText = GetLocalizedString(key + ".Header");
|
||||
if (localizedText != null)
|
||||
column.HeaderText = localizedText;
|
||||
}
|
||||
}
|
||||
|
||||
// localize empty message
|
||||
string etKey = grid.EmptyDataText;
|
||||
if (etKey != null && etKey != "")
|
||||
{
|
||||
string localizedText = GetLocalizedString(etKey + ".Empty");
|
||||
if (localizedText != null)
|
||||
grid.EmptyDataText = localizedText;
|
||||
}
|
||||
}
|
||||
|
||||
public void LocalizeGridViews(Control ctrl)
|
||||
{
|
||||
// localize control
|
||||
if (ctrl is GridView)
|
||||
{
|
||||
GridView gv = ctrl as GridView;
|
||||
LocalizeGridView(gv);
|
||||
}
|
||||
else
|
||||
{
|
||||
// localize children
|
||||
foreach (Control childCtrl in ctrl.Controls)
|
||||
LocalizeGridViews(childCtrl);
|
||||
}
|
||||
}
|
||||
|
||||
public void LocalizeMenuItems(string key, MenuItemCollection items)
|
||||
{
|
||||
foreach (MenuItem item in items)
|
||||
{
|
||||
string itemText = item.Text;
|
||||
string localizedText = GetLocalizedString(key + "." + itemText);
|
||||
if (localizedText != null)
|
||||
item.Text = localizedText;
|
||||
|
||||
// localize tool tip
|
||||
string localizedTooltip = GetLocalizedString(key + "." + itemText + ".ToolTip");
|
||||
if (localizedTooltip != null)
|
||||
item.ToolTip = localizedTooltip;
|
||||
|
||||
// localize child items
|
||||
LocalizeMenuItems(key, item.ChildItems);
|
||||
}
|
||||
}
|
||||
|
||||
public void LocalizeListItems(string key, ListItemCollection items)
|
||||
{
|
||||
foreach (ListItem item in items)
|
||||
{
|
||||
string localizedText = GetLocalizedString(key + "Item." + item.Text);
|
||||
if (localizedText != null)
|
||||
item.Text = localizedText;
|
||||
}
|
||||
}
|
||||
|
||||
public void LocalizeModuleControls(Control ctrl)
|
||||
{
|
||||
// localize control
|
||||
if (ctrl is Button)
|
||||
{
|
||||
Button btn = ctrl as Button;
|
||||
string key = btn.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
string localizedOnClientClick = GetLocalizedString(key + ".OnClientClick");
|
||||
if (localizedOnClientClick != null)
|
||||
btn.OnClientClick = localizedOnClientClick;
|
||||
}
|
||||
}
|
||||
else if (ctrl is Label)
|
||||
{
|
||||
Label lbl = ctrl as Label;
|
||||
string key = lbl.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
string localizedText = GetLocalizedString(key + ".Text");
|
||||
if (localizedText != null)
|
||||
lbl.Text = localizedText;
|
||||
}
|
||||
}
|
||||
else if (ctrl is ImageButton)
|
||||
{
|
||||
ImageButton btn = ctrl as ImageButton;
|
||||
string key = btn.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
string localizedOnClientClick = GetLocalizedString(key + ".OnClientClick");
|
||||
if (localizedOnClientClick != null)
|
||||
btn.OnClientClick = localizedOnClientClick;
|
||||
|
||||
string localizedAlternateText = GetLocalizedString(key + ".AlternateText");
|
||||
if (localizedAlternateText != null)
|
||||
btn.AlternateText = localizedAlternateText;
|
||||
}
|
||||
}
|
||||
else if (ctrl is Menu)
|
||||
{
|
||||
Menu menu = ctrl as Menu;
|
||||
|
||||
string key = menu.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
LocalizeMenuItems(key, menu.Items);
|
||||
}
|
||||
}
|
||||
else if (ctrl is DropDownList)
|
||||
{
|
||||
DropDownList ddl = ctrl as DropDownList;
|
||||
string key = ddl.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
LocalizeListItems(key, ddl.Items);
|
||||
}
|
||||
}
|
||||
else if (ctrl is RadioButtonList)
|
||||
{
|
||||
RadioButtonList rbl = ctrl as RadioButtonList;
|
||||
string key = rbl.Attributes["resourcekey"];
|
||||
if (key != null && key != "")
|
||||
{
|
||||
LocalizeListItems(key, rbl.Items);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// localize children
|
||||
foreach (Control childCtrl in ctrl.Controls)
|
||||
LocalizeModuleControls(childCtrl);
|
||||
}
|
||||
}
|
||||
|
||||
public void DisableFormControls(Control ctrl, params Control[] excludeControls)
|
||||
{
|
||||
if (excludeControls != null)
|
||||
{
|
||||
foreach (Control exCtrl in excludeControls)
|
||||
{
|
||||
if (ctrl == exCtrl)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctrl is ImageButton)
|
||||
{
|
||||
((ImageButton)ctrl).Enabled = false;
|
||||
}
|
||||
else if (ctrl is Button)
|
||||
{
|
||||
((Button)ctrl).Enabled = false;
|
||||
}
|
||||
else if (ctrl is CheckBox)
|
||||
{
|
||||
((CheckBox)ctrl).Enabled = false;
|
||||
}
|
||||
else if (ctrl is TextBox)
|
||||
{
|
||||
((TextBox)ctrl).Enabled = false;
|
||||
}
|
||||
else if (ctrl is DropDownList)
|
||||
{
|
||||
((DropDownList)ctrl).Enabled = false;
|
||||
}
|
||||
else if (ctrl is Menu)
|
||||
{
|
||||
((Menu)ctrl).Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// disable children
|
||||
foreach (Control childCtrl in ctrl.Controls)
|
||||
DisableFormControls(childCtrl, excludeControls);
|
||||
}
|
||||
}
|
||||
|
||||
public void FillDatabaseVersions(int packageId, ListItemCollection items, List<string> versions)
|
||||
{
|
||||
if (versions == null)
|
||||
return;
|
||||
|
||||
// load package context
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);
|
||||
|
||||
items.Clear();
|
||||
AddDatabaseVersion(cntx, ResourceGroups.MsSql2000, items, versions);
|
||||
AddDatabaseVersion(cntx, ResourceGroups.MsSql2005, items, versions);
|
||||
AddDatabaseVersion(cntx, ResourceGroups.MsSql2008, items, versions);
|
||||
AddDatabaseVersion(cntx, ResourceGroups.MySql4, items, versions);
|
||||
AddDatabaseVersion(cntx, ResourceGroups.MySql5, items, versions);
|
||||
}
|
||||
|
||||
private void AddDatabaseVersion(PackageContext cntx, string groupName, ListItemCollection items, List<string> versions)
|
||||
{
|
||||
if(cntx.Groups.ContainsKey(groupName) && versions.Contains(groupName))
|
||||
items.Add(new ListItem(GetSharedLocalizedString(Utils.ModuleName, "ResourceGroup." + groupName), groupName));
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
//base.LocalResourceFile = LocalResourceFile;
|
||||
|
||||
// call base handler
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
// localize grid viewes
|
||||
LocalizeGridViews(this);
|
||||
|
||||
// call base handler
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
protected override void OnPreRender(EventArgs e)
|
||||
{
|
||||
// localize all controls
|
||||
LocalizeModuleControls(this);
|
||||
|
||||
// disable controls (if required)
|
||||
if (DisableControls)
|
||||
DisableFormControls(this, ExcludeDisableControls.ToArray());
|
||||
|
||||
// call base handler
|
||||
base.OnPreRender(e);
|
||||
}
|
||||
|
||||
public string GetSharedLocalizedString(string resourceKey)
|
||||
{
|
||||
return base.GetSharedLocalizedString(Utils.ModuleName, resourceKey);
|
||||
}
|
||||
|
||||
#region Localization routines
|
||||
public string GetExceedingQuotasMessage(DataSet ds)
|
||||
{
|
||||
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
||||
return "";
|
||||
|
||||
List<string> quotas = new List<string>();
|
||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
quotas.Add(String.Format("{0} ({1})",
|
||||
GetSharedLocalizedString(Utils.ModuleName, "Quota." + dr["QuotaName"].ToString()),
|
||||
dr["QuotaValue"]));
|
||||
}
|
||||
return GetSharedLocalizedString(Utils.ModuleName, "Text.ExceedingQuotas") + String.Join(", ", quotas.ToArray());
|
||||
}
|
||||
|
||||
public string GetAuditLogRecordSeverityName(int severityId)
|
||||
{
|
||||
string typeName = "Information";
|
||||
if (severityId == 1)
|
||||
typeName = "Warning";
|
||||
else if (severityId == 2)
|
||||
typeName = "Error";
|
||||
|
||||
string localizedType = GetSharedLocalizedString(Utils.ModuleName, "AuditRecordSeverity." + typeName);
|
||||
return (localizedType != null) ? localizedType : typeName;
|
||||
}
|
||||
|
||||
public string GetAuditLogSourceName(string sourceName)
|
||||
{
|
||||
string localizedText = GetSharedLocalizedString(Utils.ModuleName, "AuditLogSource." + sourceName);
|
||||
return (localizedText != null) ? localizedText : sourceName;
|
||||
}
|
||||
|
||||
public string GetAuditLogTaskName(string sourceName, string taskName)
|
||||
{
|
||||
string localizedText = GetSharedLocalizedString(Utils.ModuleName,
|
||||
"AuditLogTask." + sourceName + "_" + taskName);
|
||||
return (localizedText != null) ? localizedText : taskName;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class WebsitePanelModuleBase : WebsitePanelControlBase
|
||||
{
|
||||
private IMessageBoxControl messageBox;
|
||||
|
||||
public WebsitePanelModuleBase()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
// add message box control
|
||||
messageBox = (IMessageBoxControl)this.LoadControl(
|
||||
PanelGlobals.WebsitePanelRootPath + "UserControls/MessageBox.ascx");
|
||||
this.Controls.AddAt(0, (Control)messageBox);
|
||||
((Control)messageBox).Visible = false;
|
||||
|
||||
// call base handler
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
//Page.MaintainScrollPositionOnPostBack = true;
|
||||
|
||||
// call base handler
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
public void SwitchUser(object arg)
|
||||
{
|
||||
//PanelSecurity.SelectedUserId = Utils.ParseInt(arg.ToString(), PanelSecurity.EffectiveUserId);
|
||||
RedirectToBrowsePage();
|
||||
}
|
||||
|
||||
public void SwitchPackage(object arg)
|
||||
{
|
||||
string[] args = arg.ToString().Split(',');
|
||||
|
||||
//PanelSecurity.SelectedUserId = Utils.ParseInt(args[0], PanelSecurity.EffectiveUserId);
|
||||
//PanelSecurity.PackageId = Utils.ParseInt(args[1], 0);
|
||||
RedirectToBrowsePage();
|
||||
}
|
||||
|
||||
public void LoadProviderControl(int packageId, string groupName, PlaceHolder container, string controlName)
|
||||
{
|
||||
string ctrlPath = null;
|
||||
//
|
||||
ProviderInfo provider = ES.Services.Servers.GetPackageServiceProvider(packageId, groupName);
|
||||
|
||||
// try to locate suitable control
|
||||
string currPath = this.AppRelativeVirtualPath;
|
||||
currPath = currPath.Substring(0, currPath.LastIndexOf("/"));
|
||||
|
||||
ctrlPath = currPath + "/ProviderControls/" + provider.EditorControl + "_" + controlName;
|
||||
|
||||
Control ctrl = Page.LoadControl(ctrlPath);
|
||||
|
||||
// add control to the placeholder
|
||||
container.Controls.Add(ctrl);
|
||||
}
|
||||
|
||||
public void HideServiceColumns(GridView gv)
|
||||
{
|
||||
try
|
||||
{
|
||||
gv.Columns[gv.Columns.Count - 1].Visible =
|
||||
(PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region Error Messages Processing
|
||||
public void ProcessException(Exception ex)
|
||||
{
|
||||
string authError = "The security token could not be authenticated or authorized";
|
||||
if (ex.Message.Contains(authError) ||
|
||||
(ex.InnerException != null &&
|
||||
ex.InnerException.Message.Contains(authError)))
|
||||
{
|
||||
ShowWarningMessage("ES_CONNECT");
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowErrorMessage("MODULE_LOAD", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void ShowResultMessage(int resultCode)
|
||||
{
|
||||
ShowResultMessage(Utils.ModuleName, resultCode, false);
|
||||
}
|
||||
|
||||
public virtual void ShowResultMessageWithContactForm(int resultCode)
|
||||
{
|
||||
ShowResultMessage(Utils.ModuleName, resultCode, true);
|
||||
}
|
||||
|
||||
public void ShowResultMessage(string moduleName, int resultCode, params object[] formatArgs)
|
||||
{
|
||||
ShowResultMessage(moduleName, resultCode, false, formatArgs);
|
||||
}
|
||||
|
||||
public void ShowResultMessage(string moduleName, int resultCode, bool showcf, params object[] formatArgs)
|
||||
{
|
||||
MessageBoxType messageType = MessageBoxType.Warning;
|
||||
|
||||
// try to get warning
|
||||
string sCode = Convert.ToString(resultCode * -1);
|
||||
string localizedMessage = GetSharedLocalizedString(moduleName, "Warning." + sCode);
|
||||
string localizedDescription = GetSharedLocalizedString(moduleName, "WarningDescription." + sCode);
|
||||
|
||||
if (localizedMessage == null)
|
||||
{
|
||||
messageType = MessageBoxType.Error;
|
||||
|
||||
// try to get error
|
||||
localizedMessage = GetSharedLocalizedString(moduleName, "Error." + sCode);
|
||||
localizedDescription = GetSharedLocalizedString(moduleName, "ErrorDescription." + sCode);
|
||||
|
||||
if (localizedMessage == null)
|
||||
{
|
||||
localizedMessage = GetSharedLocalizedString(moduleName, "Message.Generic") + " " + resultCode.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (formatArgs != null && formatArgs.Length > 0)
|
||||
localizedMessage = String.Format(localizedMessage, formatArgs);
|
||||
}
|
||||
}
|
||||
|
||||
// check if this is a "demo" message and it is overriden
|
||||
if (resultCode == BusinessErrorCodes.ERROR_USER_ACCOUNT_DEMO)
|
||||
{
|
||||
UserSettings wspSettings = UsersHelper.GetCachedUserSettings(
|
||||
PanelSecurity.EffectiveUserId, UserSettings.WEBSITEPANEL_POLICY);
|
||||
if (!String.IsNullOrEmpty(wspSettings["DemoMessage"]))
|
||||
{
|
||||
localizedDescription = wspSettings["DemoMessage"];
|
||||
}
|
||||
}
|
||||
|
||||
// render message
|
||||
Exception fake_ex = null;
|
||||
// Contact form is requested to be shown
|
||||
if (showcf)
|
||||
fake_ex = new Exception();
|
||||
//
|
||||
messageBox.RenderMessage(messageType, localizedMessage, localizedDescription, fake_ex);
|
||||
}
|
||||
|
||||
public virtual void ShowSuccessMessage(string messageKey)
|
||||
{
|
||||
ShowSuccessMessage(Utils.ModuleName, messageKey, null);
|
||||
}
|
||||
|
||||
public void ShowSuccessMessage(string moduleName, string messageKey)
|
||||
{
|
||||
ShowSuccessMessage(moduleName, messageKey, null);
|
||||
}
|
||||
|
||||
public virtual void ShowSuccessMessage(string moduleName, string messageKey, params string[] formatArgs)
|
||||
{
|
||||
string localizedMessage = GetSharedLocalizedString(moduleName, "Success." + messageKey);
|
||||
string localizedDescription = GetSharedLocalizedString(moduleName, "SuccessDescription." + messageKey);
|
||||
if (localizedMessage == null)
|
||||
{
|
||||
localizedMessage = messageKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Format message string with args
|
||||
if (formatArgs != null && formatArgs.Length > 0)
|
||||
{
|
||||
localizedMessage = String.Format(localizedMessage, formatArgs);
|
||||
}
|
||||
}
|
||||
// render message
|
||||
messageBox.RenderMessage(MessageBoxType.Information, localizedMessage, localizedDescription, null);
|
||||
}
|
||||
|
||||
public virtual void ShowWarningMessage(string messageKey)
|
||||
{
|
||||
ShowWarningMessage(Utils.ModuleName, messageKey);
|
||||
}
|
||||
|
||||
public void ShowWarningMessage(string moduleName, string messageKey)
|
||||
{
|
||||
string localizedMessage = GetSharedLocalizedString(moduleName, "Warning." + messageKey);
|
||||
string localizedDescription = GetSharedLocalizedString(moduleName, "WarningDescription." + messageKey);
|
||||
if (localizedMessage == null)
|
||||
localizedMessage = messageKey;
|
||||
|
||||
// render message
|
||||
messageBox.RenderMessage(MessageBoxType.Warning, localizedMessage, localizedDescription, null);
|
||||
}
|
||||
|
||||
public void ShowErrorMessage(string messageKey, params string[] additionalParameters)
|
||||
{
|
||||
ShowErrorMessage(messageKey, null, additionalParameters);
|
||||
}
|
||||
|
||||
public virtual void ShowErrorMessage(string messageKey, Exception ex, params string[] additionalParameters)
|
||||
{
|
||||
ShowErrorMessage(Utils.ModuleName, messageKey, ex, additionalParameters);
|
||||
}
|
||||
|
||||
public void ShowErrorMessage(string moduleName, string messageKey, Exception ex, params string[] additionalParameters)
|
||||
{
|
||||
string exceptionKey = null;
|
||||
//
|
||||
if (ex != null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ex.Message) && ex.Message.Contains("WEBSITEPANEL_ERROR"))
|
||||
{
|
||||
string[] messageParts = ex.Message.Split(new char[] { '@' });
|
||||
if (messageParts.Length > 1)
|
||||
{
|
||||
exceptionKey = messageParts[1].TrimStart(new char[] { ' ' });
|
||||
}
|
||||
}
|
||||
}
|
||||
string localizedMessage = GetSharedLocalizedString(moduleName, "Error." + exceptionKey);
|
||||
string localizedDescription = GetSharedLocalizedString(moduleName, "ErrorDescription." + exceptionKey);
|
||||
|
||||
if (localizedMessage == null)
|
||||
{
|
||||
localizedMessage = GetSharedLocalizedString(moduleName, "Error." + messageKey);
|
||||
localizedDescription = GetSharedLocalizedString(moduleName, messageKey);
|
||||
if (localizedMessage == null)
|
||||
localizedMessage = messageKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
//render localized exception message without stack trace
|
||||
messageBox.RenderMessage(MessageBoxType.Error, localizedMessage, localizedDescription, null);
|
||||
return;
|
||||
}
|
||||
|
||||
// render message
|
||||
messageBox.RenderMessage(MessageBoxType.Error, localizedMessage, localizedDescription, ex);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SchedulesHelper
|
||||
/// </summary>
|
||||
public class AppInstallerHelpers
|
||||
{
|
||||
public ApplicationInfo[] GetApplications(string categoryId)
|
||||
{
|
||||
return ES.Services.ApplicationsInstaller.GetApplications(PanelSecurity.PackageId, categoryId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for AuditLogHelper
|
||||
/// </summary>
|
||||
public class AuditLogHelper
|
||||
{
|
||||
DataSet dsLog;
|
||||
|
||||
public int GetAuditLogRecordsPagedCount(string sStartDate, string sEndDate, int packageId, int itemId, string itemName,
|
||||
int severityId, string sourceName, string taskName)
|
||||
{
|
||||
return (int)dsLog.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetAuditLogRecordsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string sStartDate, string sEndDate, int packageId, int itemId, string itemName, int severityId, string sourceName, string taskName)
|
||||
{
|
||||
dsLog = ES.Services.AuditLog.GetAuditLogRecordsPaged(
|
||||
PanelSecurity.SelectedUserId, packageId, itemId, itemName, DateTime.Parse(sStartDate), DateTime.Parse(sEndDate),
|
||||
severityId, sourceName, taskName, sortColumn, startRowIndex, maximumRows);
|
||||
return dsLog.Tables[1];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class BlackBerryHelper
|
||||
{
|
||||
public OrganizationUser[] GetBlackBerryUsersPaged(int itemId,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
if (maximumRows == 0)
|
||||
{
|
||||
maximumRows = Int32.MaxValue;
|
||||
}
|
||||
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
|
||||
string[] data = sortColumn.Split(' ');
|
||||
string direction = data.Length > 1 ? "DESC" : "ASC";
|
||||
OrganizationUsersPagedResult res =
|
||||
ES.Services.BlackBerry.GetBlackBerryUsersPaged(itemId, data[0], direction, name, email, startRowIndex, maximumRows);
|
||||
|
||||
return res.Value.PageUsers;
|
||||
}
|
||||
|
||||
|
||||
public int GetBlackBerryUsersPagedCount(int itemId, string filterColumn, string filterValue)
|
||||
{
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
IntResult res = ES.Services.BlackBerry.GetBlackBerryUserCount(itemId, name, email);
|
||||
return res.Value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class CRMHelper
|
||||
{
|
||||
public OrganizationUser[] GetCRMUsersPaged(int itemId,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
if (maximumRows == 0)
|
||||
{
|
||||
maximumRows = Int32.MaxValue;
|
||||
}
|
||||
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
|
||||
string[] data = sortColumn.Split(' ');
|
||||
string direction = data.Length > 1 ? "DESC" : "ASC";
|
||||
OrganizationUsersPagedResult res =
|
||||
ES.Services.CRM.GetCRMUsersPaged(itemId, data[0], direction, name, email, startRowIndex, maximumRows);
|
||||
|
||||
return res.Value.PageUsers;
|
||||
}
|
||||
|
||||
|
||||
public int GetCRMUsersPagedCount(int itemId, string filterColumn, string filterValue)
|
||||
{
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
IntResult res = ES.Services.CRM.GetCRMUserCount(itemId, name, email);
|
||||
return res.Value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class ExchangeHelper
|
||||
{
|
||||
#region Exchange Organizations
|
||||
DataSet orgs;
|
||||
|
||||
public int GetExchangeOrganizationsPagedCount(int packageId,
|
||||
bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)orgs.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetExchangeOrganizationsPaged(int packageId,
|
||||
bool recursive, string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
orgs = ES.Services.ExchangeServer.GetRawExchangeOrganizationsPaged(packageId,
|
||||
recursive, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return orgs.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accounts
|
||||
ExchangeAccountsPaged accounts;
|
||||
|
||||
public int GetExchangeAccountsPagedCount(int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
return accounts.RecordsCount;
|
||||
}
|
||||
|
||||
public ExchangeAccount[] GetExchangeAccountsPaged(int itemId, string accountTypes,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
accounts = ES.Services.ExchangeServer.GetAccountsPaged(itemId,
|
||||
accountTypes, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return accounts.PageItems;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace WebsitePanel.Portal.Code.Helpers
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets active view by the specifed id
|
||||
/// </summary>
|
||||
/// <param name="mv"></param>
|
||||
/// <param name="viewId"></param>
|
||||
public static void SetActiveViewById(this MultiView mv, string viewId)
|
||||
{
|
||||
foreach (View tab in mv.Views)
|
||||
{
|
||||
if (tab.ID.Equals(viewId))
|
||||
{
|
||||
mv.SetActiveView(tab);
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filters tabs list by hosting plan quotas assigned to the package.
|
||||
/// </summary>
|
||||
/// <param name="tl"></param>
|
||||
/// <param name="packageId"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Tab> FilterTabsByHostingPlanQuotas(this List<Tab> tl, int packageId)
|
||||
{
|
||||
return from t in tl where String.IsNullOrEmpty(t.Quota)
|
||||
|| PackagesHelper.CheckGroupQuotaEnabled(packageId, t.ResourceGroup, t.Quota)
|
||||
select t;
|
||||
}
|
||||
}
|
||||
|
||||
public class Tab
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets index of the tab
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets id assosicated with the tab
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets localized name of the tab
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets name of a hosting plan quota associated with the tab
|
||||
/// </summary>
|
||||
public string Quota { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets resource group of a hosting plan quota associated with the tab
|
||||
/// </summary>
|
||||
public string ResourceGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets resource key associated with the tab for localization purposes
|
||||
/// </summary>
|
||||
public string ResourceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets identificator of the view control associated with the tab
|
||||
/// </summary>
|
||||
public string ViewId { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using WebsitePanel.Providers.OS;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for FilesHelper
|
||||
/// </summary>
|
||||
public class FilesHelper
|
||||
{
|
||||
public SystemFile[] GetFiles(string path)
|
||||
{
|
||||
return ES.Services.Files.GetFiles(PanelSecurity.PackageId, path, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using WebsitePanel.Providers.SharePoint;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class HostedSharePointSiteCollectionsHelper
|
||||
{
|
||||
SharePointSiteCollectionListPaged result;
|
||||
|
||||
public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string filterColumn, string filterValue)
|
||||
{
|
||||
return result.TotalRowCount;
|
||||
}
|
||||
|
||||
public List<SharePointSiteCollection> GetSharePointSiteCollectionPaged(int packageId, int organizationId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
{
|
||||
filterValue = filterValue + "%";
|
||||
}
|
||||
|
||||
result = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return result.SiteCollections;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for HostingPlansHeler
|
||||
/// </summary>
|
||||
public class HostingPlansHelper
|
||||
{
|
||||
public DataSet GetRawHostingPlans()
|
||||
{
|
||||
return ES.Services.Packages.GetHostingPlans(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
|
||||
public DataSet GetRawHostingAddons()
|
||||
{
|
||||
return ES.Services.Packages.GetHostingAddons(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IPAddressesHelper
|
||||
/// </summary>
|
||||
public class IPAddressesHelper
|
||||
{
|
||||
#region Package IP Addresses
|
||||
IPAddressesPaged ips;
|
||||
public IPAddressInfo[] GetIPAddressesPaged(IPAddressPool pool, int serverId, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
ips = ES.Services.Servers.GetIPAddressesPaged(pool, serverId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
return ips.Items;
|
||||
}
|
||||
|
||||
public int GetIPAddressesPagedCount(IPAddressPool pool, int serverId, string filterColumn, string filterValue)
|
||||
{
|
||||
return ips.Count;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class OCSHelper
|
||||
{
|
||||
|
||||
public OCSUser[] GetOCSUsersPaged(int itemId,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
if (maximumRows == 0)
|
||||
{
|
||||
maximumRows = Int32.MaxValue;
|
||||
}
|
||||
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
|
||||
string[] data = sortColumn.Split(' ');
|
||||
string direction = data.Length > 1 ? "DESC" : "ASC";
|
||||
OCSUsersPagedResult res =
|
||||
ES.Services.OCS.GetOCSUsersPaged(itemId, data[0], direction, name, email, startRowIndex, maximumRows);
|
||||
|
||||
return res.Value.PageUsers;
|
||||
}
|
||||
|
||||
|
||||
public int GetOCSUsersPagedCount(int itemId, string filterColumn, string filterValue)
|
||||
{
|
||||
string name = string.Empty;
|
||||
string email = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
if (filterColumn == "DisplayName")
|
||||
name = filterValue;
|
||||
else
|
||||
email = filterValue;
|
||||
|
||||
IntResult res = ES.Services.OCS.GetOCSUserCount(itemId, name, email);
|
||||
return res.Value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class OrganizationsHelper
|
||||
{
|
||||
#region Organizations
|
||||
DataSet orgs;
|
||||
|
||||
public int GetOrganizationsPagedCount(int packageId,
|
||||
bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)orgs.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetOrganizationsPaged(int packageId,
|
||||
bool recursive, string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
|
||||
orgs = ES.Services.Organizations.GetRawOrganizationsPaged(packageId,
|
||||
recursive, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return orgs.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accounts
|
||||
OrganizationUsersPaged users;
|
||||
|
||||
public int GetOrganizationUsersPagedCount(int itemId,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
return users.RecordsCount;
|
||||
}
|
||||
|
||||
public OrganizationUser[] GetOrganizationUsersPaged(int itemId,
|
||||
string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(filterValue))
|
||||
filterValue = filterValue + "%";
|
||||
if (maximumRows == 0)
|
||||
{
|
||||
maximumRows = Int32.MaxValue;
|
||||
}
|
||||
|
||||
users = ES.Services.Organizations.GetOrganizationUsersPaged(itemId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return users.PageUsers;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Caching;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PackagesHelper
|
||||
/// </summary>
|
||||
public class PackagesHelper
|
||||
{
|
||||
private const int PACKAGE_CACHE_TIMEOUT = 30; // minutes
|
||||
|
||||
public static PackageInfo GetCachedPackage(int packageId)
|
||||
{
|
||||
string key = "CachedPackageInfo" + packageId;
|
||||
if (HttpContext.Current.Cache[key] != null)
|
||||
return (PackageInfo)HttpContext.Current.Cache[key];
|
||||
|
||||
// load package info from ES
|
||||
PackageInfo package = ES.Services.Packages.GetPackage(packageId);
|
||||
|
||||
// place to cache
|
||||
if(package != null)
|
||||
HttpContext.Current.Cache.Insert(key, package, null,
|
||||
DateTime.Now.AddMinutes(PACKAGE_CACHE_TIMEOUT), Cache.NoSlidingExpiration);
|
||||
|
||||
return package;
|
||||
}
|
||||
|
||||
public static bool IsQuotaEnabled(int packageId, string quotaName)
|
||||
{
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);
|
||||
return cntx.Quotas.ContainsKey(quotaName) && !cntx.Quotas[quotaName].QuotaExhausted;
|
||||
}
|
||||
|
||||
public static PackageContext GetCachedPackageContext(int packageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string key = "CachedPackageContext" + packageId.ToString();
|
||||
PackageContext cntx = (PackageContext)HttpContext.Current.Items[key];
|
||||
if (cntx == null)
|
||||
{
|
||||
// load context
|
||||
cntx = ES.Services.Packages.GetPackageContext(packageId);
|
||||
|
||||
if (cntx != null)
|
||||
{
|
||||
// fill dictionaries
|
||||
foreach (HostingPlanGroupInfo group in cntx.GroupsArray)
|
||||
cntx.Groups.Add(group.GroupName, group);
|
||||
|
||||
foreach (QuotaValueInfo quota in cntx.QuotasArray)
|
||||
cntx.Quotas.Add(quota.QuotaName, quota);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create empty context
|
||||
cntx = new PackageContext();
|
||||
}
|
||||
|
||||
// add it to the cach
|
||||
HttpContext.Current.Items[key] = cntx;
|
||||
}
|
||||
return cntx;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static HostingPlanContext GetCachedHostingPlanContext(int planId)
|
||||
{
|
||||
string key = "CachedHostingPlanContext" + planId.ToString();
|
||||
HostingPlanContext cntx = (HostingPlanContext)HttpContext.Current.Items[key];
|
||||
if (cntx == null)
|
||||
{
|
||||
// load context
|
||||
cntx = ES.Services.Packages.GetHostingPlanContext(planId);
|
||||
|
||||
if (cntx != null)
|
||||
{
|
||||
// fill dictionaries
|
||||
foreach (HostingPlanGroupInfo group in cntx.GroupsArray)
|
||||
cntx.Groups.Add(group.GroupName, group);
|
||||
|
||||
foreach (QuotaValueInfo quota in cntx.QuotasArray)
|
||||
cntx.Quotas.Add(quota.QuotaName, quota);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create empty context
|
||||
cntx = new HostingPlanContext();
|
||||
}
|
||||
|
||||
// add it to the cach
|
||||
HttpContext.Current.Items[key] = cntx;
|
||||
}
|
||||
return cntx;
|
||||
}
|
||||
|
||||
public static bool CheckGroupQuotaEnabled(int packageId, string groupName, string quotaName)
|
||||
{
|
||||
// load package context
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);
|
||||
|
||||
if (cntx == null)
|
||||
return false;
|
||||
|
||||
// check group
|
||||
if (!cntx.Groups.ContainsKey(groupName))
|
||||
return false;
|
||||
|
||||
// check quota
|
||||
if (cntx.Quotas.ContainsKey(quotaName))
|
||||
return !cntx.Quotas[quotaName].QuotaExhausted;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public DataSet GetMyPackages()
|
||||
{
|
||||
return ES.Services.Packages.GetRawMyPackages(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
|
||||
#region Packages Paged ODS Methods
|
||||
DataSet dsPackagesPaged;
|
||||
|
||||
public int GetPackagesPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsPackagesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetPackagesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsPackagesPaged = ES.Services.Packages.GetPackagesPaged(PanelSecurity.SelectedUserId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return dsPackagesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Nested Packages Paged ODS Methods
|
||||
DataSet dsNestedPackagesPaged;
|
||||
|
||||
public int GetNestedPackagesPagedCount(int packageId, string filterColumn, string filterValue,
|
||||
int statusId, int planId, int serverId)
|
||||
{
|
||||
return (int)dsNestedPackagesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetNestedPackagesPaged(int packageId, string filterColumn, string filterValue,
|
||||
int statusId, int planId, int serverId,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
dsNestedPackagesPaged = ES.Services.Packages.GetNestedPackagesPaged(
|
||||
packageId, filterColumn, filterValue, statusId, planId, serverId,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return dsNestedPackagesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Service Items Paged ODS Methods
|
||||
DataSet dsServiceItemsPaged;
|
||||
|
||||
public int SearchServiceItemsPagedCount(int itemTypeId, string filterValue)
|
||||
{
|
||||
return (int)dsServiceItemsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable SearchServiceItemsPaged(int itemTypeId, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
dsServiceItemsPaged = ES.Services.Packages.SearchServiceItemsPaged(PanelSecurity.EffectiveUserId,
|
||||
itemTypeId, "%" + filterValue + "%", sortColumn, startRowIndex, maximumRows);
|
||||
return dsServiceItemsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ReportsHelper
|
||||
/// </summary>
|
||||
public class ReportsHelper
|
||||
{
|
||||
#region Bandwidth Report
|
||||
DataSet dsBandwidthReport;
|
||||
|
||||
public int GetPackagesBandwidthPagedCount(int packageId, string sStartDate, string sEndDate)
|
||||
{
|
||||
return (int)dsBandwidthReport.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetPackagesBandwidthPaged(int packageId, int maximumRows, int startRowIndex, string sortColumn,
|
||||
string sStartDate, string sEndDate)
|
||||
{
|
||||
|
||||
dsBandwidthReport = ES.Services.Packages.GetPackagesBandwidthPaged(PanelSecurity.SelectedUserId,
|
||||
packageId, DateTime.Parse(sStartDate), DateTime.Parse(sEndDate),
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return dsBandwidthReport.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DiskSpace Report
|
||||
DataSet dsDiskspaceReport;
|
||||
|
||||
public int GetPackagesDiskspacePagedCount(int packageId)
|
||||
{
|
||||
return (int)dsDiskspaceReport.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetPackagesDiskspacePaged(int packageId, int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
|
||||
dsDiskspaceReport = ES.Services.Packages.GetPackagesDiskspacePaged(
|
||||
PanelSecurity.SelectedUserId, packageId,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return dsDiskspaceReport.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SchedulesHelper
|
||||
/// </summary>
|
||||
public class SchedulesHelper
|
||||
{
|
||||
public DataSet GetRawSchedules()
|
||||
{
|
||||
return ES.Services.Scheduler.GetSchedules(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
|
||||
DataSet dsSchedulesPaged;
|
||||
|
||||
public int GetSchedulesPagedCount(bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSchedulesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSchedulesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
dsSchedulesPaged = ES.Services.Scheduler.GetSchedulesPaged(PanelSecurity.PackageId, recursive, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSchedulesPaged.Tables[1];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using WebsitePanel.Server;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ServersHelper
|
||||
/// </summary>
|
||||
public class ServersHelper
|
||||
{
|
||||
public DataSet GetRawServers()
|
||||
{
|
||||
return ES.Services.Servers.GetRawServers();
|
||||
}
|
||||
|
||||
public DataSet GetRawVirtualServers()
|
||||
{
|
||||
return ES.Services.Servers.GetVirtualServers();
|
||||
}
|
||||
|
||||
#region Domains Paged ODS Methods
|
||||
DataSet dsDomainsPaged;
|
||||
|
||||
public int GetDomainsPagedCount(int packageId, int serverId, bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsDomainsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetDomainsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
int packageId, int serverId, bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
|
||||
dsDomainsPaged = ES.Services.Servers.GetDomainsPaged(packageId, serverId, recursive,
|
||||
filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsDomainsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Event Log Entries Paged
|
||||
SystemLogEntriesPaged logEntries;
|
||||
|
||||
public int GetEventLogEntriesPagedCount(string logName)
|
||||
{
|
||||
return logEntries.Count;
|
||||
}
|
||||
|
||||
public SystemLogEntry[] GetEventLogEntriesPaged(string logName, int maximumRows, int startRowIndex)
|
||||
{
|
||||
logEntries = ES.Services.Servers.GetLogEntriesPaged(PanelRequest.ServerId, logName, startRowIndex, maximumRows);
|
||||
return logEntries.Entries;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DNS Zone Records
|
||||
public DataSet GetRawDnsZoneRecords(int domainId)
|
||||
{
|
||||
return ES.Services.Servers.GetRawDnsZoneRecords(domainId);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,329 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ServerItemsHelper
|
||||
/// </summary>
|
||||
public class ServiceItemsHelper
|
||||
{
|
||||
#region Web Sites
|
||||
DataSet dsItemsPaged;
|
||||
|
||||
public int GetServiceItemsPagedCount(int packageId, string groupName, string typeName,
|
||||
int serverId, bool recursive, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsItemsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetServiceItemsPaged(int packageId, string groupName, string typeName,
|
||||
int serverId, bool recursive, string filterColumn, string filterValue,
|
||||
int maximumRows, int startRowIndex, string sortColumn)
|
||||
{
|
||||
dsItemsPaged = ES.Services.Packages.GetRawPackageItemsPaged(packageId, groupName, typeName, serverId,
|
||||
recursive, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsItemsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Web Sites
|
||||
DataSet dsWebSitesPaged;
|
||||
|
||||
public int GetWebSitesPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsWebSitesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetWebSitesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsWebSitesPaged = ES.Services.WebServers.GetRawWebSitesPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsWebSitesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Ftp Accounts
|
||||
DataSet dsFtpAccountsPaged;
|
||||
|
||||
public int GetFtpAccountsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsFtpAccountsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetFtpAccountsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsFtpAccountsPaged = ES.Services.FtpServers.GetRawFtpAccountsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsFtpAccountsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mail Accounts
|
||||
DataSet dsMailAccountsPaged;
|
||||
|
||||
public int GetMailAccountsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsMailAccountsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetMailAccountsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsMailAccountsPaged = ES.Services.MailServers.GetRawMailAccountsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsMailAccountsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mail Forwardings
|
||||
DataSet dsMailForwardingsPaged;
|
||||
|
||||
public int GetMailForwardingsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsMailForwardingsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetMailForwardingsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsMailForwardingsPaged = ES.Services.MailServers.GetRawMailForwardingsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsMailForwardingsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mail Groups
|
||||
DataSet dsMailGroupsPaged;
|
||||
|
||||
public int GetMailGroupsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsMailGroupsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetMailGroupsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsMailGroupsPaged = ES.Services.MailServers.GetRawMailGroupsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsMailGroupsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mail Lists
|
||||
DataSet dsMailListsPaged;
|
||||
|
||||
public int GetMailListsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsMailListsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetMailListsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsMailListsPaged = ES.Services.MailServers.GetRawMailListsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsMailListsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mail Domains
|
||||
DataSet dsMailDomainsPaged;
|
||||
|
||||
public int GetMailDomainsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsMailDomainsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetMailDomainsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsMailDomainsPaged = ES.Services.MailServers.GetRawMailDomainsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsMailDomainsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Databases
|
||||
DataSet dsSqlDatabasesPaged;
|
||||
|
||||
public int GetSqlDatabasesPagedCount(string groupName, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSqlDatabasesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSqlDatabasesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string groupName, string filterColumn, string filterValue)
|
||||
{
|
||||
dsSqlDatabasesPaged = ES.Services.DatabaseServers.GetRawSqlDatabasesPaged(PanelSecurity.PackageId,
|
||||
groupName, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSqlDatabasesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Database Users
|
||||
DataSet dsSqlUsersPaged;
|
||||
|
||||
public int GetSqlUsersPagedCount(string groupName, string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSqlUsersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSqlUsersPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string groupName, string filterColumn, string filterValue)
|
||||
{
|
||||
dsSqlUsersPaged = ES.Services.DatabaseServers.GetRawSqlUsersPaged(PanelSecurity.PackageId,
|
||||
groupName, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSqlUsersPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SharePoint Users
|
||||
DataSet dsSharePointUsersPaged;
|
||||
|
||||
public int GetSharePointUsersPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSharePointUsersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSharePointUsersPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsSharePointUsersPaged = ES.Services.SharePointServers.GetRawSharePointUsersPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSharePointUsersPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SharePoint Groups
|
||||
DataSet dsSharePointGroupsPaged;
|
||||
|
||||
public int GetSharePointGroupsPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSharePointGroupsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSharePointGroupsPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsSharePointGroupsPaged = ES.Services.SharePointServers.GetRawSharePointGroupsPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSharePointGroupsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Statistics Items
|
||||
DataSet dsStatisticsItemsPaged;
|
||||
|
||||
public int GetStatisticsSitesPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsStatisticsItemsPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetStatisticsSitesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsStatisticsItemsPaged = ES.Services.StatisticsServers.GetRawStatisticsSitesPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsStatisticsItemsPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SharePoint Sites
|
||||
DataSet dsSharePointSitesPaged;
|
||||
|
||||
public int GetSharePointSitesPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSharePointSitesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSharePointSitesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsSharePointSitesPaged = ES.Services.SharePointServers.GetRawSharePointSitesPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSharePointSitesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ODBC DSNs
|
||||
DataSet dsOdbcSourcesPaged;
|
||||
|
||||
public int GetOdbcSourcesPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsOdbcSourcesPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetOdbcSourcesPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsOdbcSourcesPaged = ES.Services.OperatingSystems.GetRawOdbcSourcesPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsOdbcSourcesPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Shared SSL Folders
|
||||
DataSet dsSharedSSLFoldersPaged;
|
||||
|
||||
public int GetSharedSSLFoldersPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsSharedSSLFoldersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetSharedSSLFoldersPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsSharedSSLFoldersPaged = ES.Services.WebServers.GetRawSSLFoldersPaged(PanelSecurity.PackageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
|
||||
return dsSharedSSLFoldersPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class TasksHelper
|
||||
{
|
||||
#region Running Tasks
|
||||
public BackgroundTask[] GetRunningTasks()
|
||||
{
|
||||
return ES.Services.Tasks.GetUserTasks(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,256 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using AspNetSecurity = System.Web.Security;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for UsersDB.
|
||||
/// </summary>
|
||||
public class UsersHelper
|
||||
{
|
||||
private const int USER_CACHE_TIMEOUT = 30; // minutes
|
||||
private const int USER_SETTINGS_CACHE_TIMEOUT = 1; // minutes
|
||||
|
||||
private const string DEFAULT_ADMIN_ROLE = "WebsitePanel Administrators";
|
||||
private const string DEFAULT_RESELLER_ROLE = "WebsitePanel Resellers";
|
||||
private const string DEFAULT_USER_ROLE = "WebsitePanel Users";
|
||||
|
||||
#region Users ODS Methods (for Selected User)
|
||||
DataSet dsUsersPaged;
|
||||
|
||||
public int GetUsersPagedCount(int userId, string filterColumn, string filterValue,
|
||||
int statusId, int roleId)
|
||||
{
|
||||
return (int)dsUsersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetUsersPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
int userId, string filterColumn, string filterValue, int statusId, int roleId)
|
||||
{
|
||||
dsUsersPaged = ES.Services.Users.GetUsersPaged(userId, filterColumn, filterValue,
|
||||
statusId, roleId, sortColumn, startRowIndex, maximumRows);
|
||||
return dsUsersPaged.Tables[1];
|
||||
}
|
||||
|
||||
public int GetUsersPagedRecursiveCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsUsersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetUsersPagedRecursive(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsUsersPaged = ES.Services.Users.GetUsersPagedRecursive(PanelSecurity.EffectiveUserId,
|
||||
filterColumn, "%" + filterValue + "%",
|
||||
0, 0, sortColumn, startRowIndex, maximumRows);
|
||||
return dsUsersPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Users ODS Methods (for Logged User)
|
||||
DataSet dsLoggedUsersPaged;
|
||||
|
||||
public int GetLoggedUsersPagedCount(string filterColumn, string filterValue)
|
||||
{
|
||||
return (int)dsLoggedUsersPaged.Tables[0].Rows[0][0];
|
||||
}
|
||||
|
||||
public DataTable GetLoggedUsersPaged(int maximumRows, int startRowIndex, string sortColumn,
|
||||
string filterColumn, string filterValue)
|
||||
{
|
||||
dsLoggedUsersPaged = ES.Services.Users.GetUsersPagedRecursive(PanelSecurity.EffectiveUserId, filterColumn, filterValue,
|
||||
0, 0, sortColumn, startRowIndex, maximumRows);
|
||||
return dsLoggedUsersPaged.Tables[1];
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Peers ODS Methods
|
||||
public DataSet GetUserPeers()
|
||||
{
|
||||
return ES.Services.Users.GetRawUserPeers(PanelSecurity.SelectedUserId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static UserInfo GetCachedUser(int userId)
|
||||
{
|
||||
string key = "CachedUser" + userId.ToString();
|
||||
UserInfo user = (UserInfo)HttpContext.Current.Cache[key];
|
||||
if (user == null)
|
||||
{
|
||||
// get remote user
|
||||
user = ES.Services.Users.GetUserById(userId);
|
||||
|
||||
// place to cache
|
||||
if (user != null)
|
||||
HttpContext.Current.Cache.Insert(key, user, null, DateTime.Now.AddMinutes(USER_CACHE_TIMEOUT), Cache.NoSlidingExpiration);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public static UserSettings GetCachedUserSettings(int userId, string settingsName)
|
||||
{
|
||||
string key = "CachedUserSettings" + userId.ToString() + "_" + settingsName;
|
||||
UserSettings settings = (UserSettings)HttpContext.Current.Cache[key];
|
||||
if (settings == null)
|
||||
{
|
||||
// get user settings
|
||||
settings = ES.Services.Users.GetUserSettings(userId, settingsName);
|
||||
|
||||
// place to cache
|
||||
if (settings != null)
|
||||
HttpContext.Current.Cache.Insert(key, settings, null, DateTime.Now.AddMinutes(USER_SETTINGS_CACHE_TIMEOUT), Cache.NoSlidingExpiration);
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
#region Display preferences
|
||||
private const int ITEMS_PER_PAGE_DEFAULT = 10;
|
||||
private const string ITEMS_PER_PAGE_SESSION = "ItemsPerPage";
|
||||
public static int GetDisplayItemsPerPage()
|
||||
{
|
||||
int itemsNumber = ITEMS_PER_PAGE_DEFAULT; // default value
|
||||
if (HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION] != null)
|
||||
{
|
||||
itemsNumber = Utils.ParseInt(HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION].ToString(), ITEMS_PER_PAGE_DEFAULT);
|
||||
}
|
||||
else
|
||||
{
|
||||
int userId = PanelSecurity.SelectedUserId;
|
||||
UserSettings settings = ES.Services.Users.GetUserSettings(userId, UserSettings.DISPLAY_PREFS);
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
itemsNumber = Utils.ParseInt(settings[UserSettings.GRID_ITEMS], ITEMS_PER_PAGE_DEFAULT);
|
||||
HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION] = itemsNumber;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (itemsNumber <= 0)
|
||||
{
|
||||
itemsNumber = ITEMS_PER_PAGE_DEFAULT;
|
||||
HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION] = itemsNumber;
|
||||
}
|
||||
|
||||
return itemsNumber;
|
||||
}
|
||||
|
||||
public static void SetDisplayItemsPerPage(int itemsNumber)
|
||||
{
|
||||
UserSettings settings = new UserSettings();
|
||||
settings.UserId = PanelSecurity.SelectedUserId;
|
||||
settings.SettingsName = UserSettings.DISPLAY_PREFS;
|
||||
settings[UserSettings.GRID_ITEMS] = itemsNumber.ToString();
|
||||
int res = ES.Services.Users.UpdateUserSettings(settings);
|
||||
|
||||
HttpContext.Current.Session[ITEMS_PER_PAGE_SESSION] = itemsNumber;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static UserInfo GetUser(int userId)
|
||||
{
|
||||
// get remote user
|
||||
return ES.Services.Users.GetUserById(userId);
|
||||
}
|
||||
|
||||
public static void InvalidateCachedUser(int userId)
|
||||
{
|
||||
string key = "CachedUser" + userId.ToString();
|
||||
HttpContext.Current.Cache.Remove(key);
|
||||
}
|
||||
|
||||
public static DataSet GetUsers(int ownerId, bool recursive)
|
||||
{
|
||||
DataSet dsUsers = ES.Services.Users.GetRawUsers(ownerId, recursive);
|
||||
DataTable dtUsers = dsUsers.Tables[0];
|
||||
|
||||
// add "RoleName", "StatusName" columns
|
||||
dtUsers.Columns.Add("RoleName", typeof(string));
|
||||
dtUsers.Columns.Add("StatusName", typeof(string));
|
||||
foreach (DataRow dr in dtUsers.Rows)
|
||||
{
|
||||
dr["RoleName"] = PanelFormatter.GetUserRoleName((int)dr["RoleID"]);
|
||||
dr["StatusName"] = PanelFormatter.GetAccountStatusName((int)dr["StatusID"]);
|
||||
}
|
||||
|
||||
return dsUsers;
|
||||
}
|
||||
|
||||
public static int AddUser(List<string> log, int portalId, UserInfo user, bool sendLetter)
|
||||
{
|
||||
// add user to WebsitePanel server
|
||||
return ES.Services.Users.AddUser(user, sendLetter);
|
||||
}
|
||||
|
||||
public static void AddUserVLan(int userId, UserVlan vLan)
|
||||
{
|
||||
ES.Services.Users.AddUserVLan(userId, vLan);
|
||||
}
|
||||
|
||||
public static void DeleteUserVlan(int userId, ushort vLanId)
|
||||
{
|
||||
ES.Services.Users.DeleteUserVLan(userId, vLanId);
|
||||
}
|
||||
|
||||
public static int DeleteUser(int portalId, int userId)
|
||||
{
|
||||
// delete WebsitePanel user
|
||||
return ES.Services.Users.DeleteUser(userId);
|
||||
}
|
||||
|
||||
public static int UpdateUser(int portalId, UserInfo user)
|
||||
{
|
||||
// update user in WebsitePanel
|
||||
int result = ES.Services.Users.UpdateUser(user);
|
||||
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int ChangeUserPassword(int portalId, int userId, string newPassword)
|
||||
{
|
||||
return PortalUtils.ChangeUserPassword(userId, newPassword);
|
||||
}
|
||||
|
||||
public static int ChangeUserStatus(int portalId, int userId, UserStatus status)
|
||||
{
|
||||
// load user account
|
||||
return ES.Services.Users.ChangeUserStatus(userId, status);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Virtualization;
|
||||
using System.Web;
|
||||
using System;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class VirtualMachinesForPCHelper
|
||||
{
|
||||
public static bool IsVirtualMachineManagementAllowed(int packageId)
|
||||
{
|
||||
bool manageAllowed = false;
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);
|
||||
if (cntx.Quotas.ContainsKey(Quotas.VPSForPC_MANAGING_ALLOWED))
|
||||
manageAllowed = !cntx.Quotas[Quotas.VPSForPC_MANAGING_ALLOWED].QuotaExhausted;
|
||||
|
||||
if (PanelSecurity.EffectiveUser.Role == UserRole.Administrator)
|
||||
manageAllowed = true;
|
||||
else if (PanelSecurity.EffectiveUser.Role == UserRole.Reseller)
|
||||
{
|
||||
// check if the reseller is allowed to manage on its parent level
|
||||
PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);
|
||||
if (package.UserId != PanelSecurity.EffectiveUserId)
|
||||
{
|
||||
cntx = PackagesHelper.GetCachedPackageContext(package.ParentPackageId);
|
||||
if (cntx != null && cntx.Quotas.ContainsKey(Quotas.VPSForPC_MANAGING_ALLOWED))
|
||||
manageAllowed = !cntx.Quotas[Quotas.VPSForPC_MANAGING_ALLOWED].QuotaExhausted;
|
||||
}
|
||||
}
|
||||
return manageAllowed;
|
||||
}
|
||||
|
||||
public static VMInfo GetCachedVirtualMachineForPC(int itemId)
|
||||
{
|
||||
if (itemId == 0)
|
||||
{
|
||||
return new VMInfo();
|
||||
}
|
||||
|
||||
string key = "CachedVirtualMachine" + itemId;
|
||||
if (HttpContext.Current.Items[key] != null)
|
||||
return (VMInfo)HttpContext.Current.Items[key];
|
||||
|
||||
// load virtual machine
|
||||
VMInfo vm = ES.Services.VPSPC.GetVirtualMachineItem(itemId);
|
||||
|
||||
// place to cache
|
||||
if (vm != null)
|
||||
HttpContext.Current.Items[key] = vm;
|
||||
|
||||
vm.HostName = vm.HostName ?? String.Empty;
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
#region Virtual Machines
|
||||
VirtualMachineMetaItemsPaged vms;
|
||||
public VirtualMachineMetaItem[] GetVirtualMachines(int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
vms = ES.Services.VPSPC.GetVirtualMachines(packageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows, true);
|
||||
return vms.Items;
|
||||
}
|
||||
|
||||
public int GetVirtualMachinesCount(int packageId, string filterColumn, string filterValue)
|
||||
{
|
||||
if (vms == null)
|
||||
{
|
||||
vms = ES.Services.VPSPC.GetVirtualMachines(packageId, filterColumn, filterValue,
|
||||
String.Empty, 0, 10, true);
|
||||
}
|
||||
|
||||
return vms.Count;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package IP Addresses
|
||||
PackageIPAddressesPaged packageAddresses;
|
||||
public PackageIPAddress[] GetPackageIPAddresses(int packageId, IPAddressPool pool, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
packageAddresses = ES.Services.Servers.GetPackageIPAddresses(packageId, pool,
|
||||
filterColumn, filterValue, sortColumn, startRowIndex, maximumRows, true);
|
||||
return packageAddresses.Items;
|
||||
}
|
||||
|
||||
public int GetPackageIPAddressesCount(int packageId, IPAddressPool pool, string filterColumn, string filterValue)
|
||||
{
|
||||
return packageAddresses.Count;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package Private IP Addresses
|
||||
PrivateIPAddressesPaged privateAddresses;
|
||||
public PrivateIPAddress[] GetPackagePrivateIPAddresses(int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
privateAddresses = ES.Services.VPS.GetPackagePrivateIPAddressesPaged(packageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return privateAddresses.Items;
|
||||
}
|
||||
|
||||
public int GetPackagePrivateIPAddressesCount(int packageId, string filterColumn, string filterValue)
|
||||
{
|
||||
return privateAddresses.Count;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Monitoring
|
||||
/// <summary>
|
||||
/// Get collection of MonitoredObjectEvent to selected VM
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MonitoredObjectEvent[] GetMonitoredObjectEvents()
|
||||
{
|
||||
return ES.Services.VPSPC.GetDeviceEvents(PanelRequest.ItemID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get collection of MonitoredObjectAlert to selected VM
|
||||
/// </summary>
|
||||
/// <returns></returns
|
||||
public MonitoredObjectAlert[] GetMonitoringAlerts()
|
||||
{
|
||||
return ES.Services.VPSPC.GetMonitoringAlerts(PanelRequest.ItemID);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Virtualization;
|
||||
using System.Web;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class VirtualMachinesHelper
|
||||
{
|
||||
public static bool IsVirtualMachineManagementAllowed(int packageId)
|
||||
{
|
||||
bool manageAllowed = false;
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(packageId);
|
||||
if (cntx.Quotas.ContainsKey(Quotas.VPS_MANAGING_ALLOWED))
|
||||
manageAllowed = !cntx.Quotas[Quotas.VPS_MANAGING_ALLOWED].QuotaExhausted;
|
||||
|
||||
if (PanelSecurity.EffectiveUser.Role == UserRole.Administrator)
|
||||
manageAllowed = true;
|
||||
else if (PanelSecurity.EffectiveUser.Role == UserRole.Reseller)
|
||||
{
|
||||
// check if the reseller is allowed to manage on its parent level
|
||||
PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);
|
||||
if (package.UserId != PanelSecurity.EffectiveUserId)
|
||||
{
|
||||
cntx = PackagesHelper.GetCachedPackageContext(package.ParentPackageId);
|
||||
if (cntx != null && cntx.Quotas.ContainsKey(Quotas.VPS_MANAGING_ALLOWED))
|
||||
manageAllowed = !cntx.Quotas[Quotas.VPS_MANAGING_ALLOWED].QuotaExhausted;
|
||||
}
|
||||
}
|
||||
return manageAllowed;
|
||||
}
|
||||
|
||||
public static VirtualMachine GetCachedVirtualMachine(int itemId)
|
||||
{
|
||||
string key = "CachedVirtualMachine" + itemId;
|
||||
if (HttpContext.Current.Items[key] != null)
|
||||
return (VirtualMachine)HttpContext.Current.Items[key];
|
||||
|
||||
// load virtual machine
|
||||
VirtualMachine vm = ES.Services.VPS.GetVirtualMachineItem(itemId);
|
||||
|
||||
// place to cache
|
||||
if (vm != null)
|
||||
HttpContext.Current.Items[key] = vm;
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
#region Virtual Machines
|
||||
VirtualMachineMetaItemsPaged vms;
|
||||
public VirtualMachineMetaItem[] GetVirtualMachines(int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
vms = ES.Services.VPS.GetVirtualMachines(packageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows, true);
|
||||
return vms.Items;
|
||||
}
|
||||
|
||||
public int GetVirtualMachinesCount(int packageId, string filterColumn, string filterValue)
|
||||
{
|
||||
return vms.Count;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package IP Addresses
|
||||
PackageIPAddressesPaged packageAddresses;
|
||||
public PackageIPAddress[] GetPackageIPAddresses(int packageId, IPAddressPool pool, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
packageAddresses = ES.Services.Servers.GetPackageIPAddresses(packageId, pool,
|
||||
filterColumn, filterValue, sortColumn, startRowIndex, maximumRows, true);
|
||||
return packageAddresses.Items;
|
||||
}
|
||||
|
||||
public int GetPackageIPAddressesCount(int packageId, IPAddressPool pool, string filterColumn, string filterValue)
|
||||
{
|
||||
return packageAddresses.Count;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package Private IP Addresses
|
||||
PrivateIPAddressesPaged privateAddresses;
|
||||
public PrivateIPAddress[] GetPackagePrivateIPAddresses(int packageId, string filterColumn, string filterValue,
|
||||
string sortColumn, int maximumRows, int startRowIndex)
|
||||
{
|
||||
privateAddresses = ES.Services.VPS.GetPackagePrivateIPAddressesPaged(packageId, filterColumn, filterValue,
|
||||
sortColumn, startRowIndex, maximumRows);
|
||||
return privateAddresses.Items;
|
||||
}
|
||||
|
||||
public int GetPackagePrivateIPAddressesCount(int packageId, string filterColumn, string filterValue)
|
||||
{
|
||||
return privateAddresses.Count;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using WebsitePanel.Providers.WebAppGallery;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public class WebAppGalleryHelpers
|
||||
{
|
||||
public GalleryApplicationsResult GetGalleryApplications(string categoryId, int packageId)
|
||||
{
|
||||
return ES.Services.WebApplicationGallery.GetGalleryApplications(packageId, categoryId);
|
||||
}
|
||||
|
||||
public List<GalleryApplication> GetGalleryApplicationsByServiceId(int serviceId)
|
||||
{
|
||||
GalleryApplicationsResult result = ES.Services.WebApplicationGallery.GetGalleryApplicationsByServiceId(serviceId);
|
||||
//
|
||||
if (result.IsSuccess)
|
||||
return result.Value;
|
||||
//
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.Providers.Database;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public interface IDatabaseEditDatabaseControl
|
||||
{
|
||||
void BindItem(SqlDatabase item);
|
||||
void SaveItem(SqlDatabase item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.Providers.Database;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public interface IDatabaseEditUserControl
|
||||
{
|
||||
void InitControl(string groupName);
|
||||
void BindItem(SqlUser item);
|
||||
void SaveItem(SqlUser item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.FTP;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IFtpEditAccountControl
|
||||
/// </summary>
|
||||
public interface IFtpAccountEditControl
|
||||
{
|
||||
void BindItem(FtpAccount item);
|
||||
void SaveItem(FtpAccount item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public interface IHostingServiceProviderSettings
|
||||
{
|
||||
void BindSettings(StringDictionary settings);
|
||||
void SaveSettings(StringDictionary settings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IMailEditAccountControl
|
||||
/// </summary>
|
||||
public interface IMailEditAccountControl
|
||||
{
|
||||
void BindItem(MailAccount item);
|
||||
void SaveItem(MailAccount item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IMailEditDomainControl
|
||||
/// </summary>
|
||||
public interface IMailEditDomainControl
|
||||
{
|
||||
void BindItem(MailDomain item);
|
||||
void SaveItem(MailDomain item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IMailEditForwardingControl
|
||||
/// </summary>
|
||||
public interface IMailEditForwardingControl
|
||||
{
|
||||
void BindItem(MailAlias item);
|
||||
void SaveItem(MailAlias item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IMailEditGroupControl
|
||||
/// </summary>
|
||||
public interface IMailEditGroupControl
|
||||
{
|
||||
void BindItem(MailGroup item);
|
||||
void SaveItem(MailGroup item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IMailEditListControl
|
||||
/// </summary>
|
||||
public interface IMailEditListControl
|
||||
{
|
||||
void BindItem(MailList item);
|
||||
void SaveItem(MailList item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public interface IPackageSettingsEditorControl
|
||||
{
|
||||
void BindSettings(PackageSettings settings);
|
||||
void SaveSettings(PackageSettings settings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Statistics;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IStatsEditInstallationControl
|
||||
/// </summary>
|
||||
public interface IStatsEditInstallationControl
|
||||
{
|
||||
void BindItem(StatsSite item);
|
||||
void SaveItem(StatsSite item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
public interface IUserSettingsEditorControl
|
||||
{
|
||||
void BindSettings(UserSettings settings);
|
||||
void SaveSettings(UserSettings settings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IWebInstallerSettings.
|
||||
/// </summary>
|
||||
public interface IWebInstallerSettings
|
||||
{
|
||||
void GetSettings(InstallationInfo inst);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// This class encapsulates the algorithm of localization of Reports.
|
||||
/// </summary>
|
||||
public abstract class AbstractReportLocalizer
|
||||
{
|
||||
#region Data
|
||||
/// <summary>
|
||||
/// The string identifier that will be used to load current report related localization strings.
|
||||
/// In resource file they are contained in the following format: {reportIdentifierId}.{localizationStringName}
|
||||
/// </summary>
|
||||
protected string reportIdentifier;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the report
|
||||
/// </summary>
|
||||
protected string reportName;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the class that helps get localization strings.
|
||||
/// </summary>
|
||||
protected IResourceStorage resourceStorage;
|
||||
|
||||
/// <summary>
|
||||
/// Nodes inside the report that can be localized.
|
||||
/// </summary>
|
||||
protected string[] localizableNodes = new string[] { "Value", "ToolTip", "Label" };
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Base constructor for every report localizer.
|
||||
/// </summary>
|
||||
/// <param name="reportName">Name of the report to localize.</param>
|
||||
/// <param name="reportIdentifier">Identifier of the report inside the resource file.</param>
|
||||
/// <param name="resourceStorage">Instance of the class used to get the strings from localization resource file.</param>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="reportName"/> or <paramref name="resourceStorage"/> is null.</exception>
|
||||
public AbstractReportLocalizer(string reportName, string reportIdentifier, IResourceStorage resourceStorage)
|
||||
{
|
||||
if (String.IsNullOrEmpty(reportName))
|
||||
{
|
||||
throw new ArgumentNullException("reportName", "Please, specify the name of the report to view.");
|
||||
}
|
||||
if (resourceStorage == null)
|
||||
{
|
||||
throw new ArgumentNullException("resourceStorage");
|
||||
}
|
||||
|
||||
this.reportName = reportName;
|
||||
this.reportIdentifier = reportIdentifier;
|
||||
this.resourceStorage = resourceStorage;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Localizes report and provides a reference to <see cref="TextReader"/> class that can be then given to the Report Viewer component.
|
||||
/// </summary>
|
||||
/// <returns><see cref="TextReader"/> class containing the localized report contents via stream.</returns>
|
||||
/// <exception cref="InvalidOperationException">When required report does not exists or cannot be found.</exception>
|
||||
public TextReader GetLocalizedReportStream()
|
||||
{
|
||||
//1. Check if report exists
|
||||
if (!IsReportExists())
|
||||
{
|
||||
ThrowReportDoesNotExist();
|
||||
}
|
||||
|
||||
// 2. Load report (report is an XLM document.)
|
||||
XmlDocument reportXml = new XmlDocument();
|
||||
reportXml.Load(
|
||||
GetReportStream()
|
||||
);
|
||||
|
||||
XmlNamespaceManager nsmgr = new XmlNamespaceManager(reportXml.NameTable);
|
||||
nsmgr.AddNamespace("nm", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");
|
||||
nsmgr.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner");
|
||||
|
||||
// 3. localize it
|
||||
foreach (string localizableNode in this.localizableNodes)
|
||||
{
|
||||
//for each of the node we can localize - do localize it
|
||||
// - find all nodes with LocID parameter
|
||||
foreach (XmlNode node in reportXml.DocumentElement.SelectNodes(
|
||||
String.Format("//nm:{0}[@rd:LocID]", localizableNode)
|
||||
, nsmgr
|
||||
)
|
||||
)
|
||||
{
|
||||
//test if LocID is not null and it's value is not empty
|
||||
if (node.Attributes["rd:LocID"] != null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(node.Attributes["rd:LocID"].Value))
|
||||
{
|
||||
//replace nodes' text value with localization string from resources
|
||||
node.InnerText = GetLocalizedResourceString(node.Attributes["rd:LocID"].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. return TextReader
|
||||
return new StringReader(reportXml.DocumentElement.OuterXml) as TextReader;
|
||||
}
|
||||
|
||||
#region Vistual Members - optional to override
|
||||
|
||||
/// <summary>
|
||||
/// Thrown <see cref="InvalidOperationException"/> to indicate that report does not exists.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Always, when called.</exception>
|
||||
public virtual void ThrowReportDoesNotExist()
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
String.Format(
|
||||
"Report '{0}' does not exist."
|
||||
, this.reportName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a strign requested by a <paramref name="localizationId"/> (resource key).
|
||||
/// It delegates the call to the <see cref="IResourceStorage"/> class instance.
|
||||
/// </summary>
|
||||
/// <param name="localizationId">The identifier of the string contained in the localization resource file.</param>
|
||||
/// <returns>String.</returns>
|
||||
/// <remarks>
|
||||
/// In case <code>reportIdentifier</code> passed to the constructor is null or empty
|
||||
/// the resource string will be requested using the <paramref name="localizationId"/> only.
|
||||
/// Otherwise, the following resource key will be used as a search pattern: {<code>reportIdentifier</code>}.{<paramref name="localizationId"/>}
|
||||
/// </remarks>
|
||||
public virtual string GetLocalizedResourceString(string localizationId)
|
||||
{
|
||||
String localizedString = String.Empty;
|
||||
|
||||
if (String.IsNullOrEmpty(this.reportIdentifier))
|
||||
{
|
||||
localizedString = this.resourceStorage.GetString(localizationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
localizedString = this.resourceStorage.GetString(
|
||||
String.Format("{0}.{1}", this.reportIdentifier, localizationId)
|
||||
);
|
||||
}
|
||||
|
||||
return localizedString;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Astract Members - Required to implement
|
||||
/// <summary>
|
||||
/// Verify whether report exists.
|
||||
/// </summary>
|
||||
/// <returns>True, if report exists. Otherwise false.</returns>
|
||||
public abstract bool IsReportExists();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the report <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <returns>Report <see cref="Stream"/>.</returns>
|
||||
public abstract Stream GetReportStream();
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
/// <summary>
|
||||
/// Returns Report Name being passed to the constuctor
|
||||
/// </summary>
|
||||
public string ReportName
|
||||
{
|
||||
get { return this.reportName; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that is used to localize reports embedded to the assembly.
|
||||
/// </summary>
|
||||
public class EmbeddedReportLocalizer : AbstractReportLocalizer
|
||||
{
|
||||
#region Data
|
||||
/// <summary>
|
||||
/// The assembly containing the required report file.
|
||||
/// </summary>
|
||||
protected Assembly assembly;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Constructs a localizer.
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly containing the report file.</param>
|
||||
/// <param name="embeddedReportName">Embedded report full name: {default namespace}.{folder path inside assembly}.{report name with extension}</param>
|
||||
/// <param name="embeddedReportId">Report identifier that will be used to load resource strings related to this report.</param>
|
||||
/// <param name="resourceStorage"><see cref="IResourceStorage"/> instance.</param>
|
||||
public EmbeddedReportLocalizer(Assembly assembly, string embeddedReportName, string embeddedReportId, IResourceStorage resourceStorage)
|
||||
: base(embeddedReportName, embeddedReportId, resourceStorage)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new ArgumentNullException("assembly");
|
||||
}
|
||||
|
||||
this.assembly = assembly;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shorter constructor that assume that report file is located in the assembly where this type is declared.
|
||||
/// </summary>
|
||||
/// <param name="embeddedReportName">Embedded report full name: {default namespace}.{folder path inside assembly}.{report name with extension}</param>
|
||||
/// <param name="embeddedReportId">Report identifier that will be used to load resource strings related to this report.</param>
|
||||
/// <param name="resourceStorage"><see cref="IResourceStorage"/> instance.</param>
|
||||
public EmbeddedReportLocalizer(string embeddedReportName, string embeddedReportId, IResourceStorage resourceStorage)
|
||||
: base(embeddedReportName, embeddedReportId, resourceStorage)
|
||||
{
|
||||
this.assembly = this.GetType().Assembly;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Algorithm Methods overloads
|
||||
/// <summary>
|
||||
/// Verify whether current assembly contains report file requested in constructor.
|
||||
/// </summary>
|
||||
/// <returns>True, if file exists. False, if not.</returns>
|
||||
public override bool IsReportExists()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (string resourceName in this.assembly.GetManifestResourceNames())
|
||||
{
|
||||
if (String.Compare(resourceName, this.reportName, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns report file stream.
|
||||
/// </summary>
|
||||
/// <returns>report file <see cref="Stream"/>.</returns>
|
||||
public override Stream GetReportStream()
|
||||
{
|
||||
return this.assembly.GetManifestResourceStream(this.reportName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.IO;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that is used to load Reporting Services report files from local file system.
|
||||
/// </summary>
|
||||
public class FileSystemReportLocalizer : AbstractReportLocalizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructs the class to function.
|
||||
/// </summary>
|
||||
/// <param name="reportName">Actually, the full path to the report file.</param>
|
||||
/// <param name="reportIdentifier">
|
||||
/// String used to identify report file related strings in resources.
|
||||
/// The following string format is used to assosiate report and its strings: {report name}.{localiation id}
|
||||
/// </param>
|
||||
/// <param name="resourceStorage"><see cref="IResourceStorage"/> instance.</param>
|
||||
public FileSystemReportLocalizer(string reportName, string reportIdentifier, IResourceStorage resourceStorage)
|
||||
: base(reportName, reportIdentifier, resourceStorage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Verify if report exists for the <code>reportName</code> passed to the constructor
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// True, if report file exists. Otherwise, false.
|
||||
/// </returns>
|
||||
public override bool IsReportExists()
|
||||
{
|
||||
FileInfo info = new FileInfo(this.reportName);
|
||||
if (info.Exists)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns <see cref="Stream"/> one can use to read report file.
|
||||
/// </summary>
|
||||
/// <returns><see cref="Stream"/> instance for the report file.</returns>
|
||||
public override Stream GetReportStream()
|
||||
{
|
||||
return File.OpenRead(this.reportName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Base interface for classes that utilize access to the localization resources.
|
||||
/// </summary>
|
||||
public interface IResourceStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Should return a string requested by <paramref name="resourceKey"/>
|
||||
/// </summary>
|
||||
/// <param name="resourceKey"></param>
|
||||
/// <returns>String value.</returns>
|
||||
string GetString(string resourceKey);
|
||||
|
||||
/// <summary>
|
||||
/// Should return a string from shared (global) resource files requested by <paramref name="resourceKey"/>
|
||||
/// </summary>
|
||||
/// <param name="resourceKey"></param>
|
||||
/// <returns></returns>
|
||||
string GetSharedString(string resourceKey);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using Microsoft.Reporting.WebForms;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Utility class that provides helper methods
|
||||
/// </summary>
|
||||
public static class ReportingServicesUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads embedded report file.
|
||||
/// </summary>
|
||||
/// <param name="assembly"><see cref="Assembly"/> containing the report file.</param>
|
||||
/// <param name="embeddedReportName">Name of the report in format {default namespace}.{folder structure inside assembly}.{file name with extension}</param>
|
||||
/// <param name="embeddedReportResourceId">Resource identifier of a report being loaded.</param>
|
||||
/// <param name="module">Instance of a module containing the ReportViewer component.</param>
|
||||
/// <returns><see cref="TextReader"/> containing the localized report file.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="assembly"/>, <paramref name="embeddedReportName"/> or <paramref name="module"/> is null.</exception>
|
||||
public static TextReader LoadReportFileFromAssembly(Assembly assembly, string embeddedReportName, string embeddedReportResourceId, WebsitePanelModuleBase module)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new ArgumentNullException("assembly");
|
||||
}
|
||||
if (String.IsNullOrEmpty(embeddedReportName))
|
||||
{
|
||||
throw new ArgumentNullException("embeddedReportName");
|
||||
}
|
||||
if (module == null)
|
||||
{
|
||||
throw new ArgumentNullException("module");
|
||||
}
|
||||
|
||||
return new EmbeddedReportLocalizer(
|
||||
assembly
|
||||
, embeddedReportName
|
||||
, embeddedReportResourceId
|
||||
, new WebsitePanelModuleResourceStorage(module)
|
||||
).GetLocalizedReportStream();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load report from file on disk.
|
||||
/// </summary>
|
||||
/// <param name="reportPath">Path to the report file.</param>
|
||||
/// <param name="reportResourceId">Resource id of a report inside resource file.</param>
|
||||
/// <param name="module">Instance of a module containing the ReportViewer component.</param>
|
||||
/// <returns><see cref="TextReader"/> containing the localized report file.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="reportPath"/> or <paramref name="module"/> is null.</exception>
|
||||
public static TextReader LoadReportFromFile(string reportPath, string reportResourceId, WebsitePanelModuleBase module)
|
||||
{
|
||||
if (String.IsNullOrEmpty(reportPath))
|
||||
{
|
||||
throw new ArgumentNullException("reportPath");
|
||||
}
|
||||
if (module == null)
|
||||
{
|
||||
throw new ArgumentNullException("module");
|
||||
}
|
||||
|
||||
return new FileSystemReportLocalizer(
|
||||
reportPath
|
||||
, reportResourceId
|
||||
, new WebsitePanelModuleResourceStorage(module)
|
||||
).GetLocalizedReportStream();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a URL that one can use to force Reporting Services
|
||||
/// </summary>
|
||||
/// <param name="report"><see cref="Report"/> instance currently loaded.</param>
|
||||
/// <param name="reportViewer"><see cref="ReportViewer"/> component instance containing <paramref name="report"/></param>
|
||||
/// <param name="contentDisposition"><paramref name="reportViewer"/> export content disposition.</param>
|
||||
/// <returns>String representing URL to export report using Reporting Serivces engine.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or <paramref name="reportViewer"/> is null.</exception>
|
||||
public static string GetReportExportUrl(Report report, ReportViewer reportViewer, ContentDisposition contentDisposition)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (reportViewer == null)
|
||||
{
|
||||
throw new ArgumentNullException("reportViewer");
|
||||
}
|
||||
|
||||
//Get the viewer instance id
|
||||
FieldInfo instanceIdInfo = typeof(ReportViewer).GetField("m_instanceIdentifier", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
String viewerInstanceId = ((Guid)instanceIdInfo.GetValue(reportViewer)).ToString("N");
|
||||
|
||||
//Get drill through field
|
||||
FieldInfo drillthroughField = typeof(Report).GetField("m_drillthroughDepth", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
int drillthroughDepth = (int)drillthroughField.GetValue(report);
|
||||
|
||||
//Create query
|
||||
StringBuilder exportQuery = new StringBuilder();
|
||||
exportQuery.AppendFormat("Mode={0}&", "true");
|
||||
exportQuery.AppendFormat("ReportID={0}&", Guid.NewGuid().ToString("N"));
|
||||
exportQuery.AppendFormat("ControlID={0}&", viewerInstanceId);
|
||||
exportQuery.AppendFormat("Culture={0}&", CultureInfo.InvariantCulture.LCID.ToString(CultureInfo.InvariantCulture));
|
||||
exportQuery.AppendFormat("UICulture={0}&", CultureInfo.InvariantCulture.LCID.ToString(CultureInfo.InvariantCulture));
|
||||
exportQuery.AppendFormat("ReportStack={0}&", drillthroughDepth);
|
||||
exportQuery.AppendFormat("OpType={0}&", "Export");
|
||||
exportQuery.AppendFormat("FileName={0}&", report.DisplayName); //it should be empty as we do not use either Embedded or File reports
|
||||
exportQuery.AppendFormat("ContentDisposition={0}&", contentDisposition);
|
||||
exportQuery.Append("Format=");
|
||||
|
||||
//Build exact URL
|
||||
UriBuilder handlerUri = GetReportHandlerUri();
|
||||
handlerUri.Query = exportQuery.ToString();
|
||||
|
||||
return handlerUri.Uri.PathAndQuery;
|
||||
}
|
||||
|
||||
#region Private functions
|
||||
static UriBuilder GetReportHandlerUri()
|
||||
{
|
||||
UriBuilder builder = new UriBuilder(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority));
|
||||
|
||||
string applicationPath = GetServerPath();
|
||||
|
||||
StringBuilder builder2 = new StringBuilder(applicationPath);
|
||||
if (!applicationPath.EndsWith("/", true, CultureInfo.InvariantCulture))
|
||||
{
|
||||
builder2.Append("/");
|
||||
}
|
||||
|
||||
builder2.Append("Reserved.ReportViewerWebControl.axd");
|
||||
builder.Path = builder2.ToString();
|
||||
return builder;
|
||||
}
|
||||
|
||||
static string GetServerPath()
|
||||
{
|
||||
return HttpContext.Current.Response.ApplyAppPathModifier(
|
||||
HttpContext.Current.Request.ApplicationPath
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
// Copyright (c) 2011, 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.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
namespace WebsitePanel.Portal.ReportingServices
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to load resource string related to current module.
|
||||
/// </summary>
|
||||
public class WebsitePanelModuleResourceStorage : IResourceStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// The module (control) currently being displayed.
|
||||
/// </summary>
|
||||
private WebsitePanelModuleBase module;
|
||||
|
||||
/// <summary>
|
||||
/// Cunstructs the instance.
|
||||
/// </summary>
|
||||
/// <param name="module">Module containing report viewer component.</param>
|
||||
/// <exception cref="ArgumentNullException">Whem <paramref name="module"/> is null.</exception>
|
||||
public WebsitePanelModuleResourceStorage(WebsitePanelModuleBase module)
|
||||
{
|
||||
if (module == null)
|
||||
{
|
||||
throw new ArgumentNullException("module");
|
||||
}
|
||||
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
#region IResourceStorage Members
|
||||
/// <summary>
|
||||
/// Returns string located in module resource file.
|
||||
/// </summary>
|
||||
/// <param name="resourceKey">The key, which is used to load string.</param>
|
||||
/// <returns>String stored in module resource file.</returns>
|
||||
public string GetString(string resourceKey)
|
||||
{
|
||||
return this.module.GetLocalizedString(resourceKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns shared string located in the global module file.
|
||||
/// </summary>
|
||||
/// <param name="resourceKey">Key, which will be used to find string in resource file.</param>
|
||||
/// <returns>String stored in shared (global) resource file.</returns>
|
||||
public string GetSharedString(string resourceKey)
|
||||
{
|
||||
return this.module.GetSharedLocalizedString(resourceKey);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue