adding to Lync2010 : Enterprise Voice, Archiving Policy, Dial Plan, Voice Policy

This commit is contained in:
dev_amdtel 2013-05-22 11:44:40 +04:00
parent e9d4b44fd1
commit c41abafe5d
29 changed files with 1934 additions and 356 deletions

View file

@ -60,11 +60,6 @@
<asp:CheckBox ID="chkMobility" runat="server" meta:resourcekey="chkMobility" Text="Mobility"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkFederation" runat="server" meta:resourcekey="chkFederation" Text="Federation"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkConferencing" runat="server" meta:resourcekey="chkConferencing" Text="Conferencing"></asp:CheckBox>
@ -78,7 +73,136 @@
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secPlanFeaturesFederation" runat="server"
TargetControlID="PlanFeaturesFederation" meta:resourcekey="secPlanFeaturesFederation" Text="Federation">
</wsp:CollapsiblePanel>
<asp:Panel ID="PlanFeaturesFederation" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox ID="chkFederation" runat="server" meta:resourcekey="chkFederation" Text="Federation"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkRemoteUserAccess" runat="server" meta:resourcekey="chkRemoteUserAccess" Text="Remote User access"></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkPublicIMConnectivity" runat="server" meta:resourcekey="chkPublicIMConnectivity" Text="Public IM Connectivity"></asp:CheckBox>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secPlanFeaturesArchiving" runat="server"
TargetControlID="PlanFeaturesArchiving" meta:resourcekey="secPlanFeaturesArchiving" Text="Archiving">
</wsp:CollapsiblePanel>
<asp:Panel ID="PlanFeaturesArchiving" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locArchivingPolicy" meta:resourcekey="locArchivingPolicy" Text="Archiving Policy:" />
</td>
<td>
<asp:DropDownList ID="ddArchivingPolicy" runat="server"></asp:DropDownList>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secPlanFeaturesMeeting" runat="server"
TargetControlID="PlanFeaturesMeeting" meta:resourcekey="secPlanFeaturesMeeting" Text="Meeting">
</wsp:CollapsiblePanel>
<asp:Panel ID="PlanFeaturesMeeting" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox ID="chkAllowOrganizeMeetingsWithExternalAnonymous" runat="server" meta:resourcekey="chkAllowOrganizeMeetingsWithExternalAnonymous" Text="Allow organize meetings with external anonymous participants"></asp:CheckBox>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secPlanFeaturesTelephony" runat="server"
TargetControlID="PlanFeaturesTelephony" meta:resourcekey="secPlanFeaturesTelephony" Text="Telephony">
</wsp:CollapsiblePanel>
<asp:Panel ID="PlanFeaturesTelephony" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locTelephony" meta:resourcekey="locTelephony" Text="Telephony :" />
</td>
<td>
<asp:DropDownList ID="ddTelephony" runat="server" AutoPostBack="True">
<asp:ListItem Value="0" Text="Audio/Video disabled" meta:resourcekey="ddlTelephonyDisabled" />
<asp:ListItem Value="1" Text="PC-to-PC only" meta:resourcekey="ddlTelephonyPCtoPCOnly" />
<asp:ListItem Value="2" Text="Enterprise voice" meta:resourcekey="ddlTelephonyEnterpriseVoice" />
<asp:ListItem Value="3" Text="Remote call control" meta:resourcekey="ddlTelephonyRemoteCallControl" />
<asp:ListItem Value="4" Text="Remote call control only" meta:resourcekey="ddlTelephonyRemoteCallControlOnly" />
</asp:DropDownList>
</td>
</tr>
</table>
<asp:Panel runat="server" ID="pnEnterpriseVoice">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locTelephonyProvider" meta:resourcekey="locTelephonyProvider" Text="Telephony Provider :" />
</td>
<td>
<asp:TextBox ID="tbTelephoneProvider" runat="server"></asp:TextBox>
<asp:Button runat="server" ID="btnAccept" Text="Accept" OnClick="btnAccept_Click" OnClientClick="ShowProgressDialog('Loading...');" ValidationGroup="Accept"/>
<asp:RequiredFieldValidator id="AcceptRequiredValidator" runat="server" ErrorMessage="Please enter provider name"
ControlToValidate="tbTelephoneProvider" Display="Dynamic" ValidationGroup="Accept" SetFocusOnError="true"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locDialPlan" meta:resourcekey="locDialPlan" Text="Dial Plan :" />
</td>
<td>
<asp:DropDownList ID="ddTelephonyDialPlanPolicy" runat="server"></asp:DropDownList>
</td>
</tr>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locVoicePolicy" meta:resourcekey="locVoicePolicy" Text="Voice Policy :" />
</td>
<td>
<asp:DropDownList ID="ddTelephonyVoicePolicy" runat="server"></asp:DropDownList>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel runat="server" ID="pnServerURI">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locServerURI" meta:resourcekey="locServerURI" Text="Server URI :" />
</td>
<td>
<asp:TextBox ID="tbServerURI" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
<br />
</asp:Panel>
<%-- Disable because not used
<wsp:CollapsiblePanel id="secEnterpriseVoice" runat="server"
TargetControlID="EnterpriseVoice" meta:resourcekey="secEnterpriseVoice" Text="Enterprise Voice Policy">
</wsp:CollapsiblePanel>
@ -115,7 +239,7 @@
</table>
<br />
</asp:Panel>
--%>
<br />
<div class="FormFooterClean">

