merge commit

This commit is contained in:
robvde 2015-02-15 09:15:02 +08:00
commit 4a80b1bdce
197 changed files with 184514 additions and 1143 deletions

View file

@ -328,21 +328,21 @@ namespace WebsitePanel.Portal
return idn.GetAscii(domainName);
}
/// <summary>
/// Adds the specified parameter to the Query String.
/// </summary>
/// <param name="url"></param>
/// <param name="paramName">Name of the parameter to add.</param>
/// <param name="paramValue">Value for the parameter to add.</param>
/// <returns>Url with added parameter.</returns>
public static Uri AddParameter(this Uri url, string paramName, string paramValue)
public static List<T> GetCheckboxValuesFromGrid<T>(GridView gridView, string checkboxName)
{
var uriBuilder = new UriBuilder(url);
var query = HttpUtility.ParseQueryString(uriBuilder.Query);
query[paramName] = paramValue;
uriBuilder.Query = query.ToString();
// Get checked users
var userIds = new List<T>();
return new Uri(uriBuilder.ToString());
foreach (GridViewRow gvr in gridView.Rows)
{
if (((CheckBox)gvr.FindControl(checkboxName)).Checked)
{
string userId = gridView.DataKeys[gvr.DataItemIndex].Value.ToString();
userIds.Add((T)Convert.ChangeType(userId, typeof(T)));
}
}
return userIds;
}
}
}

View file

@ -66,6 +66,24 @@ namespace WebsitePanel.Portal.Code.Helpers
|| PackagesHelper.CheckGroupQuotaEnabled(packageId, t.ResourceGroup, t.Quota)
select t;
}
/// <summary>
/// Adds the specified parameter to the Query String.
/// </summary>
/// <param name="url"></param>
/// <param name="paramName">Name of the parameter to add.</param>
/// <param name="paramValue">Value for the parameter to add.</param>
/// <returns>Url with added parameter.</returns>
public static Uri AddParameter(this Uri url, string paramName, string paramValue)
{
var uriBuilder = new UriBuilder(url);
var query = HttpUtility.ParseQueryString(uriBuilder.Query);
query[paramName] = paramValue;
uriBuilder.Query = query.ToString();
return new Uri(uriBuilder.ToString());
}
}
public class Tab

View file

@ -189,4 +189,7 @@
<data name="SharedMailbox.Text" xml:space="preserve">
<value>Shared Mailbox</value>
</data>
<data name="chkUserMustChangePassword.Text" xml:space="preserve">
<value>User must change password at next logon</value>
</data>
</root>

View file

@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnCreateMailbox.Text" xml:space="preserve">
<value>Create New Mailbox</value>
<value>New Mailbox</value>
</data>
<data name="cmdDelete.OnClientClick" xml:space="preserve">
<value>if(!confirm('Are you sure you want to delete this mailbox?')) return false; else ShowProgressDialog('Deleting mailbox...');</value>

View file

@ -159,4 +159,7 @@
<data name="valRequireSubscriberNumber.Text" xml:space="preserve">
<value>*</value>
</data>
<data name="chkUserMustChangePassword.Text" xml:space="preserve">
<value>User must change password at next logon</value>
</data>
</root>

View file

@ -252,4 +252,7 @@
<data name="secServiceLevels.Text" xml:space="preserve">
<value>Service Level Information</value>
</data>
<data name="chkUserMustChangePassword.Text" xml:space="preserve">
<value>User must change password at next logon</value>
</data>
</root>

View file

@ -110,6 +110,7 @@
<td>
<wsp:PasswordControl id="password" runat="server" ValidationGroup="CreateMailbox" AllowGeneratePassword="true">
</wsp:PasswordControl>
<asp:CheckBox ID="chkUserMustChangePassword" runat="server" meta:resourcekey="chkUserMustChangePassword" Text="User must change password at next login" />
</td>
</tr>
<tr>

View file

