wsp-10316 Create list of actions for WebSites page and Domains page

This commit is contained in:
me 2015-02-15 21:28:12 +04:00
parent 77b2ca42e3
commit 349862410f
23 changed files with 998 additions and 207 deletions

View file

@ -3136,14 +3136,14 @@
<data name="Success.ORGANIZATION_UPDATE_USER_SETTINGS" xml:space="preserve">
<value>User general settings have been successfully updated.</value>
</data>
<data name="Success.ORGANIZATION_USERS_ACTIONS" xml:space="preserve">
<data name="Success.ACTIONS_MESSAGE" xml:space="preserve">
<value>Action has been successfully performed.</value>
</data>
<data name="Error.ORGANIZATION_USERS_ACTIONS" xml:space="preserve">
<data name="Error.ACTIONS_MESSAGE" xml:space="preserve">
<value>Failed to perform action.</value>
</data>
<data name="Warning.ORGANIZATION_USERS_ACTIONS" xml:space="preserve">
<value>Please select the users for which you want to perform actions.</value>
<data name="Warning.ACTIONS_MESSAGE" xml:space="preserve">
<value>Please select the items for which you want to perform action.</value>
</data>
<data name="Success.ORGANIZATION_SET_USER_PASSWORD" xml:space="preserve">
<value>User password has been successfully updated.</value>

View file

@ -3,10 +3,15 @@
<%@ Register Src="UserControls/ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %>
<%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="wsp" %>
<%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/DomainActions.ascx" TagName="DomainActions" TagPrefix="wsp" %>
<script src="JavaScript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script language="javascript">
function SelectAllCheckboxes(box) {
$(".NormalGridView tbody :checkbox").attr("checked", $(box).attr("checked"));
}
</script>
<div class="FormButtonsBar">
<div class="Left">
@ -16,14 +21,32 @@
</div>
<div class="Right">
<wsp:SearchBox ID="searchBox" runat="server" />
<table>
<tr>
<td>
<wsp:DomainActions ID="websiteActions" runat="server" GridViewID="gvDomains" CheckboxesName="chkSelectedIds" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>
<wsp:SearchBox ID="searchBox" runat="server" />
</td>
</tr>
</table>
</div>
</div>
<asp:GridView ID="gvDomains" runat="server" AutoGenerateColumns="False" Width="100%" AllowSorting="True" DataSourceID="odsDomainsPaged"
EmptyDataText="gvDomains"
EmptyDataText="gvDomains" DataKeyNames="DomainID"
CssSelectorClass="NormalGridView" AllowPaging="True" OnRowCommand="gvDomains_RowCommand">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="DomainName" HeaderText="gvDomainsName">
<ItemStyle Width="45%" Wrap="False"></ItemStyle>
<ItemTemplate>

View file

@ -55,10 +55,10 @@ namespace WebsitePanel.Portal
// visibility
chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User);
gvDomains.Columns[4].Visible = gvDomains.Columns[5].Visible =
gvDomains.Columns[5].Visible = gvDomains.Columns[6].Visible =
(PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvDomains.Columns[7].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
gvDomains.Columns[7].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvDomains.Columns[8].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
if (!IsPostBack)
{

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -58,6 +30,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkRecursive;
/// <summary>
/// websiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.DomainActions websiteActions;
/// <summary>
/// searchBox control.
/// </summary>

View file

@ -36,7 +36,7 @@
<table>
<tr>
<td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" ShowSetMailboxPlan="true" />
<wsp:UserActions ID="userActions" runat="server" GridViewID="gvMailboxes" CheckboxesName="chkSelectedUsersIds" ShowSetMailboxPlan="true" />
</td>
<td class="FormButtonsBarCleanSeparatorSmall"></td>
<td>

View file

@ -271,41 +271,5 @@ namespace WebsitePanel.Portal.ExchangeServer
odsAccountsPaged.SelectParameters["accountTypes"].DefaultValue = string.Join(",", accountTypes);
}
protected void userActions_OnExecutingUserAction(object sender, EventArgs e)
{
// Get checked users
var userIds = Utils.GetCheckboxValuesFromGrid<int>(gvMailboxes, "chkSelectedUsersIds");
if (userActions.SelectedAction != UserActionTypes.None)
{
if (userIds.Count > 0)
{
try
{
var result = userActions.DoUserActions(userIds);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex);
}
// Refresh users grid
gvMailboxes.DataBind();
}
else
{
messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS");
}
}
}
}
}

View file

@ -38,7 +38,7 @@
<table>
<tr>
<td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" />
<wsp:UserActions ID="userActions" runat="server" GridViewID="gvUsers" CheckboxesName="chkSelectedUsersIds" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>

