added "memberOf" functionality and bugs fixed
This commit is contained in:
parent
594edf416c
commit
f7fae8fe2f
20 changed files with 1283 additions and 35 deletions
|
@ -77,6 +77,8 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
txtNotes.ReadOnly = true;
|
||||
manager.Enabled = false;
|
||||
members.Enabled = false;
|
||||
|
||||
btnSave.Visible = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
DataSourceID="odsSecurityGroupsPaged" PageSize="20">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="gvGroupsDisplayName" SortExpression="DisplayName">
|
||||
<ItemStyle Width="50%"></ItemStyle>
|
||||
<ItemStyle Width="100%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:hyperlink id="lnk1" runat="server"
|
||||
NavigateUrl='<%# GetListEditUrl(Eval("AccountId").ToString()) %>'>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/EmailAddress.ascx" TagName="EmailAddress" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/AccountsList.ascx" TagName="AccountsList" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/UsersList.ascx" TagName="UsersList" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/GroupsList.ascx" TagName="GroupsList" TagPrefix="wsp" %>
|
||||
|
||||
|
||||
|
||||
|
@ -63,11 +63,7 @@
|
|||
<asp:UpdatePanel ID="SCGeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<wsp:AccountsList id="securegroups" runat="server"
|
||||
MailboxesEnabled="false"
|
||||
EnableMailboxOnly="false"
|
||||
ContactsEnabled="false"
|
||||
DistributionListsEnabled="false" />
|
||||
<wsp:GroupsList id="securegroups" runat="server" />
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
|
|
@ -58,10 +58,17 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
|
||||
// title
|
||||
litDisplayName.Text = mailbox.DisplayName;
|
||||
|
||||
|
||||
//Distribution Lists
|
||||
ExchangeAccount[] dLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
distrlists.SetAccounts(dLists);
|
||||
|
||||
//Security Groups
|
||||
ExchangeAccount[] securGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
|
||||
securegroups.SetAccounts(securGroups);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -76,6 +83,7 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
|
||||
try
|
||||
{
|
||||
//Distribution Lists
|
||||
ExchangeAccount[] oldDistributionLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newDistributionLists = new List<string>(distrlists.GetAccounts());
|
||||
foreach (ExchangeAccount oldlist in oldDistributionLists)
|
||||
|
@ -89,7 +97,29 @@ namespace WebsitePanel.Portal.HostedSolution
|
|||
foreach (string newlist in newDistributionLists)
|
||||
ES.Services.ExchangeServer.AddDistributionListMember(PanelRequest.ItemID, newlist, PanelRequest.AccountID);
|
||||
|
||||
//Security Groups
|
||||
ExchangeAccount[] oldDSecurityGroups = ES.Services.Organizations.GetSecurityGroupsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
|
||||
List<string> newSecurityGroups = new List<string>(securegroups.GetAccounts());
|
||||
foreach (ExchangeAccount oldgroup in oldDSecurityGroups)
|
||||
{
|
||||
if (newSecurityGroups.Contains(oldgroup.AccountName))
|
||||
{
|
||||
newSecurityGroups.Remove(oldgroup.AccountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
ES.Services.Organizations.DeleteUserFromSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, oldgroup.AccountName);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string newgroup in newSecurityGroups)
|
||||
{
|
||||
ES.Services.Organizations.AddUserToSecurityGroup(PanelRequest.ItemID, PanelRequest.AccountID, newgroup);
|
||||
}
|
||||
|
||||
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_MAILBOX_SETTINGS");
|
||||
|
||||
|
||||
BindSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace WebsitePanel.Portal.HostedSolution {
|
|||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList securegroups;
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.GroupsList securegroups;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
<?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="btnAdd.Text" xml:space="preserve">
|
||||
<value>Add...</value>
|
||||
</data>
|
||||
<data name="btnAddSelected.Text" xml:space="preserve">
|
||||
<value>Add Groups</value>
|
||||
</data>
|
||||
<data name="btnCancel.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="btnDelete.Text" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="ddlSearchColumnDisplayName.Text" xml:space="preserve">
|
||||
<value>Display Name</value>
|
||||
</data>
|
||||
<data name="gvGroups.EmptyDataText" xml:space="preserve">
|
||||
<value>The list of groups is empty. Click "Add..." button to add groups.</value>
|
||||
</data>
|
||||
<data name="gvGroupsDisplayName.HeaderText" xml:space="preserve">
|
||||
<value>Display Name</value>
|
||||
</data>
|
||||
<data name="gvPopupGroups.EmptyDataText" xml:space="preserve">
|
||||
<value>No groups found.</value>
|
||||
</data>
|
||||
<data name="headerAddGroups.Text" xml:space="preserve">
|
||||
<value>Groups</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,105 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GroupsList.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.GroupsList" %>
|
||||
<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
|
||||
|
||||
<asp:UpdatePanel ID="GroupsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="FormButtonsBarClean">
|
||||
<asp:Button ID="btnAdd" runat="server" Text="Add..." CssClass="Button1" OnClick="btnAdd_Click" meta:resourcekey="btnAdd" />
|
||||
<asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/>
|
||||
</div>
|
||||
<asp:GridView ID="gvGroups" runat="server" meta:resourcekey="gvAccounts" AutoGenerateColumns="False"
|
||||
Width="600px" CssSelectorClass="NormalGridView"
|
||||
DataKeyNames="AccountName">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="chkSelect" runat="server" />
|
||||
<asp:Literal ID="litAccountType" runat="server" Visible="false" Text='<%# Eval("AccountType") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<ItemStyle Width="10px" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvGroupsDisplayName" HeaderText="gvGroupsDisplayName">
|
||||
<HeaderStyle Wrap="false" />
|
||||
<ItemStyle Width="100%" Wrap="false"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
|
||||
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
|
||||
<asp:Panel ID="AddGroupsPanel" runat="server" CssClass="Popup" style="display:none">
|
||||
<table class="Popup-Header" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="Popup-HeaderLeft"></td>
|
||||
<td class="Popup-HeaderTitle">
|
||||
<asp:Localize ID="headerAddGroups" runat="server" meta:resourcekey="headerAddGroups"></asp:Localize>
|
||||
</td>
|
||||
<td class="Popup-HeaderRight"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="Popup-Content">
|
||||
<div class="Popup-Body">
|
||||
<br />
|
||||
<asp:UpdatePanel ID="AddGroupsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||
<ContentTemplate>
|
||||
<div class="FormButtonsBarClean">
|
||||
<div class="FormButtonsBarCleanRight">
|
||||
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
|
||||
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
|
||||
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</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" OnClick="cmdSearch_Click"/>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Popup-Scroll">
|
||||
<asp:GridView ID="gvPopupGroups" runat="server" meta:resourcekey="gvPopupGroups" AutoGenerateColumns="False"
|
||||
Width="100%" CssSelectorClass="NormalGridView"
|
||||
DataKeyNames="AccountName">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="chkSelect" runat="server" />
|
||||
<asp:Literal ID="litAccountType" runat="server" Visible="false" Text='<%# Eval("AccountType") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<ItemStyle Width="10px" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvGroupsDisplayName">
|
||||
<ItemStyle Width="100%"></ItemStyle>
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
|
||||
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div class="FormFooter">
|
||||
<asp:Button ID="btnAddSelected" runat="server" CssClass="Button1" meta:resourcekey="btnAddSelected" Text="Add Accounts" OnClick="btnAddSelected_Click" />
|
||||
<asp:Button ID="btnCancelAdd" runat="server" CssClass="Button1" meta:resourcekey="btnCancel" Text="Cancel" CausesValidation="false" />
|
||||
</div>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
|
||||
<asp:Button ID="btnAddAccountsFake" runat="server" style="display:none;" />
|
||||
<ajaxToolkit:ModalPopupExtender ID="AddGroupsModal" runat="server"
|
||||
TargetControlID="btnAddAccountsFake" PopupControlID="AddGroupsPanel"
|
||||
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd" />
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
|
@ -0,0 +1,197 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
||||
{
|
||||
public partial class GroupsList : WebsitePanelControlBase
|
||||
{
|
||||
private enum SelectedState
|
||||
{
|
||||
All,
|
||||
Selected,
|
||||
Unselected
|
||||
}
|
||||
|
||||
public void SetAccounts(ExchangeAccount[] accounts)
|
||||
{
|
||||
BindAccounts(accounts, false);
|
||||
}
|
||||
|
||||
public string[] GetAccounts()
|
||||
{
|
||||
// get selected accounts
|
||||
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvGroups, SelectedState.All);
|
||||
|
||||
List<string> accountNames = new List<string>();
|
||||
foreach (ExchangeAccount account in selectedAccounts)
|
||||
accountNames.Add(account.AccountName);
|
||||
|
||||
return accountNames.ToArray();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// register javascript
|
||||
if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes"))
|
||||
{
|
||||
string script = @" function SelectAllCheckboxes(box)
|
||||
{
|
||||
var state = box.checked;
|
||||
var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT"");
|
||||
for(i = 0; i < elm.length; i++)
|
||||
if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled)
|
||||
elm[i].checked = state;
|
||||
}";
|
||||
Page.ClientScript.RegisterClientScriptBlock(typeof(AccountsList), "SelectAllCheckboxes",
|
||||
script, true);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetAccountImage(int accountTypeId)
|
||||
{
|
||||
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId;
|
||||
string imgName = "dlist_16.gif";
|
||||
|
||||
return GetThemedImage("Exchange/" + imgName);
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
// bind all accounts
|
||||
BindPopupAccounts();
|
||||
|
||||
// show modal
|
||||
AddGroupsModal.Show();
|
||||
}
|
||||
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
// get selected accounts
|
||||
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvGroups, SelectedState.Unselected);
|
||||
|
||||
// add to the main list
|
||||
BindAccounts(selectedAccounts.ToArray(), false);
|
||||
}
|
||||
|
||||
protected void btnAddSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
// get selected accounts
|
||||
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvPopupGroups, SelectedState.Selected);
|
||||
|
||||
// add to the main list
|
||||
BindAccounts(selectedAccounts.ToArray(), true);
|
||||
}
|
||||
|
||||
private void BindPopupAccounts()
|
||||
{
|
||||
ExchangeAccount[] accounts = ES.Services.Organizations.SearchSecurityGroups(PanelRequest.ItemID,
|
||||
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
|
||||
|
||||
accounts = accounts.Where(x => !GetAccounts().Contains(x.AccountName)).ToArray();
|
||||
|
||||
gvPopupGroups.DataSource = accounts;
|
||||
gvPopupGroups.DataBind();
|
||||
}
|
||||
|
||||
private void BindAccounts(ExchangeAccount[] newAccounts, bool preserveExisting)
|
||||
{
|
||||
// get binded addresses
|
||||
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
|
||||
if(preserveExisting)
|
||||
accounts.AddRange(GetGridViewAccounts(gvGroups, SelectedState.All));
|
||||
|
||||
// add new accounts
|
||||
if (newAccounts != null)
|
||||
{
|
||||
foreach (ExchangeAccount newAccount in newAccounts)
|
||||
{
|
||||
// check if exists
|
||||
bool exists = false;
|
||||
foreach (ExchangeAccount account in accounts)
|
||||
{
|
||||
if (String.Compare(newAccount.AccountName, account.AccountName, true) == 0)
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (exists)
|
||||
continue;
|
||||
|
||||
accounts.Add(newAccount);
|
||||
}
|
||||
}
|
||||
|
||||
gvGroups.DataSource = accounts;
|
||||
gvGroups.DataBind();
|
||||
|
||||
btnDelete.Visible = gvGroups.Rows.Count > 0;
|
||||
}
|
||||
|
||||
private List<ExchangeAccount> GetGridViewAccounts(GridView gv, SelectedState state)
|
||||
{
|
||||
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
|
||||
for (int i = 0; i < gv.Rows.Count; i++)
|
||||
{
|
||||
GridViewRow row = gv.Rows[i];
|
||||
CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");
|
||||
if (chkSelect == null)
|
||||
continue;
|
||||
|
||||
ExchangeAccount account = new ExchangeAccount();
|
||||
account.AccountType = (ExchangeAccountType)Enum.Parse(typeof(ExchangeAccountType), ((Literal)row.FindControl("litAccountType")).Text);
|
||||
account.AccountName = (string)gv.DataKeys[i][0];
|
||||
account.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text;
|
||||
|
||||
if(state == SelectedState.All ||
|
||||
(state == SelectedState.Selected && chkSelect.Checked) ||
|
||||
(state == SelectedState.Unselected && !chkSelect.Checked))
|
||||
accounts.Add(account);
|
||||
}
|
||||
return accounts;
|
||||
}
|
||||
|
||||
protected void chkIncludeMailboxes_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindPopupAccounts();
|
||||
}
|
||||
|
||||
protected void cmdSearch_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
BindPopupAccounts();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <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.ExchangeServer.UserControls {
|
||||
|
||||
|
||||
public partial class GroupsList {
|
||||
|
||||
/// <summary>
|
||||
/// GroupsUpdatePanel 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 GroupsUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// btnAdd 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 btnAdd;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 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 btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// gvGroups 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.GridView gvGroups;
|
||||
|
||||
/// <summary>
|
||||
/// AddGroupsPanel 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 AddGroupsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// headerAddGroups 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 headerAddGroups;
|
||||
|
||||
/// <summary>
|
||||
/// AddGroupsUpdatePanel 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 AddGroupsUpdatePanel;
|
||||
|
||||
/// <summary>
|
||||
/// SearchPanel 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 SearchPanel;
|
||||
|
||||
/// <summary>
|
||||
/// ddlSearchColumn 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 ddlSearchColumn;
|
||||
|
||||
/// <summary>
|
||||
/// txtSearchValue control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtSearchValue;
|
||||
|
||||
/// <summary>
|
||||
/// cmdSearch 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.ImageButton cmdSearch;
|
||||
|
||||
/// <summary>
|
||||
/// gvPopupGroups 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.GridView gvPopupGroups;
|
||||
|
||||
/// <summary>
|
||||
/// btnAddSelected 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 btnAddSelected;
|
||||
|
||||
/// <summary>
|
||||
/// btnCancelAdd 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 btnCancelAdd;
|
||||
|
||||
/// <summary>
|
||||
/// btnAddAccountsFake 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 btnAddAccountsFake;
|
||||
|
||||
/// <summary>
|
||||
/// AddGroupsModal control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.ModalPopupExtender AddGroupsModal;
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
||||
{
|
||||
|
@ -218,6 +219,10 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID,
|
||||
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "", IncludeMailboxes);
|
||||
|
||||
List<OrganizationUser> newAccounts = new List<OrganizationUser>();
|
||||
|
||||
accounts = accounts.Where(x => !GetAccounts().Contains(x.AccountName)).ToArray();
|
||||
|
||||
if (ExcludeAccountId > 0)
|
||||
{
|
||||
List<OrganizationUser> updatedAccounts = new List<OrganizationUser>();
|
||||
|
|
|
@ -283,6 +283,13 @@
|
|||
<DependentUpon>AccountsListWithPermissions.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ExchangeServer\UserControls\GroupsList.ascx.cs">
|
||||
<DependentUpon>GroupsList.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ExchangeServer\UserControls\GroupsList.ascx.designer.cs">
|
||||
<DependentUpon>GroupsList.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ExchangeServer\UserControls\MailboxPlanSelector.ascx.cs">
|
||||
<DependentUpon>MailboxPlanSelector.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
@ -3977,6 +3984,7 @@
|
|||
<Content Include="ExchangeServer\OrganizationSecurityGroupGeneralSettings.ascx" />
|
||||
<Content Include="ExchangeServer\OrganizationSecurityGroups.ascx" />
|
||||
<Content Include="ExchangeServer\OrganizationUserMemberOf.ascx" />
|
||||
<Content Include="ExchangeServer\UserControls\GroupsList.ascx" />
|
||||
<Content Include="ExchangeServer\UserControls\SecurityGroupTabs.ascx" />
|
||||
<Content Include="ExchangeServer\UserControls\UsersList.ascx" />
|
||||
<Content Include="Lync\UserControls\LyncUserSettings.ascx" />
|
||||
|
@ -5189,6 +5197,9 @@
|
|||
<Content Include="ExchangeServer\UserControls\App_LocalResources\AccountsListWithPermissions.ascx.resx" />
|
||||
<Content Include="ExchangeServer\UserControls\App_LocalResources\SecurityGroupTabs.ascx.resx" />
|
||||
<Content Include="ExchangeServer\UserControls\App_LocalResources\UsersList.ascx.resx" />
|
||||
<Content Include="ExchangeServer\UserControls\App_LocalResources\GroupsList.ascx.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<EmbeddedResource Include="UserControls\App_LocalResources\EditDomainsList.ascx.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue