This commit is contained in:
me 2015-02-12 09:07:03 +04:00
commit 6efa554058
21 changed files with 289 additions and 335 deletions

View file

@ -1058,7 +1058,7 @@ namespace WebsitePanel.EnterpriseServer
var accountNames = users.Select(x => x.AccountName).ToList(); var accountNames = users.Select(x => x.AccountName).ToList();
//Set on server //Set on server
rds.SetUsersInCollection(org.OrganizationId, collection.Name, users.Select(x => x.SamAccountName).ToArray()); rds.SetUsersInCollection(org.OrganizationId, collection.Name, users.Select(x => x.AccountName).ToArray());
//Remove from db //Remove from db
foreach (var userInDb in usersInDb) foreach (var userInDb in usersInDb)

View file

@ -381,7 +381,10 @@ namespace WebsitePanel.EnterpriseServer
site.PerlInstalled = Utils.ParseBool(webPolicy["PerlInstalled"], false); site.PerlInstalled = Utils.ParseBool(webPolicy["PerlInstalled"], false);
site.PythonInstalled = Utils.ParseBool(webPolicy["PythonInstalled"], false); site.PythonInstalled = Utils.ParseBool(webPolicy["PythonInstalled"], false);
site.CgiBinInstalled = Utils.ParseBool(webPolicy["CgiBinInstalled"], false); site.CgiBinInstalled = Utils.ParseBool(webPolicy["CgiBinInstalled"], false);
site.ColdFusionInstalled = false; QuotaValueInfo quotaInfoCF = PackageController.GetPackageQuota(packageId, Quotas.WEB_COLDFUSION);
site.ColdFusionInstalled = (quotaInfoCF.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["ColdFusionInstalled"], false);
QuotaValueInfo quotaInfoCFV = PackageController.GetPackageQuota(packageId, Quotas.WEB_CFVIRTUALDIRS);
site.CreateCFVirtualDirectoriesPol = (quotaInfoCFV.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["CreateCFVirtualDirectoriesPol"], false);
} }
else else
@ -404,6 +407,7 @@ namespace WebsitePanel.EnterpriseServer
site.PythonInstalled = false; site.PythonInstalled = false;
site.CgiBinInstalled = false; site.CgiBinInstalled = false;
site.ColdFusionInstalled = false; site.ColdFusionInstalled = false;
site.CreateCFVirtualDirectoriesPol = false;
} }
site.HttpRedirect = ""; site.HttpRedirect = "";

View file

@ -380,7 +380,10 @@ namespace WebsitePanel.EnterpriseServer
site.PerlInstalled = Utils.ParseBool(webPolicy["PerlInstalled"], false); site.PerlInstalled = Utils.ParseBool(webPolicy["PerlInstalled"], false);
site.PythonInstalled = Utils.ParseBool(webPolicy["PythonInstalled"], false); site.PythonInstalled = Utils.ParseBool(webPolicy["PythonInstalled"], false);
site.CgiBinInstalled = Utils.ParseBool(webPolicy["CgiBinInstalled"], false); site.CgiBinInstalled = Utils.ParseBool(webPolicy["CgiBinInstalled"], false);
site.ColdFusionInstalled = false; QuotaValueInfo quotaInfoCF = PackageController.GetPackageQuota(packageId, Quotas.WEB_COLDFUSION);
site.ColdFusionInstalled = (quotaInfoCF.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["ColdFusionInstalled"], false);
QuotaValueInfo quotaInfoCFV = PackageController.GetPackageQuota(packageId, Quotas.WEB_CFVIRTUALDIRS);
site.CreateCFVirtualDirectoriesPol = (quotaInfoCFV.QuotaAllocatedValue > 0) && Utils.ParseBool(webPolicy["CreateCFVirtualDirectoriesPol"], false);
} }
else else
@ -403,6 +406,7 @@ namespace WebsitePanel.EnterpriseServer
site.PythonInstalled = false; site.PythonInstalled = false;
site.CgiBinInstalled = false; site.CgiBinInstalled = false;
site.ColdFusionInstalled = false; site.ColdFusionInstalled = false;
site.CreateCFVirtualDirectoriesPol = false;
} }
site.HttpRedirect = ""; site.HttpRedirect = "";

View file

