diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs index d2a3656a..67a74266 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs @@ -38,6 +38,7 @@ namespace WebsitePanel.EnterpriseServer General = 1, WebSites = 2, VpsExternalNetwork = 3, - VpsManagementNetwork = 4 + VpsManagementNetwork = 4, + PhoneNumbers = 5 } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs index 61e838a6..39e13c75 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs @@ -965,38 +965,59 @@ namespace WebsitePanel.EnterpriseServer return res; } - var startExternalIP = IPAddress.Parse(externalIP); - var startInternalIP = IPAddress.Parse(internalIP); - var endExternalIP = IPAddress.Parse(endIP); - - // handle CIDR notation IP/Subnet addresses - if (startExternalIP.IsSubnet && endExternalIP == null) { - endExternalIP = startExternalIP.LastSubnetIP; - startExternalIP = startExternalIP.FirstSubnetIP; - } - - if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6."); - - int i = 0; - long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1; - - while (true) + if (pool == IPAddressPool.PhoneNumbers) { - if (i > MaxSubnet) - break; + string phoneFormat = "D" + Math.Max(externalIP.Length, endIP.Length); - // add IP address - DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments); + UInt64 start = UInt64.Parse(externalIP); + UInt64 end = UInt64.Parse(endIP); - if (startExternalIP == endExternalIP) - break; + if (end < start) { UInt64 temp = start; start = end; end = temp; } - i++; + const UInt64 maxPhones = 1000; // TODO max? - startExternalIP += step; + end = Math.Min(end, start + maxPhones); - if (startInternalIP != 0) - startInternalIP += step; + for (UInt64 number = start; number <= end; number++) + DataProvider.AddIPAddress((int)pool, serverId, number.ToString(phoneFormat), "", subnetMask, defaultGateway, comments); + } + + else + { + var startExternalIP = IPAddress.Parse(externalIP); + var startInternalIP = IPAddress.Parse(internalIP); + var endExternalIP = IPAddress.Parse(endIP); + + // handle CIDR notation IP/Subnet addresses + if (startExternalIP.IsSubnet && endExternalIP == null) + { + endExternalIP = startExternalIP.LastSubnetIP; + startExternalIP = startExternalIP.FirstSubnetIP; + } + + if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6."); + + int i = 0; + long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1; + + while (true) + { + if (i > MaxSubnet) + break; + + // add IP address + DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments); + + if (startExternalIP == endExternalIP) + break; + + i++; + + startExternalIP += step; + + if (startInternalIP != 0) + startInternalIP += step; + } } } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config index b2602ecb..c7d2f0d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config @@ -81,7 +81,10 @@ - + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 63db8671..fd56bbb9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -160,7 +160,17 @@ - + + + + + + + + + + + @@ -264,7 +274,13 @@ - + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config index e6277aa7..bb162c93 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config @@ -212,6 +212,17 @@ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx index 4d4e954b..2a1aabc9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx @@ -771,8 +771,19 @@ System Hard Quota - Helicon Zoo + + Phone Numbers + + + Add Phone Numbers + + + Edit Phone numbers + + + Phone Numbers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx index 6b30cf6d..6e584424 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx @@ -462,4 +462,16 @@ System Hard Quota + + Phone Numbers + + + {user} - {space} - Phone Numbers + + + Phone Numbers + + + Phone Numbers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 09d7a912..e6c16978 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3112,7 +3112,6 @@ Failed to update user login name. - Mailbox primary e-mail address has been changed. @@ -3365,7 +3364,6 @@ Please note not all email address are deleted - There are no public folders to delete @@ -3954,9 +3952,6 @@ IP Address could not be deleted - - IP Address could not be deleted because it is being used by Virtual Private Server. - Cannot add network adapter IP addresses @@ -5313,4 +5308,19 @@ By clicking on the button 'Apply', you will apply the respective hard quota on each provisioned home folder. Note that this may take some time. + + Error adding Phone number + + + Cannot add Phone numbers range. + + + The following errors have been occurred: + + + Phone number have been successfully deallocated. + + + At least one Phone number must be selected. + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx new file mode 100644 index 00000000..1cf75868 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Number of Phone Numbers: + + + Quotas + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx new file mode 100644 index 00000000..1cf75868 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Number of Phone Numbers: + + + Quotas + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx new file mode 100644 index 00000000..8b997d67 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add + + + Numbers + + + NAT Address + + + Server + + + User + + + Comments + + + No Phone Numbers found in the selected Pool. + + + Numbers + + + NAT Address + + + Server Name + + + Username + + + VPS + + + Default Gateway + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + General IP + + + Page size: + + + Pool: + + + return confirm('Delete selected?'); + + + Delete selected + + + Edit selected... + + + Item + + + Space + + + User + + + Default Gateway + + + Item Name + + + Phone Numbers + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx new file mode 100644 index 00000000..4be33be2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + IP Address: + + + NAT Address: + + + Server: + + + Comments: + + + Add + + + Cancel + + + <Not Assigned> + + + Settings: + + + to + + + Default Gateway: + + + Subnet Mask: + + + General IP + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + + Phone Numbers + + + Phone Numbers: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx new file mode 100644 index 00000000..4411a1aa --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Server: + + + Comments: + + + Update + + + Cancel + + + <Not Assigned> + + + Default Gateway: + + + Subnet Mask: + + + General IP + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + IP Address: + + + NAT Address: + + + Phone Numbers + + + Phone Number: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs index accdff07..d6b1088f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs @@ -1,10 +1,11 @@ //------------------------------------------------------------------------------ -// <àâòîìàòè÷åñêè ñîçäàâàåìîå> -// Ýòîò êîä ñîçäàí ïðîãðàììîé. +// +// This code was generated by a tool. // -// Èçìåíåíèÿ â ýòîì ôàéëå ìîãóò ïðèâåñòè ê íåïðàâèëüíîé ðàáîòå è áóäóò ïîòåðÿíû â ñëó÷àå -// ïîâòîðíîé ãåíåðàöèè êîäà. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + //------------------------------------------------------------------------------ namespace WebsitePanel.Portal.ExchangeServer { @@ -13,128 +14,142 @@ namespace WebsitePanel.Portal.ExchangeServer { public partial class ExchangeDisclaimerGeneralSettings { /// - /// asyncTasks ýëåìåíò óïðàâëåíèÿ. + /// asyncTasks control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; /// - /// breadcrumb ýëåìåíò óïðàâëåíèÿ. + /// breadcrumb control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; /// - /// menu ýëåìåíò óïðàâëåíèÿ. + /// menu control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; /// - /// Image1 ýëåìåíò óïðàâëåíèÿ. + /// Image1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Image Image1; /// - /// locTitle ýëåìåíò óïðàâëåíèÿ. + /// locTitle control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locTitle; /// - /// litDisplayName ýëåìåíò óïðàâëåíèÿ. + /// litDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Literal litDisplayName; /// - /// messageBox ýëåìåíò óïðàâëåíèÿ. + /// messageBox control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; /// - /// locDisplayName ýëåìåíò óïðàâëåíèÿ. + /// locDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locDisplayName; /// - /// txtDisplayName ýëåìåíò óïðàâëåíèÿ. + /// txtDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtDisplayName; /// - /// valRequireDisplayName ýëåìåíò óïðàâëåíèÿ. + /// valRequireDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireDisplayName; /// - /// locNotes ýëåìåíò óïðàâëåíèÿ. + /// locNotes control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locNotes; /// - /// txtNotes ýëåìåíò óïðàâëåíèÿ. + /// txtNotes control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtNotes; /// - /// btnSave ýëåìåíò óïðàâëåíèÿ. + /// btnSave control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Button btnSave; /// - /// ValidationSummary1 ýëåìåíò óïðàâëåíèÿ. + /// ValidationSummary1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx index 92d9ad13..1ca87bfe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx @@ -52,9 +52,10 @@ - + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs index 24e9e225..74d1e604 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs @@ -32,6 +32,10 @@ using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + namespace WebsitePanel.Portal.Lync { @@ -43,11 +47,27 @@ namespace WebsitePanel.Portal.Lync { WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID); + BindPhoneNumbers(); + if (plans.Length == 0) btnCreate.Enabled = false; } } + private void BindPhoneNumbers() + { + + ddlPhoneNumber.Items.Add(new ListItem("", "")); + + PackageIPAddress[] ips = ES.Services.Servers.GetPackageUnassignedIPAddresses(PanelSecurity.PackageId, IPAddressPool.PhoneNumbers); + foreach (PackageIPAddress ip in ips) + { + string phone = ip.ExternalIP; + ddlPhoneNumber.Items.Add(new ListItem(phone, phone)); + } + + } + + protected void Page_PreRender(object sender, EventArgs e) { bool EnterpriseVoice = false; @@ -54,7 +77,7 @@ namespace WebsitePanel.Portal.Lync if (!EnterpriseVoice) { - tbPhoneNumber.Text = ""; + ddlPhoneNumber.Text = ""; tbPin.Text = ""; } @@ -88,7 +111,7 @@ namespace WebsitePanel.Portal.Lync planSelector.planId = lyncUser.LyncUserPlanId.ToString(); lyncUserSettings.sipAddress = lyncUser.SipAddress; - tbPhoneNumber.Text = lyncUser.LineUri; + Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri); } protected void btnSave_Click(object sender, EventArgs e) @@ -100,7 +123,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, tbPhoneNumber.Text + ":" + tbPin.Text); + res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, ddlPhoneNumber.SelectedItem.Text + ":" + tbPin.Text); } if (res.IsSuccess && res.ErrorCodes.Count == 0) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index 3598ce62..4d0c2b8f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -3,9 +3,10 @@ // 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. // //------------------------------------------------------------------------------ + namespace WebsitePanel.Portal.Lync { @@ -15,8 +16,9 @@ namespace WebsitePanel.Portal.Lync { /// asyncTasks control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; @@ -24,8 +26,9 @@ namespace WebsitePanel.Portal.Lync { /// breadcrumb control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; @@ -33,8 +36,9 @@ namespace WebsitePanel.Portal.Lync { /// menu control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; @@ -42,8 +46,9 @@ namespace WebsitePanel.Portal.Lync { /// Image1 control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Image Image1; @@ -51,8 +56,9 @@ namespace WebsitePanel.Portal.Lync { /// locTitle control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locTitle; @@ -60,8 +66,9 @@ namespace WebsitePanel.Portal.Lync { /// litDisplayName control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Literal litDisplayName; @@ -69,8 +76,9 @@ namespace WebsitePanel.Portal.Lync { /// messageBox control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; @@ -78,8 +86,9 @@ namespace WebsitePanel.Portal.Lync { /// locPlanName control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locPlanName; @@ -87,8 +96,9 @@ namespace WebsitePanel.Portal.Lync { /// planSelector control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector planSelector; @@ -96,8 +106,9 @@ namespace WebsitePanel.Portal.Lync { /// locSipAddress control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locSipAddress; @@ -105,8 +116,9 @@ namespace WebsitePanel.Portal.Lync { /// lyncUserSettings control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserSettings lyncUserSettings; @@ -114,8 +126,9 @@ namespace WebsitePanel.Portal.Lync { /// pnEnterpriseVoice control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; @@ -123,26 +136,39 @@ namespace WebsitePanel.Portal.Lync { /// locPhoneNumber control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locPhoneNumber; /// - /// tbPhoneNumber control. + /// tb_PhoneNumber control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// - protected global::System.Web.UI.WebControls.TextBox tbPhoneNumber; + protected global::System.Web.UI.WebControls.TextBox tb_PhoneNumber; + + /// + /// ddlPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPhoneNumber; /// /// PhoneFormatValidator control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RegularExpressionValidator PhoneFormatValidator; @@ -150,8 +176,9 @@ namespace WebsitePanel.Portal.Lync { /// locLyncPin control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locLyncPin; @@ -159,8 +186,9 @@ namespace WebsitePanel.Portal.Lync { /// tbPin control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox tbPin; @@ -168,8 +196,9 @@ namespace WebsitePanel.Portal.Lync { /// PinRegularExpressionValidator control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RegularExpressionValidator PinRegularExpressionValidator; @@ -177,8 +206,9 @@ namespace WebsitePanel.Portal.Lync { /// btnSave control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Button btnSave; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx new file mode 100644 index 00000000..11b61237 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncAllocatePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.LyncAllocatePhoneNumbers" %> +<%@ Register Src="UserControls/AllocatePackagePhoneNumbers.ascx" TagName="AllocatePackagePhoneNumbers" TagPrefix="wsp" %> + +
+ + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs new file mode 100644 index 00000000..83622ff7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal +{ + public partial class LyncAllocatePhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..e6560c46 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class LyncAllocatePhoneNumbers { + + /// + /// allocatePhoneNumbers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.AllocatePackagePhoneNumbers allocatePhoneNumbers; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx new file mode 100644 index 00000000..6d0fcca5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx @@ -0,0 +1,30 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncPhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.LyncPhoneNumbers" %> +<%@ Register Src="UserControls/PackagePhoneNumbers.ascx" TagName="PackagePhoneNumbers" TagPrefix="wsp" %> +<%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> + +
+ + +
+ + + + + + + + + +
+ + +
+
+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs new file mode 100644 index 00000000..dd0b1e40 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal +{ + public partial class LyncPhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..ea72d381 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class LyncPhoneNumbers { + + /// + /// webAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.PackagePhoneNumbers webAddresses; + + /// + /// secQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secQuotas; + + /// + /// QuotasPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Panel QuotasPanel; + + /// + /// locIPQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locIPQuota; + + /// + /// addressesQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.Quota addressesQuota; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx new file mode 100644 index 00000000..31a176b6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx @@ -0,0 +1,100 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbers" %> +<%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + + + + + + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + <%# Eval("ExternalIP") %> + + + + + + + <%# Eval("UserName") %>  + + + + + + <%# Eval("PackageName") %> +   + + + + + + + + + + + + + + + +
+
+ + +
+
+ + + 10 + 20 + 50 + 100 + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs new file mode 100644 index 00000000..48705d52 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs @@ -0,0 +1,157 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Web.UI.WebControls; +using System.Collections.Generic; +using WebsitePanel.Providers.Common; +using System.Text; +using WebsitePanel.EnterpriseServer; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + // set display preferences + if (!IsPostBack) + { + // page size + gvIPAddresses.PageSize = UsersHelper.GetDisplayItemsPerPage(); + ddlItemsPerPage.SelectedValue = gvIPAddresses.PageSize.ToString(); + + } + else + { + gvIPAddresses.PageSize = Utils.ParseInt(ddlItemsPerPage.SelectedValue, 10); + } + + + if (!IsPostBack) + { + searchBox.AddCriteria("ExternalIP", GetLocalizedString("SearchField.ExternalIP")); + searchBox.AddCriteria("ServerName", GetLocalizedString("SearchField.Server")); + searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName")); + searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username")); + } + + } + protected void odsIPAddresses_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + ProcessException(e.Exception); + this.DisableControls = true; + e.ExceptionHandled = true; + } + } + + public string GetSpaceHomeUrl(int spaceId) + { + return PortalUtils.GetSpaceHomePageUrl(spaceId); + } + + + protected void btnAddItem_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("PoolID", "PhoneNumbers", "add_phone"), true); + } + + protected void ddlItemsPerPage_SelectedIndexChanged(object sender, EventArgs e) + { + gvIPAddresses.PageSize = Utils.ParseInt(ddlItemsPerPage.SelectedValue, 10); + gvIPAddresses.DataBind(); + } + + protected void btnEditSelected_Click(object sender, EventArgs e) + { + int[] addresses = GetSelectedItems(gvIPAddresses); + if (addresses.Length == 0) + { + ShowWarningMessage("IP_EDIT_LIST_EMPTY_ERROR"); + return; + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < addresses.Length; i++) + { + if (i > 0) sb.Append(","); + sb.Append(addresses[i]); + } + + // go to edit screen + Response.Redirect(EditUrl("Addresses", sb.ToString(), "edit_phone"), true); + } + + protected void btnDeleteSelected_Click(object sender, EventArgs e) + { + int[] addresses = GetSelectedItems(gvIPAddresses); + if (addresses.Length == 0) + { + ShowWarningMessage("IP_DELETE_LIST_EMPTY_ERROR"); + return; + } + + try + { + // delete selected IP addresses + ResultObject res = ES.Services.Servers.DeleteIPAddresses(addresses); + + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, "IP_DELETE_RANGE_IP", "IP"); + return; + } + + // refresh grid + gvIPAddresses.DataBind(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_DELETE_RANGE_IP", ex); + return; + } + } + + private int[] GetSelectedItems(GridView gv) + { + List items = new List(); + + for (int i = 0; i < gv.Rows.Count; i++) + { + GridViewRow row = gv.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect.Checked) + items.Add((int)gv.DataKeys[i].Value); + } + + return items.ToArray(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..9e7b294c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAddItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAddItem; + + /// + /// searchBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.SearchBox searchBox; + + /// + /// gvIPAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.GridView gvIPAddresses; + + /// + /// odsIPAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsIPAddresses; + + /// + /// btnEditSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnEditSelected; + + /// + /// btnDeleteSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnDeleteSelected; + + /// + /// lblItemsPerPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Label lblItemsPerPage; + + /// + /// ddlItemsPerPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlItemsPerPage; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx new file mode 100644 index 00000000..de4f9a51 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx @@ -0,0 +1,43 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbersAddPhoneNumber.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbersAddPhoneNumber" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +    + + + +
+ +
+
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs new file mode 100644 index 00000000..f050f67c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs @@ -0,0 +1,173 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.ResultObjects; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbersAddPhoneNumber : WebsitePanelModuleBase + { + private void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + // bind dropdowns + try + { + BindServers(); + + // set server if found in request + if (PanelRequest.ServerId != 0) + Utils.SelectListItem(ddlServer, PanelRequest.ServerId); + } + catch (Exception ex) + { + ShowErrorMessage("IP_ADD_INIT_FORM", ex); + return; + } + + ToggleControls(); + } + } + + private void BindServers() + { + try + { + ddlServer.DataSource = ES.Services.Servers.GetServers(); + ddlServer.DataBind(); + } + catch (Exception ex) + { + Response.Write(ex); + } + + // add "select" item + ddlServer.Items.Insert(0, new ListItem(GetLocalizedString("Text.NotAssigned"), "")); + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + if (Page.IsValid) + { + int serverId = Utils.ParseInt(ddlServer.SelectedValue, 0); + IPAddressPool pool = IPAddressPool.PhoneNumbers; + string comments = txtComments.Text.Trim(); + + string start; + string end; + + start = startPhone.Text; + end = endPhone.Text; + + // add ip address + if (end != "" || start.Contains("/")) + { + string errorKey = "IP_ADD_PHONE_RANGE"; + + try + { + // add IP range + ResultObject res = ES.Services.Servers.AddIPAddressesRange(pool, serverId, start, end, + "", "", "", comments); + if (!res.IsSuccess) + { + // show error + messageBox.ShowMessage(res, errorKey, "IP"); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage(errorKey, ex); + return; + } + } + else + { + string errorKey = "IP_ADD_PHONE"; + + // add single IP + try + { + IntResult res = ES.Services.Servers.AddIPAddress(pool, serverId, start, + "", "", "", comments); + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, errorKey, "IP"); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage(errorKey, ex); + return; + } + } + + // Redirect back to the portal home page + RedirectBack(); + } + } + protected void btnCancel_Click(object sender, EventArgs e) + { + // Redirect back to the portal home page + RedirectBack(); + } + + private void RedirectBack() + { + Response.Redirect(NavigateURL("PoolID", "PhoneNumbers")); + } + + protected void ddlPools_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + requireStartPhoneValidator.Enabled = true; + } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs new file mode 100644 index 00000000..37bb6c33 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs @@ -0,0 +1,166 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbersAddPhoneNumber { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// consistentAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.CustomValidator consistentAddresses; + + /// + /// locServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locServer; + + /// + /// ddlServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlServer; + + /// + /// PhoneNumbersRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PhoneNumbersRow; + + /// + /// Localize1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize1; + + /// + /// startPhone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox startPhone; + + /// + /// requireStartPhoneValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator requireStartPhoneValidator; + + /// + /// Localize2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize2; + + /// + /// endPhone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox endPhone; + + /// + /// lblComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize lblComments; + + /// + /// txtComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtComments; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx new file mode 100644 index 00000000..1bd18e27 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbersEditPhoneNumber.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbersEditPhoneNumber" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs new file mode 100644 index 00000000..c056895d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs @@ -0,0 +1,176 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbersEditPhoneNumber : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + try + { + // bind dropdowns + BindServers(); + + // bind IP + BindPhone(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_GET_IP", ex); + return; + } + } + } + + private void BindPhone() + { + int addressId = PanelRequest.AddressID; + + // check if multiple editing + if (!String.IsNullOrEmpty(PanelRequest.Addresses)) + { + string[] ids = PanelRequest.Addresses.Split(','); + addressId = Utils.ParseInt(ids[0], 0); + } + + // bind first address + IPAddressInfo addr = ES.Services.Servers.GetIPAddress(addressId); + + if (addr != null) + { + Utils.SelectListItem(ddlServer, addr.ServerId); + + Phone.Text = addr.ExternalIP; + txtComments.Text = addr.Comments; + + ToggleControls(); + } + else + { + // exit + RedirectBack(); + } + } + + private void BindServers() + { + ddlServer.DataSource = ES.Services.Servers.GetServers(); + ddlServer.DataBind(); + ddlServer.Items.Insert(0, new ListItem(GetLocalizedString("Text.NotAssigned"), "")); + } + + private void RedirectBack() + { + Response.Redirect(NavigateURL("PoolID", "PhoneNumbers")); + } + + protected void btnUpdate_Click(object sender, EventArgs e) + { + if (Page.IsValid) + { + try + { + int serverId = Utils.ParseInt(ddlServer.SelectedValue, 0); + IPAddressPool pool = IPAddressPool.PhoneNumbers; + + ResultObject res = null; + + // update single IP address + if (!String.IsNullOrEmpty(PanelRequest.Addresses)) + { + // update multiple IPs + string[] ids = PanelRequest.Addresses.Split(','); + int[] addresses = new int[ids.Length]; + for (int i = 0; i < ids.Length; i++) + addresses[i] = Utils.ParseInt(ids[i], 0); + + res = ES.Services.Servers.UpdateIPAddresses(addresses, + pool, serverId, "", "", txtComments.Text.Trim()); + } + else + { + string address = Phone.Text; + + // update single IP + res = ES.Services.Servers.UpdateIPAddress(PanelRequest.AddressID, + pool, serverId, address, "", "", "", txtComments.Text.Trim()); + } + + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, "IP_UPDATE_IP", "IP"); + return; + } + + // Redirect back to the portal home page + RedirectBack(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_UPDATE_IP", ex); + return; + } + } + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + // Redirect back to the portal home page + RedirectBack(); + } + + protected void ddlPools_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + bool multipleEdit = !String.IsNullOrEmpty(PanelRequest.Addresses); + PhoneNumbersRow.Visible = !multipleEdit; + requireStartPhoneValidator.Enabled = !multipleEdit; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs new file mode 100644 index 00000000..c47738c0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbersEditPhoneNumber { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// locServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locServer; + + /// + /// ddlServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlServer; + + /// + /// PhoneNumbersRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PhoneNumbersRow; + + /// + /// Localize1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize1; + + /// + /// Phone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox Phone; + + /// + /// requireStartPhoneValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator requireStartPhoneValidator; + + /// + /// lblComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize lblComments; + + /// + /// txtComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtComments; + + /// + /// btnUpdate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnUpdate; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs index 5cf5ec1e..a7e103dc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs @@ -1,10 +1,11 @@ //------------------------------------------------------------------------------ -// <àâòîìàòè÷åñêè ñîçäàâàåìîå> -// Ýòîò êîä ñîçäàí ïðîãðàììîé. +// +// This code was generated by a tool. // -// Èçìåíåíèÿ â ýòîì ôàéëå ìîãóò ïðèâåñòè ê íåïðàâèëüíîé ðàáîòå è áóäóò ïîòåðÿíû â ñëó÷àå -// ïîâòîðíîé ãåíåðàöèè êîäà. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + //------------------------------------------------------------------------------ namespace WebsitePanel.Portal.ProviderControls { @@ -13,83 +14,92 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class CRM2011_Settings { /// - /// txtSqlServer ýëåìåíò óïðàâëåíèÿ. + /// txtSqlServer control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtSqlServer; /// - /// RequiredFieldValidator1 ýëåìåíò óïðàâëåíèÿ. + /// RequiredFieldValidator1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; /// - /// txtReportingService ýëåìåíò óïðàâëåíèÿ. + /// txtReportingService control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtReportingService; /// - /// txtDomainName ýëåìåíò óïðàâëåíèÿ. + /// txtDomainName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtDomainName; /// - /// RequiredFieldValidator2 ýëåìåíò óïðàâëåíèÿ. + /// RequiredFieldValidator2 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; /// - /// ddlSchema ýëåìåíò óïðàâëåíèÿ. + /// ddlSchema control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.DropDownList ddlSchema; /// - /// ddlCrmIpAddress ýëåìåíò óïðàâëåíèÿ. + /// ddlCrmIpAddress control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.SelectIPAddress ddlCrmIpAddress; /// - /// txtPort ýëåìåíò óïðàâëåíèÿ. + /// txtPort control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtPort; /// - /// txtAppRootDomain ýëåìåíò óïðàâëåíèÿ. + /// txtAppRootDomain control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtAppRootDomain; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx new file mode 100644 index 00000000..7dd2aece --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx @@ -0,0 +1,71 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AllocatePackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.AllocatePackagePhoneNumbers" %> +<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + + + + + + +
    +
  • + +
  • +
  • + +
  • +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + * + + +
+ +
+ +
+ +
+
+
+

+ + +

\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs new file mode 100644 index 00000000..991b7a21 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs @@ -0,0 +1,174 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class AllocatePackagePhoneNumbers : WebsitePanelControlBase + { + private IPAddressPool pool; + public IPAddressPool Pool + { + get { return pool; } + set { pool = value; } + } + + private string listAddressesControl; + public string ListAddressesControl + { + get { return listAddressesControl; } + set { listAddressesControl = value; } + } + + private string resourceGroup; + public string ResourceGroup + { + get { return resourceGroup; } + set { resourceGroup = value; } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindIPAddresses(); + ToggleControls(); + } + } + + private void BindIPAddresses() + { + bool vps = (Pool == IPAddressPool.VpsExternalNetwork || Pool == IPAddressPool.VpsManagementNetwork); + + // bind list + IPAddressInfo[] ips = ES.Services.Servers.GetUnallottedIPAddresses(PanelSecurity.PackageId, ResourceGroup, Pool); + foreach (IPAddressInfo ip in ips) + { + string txt = ip.ExternalIP; + + // web sites - NAT Address + if (!vps && !String.IsNullOrEmpty(ip.InternalIP)) + txt += "/" + ip.InternalIP; + + // VPS - Gateway Address + else if (vps && !String.IsNullOrEmpty(ip.DefaultGateway)) + txt += "/" + ip.DefaultGateway; + + listExternalAddresses.Items.Add(new ListItem(txt, ip.AddressId.ToString())); + } + + int quotaAllowed = -1; + string quotaName = (String.Compare(ResourceGroup, ResourceGroups.VPS, true) == 0) ? Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER : Quotas.WEB_IP_ADDRESSES; + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(quotaName)) + { + int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; + int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; + + if (quotaAllocated != -1) + quotaAllowed = quotaAllocated - quotaUsed; + } + + // bind controls + int max = quotaAllowed == -1 ? listExternalAddresses.Items.Count : quotaAllowed; + + txtExternalAddressesNumber.Text = max.ToString(); + litMaxAddresses.Text = String.Format(GetLocalizedString("litMaxAddresses.Text"), max); + + if (max == 0) + { + AddressesTable.Visible = false; + ErrorMessagesList.Visible = true; + EmptyAddressesMessage.Visible = (listExternalAddresses.Items.Count == 0); + QuotaReachedMessage.Visible = (quotaAllowed == 0); + btnAdd.Enabled = false; + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + try + { + List ids = new List(); + foreach (ListItem item in listExternalAddresses.Items) + { + if (item.Selected) + ids.Add(Utils.ParseInt(item.Value)); + } + + ResultObject res = ES.Services.Servers.AllocatePackageIPAddresses(PanelSecurity.PackageId, + ResourceGroup, Pool, + radioExternalRandom.Checked, + Utils.ParseInt(txtExternalAddressesNumber.Text), + ids.ToArray()); + if (res.IsSuccess) + { + // return back + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl)); + } + else + { + // show message + messageBox.ShowMessage(res, "VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", "VPS"); + } + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", ex); + } + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl)); + } + + protected void radioExternalSelected_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + AddressesNumberRow.Visible = radioExternalRandom.Checked; + AddressesListRow.Visible = radioExternalSelected.Checked; + } + + protected void radioExternalRandom_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..14339064 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs @@ -0,0 +1,215 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class AllocatePackagePhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// ErrorMessagesList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl ErrorMessagesList; + + /// + /// EmptyAddressesMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl EmptyAddressesMessage; + + /// + /// locNotEnoughAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locNotEnoughAddresses; + + /// + /// QuotaReachedMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl QuotaReachedMessage; + + /// + /// locQuotaReached control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locQuotaReached; + + /// + /// AddressesTable control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.UpdatePanel AddressesTable; + + /// + /// radioExternalRandom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RadioButton radioExternalRandom; + + /// + /// AddressesNumberRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesNumberRow; + + /// + /// locExternalAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locExternalAddresses; + + /// + /// txtExternalAddressesNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtExternalAddressesNumber; + + /// + /// ExternalAddressesValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ExternalAddressesValidator; + + /// + /// litMaxAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Literal litMaxAddresses; + + /// + /// radioExternalSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RadioButton radioExternalSelected; + + /// + /// AddressesListRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesListRow; + + /// + /// listExternalAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ListBox listExternalAddresses; + + /// + /// locHoldCtrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locHoldCtrl; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx new file mode 100644 index 00000000..b8f2d0ea --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add + + + Cancel + + + Enter the number of Phone Numbers + + + ({0} max) + + + Number of Phone Numbers: + + + * Hold CTRL key to select multiple phone numbers + + + The pool of Phone Numbers is empty.<br/>Allocate more Phone Numbers on reseller level. If the current hosting space is nested within "System" space then add more server Phone Numbers to the appropriate pool on "Configuration -> Phone Numbers" page. + + + Allocate Phone Numbers + + + Randomly select Phone Numbers from the pool + + + Select Phone Numbers from the list + + + Phone Numbers quota has been reached. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx new file mode 100644 index 00000000..646a40dd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Allocate... + + + Deallocate Selected + + + No Phone Numbers have been allocated to this hosting space. + + + Gateway + + + Phone Numbers + + + Item Name + + + Primary + + + Space + + + Subnet Mask + + + User + + + Default Gateway + + + Phone Numbers + + + Item Name + + + User Name + + + return confirm('Deallocate selected Phone Numbers from hosting space?'); + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx new file mode 100644 index 00000000..6fb848de --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx @@ -0,0 +1,87 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.PackagePhoneNumbers" %> +<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> + + + + + + +
+
+ +
+
+ +
+
+ + + + + + + + +   + + + + + + + + + <%# Eval("ItemName") %> +   + + + + + + + <%# Eval("PackageName") %> + + + + + + <%# Eval("UserName") %> + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs new file mode 100644 index 00000000..e907fb61 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs @@ -0,0 +1,172 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class PackagePhoneNumbers : WebsitePanelControlBase + { + private bool spaceOwner; + + private IPAddressPool pool; + public IPAddressPool Pool + { + get { return pool; } + set { pool = value; } + } + + private string editItemControl; + public string EditItemControl + { + get { return editItemControl; } + set { editItemControl = value; } + } + + private string spaceHomeControl; + public string SpaceHomeControl + { + get { return spaceHomeControl; } + set { spaceHomeControl = value; } + } + + private string allocateAddressesControl; + public string AllocateAddressesControl + { + get { return allocateAddressesControl; } + set { allocateAddressesControl = value; } + } + + public bool ManageAllowed + { + get { return ViewState["ManageAllowed"] != null ? (bool)ViewState["ManageAllowed"] : false; } + set { ViewState["ManageAllowed"] = value; } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + searchBox.AddCriteria("ExternalIP", GetLocalizedString("SearchField.IPAddress")); + searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName")); + searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username")); + } + + bool isUserSelected = PanelSecurity.SelectedUser.Role == WebsitePanel.EnterpriseServer.UserRole.User; + bool isUserLogged = PanelSecurity.EffectiveUser.Role == WebsitePanel.EnterpriseServer.UserRole.User; + spaceOwner = PanelSecurity.EffectiveUserId == PanelSecurity.SelectedUserId; + + gvAddresses.Columns[3].Visible = !isUserSelected; // space + gvAddresses.Columns[4].Visible = !isUserSelected; // user + + // managing external network permissions + gvAddresses.Columns[0].Visible = !isUserLogged && ManageAllowed; + btnAllocateAddress.Visible = !isUserLogged && !spaceOwner && ManageAllowed && !String.IsNullOrEmpty(AllocateAddressesControl); + btnDeallocateAddresses.Visible = !isUserLogged && ManageAllowed; + } + + public string GetItemEditUrl(string itemID) + { + return HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), EditItemControl, + "ItemID=" + itemID); + } + + public string GetSpaceHomeUrl(string spaceId) + { + return HostModule.EditUrl("SpaceID", spaceId, SpaceHomeControl); + } + + protected void odsExternalAddressesPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOXES", e.Exception); + e.ExceptionHandled = true; + } + } + + protected void btnAllocateAddress_Click(object sender, EventArgs e) + { + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), AllocateAddressesControl)); + } + + protected void gvAddresses_RowDataBound(object sender, GridViewRowEventArgs e) + { + PackageIPAddress item = e.Row.DataItem as PackageIPAddress; + if (item != null) + { + // checkbox + CheckBox chkSelect = e.Row.FindControl("chkSelect") as CheckBox; + chkSelect.Enabled = (!spaceOwner || (PanelSecurity.PackageId != item.PackageId)) && item.ItemId == 0; + } + } + + protected void btnDeallocateAddresses_Click(object sender, EventArgs e) + { + List ids = new List(); + + try + { + List items = new List(); + for (int i = 0; i < gvAddresses.Rows.Count; i++) + { + GridViewRow row = gvAddresses.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect.Checked) + items.Add((int)gvAddresses.DataKeys[i].Value); + } + + // check if at least one is selected + if (items.Count == 0) + { + messageBox.ShowWarningMessage("PHONE_EDIT_LIST_EMPTY_ERROR"); + return; + } + + ResultObject res = ES.Services.Servers.DeallocatePackageIPAddresses(PanelSecurity.PackageId, items.ToArray()); + messageBox.ShowMessage(res, "DEALLOCATE_SPACE_PHONE_NUMBER", "VPS"); + gvAddresses.DataBind(); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("DEALLOCATE_SPACE_PHONE_NUMBER", ex); + } + } + + protected void odsExternalAddressesPaged_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) + { + e.InputParameters["pool"] = Pool; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..2a0d585d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class PackagePhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAllocateAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAllocateAddress; + + /// + /// searchBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.SearchBox searchBox; + + /// + /// gvAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.GridView gvAddresses; + + /// + /// odsExternalAddressesPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsExternalAddressesPaged; + + /// + /// btnDeallocateAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnDeallocateAddresses; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs index 073a45f6..ce25e873 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs @@ -38,7 +38,6 @@ namespace WebsitePanel.Portal { protected void Page_Load(object sender, EventArgs e) { - } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 0596b4b6..689afdc0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -461,6 +461,20 @@ OrgIdPolicyEditor.ascx + + PackagePhoneNumbers.ascx + ASPXCodeBehind + + + PackagePhoneNumbers.ascx + + + AllocatePackagePhoneNumbers.ascx + ASPXCodeBehind + + + AllocatePackagePhoneNumbers.ascx + MonitoringPage.aspx ASPXCodeBehind @@ -3879,6 +3893,41 @@ WebsitesSSL.ascx + + LyncPhoneNumbers.ascx + ASPXCodeBehind + + + LyncPhoneNumbers.ascx + + + LyncAllocatePhoneNumbers.ascx + ASPXCodeBehind + + + LyncAllocatePhoneNumbers.ascx + + + PhoneNumbers.ascx + ASPXCodeBehind + + + PhoneNumbers.ascx + + + PhoneNumbersAddPhoneNumber.ascx + ASPXCodeBehind + + + PhoneNumbersAddPhoneNumber.ascx + + + PhoneNumbersEditPhoneNumber.ascx + ASPXCodeBehind + + + PhoneNumbersEditPhoneNumber.ascx + @@ -3918,6 +3967,8 @@ + + @@ -3980,6 +4031,11 @@ + + + + + @@ -5061,6 +5117,12 @@ Designer + + Designer + + + Designer + @@ -5072,6 +5134,15 @@ + + Designer + + + Designer + + + + Designer