@ -236,7 +236,8 @@ namespace WebsitePanel.Portal.ExchangeServer
user.ExternalEmail,
txtSubscriberNumber.Text,
0,
false);
false,
chkUserMustChangePassword.Checked);
}

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.
@ -274,6 +246,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.PasswordControl password;
/// <summary>
/// chkUserMustChangePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkUserMustChangePassword;
/// <summary>
/// locMailboxType control.
/// </summary>

View file

@ -2,6 +2,15 @@
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/UserActions.ascx" TagName="UserActions" 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>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -21,40 +30,59 @@
<div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanLeft">
<asp:Button ID="btnCreateMailbox" runat="server" meta:resourcekey="btnCreateMailbox"
Text="Create New Mailbox" CssClass="Button1" OnClick="btnCreateMailbox_Click" />
Text="New Mailbox" CssClass="Button1" OnClick="btnCreateMailbox_Click" />
</div>
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:CheckBox ID="chkMailboxes" runat="server" meta:resourcekey="chkMailboxes" Text="Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged"/>
<asp:CheckBox ID="chkResourceMailboxes" runat="server" meta:resourcekey="chkResourceMailboxes" Text="Resource Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged"/>
<asp:CheckBox ID="chkSharedMailboxes" runat="server" meta:resourcekey="chkSharedMailboxes" Text="Shared Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged"/>
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<div class="FormButtonsBarCleanMiddle">
<table>
<tr>
<td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" ShowSetMailboxPlan="true" />
</td>
<td class="FormButtonsBarCleanSeparatorSmall"></td>
<td>
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:CheckBox ID="chkMailboxes" runat="server" meta:resourcekey="chkMailboxes" Text="Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged" CssClass="Small" />
<asp:CheckBox ID="chkResourceMailboxes" runat="server" meta:resourcekey="chkResourceMailboxes" Text="Resource Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged" CssClass="Small" />
<asp:CheckBox ID="chkSharedMailboxes" runat="server" meta:resourcekey="chkSharedMailboxes" Text="Shared Mailboxes" AutoPostBack="true" OnCheckedChanged="chkMailboxes_CheckedChanged" CssClass="Small" />
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged" Width="50">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
<asp:ListItem Value="AccountName" meta:resourcekey="ddlSearchColumnAccountName">AccountName</asp:ListItem>
<asp:ListItem Value="SubscriberNumber" meta:resourcekey="ddlSearchColumnSubscriberNumber">Account Number</asp:ListItem>
<asp:ListItem Value="UserPrincipalName" meta:resourcekey="ddlSearchColumnUserPrincipalName">Login</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false"/>
</asp:Panel>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
<asp:ListItem Value="AccountName" meta:resourcekey="ddlSearchColumnAccountName">AccountName</asp:ListItem>
<asp:ListItem Value="SubscriberNumber" meta:resourcekey="ddlSearchColumnSubscriberNumber">Account Number</asp:ListItem>
<asp:ListItem Value="UserPrincipalName" meta:resourcekey="ddlSearchColumnUserPrincipalName">Login</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox>
<asp:ImageButton ID="cmdSearch" runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton" CausesValidation="false" />
</asp:Panel>
</td>
</tr>
</table>
</div>
</div>
<asp:GridView ID="gvMailboxes" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvMailboxes" CssSelectorClass="NormalGridView"
Width="100%" EmptyDataText="gvMailboxes" CssSelectorClass="NormalGridView" DataKeyNames="AccountId"
OnRowCommand="gvMailboxes_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsAccountsPaged" PageSize="20">
<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="chkSelectedUsersIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetStateImage((bool)Eval("Locked"),(bool)Eval("Disabled")) %>' ImageAlign="AbsMiddle" />
@ -80,7 +108,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvServiceLevel">
<ItemStyle Width="20%"></ItemStyle>
<ItemStyle Width="15%"></ItemStyle>
<ItemTemplate>
<asp:Label id="lbServLevel" runat="server" ToolTip = '<%# GetServiceLevel((int)Eval("LevelId")).LevelDescription%>'>
<%# GetServiceLevel((int)Eval("LevelId")).LevelName%>