View file

@ -40,9 +40,19 @@ namespace WebsitePanel.Portal.Lync
if (!IsPostBack)
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
string[] archivePolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Archiving, null);
if (archivePolicy != null)
{
foreach (string policy in archivePolicy)
{
if (policy.ToLower()=="global") continue;
string txt = policy.Replace("Tag:","");
ddArchivingPolicy.Items.Add( new System.Web.UI.WebControls.ListItem( txt, policy) );
}
}
if (PanelRequest.GetInt("LyncUserPlanId") != 0)
{
Providers.HostedSolution.LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, PanelRequest.GetInt("LyncUserPlanId"));
@ -54,6 +64,8 @@ namespace WebsitePanel.Portal.Lync
chkConferencing.Checked = plan.Conferencing;
chkMobility.Checked = plan.Mobility;
chkEnterpriseVoice.Checked = plan.EnterpriseVoice;
/* because not used
switch (plan.VoicePolicy)
{
case LyncVoicePolicyType.None:
@ -74,16 +86,40 @@ namespace WebsitePanel.Portal.Lync
chkNone.Checked = true;
break;
}
*/
chkRemoteUserAccess.Checked = plan.RemoteUserAccess;
chkPublicIMConnectivity.Checked = plan.PublicIMConnectivity;
chkAllowOrganizeMeetingsWithExternalAnonymous.Checked = plan.AllowOrganizeMeetingsWithExternalAnonymous;
ddTelephony.SelectedIndex = plan.Telephony;
tbServerURI.Text = plan.ServerURI;
locTitle.Text = plan.LyncUserPlanName;
this.DisableControls = true;
string planArchivePolicy = "";
if (plan.ArchivePolicy != null) planArchivePolicy = plan.ArchivePolicy;
string planTelephonyDialPlanPolicy = "";
if (plan.TelephonyDialPlanPolicy != null) planTelephonyDialPlanPolicy = plan.TelephonyDialPlanPolicy;
string planTelephonyVoicePolicy = "";
if (plan.TelephonyVoicePolicy != null) planTelephonyVoicePolicy = plan.TelephonyVoicePolicy;
ddArchivingPolicy.Items.Clear();
ddArchivingPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planArchivePolicy.Replace("Tag:", ""), planArchivePolicy));
ddTelephonyDialPlanPolicy.Items.Clear();
ddTelephonyDialPlanPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planTelephonyDialPlanPolicy.Replace("Tag:", ""), planTelephonyDialPlanPolicy));
ddTelephonyVoicePolicy.Items.Clear();
ddTelephonyVoicePolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planTelephonyVoicePolicy.Replace("Tag:", ""), planTelephonyVoicePolicy));
}
else
{
chkIM.Checked = true;
chkIM.Enabled = false;
chkNone.Checked = true;
// chkNone.Checked = true; because not used
if (cntx != null)
{
foreach (QuotaValueInfo quota in cntx.QuotasArray)
@ -110,6 +146,29 @@ namespace WebsitePanel.Portal.Lync
}
}
chkEnterpriseVoice.Enabled = false;
chkEnterpriseVoice.Checked = false;
pnEnterpriseVoice.Visible = false;
pnServerURI.Visible = false;
switch (ddTelephony.SelectedIndex)
{
case 1:
break;
case 2:
pnEnterpriseVoice.Visible = true;
chkEnterpriseVoice.Checked = true;
break;
case 3:
pnServerURI.Visible = true;
break;
case 4:
pnServerURI.Visible = true;
break;
}
}
protected void btnAdd_Click(object sender, EventArgs e)
@ -117,6 +176,37 @@ namespace WebsitePanel.Portal.Lync
AddPlan();
}
protected void btnAccept_Click(object sender, EventArgs e)
{
string name = tbTelephoneProvider.Text;
if (string.IsNullOrEmpty(name)) return;
ddTelephonyDialPlanPolicy.Items.Clear();
string[] dialPlan = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.DialPlan, name);
if (dialPlan != null)
{
foreach (string policy in dialPlan)
{
if (policy.ToLower() == "global") continue;
string txt = policy.Replace("Tag:", "");
ddTelephonyDialPlanPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy));
}
}
ddTelephonyVoicePolicy.Items.Clear();
string[] voicePolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Voice, name);
if (voicePolicy != null)
{
foreach (string policy in voicePolicy)
{
if (policy.ToLower() == "global") continue;
string txt = policy.Replace("Tag:", "");
ddTelephonyVoicePolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy));
}
}
}
private void AddPlan()
{
try
@ -132,6 +222,10 @@ namespace WebsitePanel.Portal.Lync
plan.EnterpriseVoice = chkEnterpriseVoice.Checked;
plan.VoicePolicy = LyncVoicePolicyType.None;
/* because not used
if (!plan.EnterpriseVoice)
{
plan.VoicePolicy = LyncVoicePolicyType.None;
@ -149,7 +243,21 @@ namespace WebsitePanel.Portal.Lync
else
plan.VoicePolicy = LyncVoicePolicyType.None;
}
}
*/
plan.RemoteUserAccess = chkRemoteUserAccess.Checked;
plan.PublicIMConnectivity = chkPublicIMConnectivity.Checked;
plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked;
plan.Telephony = ddTelephony.SelectedIndex;
plan.ServerURI = tbServerURI.Text;
plan.ArchivePolicy = ddArchivingPolicy.SelectedValue;
plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue;
plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue;
int result = ES.Services.Lync.AddLyncUserPlan(PanelRequest.ItemID,
plan);

View file

@ -1,40 +1,11 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <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.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.Lync {
@ -166,15 +137,6 @@ namespace WebsitePanel.Portal.Lync {
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkMobility;
/// <summary>
/// chkFederation 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 chkFederation;
/// <summary>
/// chkConferencing control.
/// </summary>
@ -194,67 +156,256 @@ namespace WebsitePanel.Portal.Lync {
protected global::System.Web.UI.WebControls.CheckBox chkEnterpriseVoice;
/// <summary>
/// secEnterpriseVoice control.
/// secPlanFeaturesFederation control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secEnterpriseVoice;
protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesFederation;
/// <summary>
/// EnterpriseVoice control.
/// PlanFeaturesFederation 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 EnterpriseVoice;
protected global::System.Web.UI.WebControls.Panel PlanFeaturesFederation;
/// <summary>
/// chkNone control.
/// chkFederation 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.RadioButton chkNone;
protected global::System.Web.UI.WebControls.CheckBox chkFederation;
/// <summary>
/// chkEmergency control.
/// chkRemoteUserAccess 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.RadioButton chkEmergency;
protected global::System.Web.UI.WebControls.CheckBox chkRemoteUserAccess;
/// <summary>
/// chkNational control.
/// chkPublicIMConnectivity 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.RadioButton chkNational;
protected global::System.Web.UI.WebControls.CheckBox chkPublicIMConnectivity;
/// <summary>
/// chkMobile control.
/// secPlanFeaturesArchiving 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.RadioButton chkMobile;
protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesArchiving;
/// <summary>
/// chkInternational control.
/// PlanFeaturesArchiving 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.RadioButton chkInternational;
protected global::System.Web.UI.WebControls.Panel PlanFeaturesArchiving;
/// <summary>
/// locArchivingPolicy 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 locArchivingPolicy;
/// <summary>
/// ddArchivingPolicy 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 ddArchivingPolicy;
/// <summary>
/// secPlanFeaturesMeeting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesMeeting;
/// <summary>
/// PlanFeaturesMeeting 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 PlanFeaturesMeeting;
/// <summary>
/// chkAllowOrganizeMeetingsWithExternalAnonymous 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 chkAllowOrganizeMeetingsWithExternalAnonymous;
/// <summary>
/// secPlanFeaturesTelephony control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesTelephony;
/// <summary>
/// PlanFeaturesTelephony 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 PlanFeaturesTelephony;
/// <summary>
/// locTelephony 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 locTelephony;
/// <summary>
/// ddTelephony 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 ddTelephony;
/// <summary>
/// pnEnterpriseVoice 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 pnEnterpriseVoice;
/// <summary>
/// locTelephonyProvider 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 locTelephonyProvider;
/// <summary>
/// tbTelephoneProvider 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 tbTelephoneProvider;
/// <summary>
/// btnAccept 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 btnAccept;
/// <summary>
/// AcceptRequiredValidator 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 AcceptRequiredValidator;
/// <summary>
/// locDialPlan 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 locDialPlan;
/// <summary>
/// ddTelephonyDialPlanPolicy 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 ddTelephonyDialPlanPolicy;
/// <summary>
/// locVoicePolicy 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 locVoicePolicy;
/// <summary>
/// ddTelephonyVoicePolicy 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 ddTelephonyVoicePolicy;
/// <summary>
/// pnServerURI 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 pnServerURI;
/// <summary>
/// locServerURI 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 locServerURI;
/// <summary>
/// tbServerURI 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 tbServerURI;
/// <summary>
/// btnAdd control.
@ -273,14 +424,5 @@ namespace WebsitePanel.Portal.Lync {
/// 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

@ -43,11 +43,41 @@
<wsp:LyncUserPlanSelector ID="planSelector" runat="server" />
</td>
</tr>
</table>
</table>
<asp:Panel runat="server" ID="pnEnterpriseVoice">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locPhoneNumber" meta:resourcekey="locPhoneNumber" Text="Phone Number:" />
</td>
<td>
<asp:TextBox runat="server" ID="tbPhoneNumber" />
<asp:RegularExpressionValidator ID="PhoneFormatValidator" runat="server"
ControlToValidate="tbPhoneNumber" Display="Dynamic" ValidationGroup="Validation1" SetFocusOnError="true"
ValidationExpression="^([0-9])*$"
ErrorMessage="Must contain only numbers.">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locLyncPin" meta:resourcekey="locLyncPin" Text="Lync Pin:" />
</td>
<td>
<asp:TextBox runat="server" ID="tbPin" />
<asp:RegularExpressionValidator ID="PinRegularExpressionValidator" runat="server"
ControlToValidate="tbPin" Display="Dynamic" ValidationGroup="Validation1" SetFocusOnError="true"
ValidationExpression="^([0-9])*$"
ErrorMessage="Must contain only numbers.">
</asp:RegularExpressionValidator>
</td>
</tr>
</table>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button id="btnCreate" runat="server"
<asp:Button id="btnCreate" runat="server" ValidationGroup="Validation1"
CssClass="Button1" meta:resourcekey="btnCreate"
onclick="btnCreate_Click" ></asp:Button>
</div>

View file

@ -30,6 +30,9 @@
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.Lync
{
public partial class CreateLyncUser : WebsitePanelModuleBase
@ -43,8 +46,42 @@ namespace WebsitePanel.Portal.Lync
if (plans.Length == 0)
btnCreate.Enabled = false;
}
}
protected void Page_PreRender(object sender, EventArgs e)
{
bool EnterpriseVoice = false;
WebsitePanel.Providers.HostedSolution.LyncUserPlan plan = planSelector.plan;
if (plan != null)
EnterpriseVoice = plan.EnterpriseVoice;
pnEnterpriseVoice.Visible = EnterpriseVoice;
if (!EnterpriseVoice)
{
tbPhoneNumber.Text = "";
tbPin.Text = "";
}
if (EnterpriseVoice)
{
string[] pinPolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Pin, "MinPasswordLength");
if (pinPolicy != null)
{
if (pinPolicy.Length > 0)
{
int MinPasswordLength = -1;
if (int.TryParse(pinPolicy[0], out MinPasswordLength))
{
PinRegularExpressionValidator.ValidationExpression = "^([0-9]){" + MinPasswordLength.ToString() + ",}$";
PinRegularExpressionValidator.ErrorMessage = "Must contain only numbers. Min. length " + MinPasswordLength.ToString();
}
}
}
}
}
protected void btnCreate_Click(object sender, EventArgs e)
@ -53,6 +90,11 @@ namespace WebsitePanel.Portal.Lync
LyncUserResult res = ES.Services.Lync.CreateLyncUser(PanelRequest.ItemID, accountId, Convert.ToInt32(planSelector.planId));
if (res.IsSuccess && res.ErrorCodes.Count == 0)
{
//#1
LyncUser lyncUser = ES.Services.Lync.GetLyncUserGeneralSettings(PanelRequest.ItemID, accountId);
ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, accountId, lyncUser.SipAddress, tbPhoneNumber.Text + ":" + tbPin.Text);
Response.Redirect(EditUrl("AccountID", accountId.ToString(), "edit_lync_user",
"SpaceID=" + PanelSecurity.PackageId,
"ItemID=" + PanelRequest.ItemID));

View file

@ -1,40 +1,11 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <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.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.Lync {
@ -139,6 +110,69 @@ namespace WebsitePanel.Portal.Lync {
/// </remarks>
protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector planSelector;
/// <summary>
/// pnEnterpriseVoice 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 pnEnterpriseVoice;
/// <summary>
/// locPhoneNumber 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 locPhoneNumber;
/// <summary>
/// tbPhoneNumber 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 tbPhoneNumber;
/// <summary>
/// PhoneFormatValidator 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.RegularExpressionValidator PhoneFormatValidator;
/// <summary>
/// locLyncPin 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 locLyncPin;
/// <summary>
/// tbPin 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 tbPin;
/// <summary>
/// PinRegularExpressionValidator 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.RegularExpressionValidator PinRegularExpressionValidator;
/// <summary>
/// btnCreate control.
/// </summary>

View file

@ -47,11 +47,41 @@
<wsp:LyncUserSettings ID="lyncUserSettings" runat="server" />
</td>
</tr>
</table>
<asp:Panel runat="server" ID="pnEnterpriseVoice">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locPhoneNumber" meta:resourcekey="locPhoneNumber" Text="Phone Number:" />
</td>
<td>
<asp:TextBox runat="server" ID="tbPhoneNumber" />
<asp:RegularExpressionValidator ID="PhoneFormatValidator" runat="server"
ControlToValidate="tbPhoneNumber" Display="Dynamic" ValidationGroup="Validation1" SetFocusOnError="true"
ValidationExpression="^([0-9])*$"
ErrorMessage="Must contain only numbers.">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="FormLabel150">
<asp:Localize runat="server" ID="locLyncPin" meta:resourcekey="locLyncPin" Text="Lync Pin:" />
</td>
<td>
<asp:TextBox runat="server" ID="tbPin" />
<asp:RegularExpressionValidator ID="PinRegularExpressionValidator" runat="server"
ControlToValidate="tbPin" Display="Dynamic" ValidationGroup="Validation1" SetFocusOnError="true"
ValidationExpression="^([0-9])*$"
ErrorMessage="Must contain only numbers.">
</asp:RegularExpressionValidator>
</td>
</tr>
</table>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button runat="server" ID="btnSave" meta:resourcekey="btnSave"
<asp:Button runat="server" ID="btnSave" meta:resourcekey="btnSave" ValidationGroup="Validation1"
CssClass="Button1" onclick="btnSave_Click" />
</div>
</div>

View file

@ -40,6 +40,40 @@ namespace WebsitePanel.Portal.Lync
{
if (!IsPostBack)
BindItems();
}
protected void Page_PreRender(object sender, EventArgs e)
{
bool EnterpriseVoice = false;
WebsitePanel.Providers.HostedSolution.LyncUserPlan plan = planSelector.plan;
if (plan != null)
EnterpriseVoice = plan.EnterpriseVoice;
pnEnterpriseVoice.Visible = EnterpriseVoice;
if (!EnterpriseVoice)
{
tbPhoneNumber.Text = "";
tbPin.Text = "";
}
if (EnterpriseVoice)
{
string[] pinPolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Pin, "MinPasswordLength");
if (pinPolicy != null)
{
if (pinPolicy.Length > 0)
{
int MinPasswordLength = -1;
if (int.TryParse(pinPolicy[0], out MinPasswordLength))
{
PinRegularExpressionValidator.ValidationExpression = "^([0-9]){" + MinPasswordLength.ToString() + ",}$";
PinRegularExpressionValidator.ErrorMessage = "Must contain only numbers. Min. length " + MinPasswordLength.ToString();
}
}
}
}
}
@ -54,6 +88,7 @@ namespace WebsitePanel.Portal.Lync
planSelector.planId = lyncUser.LyncUserPlanId.ToString();
lyncUserSettings.sipAddress = lyncUser.SipAddress;
tbPhoneNumber.Text = lyncUser.LineUri;
}
protected void btnSave_Click(object sender, EventArgs e)
@ -65,7 +100,7 @@ namespace WebsitePanel.Portal.Lync
LyncUserResult res = ES.Services.Lync.SetUserLyncPlan(PanelRequest.ItemID, PanelRequest.AccountID, Convert.ToInt32(planSelector.planId));
if (res.IsSuccess && res.ErrorCodes.Count == 0)
{
res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, string.Empty);
res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, tbPhoneNumber.Text + ":" + tbPin.Text);
}
if (res.IsSuccess && res.ErrorCodes.Count == 0)

View file

@ -1,40 +1,11 @@
// 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.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <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.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.Lync {
@ -139,6 +110,69 @@ namespace WebsitePanel.Portal.Lync {
/// </remarks>
protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserSettings lyncUserSettings;
/// <summary>
/// pnEnterpriseVoice 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 pnEnterpriseVoice;
/// <summary>
/// locPhoneNumber 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 locPhoneNumber;
/// <summary>
/// tbPhoneNumber 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 tbPhoneNumber;
/// <summary>
/// PhoneFormatValidator 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.RegularExpressionValidator PhoneFormatValidator;
/// <summary>
/// locLyncPin 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 locLyncPin;
/// <summary>
/// tbPin 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 tbPin;
/// <summary>
/// PinRegularExpressionValidator 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.RegularExpressionValidator PinRegularExpressionValidator;
/// <summary>
/// btnSave control.
/// </summary>

View file

@ -1,2 +1,2 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncUserPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector" %>
<asp:DropDownList ID="ddlPlan" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
<asp:DropDownList ID="ddlPlan" runat="server" CssClass="NormalTextBox" AutoPostBack="true"></asp:DropDownList>

View file

@ -35,11 +35,14 @@ namespace WebsitePanel.Portal.Lync.UserControls
{
private string planToSelect;
public string planId
{
get { return ddlPlan.SelectedItem.Value; }
get {
if (ddlPlan.Items.Count == 0) return "";
return ddlPlan.SelectedItem.Value;
}
set
{
planToSelect = value;
@ -72,6 +75,19 @@ namespace WebsitePanel.Portal.Lync.UserControls
}
}
public WebsitePanel.Providers.HostedSolution.LyncUserPlan plan
{
get
{
WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID);
foreach (WebsitePanel.Providers.HostedSolution.LyncUserPlan planitem in plans)
{
if (planitem.LyncUserPlanId.ToString() == planId) return planitem;
}
return null;
}
}
private void BindPlans()
{
WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID);

View file

@ -1,41 +1,11 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <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.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.Lync.UserControls {