View file

@ -389,41 +389,5 @@ namespace WebsitePanel.Portal.HostedSolution
}
}
protected void userActions_OnExecutingUserAction(object sender, EventArgs e)
{
// Get checked users
var userIds = Utils.GetCheckboxValuesFromGrid<int>(gvUsers, "chkSelectedUsersIds");
if (userActions.SelectedAction != UserActionTypes.None)
{
if (userIds.Count > 0)
{
try
{
var result = userActions.DoUserActions(userIds);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex);
}
// Refresh users grid
gvUsers.DataBind();
}
else
{
messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS");
}
}
}
}
}

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View file

@ -0,0 +1,144 @@
// Copyright (c) 2015, 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 System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Web.UI.WebControls;
namespace WebsitePanel.Portal.UserControls
{
public abstract class ActionListControlBase<TEnum> : WebsitePanelControlBase
{
public event CancelEventHandler ExecutingAction;
public event EventHandler ExecutedAction;
#region Properties
public string GridViewID { get; set; }
public string CheckboxesName { get; set; }
private string _message = "ACTIONS_MESSAGE";
public string Message
{
get { return _message; }
set { _message = value; }
}
#endregion
protected abstract DropDownList ActionsList { get; }
protected abstract int DoAction(List<int> ids);
public TEnum SelectedAction
{
get
{
return (TEnum)(object)Convert.ToInt32(ActionsList.SelectedValue);
}
}
protected GridView GridView
{
get { return Parent.FindControl(GridViewID) as GridView; }
}
public void ResetSelection()
{
ActionsList.ClearSelection();
}
public void RemoveActionItem<TNum>(TNum value)
{
ActionsList.Items.Remove(ActionsList.Items.FindByValue(((int)(object)value).ToString()));
}
protected void FireExecuteAction()
{
if (ExecutingAction != null)
{
var e = new CancelEventArgs();
ExecutingAction(this, e);
if (e.Cancel)
return;
}
DoAction();
if (ExecutedAction != null)
ExecutedAction(this, new EventArgs());
}
protected void DoAction()
{
if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName))
return;
// Get checked users
var ids = Utils.GetCheckboxValuesFromGrid<int>(GridView, CheckboxesName);
if ((int)(object)SelectedAction != 0)
{
if (ids.Count > 0)
{
try
{
var result = DoAction(ids);
if (result < 0)
{
HostModule.ShowResultMessage(result);
return;
}
HostModule.ShowSuccessMessage(Message);
}
catch (Exception ex)
{
HostModule.ShowErrorMessage(Message, ex);
}
// Refresh users grid
GridView.DataBind();
}
else
{
HostModule.ShowWarningMessage(Message);
}
}
}
}
}

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnApply.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="ddlDomainActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value>
</data>
<data name="ddlDomainActionsItem.CreateInstantAlias" xml:space="preserve">
<value>Create Instant Alias</value>
</data>
<data name="ddlDomainActionsItem.DeleteInstantAlias" xml:space="preserve">
<value>Delete Instant Alias</value>
</data>
<data name="ddlDomainActionsItem.DisableDns" xml:space="preserve">
<value>Disable Dns</value>
</data>
<data name="ddlDomainActionsItem.EnableDns" xml:space="preserve">
<value>Enable Dns</value>
</data>
</root>

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnApply.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="ddlWebsiteActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value>
</data>
<data name="ddlWebsiteActionsItem.RestartAppPool" xml:space="preserve">
<value>Restart App Pool</value>
</data>
<data name="ddlWebsiteActionsItem.Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ddlWebsiteActionsItem.Stop" xml:space="preserve">
<value>Stop</value>
</data>
</root>

View file

@ -0,0 +1,37 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainActions.ascx.cs" Inherits="WebsitePanel.Portal.DomainActions" %>
<script language="javascript">
function ShowProrgess(btn) {
var action = $(btn).prev().val();
if (action === 1) {
ShowProgressDialog("Enabling Dns...");
} else if (action == 2) {
ShowProgressDialog("Disabling Dns...");
} else if (action == 3) {
ShowProgressDialog("Creating Instant Alias...");
} else if (action == 4) {
ShowProgressDialog("Removing Instant Alias...");
}
}
</script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:DropDownList ID="ddlDomainActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlDomainActions" AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">EnableDns</asp:ListItem>
<asp:ListItem Value="2">DisableDns</asp:ListItem>
<asp:ListItem Value="3">CreateInstantAlias</asp:ListItem>
<asp:ListItem Value="4">DeleteInstantAlias</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers>
</asp:UpdatePanel>