@ -55,6 +55,7 @@ namespace WebsitePanel.Providers.Web
private bool frontPageInstalled; private bool frontPageInstalled;
private bool coldFusionAvailable; private bool coldFusionAvailable;
private bool createCFVirtualDirectories; private bool createCFVirtualDirectories;
private bool createCFVirtualDirectoriesPol;
private string frontPageAccount; private string frontPageAccount;
private string frontPagePassword; private string frontPagePassword;
private string coldFusionVersion; private string coldFusionVersion;
@ -157,6 +158,12 @@ namespace WebsitePanel.Providers.Web
get { return this.createCFVirtualDirectories; } get { return this.createCFVirtualDirectories; }
set { this.createCFVirtualDirectories = value; } set { this.createCFVirtualDirectories = value; }
} }
public bool CreateCFVirtualDirectoriesPol
{
get { return this.createCFVirtualDirectoriesPol; }
set { this.createCFVirtualDirectoriesPol = value; }
}
public ServerState SiteState public ServerState SiteState
{ {

View file

@ -527,6 +527,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
catch (Exception e) catch (Exception e)
{ {
result = false; result = false;
Log.WriteWarning(e.ToString());
} }
return result; return result;
@ -672,6 +673,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
try try
{ {
Log.WriteWarning(string.Format("App alias: {0}\r\nCollection Name:{2}\r\nUsers: {1}", remoteApp.Alias, string.Join("; ", users), collectionName));
runspace = OpenRunspace(); runspace = OpenRunspace();
Command cmd = new Command("Set-RDRemoteApp"); Command cmd = new Command("Set-RDRemoteApp");
@ -680,8 +682,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
cmd.Parameters.Add("DisplayName", remoteApp.DisplayName); cmd.Parameters.Add("DisplayName", remoteApp.DisplayName);
cmd.Parameters.Add("UserGroups", users); cmd.Parameters.Add("UserGroups", users);
cmd.Parameters.Add("Alias", remoteApp.Alias); cmd.Parameters.Add("Alias", remoteApp.Alias);
object[] errors;
ExecuteShellCommand(runspace, cmd, false).FirstOrDefault(); ExecuteShellCommand(runspace, cmd, false, out errors).FirstOrDefault();
if (errors.Any())
{
Log.WriteWarning(string.Format("{0} adding users errors: {1}", remoteApp.DisplayName, string.Join("\r\n", errors.Select(e => e.ToString()).ToArray())));
}
else
{
Log.WriteWarning(string.Format("{0} users added successfully", remoteApp.DisplayName));
}
} }
catch(Exception) catch(Exception)
{ {
@ -985,15 +997,23 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
//adding users to group //adding users to group
foreach (var user in users) foreach (var user in users)
{ {
var samName = user.Split('\\').Last(); var userPath = GetUserPath(organizationId, user);
var userPath = GetUserPath(organizationId, samName); Log.WriteWarning(string.Format("User Path: {0}", userPath));
Log.WriteWarning(string.Format("Group Name: {0}", usersGroupName));
if (ActiveDirectoryUtils.AdObjectExists(userPath)) if (ActiveDirectoryUtils.AdObjectExists(userPath))
{ {
var userObject = ActiveDirectoryUtils.GetADObject(userPath);
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName");
Log.WriteWarning(string.Format("SAMAccountName: {0}", samName));
if (!ActiveDirectoryUtils.IsUserInGroup(samName, usersGroupName)) if (!ActiveDirectoryUtils.IsUserInGroup(samName, usersGroupName))
{ {
ActiveDirectoryUtils.AddObjectToGroup(userPath, GetUsersGroupPath(organizationId, collectionName)); Log.WriteWarning(string.Format("{0} not exists in {1}", samName, usersGroupName));
var userGroupsPath = GetUsersGroupPath(organizationId, collectionName);
ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath);
Log.WriteWarning(string.Format("{0} added", samName));
} }
} }
} }

View file

@ -1349,6 +1349,11 @@ namespace WebsitePanel.Providers.Web
// //
UpdateCgiBinFolder(site); UpdateCgiBinFolder(site);
// //
if (site.CreateCFVirtualDirectoriesPol)
{
//Create CFVirtDirs if enabled in hosting plan, this allows for CF to be enbled via Web Policy
CreateCFVirtualDirectories(site.SiteId);
}
try try
{ {
webObjectsSvc.ChangeSiteState(site.SiteId, ServerState.Started); webObjectsSvc.ChangeSiteState(site.SiteId, ServerState.Started);
@ -1357,7 +1362,7 @@ namespace WebsitePanel.Providers.Web
{ {
Log.WriteError(ex); Log.WriteError(ex);
} }
// //
return site.SiteId; return site.SiteId;
} }
@ -1448,6 +1453,7 @@ namespace WebsitePanel.Providers.Web
{ {
DeleteCFVirtualDirectories(site.SiteId); DeleteCFVirtualDirectories(site.SiteId);
site.CreateCFVirtualDirectories = false; site.CreateCFVirtualDirectories = false;
site.CreateCFVirtualDirectoriesPol = false;
} }
else else
{ {
@ -1457,6 +1463,7 @@ namespace WebsitePanel.Providers.Web
{ {
DeleteCFVirtualDirectories(site.SiteId); DeleteCFVirtualDirectories(site.SiteId);
site.CreateCFVirtualDirectories = false; site.CreateCFVirtualDirectories = false;
site.CreateCFVirtualDirectoriesPol = false;
} }
} }
else else
@ -1465,6 +1472,7 @@ namespace WebsitePanel.Providers.Web
{ {
CreateCFVirtualDirectories(site.SiteId); CreateCFVirtualDirectories(site.SiteId);
site.CreateCFVirtualDirectories = true; site.CreateCFVirtualDirectories = true;
site.CreateCFVirtualDirectoriesPol = true;
} }
} }
} }

View file

@ -94,6 +94,7 @@ textarea {font-family:inherit; font-size:inherit; color:inherit; background:#fff
/* checkbox */ /* checkbox */
input[type=checkbox], input[type=radio] {margin:8px 4px 8px; vertical-align:-1px;} input[type=checkbox], input[type=radio] {margin:8px 4px 8px; vertical-align:-1px;}
.HeaderCheckbox {margin-left:5px;} .HeaderCheckbox {margin-left:5px;}
.GridCheckbox input[type=checkbox] {margin-top:0px;}
input[type=image] {margin-right:4px;} input[type=image] {margin-right:4px;}
.LoginLabel {display:block; line-height:34px; width:auto !important; padding-right:8px;} .LoginLabel {display:block; line-height:34px; width:auto !important; padding-right:8px;}
.LoginContainer .SubHead {padding-right:8px; color:#333;} .LoginContainer .SubHead {padding-right:8px; color:#333;}
@ -178,7 +179,7 @@ h2.ProductTitle.Huge {margin:0;}
.FormButtonsBar .Left {float: left;} .FormButtonsBar .Left {float: left;}
.FormButtonsBar .Right {float:right;} .FormButtonsBar .Right {float:right;}
.FormButtonsBar Button2.Right {text-align: right; margin-bottom: 3px;} .FormButtonsBar Button2.Right {text-align: right; margin-bottom: 3px;}
.FormButtonsBarClean {clear: both; padding-bottom: 4px;} .FormButtonsBarClean {clear: both; padding-bottom: 4px; height: 26px;}
.FormButtonsBarCleanLeft {float: left;} .FormButtonsBarCleanLeft {float: left;}
.FormButtonsBarCleanRight {text-align: right;} .FormButtonsBarCleanRight {text-align: right;}
.FormButtonsBarCleanMiddle {float: right;} .FormButtonsBarCleanMiddle {float: right;}

View file

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

View file

@ -30,22 +30,22 @@
<div class="FormButtonsBarClean"> <div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanLeft"> <div class="FormButtonsBarCleanLeft">
<asp:Button ID="btnCreateMailbox" runat="server" meta:resourcekey="btnCreateMailbox" <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>
<div class="FormButtonsBarCleanMiddle"> <div class="FormButtonsBarCleanMiddle">
<table> <table>
<tr> <tr>
<td> <td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" /> <wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" ShowSetMailboxPlan="true" />
</td> </td>
<td class="FormButtonsBarCleanSeparatorSmall"></td> <td class="FormButtonsBarCleanSeparatorSmall"></td>
<td> <td>
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch"> <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="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" /> <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" /> <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" <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged"> OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged" Width="50">
<asp:ListItem>10</asp:ListItem> <asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem> <asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem> <asp:ListItem>50</asp:ListItem>
@ -60,8 +60,9 @@
<asp:ListItem Value="AccountName" meta:resourcekey="ddlSearchColumnAccountName">AccountName</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="SubscriberNumber" meta:resourcekey="ddlSearchColumnSubscriberNumber">Account Number</asp:ListItem>
<asp:ListItem Value="UserPrincipalName" meta:resourcekey="ddlSearchColumnUserPrincipalName">Login</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" </asp:DropDownList>
CausesValidation="false" /> <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:Panel>
</td> </td>
</tr> </tr>
@ -74,19 +75,19 @@
OnRowCommand="gvMailboxes_RowCommand" AllowPaging="True" AllowSorting="True" OnRowCommand="gvMailboxes_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsAccountsPaged" PageSize="20"> DataSourceID="odsAccountsPaged" PageSize="20">
<Columns> <Columns>
<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> <asp:TemplateField>
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox> <asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedUsersIds"></asp:CheckBox> <asp:CheckBox runat="server" ID="chkSelectedUsersIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </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="gvMailboxesDisplayName" SortExpression="DisplayName"> <asp:TemplateField HeaderText="gvMailboxesDisplayName" SortExpression="DisplayName">
<ItemStyle Width="20%"></ItemStyle> <ItemStyle Width="20%"></ItemStyle>
<ItemTemplate> <ItemTemplate>

View file

@ -73,11 +73,11 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) 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() private void BindServiceLevels()

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> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.

View file

@ -73,19 +73,19 @@
OnRowCommand="gvUsers_RowCommand" AllowPaging="True" AllowSorting="True" OnRowCommand="gvUsers_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsAccountsPaged" PageSize="20"> DataSourceID="odsAccountsPaged" PageSize="20">
<Columns> <Columns>
<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> <asp:TemplateField>
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox> <asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedUsersIds"></asp:CheckBox> <asp:CheckBox runat="server" ID="chkSelectedUsersIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </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"> <asp:TemplateField HeaderText="gvUsersDisplayName" SortExpression="DisplayName">
<ItemStyle Width="25%"></ItemStyle> <ItemStyle Width="25%"></ItemStyle>
<ItemTemplate> <ItemTemplate>

View file

@ -56,10 +56,10 @@ namespace WebsitePanel.Portal.HostedSolution
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) 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() private void BindServiceLevels()

