Exchange Module: Add ability to manage all built-in security types in public folder management.

This commit is contained in:
omara 2012-06-06 19:45:41 -04:00
parent 5326d4ff26
commit a62703d32f
22 changed files with 3680 additions and 2763 deletions

View file

@ -7,6 +7,7 @@
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register src="UserControls/AccountsListWithPermissions.ascx" tagname="AccountsListWithPermissions" tagprefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -48,17 +49,20 @@
<asp:Button ID="btnMailDisable" runat="server" Text="Mail Disable Folder" meta:resourcekey="btnMailDisable" CssClass="Button1" CausesValidation="false" OnClick="btnMailDisable_Click" />
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2"><asp:Localize ID="locAuthors" runat="server" meta:resourcekey="locAuthors" Text="Authors:"></asp:Localize></td>
<td colspan="2"><asp:Localize ID="locAllAccounts" runat="server" meta:resourcekey="locAllAccounts" Text="Accounts:"></asp:Localize></td>
</tr>
<tr>
<td colspan="2">
<wsp:AccountsList id="authors" runat="server"
MailboxesEnabled="true" />
<td colspan="2">
<wsp:AccountsListWithPermissions ID="allAccounts" runat="server" MailboxesEnabled="true"/>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td>
<br />

View file

@ -30,6 +30,9 @@ using System;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer;
using Microsoft.Security.Application;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace WebsitePanel.Portal.ExchangeServer
{
@ -65,15 +68,33 @@ namespace WebsitePanel.Portal.ExchangeServer
// bind form
txtName.Text = folder.Name;
chkHideAddressBook.Checked = folder.HideFromAddressBook;
authors.SetAccounts(folder.AuthorsAccounts);
List<ExchangeAccount> list = new List<ExchangeAccount>();
foreach (ExchangeAccount ex in folder.Accounts)
{
try
{
if (ex != null)
{
list.Add(ex);
}
}
catch (Exception)
{
continue;
}
}
ExchangeAccount[] accounts = list.ToArray();
allAccounts.SetAccounts(accounts);
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("EXCHANGE_GET_PFOLDER_SETTINGS", ex);
messageBox.ShowErrorMessage("EXCHANGE_GET_PFOLDER_SETTINGS", ex);
}
}
private void SaveSettings()
{
if (!Page.IsValid)
@ -81,26 +102,27 @@ namespace WebsitePanel.Portal.ExchangeServer
try
{
int result = ES.Services.ExchangeServer.SetPublicFolderGeneralSettings(
int result = ES.Services.ExchangeServer.SetPublicFolderGeneralSettings(
PanelRequest.ItemID, PanelRequest.AccountID,
txtName.Text,
chkHideAddressBook.Checked,
authors.GetAccounts());
allAccounts.GetAccounts());
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_PFOLDER_SETTINGS");
messageBox.ShowSuccessMessage("EXCHANGE_UPDATE_PFOLDER_SETTINGS");
// folder name
string origName = litDisplayName.Text;
origName = origName.Substring(0, origName.LastIndexOf("\\"));
// folder name
string origName = litDisplayName.Text;
origName = origName.Substring(0, origName.LastIndexOf("\\"));
litDisplayName.Text = AntiXss.HtmlEncode(origName + txtName.Text);
BindSettings();
}
catch (Exception ex)
{

View file

@ -1,34 +1,186 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class ExchangePublicFolderGeneralSettings {
protected WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
protected WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
protected WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
protected System.Web.UI.WebControls.Image Image1;
protected System.Web.UI.WebControls.Localize locTitle;
protected System.Web.UI.WebControls.Literal litDisplayName;
protected WebsitePanel.Portal.ExchangeServer.UserControls.PublicFolderTabs tabs;
protected WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
protected System.Web.UI.WebControls.Localize locName;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.RequiredFieldValidator valDisplayName;
protected System.Web.UI.WebControls.Button btnMailEnable;
protected System.Web.UI.WebControls.Button btnMailDisable;
protected System.Web.UI.WebControls.Localize locAuthors;
protected WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList authors;
protected System.Web.UI.WebControls.CheckBox chkHideAddressBook;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.Localize FormComments;
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb 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.Breadcrumb breadcrumb;
/// <summary>
/// menu 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.Menu menu;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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 locTitle;
/// <summary>
/// litDisplayName 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 litDisplayName;
/// <summary>
/// tabs 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.PublicFolderTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// locName 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 locName;
/// <summary>
/// txtName 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 txtName;
/// <summary>
/// valDisplayName 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.RequiredFieldValidator valDisplayName;
/// <summary>
/// btnMailEnable 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 btnMailEnable;
/// <summary>
/// btnMailDisable 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 btnMailDisable;
/// <summary>
/// locAllAccounts 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 locAllAccounts;
/// <summary>
/// allAccounts 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.AccountsListWithPermissions allAccounts;
/// <summary>
/// chkHideAddressBook 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 chkHideAddressBook;
/// <summary>
/// btnSave 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 btnSave;
/// <summary>
/// ValidationSummary1 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.ValidationSummary ValidationSummary1;
/// <summary>
/// FormComments 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 FormComments;
}
}

View file

@ -0,0 +1,152 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AccountsListWithPermissions.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.AccountsListWithPermissions" %>
<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<asp:UpdatePanel ID="AccountsUpdatePanel" 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="gvAccounts" runat="server" meta:resourcekey="gvAccounts" AutoGenerateColumns="False"
Width="600px" CssSelectorClass="NormalGridView" OnRowDataBound="gvAccounts_RowDataBound"
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="gvAccountsDisplayName" HeaderText="gvAccountsDisplayName">
<HeaderStyle Wrap="false" />
<ItemStyle Width="50%" 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>
<asp:TemplateField meta:resourcekey="gvAccountsEmail" HeaderText="gvAccountsEmail">
<HeaderStyle Wrap="false" />
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
<ItemTemplate>
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsPermissions" HeaderText="Folder Permission">
<HeaderStyle Wrap="false" />
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
<ItemTemplate>
<asp:DropDownList ID="ddlPermissions" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPermissions_SelectedIndexChanged" >
<asp:ListItem Text="None" Value="None"></asp:ListItem>
<asp:ListItem Text="Owner" Value="Owner"></asp:ListItem>
<asp:ListItem Text="Publishing Editor" Value="PublishingEditor"></asp:ListItem>
<asp:ListItem Text="Editor" Value="Editor"></asp:ListItem>
<asp:ListItem Text="Publishing Author" Value="PublishingAuthor"></asp:ListItem>
<asp:ListItem Text="Author" Value="Author" Selected="True"></asp:ListItem>
<asp:ListItem Text="Reviewer" Value="Reviewer"></asp:ListItem>
<asp:ListItem Text="Contributor" Value="Contributor"></asp:ListItem>
</asp:DropDownList>
<asp:HiddenField runat="server" ID="PermissionLabel" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Panel ID="AddAccountsPanel" 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="headerAddAccounts" runat="server" meta:resourcekey="headerAddAccounts"></asp:Localize>
</td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="AddAccountsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
<div style="text-align:right;margin-bottom: 4px;">
<asp:Localize ID="locIncludeSearch" runat="server" Text="Include in search:"></asp:Localize>
<asp:CheckBox ID="chkIncludeMailboxes" runat="server" Text="Accounts" Checked="true"
meta:resourcekey="chkIncludeMailboxes" AutoPostBack="true" CssClass="Normal" OnCheckedChanged="chkIncludeMailboxes_CheckedChanged" />
<asp:CheckBox ID="chkIncludeRooms" runat="server" Text="Rooms" Checked="true"
meta:resourcekey="chkIncludeRooms" AutoPostBack="true" CssClass="Normal" OnCheckedChanged="chkIncludeMailboxes_CheckedChanged" />
<asp:CheckBox ID="chkIncludeEquipment" runat="server" Text="Equipment" Checked="true"
meta:resourcekey="chkIncludeEquipment" AutoPostBack="true" CssClass="Normal" OnCheckedChanged="chkIncludeMailboxes_CheckedChanged" />
<asp:CheckBox ID="chkIncludeContacts" runat="server" Text="Contacts" Checked="true"
meta:resourcekey="chkIncludeContacts" AutoPostBack="true" CssClass="Normal" OnCheckedChanged="chkIncludeMailboxes_CheckedChanged" />
<asp:CheckBox ID="chkIncludeLists" runat="server" Text="Distribution Lists" Checked="true"
meta:resourcekey="chkIncludeLists" AutoPostBack="true" CssClass="Normal" OnCheckedChanged="chkIncludeMailboxes_CheckedChanged" />
</div>
<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:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</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="gvPopupAccounts" runat="server" meta:resourcekey="gvPopupAccounts" 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="gvAccountsDisplayName">
<ItemStyle Width="50%"></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>
<asp:TemplateField meta:resourcekey="gvAccountsEmail">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<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="AddAccountsModal" runat="server"
TargetControlID="btnAddAccountsFake" PopupControlID="AddAccountsPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd" />
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -0,0 +1,320 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.Providers.HostedSolution;
using System.Data;
namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class AccountsListWithPermissions : WebsitePanelControlBase
{
private enum SelectedState
{
All,
Selected,
Unselected
}
public bool EnableMailboxOnly
{
get {return ViewState["EnableMailboxOnly"] != null ? (bool)ViewState["EnableMailboxOnly"]: false; }
set { ViewState["EnableMailboxOnly"] = value; }
}
public bool MailboxesEnabled
{
get { return ViewState["MailboxesEnabled"] != null ? (bool)ViewState["MailboxesEnabled"] : false; }
set { ViewState["MailboxesEnabled"] = value; }
}
public bool ContactsEnabled
{
get { return ViewState["ContactsEnabled"] != null ? (bool)ViewState["ContactsEnabled"] : false; }
set { ViewState["ContactsEnabled"] = value; }
}
public bool DistributionListsEnabled
{
get { return ViewState["DistributionListsEnabled"] != null ? (bool)ViewState["DistributionListsEnabled"] : false; }
set { ViewState["DistributionListsEnabled"] = value; }
}
public int ExcludeAccountId
{
get { return PanelRequest.AccountID; }
}
public void SetAccounts(ExchangeAccount[] accounts)
{
BindAccounts(accounts, false);
}
public ExchangeAccount[] GetAccounts()
{
// get selected accounts
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
List<ExchangeAccount> accountNames = new List<ExchangeAccount>();
foreach (ExchangeAccount account in selectedAccounts)
{
accountNames.Add(account);
}
ExchangeAccount[] accounts = accountNames.ToArray();
return accounts;
}
protected void Page_Load(object sender, EventArgs e)
{
// toggle controls
if (!IsPostBack)
{
chkIncludeMailboxes.Visible = chkIncludeRooms.Visible = chkIncludeEquipment.Visible = MailboxesEnabled;
chkIncludeMailboxes.Checked = chkIncludeRooms.Checked = chkIncludeEquipment.Checked = MailboxesEnabled;
if (EnableMailboxOnly)
{
chkIncludeRooms.Checked = false;
chkIncludeRooms.Visible = false;
chkIncludeEquipment.Checked = false;
chkIncludeEquipment.Visible = false;
}
chkIncludeContacts.Visible = ContactsEnabled;
chkIncludeContacts.Checked = ContactsEnabled;
chkIncludeLists.Visible = DistributionListsEnabled;
chkIncludeLists.Checked = DistributionListsEnabled;
}
// 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 = "mailbox_16.gif";
if (accountType == ExchangeAccountType.Contact)
imgName = "contact_16.gif";
else if (accountType == ExchangeAccountType.DistributionList)
imgName = "dlist_16.gif";
else if (accountType == ExchangeAccountType.Room)
imgName = "room_16.gif";
else if (accountType == ExchangeAccountType.Equipment)
imgName = "equipment_16.gif";
return GetThemedImage("Exchange/" + imgName);
}
protected void btnAdd_Click(object sender, EventArgs e)
{
// bind all accounts
BindPopupAccounts();
// show modal
AddAccountsModal.Show();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
// get selected accounts
List<ExchangeAccount> selectedAccounts = GetGridViewAccounts(gvAccounts, 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(gvPopupAccounts, SelectedState.Selected);
List<ExchangeAccount> selectedAccountsWithPermissions = new List<ExchangeAccount>();
foreach (ExchangeAccount account in selectedAccounts)
{
if (account.AccountId != ExcludeAccountId)
account.PublicFolderPermission = "Reviewer";
selectedAccountsWithPermissions.Add(account);
}
// add to the main list
BindAccounts(selectedAccountsWithPermissions.ToArray(), true);
}
private void BindPopupAccounts()
{
ExchangeAccount[] accounts = ES.Services.ExchangeServer.SearchAccounts(PanelRequest.ItemID,
chkIncludeMailboxes.Checked, chkIncludeContacts.Checked, chkIncludeLists.Checked,
chkIncludeRooms.Checked, chkIncludeEquipment.Checked,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "");
if (ExcludeAccountId > 0)
{
List<ExchangeAccount> updatedAccounts = new List<ExchangeAccount>();
foreach (ExchangeAccount account in accounts)
{
if (account.AccountId != ExcludeAccountId)
account.PublicFolderPermission = "Reviewer";
updatedAccounts.Add(account);
}
accounts = updatedAccounts.ToArray();
}
gvPopupAccounts.DataSource = accounts;
gvPopupAccounts.DataBind();
}
private void BindAccounts(ExchangeAccount[] newAccounts, bool preserveExisting)
{
// get binded addresses
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
if(preserveExisting)
accounts.AddRange(GetGridViewAccounts(gvAccounts, 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);
}
}
gvAccounts.DataSource = accounts;
gvAccounts.DataBind();
btnDelete.Visible = gvAccounts.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;
account.PrimaryEmailAddress = ((Literal)row.FindControl("litPrimaryEmailAddress")).Text;
if (gv != gvPopupAccounts)
{
DropDownList ddlPermissions = (DropDownList)row.FindControl("ddlPermissions");
//HiddenField PermissionLabel = (HiddenField)row.FindControl("PermissionLabel");
//account.PublicFolderPermission = PermissionLabel.Value;
account.PublicFolderPermission = ddlPermissions.SelectedValue;
}
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();
}
protected void gvAccounts_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlPermissions = (DropDownList)e.Row.FindControl("ddlPermissions");
HiddenField PermissionLabel = (HiddenField)e.Row.FindControl("PermissionLabel");
ExchangeAccount dRow = (ExchangeAccount)e.Row.DataItem as ExchangeAccount;
ListItem itm = new ListItem(dRow.PublicFolderPermission, dRow.PublicFolderPermission);
if (ddlPermissions.Items.Contains(itm))
{
PermissionLabel.Value = dRow.PublicFolderPermission;
ddlPermissions.SelectedValue = dRow.PublicFolderPermission;
}
else
{
PermissionLabel.Value = dRow.PublicFolderPermission;
ddlPermissions.Items.Add(itm);
ddlPermissions.SelectedValue = dRow.PublicFolderPermission;
ddlPermissions.DataBind();
}
}
}
protected void ddlPermissions_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlCurrentDropDownList = (DropDownList)sender;
GridViewRow grdrDropDownRow = ((GridViewRow)ddlCurrentDropDownList.Parent.Parent);
ExchangeAccount ex = (ExchangeAccount)grdrDropDownRow.DataItem as ExchangeAccount;
if (ex != null)
ex.PublicFolderPermission = ddlCurrentDropDownList.SelectedValue;
}
}
}