View file

@ -69,16 +69,15 @@ namespace WebsitePanel.Portal.ExchangeServer
BindServiceLevels();
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
{
gvMailboxes.Columns[4].Visible = false;
gvMailboxes.Columns[6].Visible = false;
}
}
gvMailboxes.Columns[3].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
gvMailboxes.Columns[4].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
}
private void BindServiceLevels()
@ -273,5 +272,42 @@ 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");
}
}
userActions.ResetSelection();
}
}
}

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.
@ -85,6 +57,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCreateMailbox;
/// <summary>
/// userActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserActions userActions;
/// <summary>
/// SearchPanel control.
/// </summary>

View file

@ -81,6 +81,7 @@
<td>
<wsp:PasswordControl id="password" runat="server" ValidationGroup="CreateMailbox" AllowGeneratePassword="true" >
</wsp:PasswordControl>
<asp:CheckBox ID="chkUserMustChangePassword" runat="server" meta:resourcekey="chkUserMustChangePassword" Text="User must change password at next login" />
</td>
</tr>

View file

@ -169,7 +169,8 @@ namespace WebsitePanel.Portal.HostedSolution
user.ExternalEmail,
txtSubscriberNumber.Text,
0,
false);
false,
chkUserMustChangePassword.Checked);
}
}
}

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.
@ -229,6 +201,15 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks>
protected global::WebsitePanel.Portal.PasswordControl password;
/// <summary>
/// chkUserMustChangePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkUserMustChangePassword;
/// <summary>
/// chkSendInstructions control.
/// </summary>

View file

@ -77,10 +77,10 @@
</td>
</tr>
<tr>
<td></td>
<td>
<asp:CheckBox ID="chkUserMustChangePassword" runat="server" meta:resourcekey="chkUserMustChangePassword" Text="User must change password at next login" />
<br />
<asp:CheckBox ID="chkDisable" runat="server" meta:resourcekey="chkDisable" Text="Disable User" />
<br />

View file

@ -231,6 +231,8 @@ namespace WebsitePanel.Portal.HostedSolution
password.ValidationEnabled = true;
password.Password = string.Empty;
chkUserMustChangePassword.Checked = user.UserMustChangePassword;
}
catch (Exception ex)
{
@ -323,7 +325,8 @@ namespace WebsitePanel.Portal.HostedSolution
txtExternalEmailAddress.Text,
txtSubscriberNumber.Text,
string.IsNullOrEmpty(ddlServiceLevels.SelectedValue) ? 0 : int.Parse(ddlServiceLevels.SelectedValue),
chkVIP.Checked);
chkVIP.Checked,
chkUserMustChangePassword.Checked);
if (result < 0)
{

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.
@ -238,6 +210,15 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary2;
/// <summary>
/// chkUserMustChangePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkUserMustChangePassword;
/// <summary>
/// chkDisable control.
/// </summary>

View file

@ -3,6 +3,15 @@
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/UserActions.ascx" TagName="UserActions" 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>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -25,25 +34,35 @@
<asp:Button ID="btnCreateUser" runat="server" meta:resourcekey="btnCreateUser"
Text="Create New User" CssClass="Button1" OnClick="btnCreateUser_Click" />
</div>
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<div class="FormButtonsBarCleanMiddle">
<table>
<tr>
<td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
<asp:ListItem Value="AccountName" meta:resourcekey="ddlSearchColumnAccountName">AccountName</asp:ListItem>
<asp:ListItem Value="SubscriberNumber" meta:resourcekey="ddlSearchColumnSubscriberNumber">Account Number</asp:ListItem>
<asp:ListItem Value="UserPrincipalName" meta:resourcekey="ddlSearchColumnUserPrincipalName">Login</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false"/>
</asp:Panel>
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
<asp:ListItem Value="AccountName" meta:resourcekey="ddlSearchColumnAccountName">AccountName</asp:ListItem>
<asp:ListItem Value="SubscriberNumber" meta:resourcekey="ddlSearchColumnSubscriberNumber">Account Number</asp:ListItem>
<asp:ListItem Value="UserPrincipalName" meta:resourcekey="ddlSearchColumnUserPrincipalName">Login</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false" />
</asp:Panel>
</td>
</tr>
</table>
</div>
</div>
<asp:Panel ID="UsersPanel" runat="server">
@ -54,12 +73,19 @@
OnRowCommand="gvUsers_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsAccountsPaged" PageSize="20">
<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="chkSelectedUsersIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetStateImage((bool)Eval("Locked"),(bool)Eval("Disabled")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvUsersDisplayName" SortExpression="DisplayName">
<ItemStyle Width="25%"></ItemStyle>
<ItemTemplate>

View file

@ -56,10 +56,10 @@ namespace WebsitePanel.Portal.HostedSolution
{
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
{
gvUsers.Columns[5].Visible = false;
gvUsers.Columns[6].Visible = false;
}
}
gvUsers.Columns[3].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
gvUsers.Columns[4].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels);
}
private void BindServiceLevels()
@ -388,5 +388,44 @@ namespace WebsitePanel.Portal.HostedSolution
messageBox.ShowErrorMessage("ORGANIZATIONS_DELETE_USERS", ex);
}
}
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");
}
}
userActions.ResetSelection();
}
}
}