View file

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

View file

@ -181,6 +181,23 @@
<td class="Normal"> <td class="Normal">
<asp:CheckBox ID="chkCgiBin" runat="server" Text="Installed" /></td> <asp:CheckBox ID="chkCgiBin" runat="server" Text="Installed" /></td>
</tr> </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> </table>
</asp:Panel> </asp:Panel>

View file

@ -76,6 +76,8 @@ namespace WebsitePanel.Portal
chkPerl.Checked = Utils.ParseBool(settings["PerlInstalled"], false); chkPerl.Checked = Utils.ParseBool(settings["PerlInstalled"], false);
chkPython.Checked = Utils.ParseBool(settings["PythonInstalled"], false); chkPython.Checked = Utils.ParseBool(settings["PythonInstalled"], false);
chkCgiBin.Checked = Utils.ParseBool(settings["CgiBinInstalled"], 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 // anonymous account policy
anonymousUsername.Value = settings["AnonymousAccountPolicy"]; anonymousUsername.Value = settings["AnonymousAccountPolicy"];
@ -130,6 +132,8 @@ namespace WebsitePanel.Portal
settings["PerlInstalled"] = chkPerl.Checked.ToString(); settings["PerlInstalled"] = chkPerl.Checked.ToString();
settings["PythonInstalled"] = chkPython.Checked.ToString(); settings["PythonInstalled"] = chkPython.Checked.ToString();
settings["CgiBinInstalled"] = chkCgiBin.Checked.ToString(); settings["CgiBinInstalled"] = chkCgiBin.Checked.ToString();
settings["ColdFusionInstalled"] = chkCfExt.Checked.ToString();
settings["CreateCFVirtualDirectoriesPol"] = chkVirtDir.Checked.ToString();
// anonymous account policy // anonymous account policy
settings["AnonymousAccountPolicy"] = anonymousUsername.Value; 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. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkCgiBin; 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> /// <summary>
/// secAnonymousAccount control. /// secAnonymousAccount control.

View file

@ -117,16 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="btnDisableCancel.Text" xml:space="preserve"> <data name="btnApply.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="btnMailboxPlanCancel.Text" xml:space="preserve">
<value>Cancel</value> <value>Cancel</value>
</data> </data>
<data name="btnDisableOk.Text" xml:space="preserve"> <data name="btnMailboxPlanOk.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="btnEnableCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnEnableOk.Text" xml:space="preserve">
<value>Ok</value> <value>Ok</value>
</data> </data>
<data name="btnServiceLevelCancel.Text" xml:space="preserve"> <data name="btnServiceLevelCancel.Text" xml:space="preserve">
@ -135,12 +132,6 @@
<data name="btnServiceLevelOk.Text" xml:space="preserve"> <data name="btnServiceLevelOk.Text" xml:space="preserve">
<value>Ok</value> <value>Ok</value>
</data> </data>
<data name="btnVIPCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnVIPOk.Text" xml:space="preserve">
<value>Ok</value>
</data>
<data name="cmdApply.AlternateText" xml:space="preserve"> <data name="cmdApply.AlternateText" xml:space="preserve">
<value>Apply</value> <value>Apply</value>
</data> </data>
@ -153,35 +144,26 @@
<data name="ddlUserActionsItem.Enable" xml:space="preserve"> <data name="ddlUserActionsItem.Enable" xml:space="preserve">
<value>Enable</value> <value>Enable</value>
</data> </data>
<data name="ddlUserActionsItem.SetMailboxPlan" xml:space="preserve">
<value>Set Mailbox Plan</value>
</data>
<data name="ddlUserActionsItem.SetServiceLevel" xml:space="preserve"> <data name="ddlUserActionsItem.SetServiceLevel" xml:space="preserve">
<value>Set Service Level</value> <value>Set Service Level</value>
</data> </data>
<data name="ddlUserActionsItem.SetVIP" xml:space="preserve"> <data name="ddlUserActionsItem.SetVIP" xml:space="preserve">
<value>Set VIP</value> <value>Set VIP</value>
</data> </data>
<data name="ddlVIPItem.SetVIP" xml:space="preserve"> <data name="ddlUserActionsItem.UnsetVIP" xml:space="preserve">
<value>Set VIP</value>
</data>
<data name="ddlVIPItem.UnsetVIP" xml:space="preserve">
<value>Unset VIP</value> <value>Unset VIP</value>
</data> </data>
<data name="headerDisable.Text" xml:space="preserve"> <data name="headerMailboxPlanLabel.Text" xml:space="preserve">
<value>Disable users</value> <value>Mailbox Plan</value>
</data>
<data name="headerEnable.Text" xml:space="preserve">
<value>Enable users</value>
</data> </data>
<data name="headerServiceLevel.Text" xml:space="preserve"> <data name="headerServiceLevel.Text" xml:space="preserve">
<value>Service Level</value> <value>Service Level</value>
</data> </data>
<data name="headerVIP.Text" xml:space="preserve"> <data name="litMailboxPlan.text" xml:space="preserve">
<value>Set VIP</value> <value>Please select a Mailbox Plan for the all checked mailboxes</value>
</data>
<data name="litDisable.Text" xml:space="preserve">
<value>Do you wish to disable all selected users?</value>
</data>
<data name="litEnable.Text" xml:space="preserve">
<value>Do you wish to enable all selected users?</value>
</data> </data>
<data name="litServiceLevel.text" xml:space="preserve"> <data name="litServiceLevel.text" xml:space="preserve">
<value>Please select a Service Level for the all checked users</value> <value>Please select a Service Level for the all checked users</value>

View file

@ -1,73 +1,46 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserActions.ascx.cs" Inherits="WebsitePanel.Portal.UserActions" %> <%@ 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"> <script language="javascript">
function CloseAndShowProgressDialog(text) { function CloseAndShowProgressDialog(text) {
$(".Popup").hide(); $(".Popup").hide();
return ShowProgressDialog(text); 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> </script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" > <asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate> <ContentTemplate>
<asp:DropDownList ID="ddlUserActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlUserActions" style="margin-right: 0px" > <asp:DropDownList ID="ddlUserActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlUserActions"
<%--<asp:ListItem Value="0">Actions</asp:ListItem>--%> AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">Disable</asp:ListItem> <asp:ListItem Value="1">Disable</asp:ListItem>
<asp:ListItem Value="2">Enable</asp:ListItem> <asp:ListItem Value="2">Enable</asp:ListItem>
<asp:ListItem Value="3">SetServiceLevel</asp:ListItem> <asp:ListItem Value="3">SetServiceLevel</asp:ListItem>
<asp:ListItem Value="4">SetVIP</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:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
<asp:ImageButton ID="cmdApply" Runat="server" meta:resourcekey="cmdApply" SkinID="ApplySmall" CausesValidation="false" OnClick="cmdApply_OnClick"/>
<ajaxToolkit:ModalPopupExtender ID="Modal" runat="server" EnableViewState="true" TargetControlID="FakeModalPopupTarget" <ajaxToolkit:ModalPopupExtender ID="Modal" runat="server" EnableViewState="true" TargetControlID="FakeModalPopupTarget"
PopupControlID="EnablePanel" BackgroundCssClass="modalBackground" DropShadow="false" /> PopupControlID="FakeModalPopupTarget" BackgroundCssClass="modalBackground" DropShadow="false" />
<%-- Enable --%>
<asp:Panel ID="EnablePanel" runat="server" CssClass="Popup" Style="display: none">
<table class="Popup-Header">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle"><asp:Localize ID="headerEnable" runat="server" meta:resourcekey="headerEnable"></asp:Localize></td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br/>
<asp:Literal ID="litEnable" runat="server" meta:resourcekey="litEnable"></asp:Literal>
<br/>
</div>
<div class="FormFooterMiddle">
<asp:Button ID="btnEnableOk" runat="server" CssClass="Button1" meta:resourcekey="btnEnableOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Enabling users...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnEnableCancel" runat="server" CssClass="Button1" meta:resourcekey="btnEnableCancel" Text="Cancel"
CausesValidation="false" />
</div>
</div>
</asp:Panel>
<%-- Disable --%>
<asp:Panel ID="DisablePanel" runat="server" CssClass="Popup" Style="display: none">
<table class="Popup-Header">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle"><asp:Localize ID="headerDisable" runat="server" meta:resourcekey="headerDisable"></asp:Localize></td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br/>
<asp:Literal ID="litDisable" runat="server" meta:resourcekey="litDisable"></asp:Literal>
<br/>
</div>
<div class="FormFooterMiddle">
<asp:Button ID="btnDisableOk" runat="server" CssClass="Button1" meta:resourcekey="btnDisableOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Disabling users...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnDisableCancel" runat="server" CssClass="Button1" meta:resourcekey="btnDisableCancel" Text="Cancel"
CausesValidation="false" />
</div>
</div>
</asp:Panel>
<%--Set Service Level--%> <%--Set Service Level--%>
<asp:Panel ID="ServiceLevelPanel" runat="server" CssClass="Popup" Style="display: none"> <asp:Panel ID="ServiceLevelPanel" runat="server" CssClass="Popup" Style="display: none">
@ -90,47 +63,44 @@
<asp:Button ID="btnServiceLevelOk" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelOk" Text="Ok" <asp:Button ID="btnServiceLevelOk" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Setting Service Level...')" OnClick="btnModalOk_Click" /> OnClientClick="return CloseAndShowProgressDialog('Setting Service Level...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnServiceLevelCancel" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelCancel" Text="Cancel" <asp:Button ID="btnServiceLevelCancel" runat="server" CssClass="Button1" meta:resourcekey="btnServiceLevelCancel" Text="Cancel"
CausesValidation="false" /> OnClick="btnModalCancel_OnClick" CausesValidation="false" />
</div> </div>
</div> </div>
</asp:Panel> </asp:Panel>
<%-- VIP --%> <%--Set MailboxPlan--%>
<asp:Panel ID="VIPPanel" runat="server" CssClass="Popup" Style="display: none"> <asp:Panel ID="MailboxPlanPanel" runat="server" CssClass="Popup" Style="display: none">
<table class="Popup-Header"> <table class="Popup-Header">
<tr> <tr>
<td class="Popup-HeaderLeft"></td> <td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle"><asp:Localize ID="headerVIP" runat="server" meta:resourcekey="headerVIP"></asp:Localize></td> <td class="Popup-HeaderTitle"><asp:Localize ID="headerMailboxPlanLabel" runat="server" meta:resourcekey="headerMailboxPlanLabel"></asp:Localize></td>
<td class="Popup-HeaderRight"></td> <td class="Popup-HeaderRight"></td>
</tr> </tr>
</table> </table>
<div class="Popup-Content"> <div class="Popup-Content">
<div class="Popup-Body"> <div class="Popup-Body">
<br/> <br/>
<asp:Literal ID="litVIP" runat="server" meta:resourcekey="litVIP"></asp:Literal> <asp:Literal ID="litMailboxPlan" runat="server" meta:resourcekey="litMailboxPlan"></asp:Literal>
<br/> <br/>
<asp:DropDownList ID="ddlVIP" runat="server" CssClass="NormalTextBox" resourcekey="ddlVIP"> <wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" />
<asp:ListItem Value="0">SetVIP</asp:ListItem>
<asp:ListItem Value="1">UnsetVIP</asp:ListItem>
</asp:DropDownList>
<br/> <br/>
</div> </div>
<div class="FormFooterMiddle"> <div class="FormFooterMiddle">
<asp:Button ID="btnVIPOk" runat="server" CssClass="Button1" meta:resourcekey="btnVIPOk" Text="Ok" <asp:Button ID="btnMailboxPlanOk" runat="server" CssClass="Button1" meta:resourcekey="btnMailboxPlanOk" Text="Ok"
OnClientClick="return CloseAndShowProgressDialog('Setting VIP...')" OnClick="btnModalOk_Click" /> OnClientClick="return CloseAndShowProgressDialog('Setting Mailbox Plan ...')" OnClick="btnModalOk_Click" />
<asp:Button ID="btnVIPCancel" runat="server" CssClass="Button1" meta:resourcekey="btnVIPCancel" Text="Cancel" <asp:Button ID="btnMailboxPlanCancel" runat="server" CssClass="Button1" meta:resourcekey="btnMailboxPlanCancel" Text="Cancel"
CausesValidation="false" /> OnClick="btnModalCancel_OnClick" CausesValidation="false" />
</div> </div>
</div> </div>
</asp:Panel> </asp:Panel>
<asp:Button ID="FakeModalPopupTarget" runat="server" Style="display: none;" /> <asp:Button ID="FakeModalPopupTarget" runat="server" Style="display: none;" />
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:PostBackTrigger ControlID="btnDisableOk" />
<asp:PostBackTrigger ControlID="btnEnableOk" />
<asp:PostBackTrigger ControlID="btnServiceLevelOk" /> <asp:PostBackTrigger ControlID="btnServiceLevelOk" />
<asp:PostBackTrigger ControlID="btnVIPOk" /> <asp:PostBackTrigger ControlID="btnMailboxPlanOk" />
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>

View file

@ -53,20 +53,33 @@ namespace WebsitePanel.Portal
Enable = 2, Enable = 2,
SetServiceLevel = 3, SetServiceLevel = 3,
SetVIP = 4, SetVIP = 4,
UnsetVIP = 5,
SetMailboxPlan = 6
} }
public partial class UserActions : WebsitePanelControlBase public partial class UserActions : WebsitePanelControlBase
{ {
public event EventHandler ExecutingUserAction; 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) 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 // 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)) if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels))
{ {
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(UserActionTypes.SetServiceLevel.ToString())); ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetServiceLevel).ToString()));
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(UserActionTypes.SetVIP.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 public UserActionTypes SelectedAction
@ -77,30 +90,6 @@ namespace WebsitePanel.Portal
} }
} }
protected void cmdApply_OnClick(object sender, ImageClickEventArgs e)
{
switch (SelectedAction)
{
case UserActionTypes.Disable:
Modal.PopupControlID = DisablePanel.ID;
break;
case UserActionTypes.Enable:
Modal.PopupControlID = EnablePanel.ID;
break;
case UserActionTypes.SetServiceLevel:
FillServiceLevelsList();
Modal.PopupControlID = ServiceLevelPanel.ID;
break;
case UserActionTypes.SetVIP:
Modal.PopupControlID = VIPPanel.ID;
break;
default:
return;
}
Modal.Show();
}
public int DoUserActions(List<int> userIds) public int DoUserActions(List<int> userIds)
{ {
switch (SelectedAction) switch (SelectedAction)
@ -112,18 +101,37 @@ namespace WebsitePanel.Portal
case UserActionTypes.SetServiceLevel: case UserActionTypes.SetServiceLevel:
return ChangeUsersSettings(userIds, null, SelectedServiceId, null); return ChangeUsersSettings(userIds, null, SelectedServiceId, null);
case UserActionTypes.SetVIP: case UserActionTypes.SetVIP:
return ChangeUsersSettings(userIds, null, null, SelectedVIP); return ChangeUsersSettings(userIds, null, null, true);
case UserActionTypes.UnsetVIP:
return ChangeUsersSettings(userIds, null, null, false);
case UserActionTypes.SetMailboxPlan:
return SetMailboxPlan(userIds);
} }
return 0; return 0;
} }
protected void btnModalOk_Click(object sender, EventArgs e) protected void DoExecutingUserAction()
{ {
if (ExecutingUserAction != null) if (ExecutingUserAction != null)
ExecutingUserAction(this, new EventArgs()); 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) protected int ChangeUsersSettings(List<int> userIds, bool? disable, int? serviceLevelId, bool? isVIP)
{ {
foreach (var userId in userIds) foreach (var userId in userIds)
@ -166,12 +174,11 @@ namespace WebsitePanel.Portal
user.ExternalEmail, user.ExternalEmail,
user.SubscriberNumber, user.SubscriberNumber,
serviceLevelId ?? user.LevelId, serviceLevelId ?? user.LevelId,
isVIP ?? user.IsVIP, false); isVIP ?? user.IsVIP,
user.UserMustChangePassword);
if (result < 0) if (result < 0)
{
return result; return result;
}
} }
return 0; return 0;
@ -180,6 +187,29 @@ namespace WebsitePanel.Portal
#region ServiceLevel #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 protected int? SelectedServiceId
{ {
get get
@ -232,15 +262,29 @@ namespace WebsitePanel.Portal
#endregion #endregion
protected void btnApply_Click(object sender, EventArgs e)
#region VIP
protected bool? SelectedVIP
{ {
get { return ddlVIP.SelectedValue == "0"; } 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;
#endregion }
}
} }
} }

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> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -59,13 +31,13 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.DropDownList ddlUserActions; protected global::System.Web.UI.WebControls.DropDownList ddlUserActions;
/// <summary> /// <summary>
/// cmdApply control. /// btnApply control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.ImageButton cmdApply; protected global::System.Web.UI.WebControls.Button btnApply;
/// <summary> /// <summary>
/// Modal control. /// Modal control.
@ -76,96 +48,6 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender Modal; protected global::AjaxControlToolkit.ModalPopupExtender Modal;
/// <summary>
/// EnablePanel 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 EnablePanel;
/// <summary>
/// headerEnable 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 headerEnable;
/// <summary>
/// litEnable 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 litEnable;
/// <summary>
/// btnEnableOk 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 btnEnableOk;
/// <summary>
/// btnEnableCancel 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 btnEnableCancel;
/// <summary>
/// DisablePanel 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 DisablePanel;
/// <summary>
/// headerDisable 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 headerDisable;
/// <summary>
/// litDisable 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 litDisable;
/// <summary>
/// btnDisableOk 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 btnDisableOk;
/// <summary>
/// btnDisableCancel 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 btnDisableCancel;
/// <summary> /// <summary>
/// ServiceLevelPanel control. /// ServiceLevelPanel control.
/// </summary> /// </summary>
@ -221,58 +103,58 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Button btnServiceLevelCancel; protected global::System.Web.UI.WebControls.Button btnServiceLevelCancel;
/// <summary> /// <summary>
/// VIPPanel control. /// MailboxPlanPanel control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Panel VIPPanel; protected global::System.Web.UI.WebControls.Panel MailboxPlanPanel;
/// <summary> /// <summary>
/// headerVIP control. /// headerMailboxPlanLabel control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Localize headerVIP; protected global::System.Web.UI.WebControls.Localize headerMailboxPlanLabel;
/// <summary> /// <summary>
/// litVIP control. /// litMailboxPlan control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Literal litVIP; protected global::System.Web.UI.WebControls.Literal litMailboxPlan;
/// <summary> /// <summary>
/// ddlVIP control. /// mailboxPlanSelector control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlVIP; protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector;
/// <summary> /// <summary>
/// btnVIPOk control. /// btnMailboxPlanOk control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Button btnVIPOk; protected global::System.Web.UI.WebControls.Button btnMailboxPlanOk;
/// <summary> /// <summary>
/// btnVIPCancel control. /// btnMailboxPlanCancel control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Button btnVIPCancel; protected global::System.Web.UI.WebControls.Button btnMailboxPlanCancel;
/// <summary> /// <summary>
/// FakeModalPopupTarget control. /// FakeModalPopupTarget control.