View file

@ -0,0 +1,179 @@
// Copyright (c) 2015, 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.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
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.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
public enum DomainActionTypes
{
None = 0,
EnableDns = 1,
DisableDns = 2,
CreateInstantAlias = 3,
DeleteInstantAlias = 4,
}
public partial class DomainActions : ActionListControlBase<DomainActionTypes>
{
protected void Page_Load(object sender, EventArgs e)
{
// Remove DNS items if current Hosting plan does not allow it
if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.Dns))
{
RemoveActionItem(DomainActionTypes.EnableDns);
RemoveActionItem(DomainActionTypes.DisableDns);
}
// Remove Instant Alias items if current Hosting plan does not allow it
PackageSettings packageSettings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS);
if (packageSettings == null || String.IsNullOrEmpty(packageSettings["InstantAlias"]))
{
RemoveActionItem(DomainActionTypes.CreateInstantAlias);
RemoveActionItem(DomainActionTypes.DeleteInstantAlias);
}
// hide control if no actions allowed
if (ActionsList.Items.Count <= 1)
{
Visible = false;
}
}
protected override DropDownList ActionsList
{
get { return ddlDomainActions; }
}
protected override int DoAction(List<int> ids)
{
switch (SelectedAction)
{
case DomainActionTypes.EnableDns:
return EnableDns(true, ids);
case DomainActionTypes.DisableDns:
return EnableDns(false, ids);
case DomainActionTypes.CreateInstantAlias:
return CreateInstantAlias(true, ids);
case DomainActionTypes.DeleteInstantAlias:
return CreateInstantAlias(false, ids);
}
return 0;
}
protected void btnApply_Click(object sender, EventArgs e)
{
switch (SelectedAction)
{
case DomainActionTypes.EnableDns:
case DomainActionTypes.DisableDns:
case DomainActionTypes.CreateInstantAlias:
case DomainActionTypes.DeleteInstantAlias:
FireExecuteAction();
break;
}
}
private int EnableDns(bool enable, List<int> ids)
{
foreach (var id in ids)
{
// load domain
DomainInfo domain = ES.Services.Servers.GetDomain(id);
if (domain == null)
continue;
// load package context
PackageContext cntx = PackagesHelper.GetCachedPackageContext(domain.PackageId);
bool dnsEnabled = cntx.Groups.ContainsKey(ResourceGroups.Dns);
if (!dnsEnabled)
continue;
int result;
if (enable)
result = ES.Services.Servers.EnableDomainDns(id);
else
result = ES.Services.Servers.DisableDomainDns(id);
if (result < 0)
return result;
}
return 0;
}
private int CreateInstantAlias(bool enable, List<int> ids)
{
foreach (var id in ids)
{
// load domain
DomainInfo domain = ES.Services.Servers.GetDomain(id);
if (domain == null)
continue;
// instant alias
bool instantAliasAllowed = !String.IsNullOrEmpty(domain.InstantAliasName);
if (!instantAliasAllowed || domain.IsDomainPointer || domain.IsInstantAlias)
continue;
int result;
if (enable)
result = ES.Services.Servers.CreateDomainInstantAlias("", id);
else
result = ES.Services.Servers.DeleteDomainInstantAlias(id);
if (result < 0)
return result;
}
return 0;
}
}
}

View file

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {
public partial class DomainActions {
/// <summary>
/// tblActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel tblActions;
/// <summary>
/// ddlDomainActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlDomainActions;
/// <summary>
/// btnApply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnApply;
}
}

View file

@ -2,6 +2,16 @@
<%@ Register Src="Quota.ascx" TagName="Quota" TagPrefix="wsp" %>
<%@ Register Src="ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %>
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %>
<%@ Register Src="WebsiteActions.ascx" TagName="WebsiteActions" TagPrefix="wsp" %>
<script src="JavaScript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script language="javascript">
function SelectAllCheckboxes(box) {
$(".NormalGridView tbody :checkbox").attr("checked", $(box).attr("checked"));
}
</script>
<div class="FormButtonsBar">
<div class="Left">
<asp:Button ID="btnAddItem" runat="server" Text="btnAddItem" CssClass="Button3" OnClick="btnAddItem_Click" />
@ -9,7 +19,17 @@
meta:resourcekey="chkRecursive" AutoPostBack="true" Checked="True" CssClass="Normal" />
</div>
<div class="Right">
<wsp:SearchBox ID="searchBox" runat="server" />
<table>
<tr>
<td>
<wsp:WebsiteActions ID="websiteActions" runat="server" GridViewID="gvItems" CheckboxesName="chkSelectedIds" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>
<wsp:SearchBox ID="searchBox" runat="server" />
</td>
</tr>
</table>
</div>
</div>
<asp:Literal ID="litGroupName" runat="server" Visible="false"></asp:Literal>
@ -19,9 +39,17 @@
<ContentTemplate>
<asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="False" AllowSorting="True"
DataSourceID="odsItemsPaged" EmptyDataText="gvItems" CssSelectorClass="NormalGridView"
DataSourceID="odsItemsPaged" EmptyDataText="gvItems" CssSelectorClass="NormalGridView" DataKeyNames="ItemID"
AllowPaging="True" OnRowCommand="gvItems_RowCommand" OnRowDataBound="gvItems_RowDataBound">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="ItemName" HeaderText="gvItemsName">
<ItemStyle Width="100%"></ItemStyle>
<ItemTemplate>