View file

@ -85,6 +85,15 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCreateUser;
/// <summary>
/// userActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserActions userActions;
/// <summary>
/// SearchPanel control.
/// </summary>

View file

@ -31,6 +31,7 @@ using System.Web.UI.WebControls;
using System.Collections.Generic;
using WebsitePanel.Providers.Common;
using System.Text;
using WebsitePanel.Portal.Code.Helpers;
namespace WebsitePanel.Portal
{

View file

@ -50,7 +50,8 @@ namespace WebsitePanel.Portal.RDS
litCollectionName.Text = collection.Name;
txtApplicationName.Text = remoteApp.DisplayName;
var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Contains(x.DomainUserName));
//var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Contains(x.AccountName));
var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Select(a => a.Split('\\').Last().ToLower()).Contains(x.SamAccountName.Split('\\').Last().ToLower()));
users.SetUsers(remoteAppUsers.ToArray());
}
@ -64,7 +65,8 @@ namespace WebsitePanel.Portal.RDS
var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name);
var remoteApp = applications.Where(x => x.Alias.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
remoteApp.DisplayName = txtApplicationName.Text;
ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.AccountName).ToArray());
//ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.AccountName).ToArray());
ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.SamAccountName.Split('\\').Last()).ToArray());
}
catch (Exception ex)
{

View file

@ -25,6 +25,7 @@
</ItemStyle>
<ItemTemplate>
<asp:Literal ID="litAccount" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:HiddenField ID="hdnSamAccountName" runat="server" Value='<%# Eval("SamAccountName") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
@ -79,6 +80,7 @@
<ItemTemplate>
<asp:Image ID="imgAccount" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
<asp:HiddenField ID="hdnSamName" runat="server" Value='<%# Eval("SamAccountName") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsEmail">

View file

@ -194,6 +194,7 @@ namespace WebsitePanel.Portal.RDS.UserControls
OrganizationUser user = new OrganizationUser();
user.AccountName = (string)gvUsers.DataKeys[i][0];
user.DisplayName = ((Literal)row.FindControl("litAccount")).Text;
user.SamAccountName = ((HiddenField)row.FindControl("hdnSamAccountName")).Value;
if (state == SelectedState.All ||
(state == SelectedState.Selected && chkSelect.Checked) ||
@ -219,7 +220,8 @@ namespace WebsitePanel.Portal.RDS.UserControls
accounts.Add(new OrganizationUser
{
AccountName = (string)gvPopupAccounts.DataKeys[i][0],
DisplayName = ((Literal)row.FindControl("litDisplayName")).Text
DisplayName = ((Literal)row.FindControl("litDisplayName")).Text,
SamAccountName = ((HiddenField)row.FindControl("hdnSamName")).Value
});
}
}