View file

@ -0,0 +1,213 @@
//------------------------------------------------------------------------------
// <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 AccountsListWithPermissions {
/// <summary>
/// AccountsUpdatePanel 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 AccountsUpdatePanel;
/// <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>
/// gvAccounts 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 gvAccounts;
/// <summary>
/// AddAccountsPanel 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 AddAccountsPanel;
/// <summary>
/// headerAddAccounts 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 headerAddAccounts;
/// <summary>
/// AddAccountsUpdatePanel 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 AddAccountsUpdatePanel;
/// <summary>
/// locIncludeSearch 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 locIncludeSearch;
/// <summary>
/// chkIncludeMailboxes 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 chkIncludeMailboxes;
/// <summary>
/// chkIncludeRooms 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 chkIncludeRooms;
/// <summary>
/// chkIncludeEquipment 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 chkIncludeEquipment;
/// <summary>
/// chkIncludeContacts 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 chkIncludeContacts;
/// <summary>
/// chkIncludeLists 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 chkIncludeLists;
/// <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>
/// gvPopupAccounts 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 gvPopupAccounts;
/// <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>
/// AddAccountsModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal;
}
}

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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.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 Accounts</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="chkIncludeContacts.Text" xml:space="preserve">
<value>Contacts</value>
</data>
<data name="chkIncludeEquipment.Text" xml:space="preserve">
<value>Equipment</value>
</data>
<data name="chkIncludeLists.Text" xml:space="preserve">
<value>Distribution Lists</value>
</data>
<data name="chkIncludeMailboxes.Text" xml:space="preserve">
<value>Mailboxes</value>
</data>
<data name="chkIncludeRooms.Text" xml:space="preserve">
<value>Rooms</value>
</data>
<data name="ddlSearchColumnDisplayName.Text" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="ddlSearchColumnEmail.Text" xml:space="preserve">
<value>E-mail Address</value>
</data>
<data name="gvAccounts.EmptyDataText" xml:space="preserve">
<value>The list of accounts is empty. Click "Add..." button to add accounts.</value>
</data>
<data name="gvAccountsDisplayName.HeaderText" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="gvAccountsEmail.HeaderText" xml:space="preserve">
<value>E-mail Address</value>
</data>
<data name="gvPopupAccounts.EmptyDataText" xml:space="preserve">
<value>No accounts found.</value>
</data>
<data name="headerAddAccounts.Text" xml:space="preserve">
<value>Exchange Address Book</value>
</data>
<data name="locIncludeSearch.Text" xml:space="preserve">
<value>Include in search:</value>
</data>
</root>