View file

@ -108,11 +108,11 @@ namespace WebsitePanel.Portal.UserControls
// visibility
chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User);
gvItems.Columns[1].Visible = !String.IsNullOrEmpty(ViewLinkText);
gvItems.Columns[2].Visible = gvItems.Columns[3].Visible =
gvItems.Columns[2].Visible = !String.IsNullOrEmpty(ViewLinkText);
gvItems.Columns[3].Visible = gvItems.Columns[4].Visible =
(PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
gvItems.Columns[4].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvItems.Columns[5].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
gvItems.Columns[5].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvItems.Columns[6].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
if (!IsPostBack)
{
@ -206,5 +206,6 @@ namespace WebsitePanel.Portal.UserControls
string localizedLinkText = HostModule.GetLocalizedString(ViewLinkText + ".Text");
lnkView.Text = localizedLinkText != null ? localizedLinkText : ViewLinkText;
}
}
}

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -58,6 +30,15 @@ namespace WebsitePanel.Portal.UserControls {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkRecursive;
/// <summary>
/// websiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.WebsiteActions websiteActions;
/// <summary>
/// searchBox control.
/// </summary>

View file

@ -42,6 +42,7 @@ using System.Web.UI.HtmlControls;
using Microsoft.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
@ -57,40 +58,30 @@ namespace WebsitePanel.Portal
SetMailboxPlan = 6
}
public partial class UserActions : WebsitePanelControlBase
public partial class UserActions : ActionListControlBase<UserActionTypes>
{
public event EventHandler ExecutingUserAction;
private bool showSetMailboxPlan = false;
public bool ShowSetMailboxPlan
{
get { return showSetMailboxPlan; }
set { showSetMailboxPlan = value; }
}
public bool ShowSetMailboxPlan { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
// Remove Service Level item and VIP item from Action List if current Hosting plan does not allow Service Levels
if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetServiceLevel).ToString()));
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetVIP).ToString()));
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.UnsetVIP).ToString()));
RemoveActionItem(UserActionTypes.SetServiceLevel);
RemoveActionItem(UserActionTypes.SetVIP);
RemoveActionItem(UserActionTypes.UnsetVIP);
}
if (!ShowSetMailboxPlan)
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetMailboxPlan).ToString()));
RemoveActionItem(UserActionTypes.SetMailboxPlan);
}
public UserActionTypes SelectedAction
protected override DropDownList ActionsList
{
get
{
return (UserActionTypes)Convert.ToInt32(ddlUserActions.SelectedValue);
}
get { return ddlUserActions; }
}
public int DoUserActions(List<int> userIds)
protected override int DoAction(List<int> userIds)
{
switch (SelectedAction)
{
@ -111,15 +102,9 @@ namespace WebsitePanel.Portal
return 0;
}
protected void DoExecutingUserAction()
{
if (ExecutingUserAction != null)
ExecutingUserAction(this, new EventArgs());
}
protected void btnModalOk_Click(object sender, EventArgs e)
{
DoExecutingUserAction();
FireExecuteAction();
}
protected void btnModalCancel_OnClick(object sender, EventArgs e)
@ -127,11 +112,6 @@ namespace WebsitePanel.Portal
ResetSelection();
}
public void ResetSelection()
{
ddlUserActions.ClearSelection();
}
protected int ChangeUsersSettings(List<int> userIds, bool? disable, int? serviceLevelId, bool? isVIP)
{
foreach (var userId in userIds)
@ -270,7 +250,7 @@ namespace WebsitePanel.Portal
case UserActionTypes.Enable:
case UserActionTypes.SetVIP:
case UserActionTypes.UnsetVIP:
DoExecutingUserAction();
FireExecuteAction();
break;
case UserActionTypes.SetServiceLevel:
FillServiceLevelsList();

View file

@ -0,0 +1,34 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebsiteActions.ascx.cs" Inherits="WebsitePanel.Portal.WebsiteActions" %>
<script language="javascript">
function ShowProrgess(btn) {
var action = $(btn).prev().val();
if (action === 1) {
ShowProgressDialog("Stopping websites...");
} else if (action == 2) {
ShowProgressDialog("Starting websites...");
} else if (action == 3) {
ShowProgressDialog("Restarting App Pools...");
}
}
</script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:DropDownList ID="ddlWebsiteActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlWebsiteActions" AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">Stop</asp:ListItem>
<asp:ListItem Value="2">Start</asp:ListItem>
<asp:ListItem Value="3">RestartAppPool</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers>
</asp:UpdatePanel>

View file

@ -0,0 +1,125 @@
// Copyright (c) 2015, 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.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
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.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
public enum WebsiteActionTypes
{
None = 0,
Stop = 1,
Start = 2,
RestartAppPool = 3,
}
public partial class WebsiteActions : ActionListControlBase<WebsiteActionTypes>
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override DropDownList ActionsList
{
get { return ddlWebsiteActions; }
}
protected override int DoAction(List<int> ids)
{
switch (SelectedAction)
{
case WebsiteActionTypes.Stop:
return ChangeWebsiteState(false, ids);
case WebsiteActionTypes.Start:
return ChangeWebsiteState(true, ids);
case WebsiteActionTypes.RestartAppPool:
return RestartAppPool(ids);
}
return 0;
}
protected void btnApply_Click(object sender, EventArgs e)
{
switch (SelectedAction)
{
case WebsiteActionTypes.Stop:
case WebsiteActionTypes.Start:
case WebsiteActionTypes.RestartAppPool:
FireExecuteAction();
break;
}
}
private int ChangeWebsiteState(bool enable, List<int> ids)
{
foreach (var id in ids)
{
var state = enable ? ServerState.Started : ServerState.Paused;
int result = ES.Services.WebServers.ChangeSiteState(id, state);
if (result < 0)
return result;
}
return 0;
}
private int RestartAppPool(List<int> ids)
{
foreach (var id in ids)
{
int result = ES.Services.WebServers.ChangeAppPoolState(id, AppPoolState.Recycle);
if (result < 0)
return result;
}
return 0;
}
}
}