View file

@ -36,6 +36,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.Portal.Code.Helpers;
namespace WebsitePanel.Portal
{

View file

@ -181,6 +181,23 @@
<td class="Normal">
<asp:CheckBox ID="chkCgiBin" runat="server" Text="Installed" /></td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblCfExt" runat="server" meta:resourcekey="lblCfExt" Text="ColdFusion:"></asp:Label>
</td>
<td class="Normal">
<asp:CheckBox ID="chkCfExt" runat="server" Text="Enabled" /></td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblVirtDir" runat="server" meta:resourcekey="lblVirtDir" Text="CFVirtualDirectories:"></asp:Label>
</td>
<td class="Normal">
<asp:CheckBox ID="chkVirtDir" runat="server" Text="Enabled" /></td>
</tr>
</table>
</asp:Panel>

View file

@ -76,6 +76,8 @@ namespace WebsitePanel.Portal
chkPerl.Checked = Utils.ParseBool(settings["PerlInstalled"], false);
chkPython.Checked = Utils.ParseBool(settings["PythonInstalled"], false);
chkCgiBin.Checked = Utils.ParseBool(settings["CgiBinInstalled"], false);
chkCfExt.Checked = Utils.ParseBool(settings["ColdFusionInstalled"], false);
chkVirtDir.Checked = Utils.ParseBool(settings["CreateCFVirtualDirectoriesPol"], false);
// anonymous account policy
anonymousUsername.Value = settings["AnonymousAccountPolicy"];
@ -130,6 +132,8 @@ namespace WebsitePanel.Portal
settings["PerlInstalled"] = chkPerl.Checked.ToString();
settings["PythonInstalled"] = chkPython.Checked.ToString();
settings["CgiBinInstalled"] = chkCgiBin.Checked.ToString();
settings["ColdFusionInstalled"] = chkCfExt.Checked.ToString();
settings["CreateCFVirtualDirectoriesPol"] = chkVirtDir.Checked.ToString();
// anonymous account policy
settings["AnonymousAccountPolicy"] = anonymousUsername.Value;

View file

@ -462,6 +462,42 @@ namespace WebsitePanel.Portal {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkCgiBin;
/// <summary>
/// lblCfExt 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.Label lblCfExt;
/// <summary>
/// chkCfExt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkCfExt;
/// <summary>
/// lblVirtDir 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.Label lblVirtDir;
/// <summary>
/// chkVirtDir control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkVirtDir;
/// <summary>
/// secAnonymousAccount control.

View file

@ -0,0 +1,171 @@
<?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="btnMailboxPlanCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnMailboxPlanOk.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="btnServiceLevelCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnServiceLevelOk.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="ddlUserActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value>
</data>
<data name="ddlUserActionsItem.Disable" xml:space="preserve">
<value>Disable</value>
</data>
<data name="ddlUserActionsItem.Enable" xml:space="preserve">
<value>Enable</value>
</data>
<data name="ddlUserActionsItem.SetMailboxPlan" xml:space="preserve">
<value>Set Mailbox Plan</value>
</data>
<data name="ddlUserActionsItem.SetServiceLevel" xml:space="preserve">
<value>Set Service Level</value>
</data>
<data name="ddlUserActionsItem.SetVIP" xml:space="preserve">
<value>Set VIP</value>
</data>
<data name="ddlUserActionsItem.UnsetVIP" xml:space="preserve">
<value>Unset VIP</value>
</data>
<data name="headerMailboxPlanLabel.Text" xml:space="preserve">
<value>Mailbox Plan</value>
</data>
<data name="headerServiceLevel.Text" xml:space="preserve">
<value>Service Level</value>
</data>
<data name="litMailboxPlan.text" xml:space="preserve">
<value>Please select a Mailbox Plan for the all checked mailboxes</value>
</data>
<data name="litServiceLevel.text" xml:space="preserve">
<value>Please select a Service Level for the all checked users</value>
</data>
<data name="litVIP.Text" xml:space="preserve">
<value>Please select a VIP status for the all checked users</value>
</data>
</root>

View file

@ -0,0 +1,106 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserActions.ascx.cs" Inherits="WebsitePanel.Portal.UserActions" %>
<%@ Register Src="../ExchangeServer/UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %>
<script language="javascript">
function CloseAndShowProgressDialog(text) {
$(".Popup").hide();
return ShowProgressDialog(text);
}
function ShowProrgess(btn) {
var action = $(btn).prev().val();
if (action == 1) {
ShowProgressDialog('Disabling users...');
} else if (action == 2) {
ShowProgressDialog('Enabling users...');
} else if (action == 4) {
ShowProgressDialog('Setting VIP...');
} else if (action == 5) {
ShowProgressDialog('Unsetting VIP...');
}
}
</script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:DropDownList ID="ddlUserActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlUserActions"
AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">Disable</asp:ListItem>
<asp:ListItem Value="2">Enable</asp:ListItem>
<asp:ListItem Value="3">SetServiceLevel</asp:ListItem>
<asp:ListItem Value="4">SetVIP</asp:ListItem>
<asp:ListItem Value="5">UnsetVIP</asp:ListItem>
<asp:ListItem Value="6">SetMailboxPlan</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
<ajaxToolkit:ModalPopupExtender ID="Modal" runat="server" EnableViewState="true" TargetControlID="FakeModalPopupTarget"
PopupControlID="FakeModalPopupTarget" BackgroundCssClass="modalBackground" DropShadow="false" />
<%--Set Service Level--%>
<asp:Panel ID="ServiceLevelPanel" runat="server" CssClass="Popup" Style="display: none">
<table class="Popup-Header">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle"><asp:Localize ID="headerServiceLevel" runat="server" meta:resourcekey="headerServiceLevel"></asp:Localize></td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br/>
<asp:Literal ID="litServiceLevel" runat="server" meta:resourcekey="litServiceLevel"></asp:Literal>
<br/>
<asp:DropDownList ID="ddlServiceLevels" runat="server" CssClass="NormalTextBox" />
<br/>
</div>
<div class="FormFooterMiddle">
<asp:Button ID="btnServiceLevelOk" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Setting Service Level...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnServiceLevelCancel" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelCancel" Text="Cancel"
OnClick="btnModalCancel_OnClick" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<%--Set MailboxPlan--%>
<asp:Panel ID="MailboxPlanPanel" runat="server" CssClass="Popup" Style="display: none">
<table class="Popup-Header">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle"><asp:Localize ID="headerMailboxPlanLabel" runat="server" meta:resourcekey="headerMailboxPlanLabel"></asp:Localize></td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br/>
<asp:Literal ID="litMailboxPlan" runat="server" meta:resourcekey="litMailboxPlan"></asp:Literal>
<br/>
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" />
<br/>
</div>
<div class="FormFooterMiddle">
<asp:Button ID="btnMailboxPlanOk" runat="server" CssClass="Button1" meta:resourcekey="btnMailboxPlanOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Setting Mailbox Plan ...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnMailboxPlanCancel" runat="server" CssClass="Button1" meta:resourcekey="btnMailboxPlanCancel" Text="Cancel"
OnClick="btnModalCancel_OnClick" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Button ID="FakeModalPopupTarget" runat="server" Style="display: none;" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnServiceLevelOk" />
<asp:PostBackTrigger ControlID="btnMailboxPlanOk" />
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers>
</asp:UpdatePanel>

View file

@ -0,0 +1,290 @@
// 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.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
public enum UserActionTypes
{
None = 0,
Disable = 1,
Enable = 2,
SetServiceLevel = 3,
SetVIP = 4,
UnsetVIP = 5,
SetMailboxPlan = 6
}
public partial class UserActions : WebsitePanelControlBase
{
public event EventHandler ExecutingUserAction;
private bool showSetMailboxPlan = false;
public bool ShowSetMailboxPlan
{
get { return showSetMailboxPlan; }
set { showSetMailboxPlan = value; }
}
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()));
}
if (!ShowSetMailboxPlan)
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetMailboxPlan).ToString()));
}
public UserActionTypes SelectedAction
{
get
{
return (UserActionTypes)Convert.ToInt32(ddlUserActions.SelectedValue);
}
}
public int DoUserActions(List<int> userIds)
{
switch (SelectedAction)
{
case UserActionTypes.Disable:
return ChangeUsersSettings(userIds, true, null, null);
case UserActionTypes.Enable:
return ChangeUsersSettings(userIds, false, null, null);
case UserActionTypes.SetServiceLevel:
return ChangeUsersSettings(userIds, null, SelectedServiceId, null);
case UserActionTypes.SetVIP:
return ChangeUsersSettings(userIds, null, null, true);
case UserActionTypes.UnsetVIP:
return ChangeUsersSettings(userIds, null, null, false);
case UserActionTypes.SetMailboxPlan:
return SetMailboxPlan(userIds);
}
return 0;
}
protected void DoExecutingUserAction()
{
if (ExecutingUserAction != null)
ExecutingUserAction(this, new EventArgs());
}
protected void btnModalOk_Click(object sender, EventArgs e)
{
DoExecutingUserAction();
}
protected void btnModalCancel_OnClick(object sender, EventArgs e)
{
ResetSelection();
}
public void ResetSelection()
{
ddlUserActions.ClearSelection();
}
protected int ChangeUsersSettings(List<int> userIds, bool? disable, int? serviceLevelId, bool? isVIP)
{
foreach (var userId in userIds)
{
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, userId);
int result = ES.Services.Organizations.SetUserGeneralSettings(
PanelRequest.ItemID,
userId,
user.DisplayName,
string.Empty,
false,
disable ?? user.Disabled,
user.Locked,
user.FirstName,
user.Initials,
user.LastName,
user.Address,
user.City,
user.State,
user.Zip,
user.Country,
user.JobTitle,
user.Company,
user.Department,
user.Office,
user.Manager != null ? user.Manager.AccountName : String.Empty,
user.BusinessPhone,
user.Fax,
user.HomePhone,
user.MobilePhone,
user.Pager,
user.WebPage,
user.Notes,
user.ExternalEmail,
user.SubscriberNumber,
serviceLevelId ?? user.LevelId,
isVIP ?? user.IsVIP,
user.UserMustChangePassword);
if (result < 0)
return result;
}
return 0;
}
#region ServiceLevel
protected int SetMailboxPlan(List<int> userIds)
{
int planId;
if (!int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId))
return 0;
if (planId < 0) return 0;
foreach (int userId in userIds)
{
ExchangeAccount account = ES.Services.ExchangeServer.GetAccount(PanelRequest.ItemID, userId);
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, userId, planId,
account.ArchivingMailboxPlanId, account.EnableArchiving);
if (result < 0)
return result;
}
return 0;
}
protected int? SelectedServiceId
{
get
{
if (ddlServiceLevels.SelectedValue == string.Empty)
return null;
return Convert.ToInt32(ddlServiceLevels.SelectedValue);
}
}
protected void FillServiceLevelsList()
{
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
{
List<ServiceLevel> enabledServiceLevels = new List<ServiceLevel>();
foreach (var quota in cntx.Quotas.Where(x => x.Key.Contains(Quotas.SERVICE_LEVELS)))
{
foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels())
{
if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value))
{
enabledServiceLevels.Add(serviceLevel);
}
}
}
ddlServiceLevels.DataSource = enabledServiceLevels;
ddlServiceLevels.DataTextField = "LevelName";
ddlServiceLevels.DataValueField = "LevelId";
ddlServiceLevels.DataBind();
ddlServiceLevels.Items.Insert(0, new ListItem("<Select Service Level>", string.Empty));
ddlServiceLevels.Items.FindByValue(string.Empty).Selected = true;
}
}
private bool CheckServiceLevelQuota(QuotaValueInfo quota)
{
if (quota.QuotaAllocatedValue != -1)
{
return quota.QuotaAllocatedValue > quota.QuotaUsedValue;
}
return true;
}
#endregion
protected void btnApply_Click(object sender, EventArgs e)
{
switch (SelectedAction)
{
case UserActionTypes.Disable:
case UserActionTypes.Enable:
case UserActionTypes.SetVIP:
case UserActionTypes.UnsetVIP:
DoExecutingUserAction();
break;
case UserActionTypes.SetServiceLevel:
FillServiceLevelsList();
Modal.PopupControlID = ServiceLevelPanel.ID;
Modal.Show();
break;
case UserActionTypes.SetMailboxPlan:
Modal.PopupControlID = MailboxPlanPanel.ID;
Modal.Show();
break;
}
}
}
}