View file

@ -75,15 +75,15 @@
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WebsitePanel.EnterpriseServer.Base, Version=1.0.1.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<Reference Include="WebsitePanel.EnterpriseServer.Base, Version=1.2.2.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Client, Version=1.0.1.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<Reference Include="WebsitePanel.EnterpriseServer.Client, Version=1.2.2.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.Providers.Base, Version=1.0.1.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<Reference Include="WebsitePanel.Providers.Base, Version=1.2.2.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
</Reference>
@ -199,10 +199,17 @@
<Compile Include="Code\ReportingServices\FileSystemReportLocalizer.cs" />
<Compile Include="Code\ReportingServices\IResourceStorage.cs" />
<Compile Include="Code\ReportingServices\ReportingServicesUtils.cs" />
<Compile Include="ExchangeServer\UserControls\AccountsListWithPermissions.ascx.cs">
<DependentUpon>AccountsListWithPermissions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ProviderControls\hMailServer5_EditAccount.ascx.cs">
<DependentUpon>hMailServer5_EditAccount.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\AccountsListWithPermissions.ascx.designer.cs">
<DependentUpon>AccountsListWithPermissions.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\hMailServer5_EditAccount.ascx.designer.cs">
<DependentUpon>hMailServer5_EditAccount.ascx</DependentUpon>
</Compile>
@ -3749,6 +3756,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="ExchangeServer\UserControls\AccountsListWithPermissions.ascx" />
<Content Include="ProviderControls\hMailServer5_EditAccount.ascx" />
<Content Include="ProviderControls\hMailServer5_EditDomain.ascx" />
<Content Include="ProviderControls\hMailServer5_EditForwarding.ascx" />