View file

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {
public partial class WebsiteActions {
/// <summary>
/// tblActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel tblActions;
/// <summary>
/// ddlWebsiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlWebsiteActions;
/// <summary>
/// btnApply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnApply;
}
}

View file

@ -843,6 +843,9 @@
<Compile Include="UserControls\DomainControl.ascx.designer.cs">
<DependentUpon>DomainControl.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\ActionListControlBase.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\DomainListControlBase.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -891,6 +894,20 @@
<Compile Include="UserControls\ItemButtonPanel.ascx.designer.cs">
<DependentUpon>ItemButtonPanel.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\DomainActions.ascx.cs">
<DependentUpon>DomainActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\DomainActions.ascx.designer.cs">
<DependentUpon>DomainActions.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\WebsiteActions.ascx.cs">
<DependentUpon>WebsiteActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\WebsiteActions.ascx.designer.cs">
<DependentUpon>WebsiteActions.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\UserActions.ascx.cs">
<DependentUpon>UserActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4480,6 +4497,8 @@
<Content Include="UserControls\PackagePhoneNumbers.ascx" />
<Content Include="Lync\UserControls\AllocatePackagePhoneNumbers.ascx" />
<Content Include="UserControls\ItemButtonPanel.ascx" />
<Content Include="UserControls\DomainActions.ascx" />
<Content Include="UserControls\WebsiteActions.ascx" />
<Content Include="UserControls\UserActions.ascx" />
<Content Include="UserOrganization.ascx" />
<Content Include="VPSForPC\MonitoringPage.aspx" />
@ -4550,6 +4569,8 @@
<Content Include="PhoneNumbersAddPhoneNumber.ascx" />
<Content Include="PhoneNumbersEditPhoneNumber.ascx" />
<Content Include="UserControls\App_LocalResources\UserActions.ascx.resx" />
<Content Include="UserControls\App_LocalResources\DomainActions.ascx.resx" />
<EmbeddedResource Include="UserControls\App_LocalResources\WebsiteActions.ascx.resx" />
</ItemGroup>
<ItemGroup>
<Content Include="App_LocalResources\BandwidthReport.ascx.resx">