View file

@ -0,0 +1,168 @@
//------------------------------------------------------------------------------
// <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 UserActions {
/// <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>
/// ddlUserActions 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 ddlUserActions;
/// <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;
/// <summary>
/// Modal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender Modal;
/// <summary>
/// ServiceLevelPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel ServiceLevelPanel;
/// <summary>
/// headerServiceLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize headerServiceLevel;
/// <summary>
/// litServiceLevel 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.Literal litServiceLevel;
/// <summary>
/// ddlServiceLevels 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 ddlServiceLevels;
/// <summary>
/// btnServiceLevelOk 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 btnServiceLevelOk;
/// <summary>
/// btnServiceLevelCancel 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 btnServiceLevelCancel;
/// <summary>
/// MailboxPlanPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel MailboxPlanPanel;
/// <summary>
/// headerMailboxPlanLabel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize headerMailboxPlanLabel;
/// <summary>
/// litMailboxPlan 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.Literal litMailboxPlan;
/// <summary>
/// mailboxPlanSelector control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector;
/// <summary>
/// btnMailboxPlanOk 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 btnMailboxPlanOk;
/// <summary>
/// btnMailboxPlanCancel 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 btnMailboxPlanCancel;
/// <summary>
/// FakeModalPopupTarget 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 FakeModalPopupTarget;
}
}

View file

@ -891,6 +891,13 @@
<Compile Include="UserControls\ItemButtonPanel.ascx.designer.cs">
<DependentUpon>ItemButtonPanel.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\UserActions.ascx.cs">
<DependentUpon>UserActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\UserActions.ascx.designer.cs">
<DependentUpon>UserActions.ascx</DependentUpon>
</Compile>
<Compile Include="UserOrganization.ascx.cs">
<DependentUpon>UserOrganization.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -4473,6 +4480,7 @@
<Content Include="UserControls\PackagePhoneNumbers.ascx" />
<Content Include="Lync\UserControls\AllocatePackagePhoneNumbers.ascx" />
<Content Include="UserControls\ItemButtonPanel.ascx" />
<Content Include="UserControls\UserActions.ascx" />
<Content Include="UserOrganization.ascx" />
<Content Include="VPSForPC\MonitoringPage.aspx" />
<Content Include="VPSForPC\VdcAccountVLanAdd.ascx" />
@ -4541,6 +4549,7 @@
<Content Include="PhoneNumbers.ascx" />
<Content Include="PhoneNumbersAddPhoneNumber.ascx" />
<Content Include="PhoneNumbersEditPhoneNumber.ascx" />
<Content Include="UserControls\App_LocalResources\UserActions.ascx.resx" />
</ItemGroup>
<ItemGroup>
<Content Include="App_LocalResources\BandwidthReport.ascx.resx">