From aed8ea323e663c2358f8eb324d2aa9c52cef799a Mon Sep 17 00:00:00 2001 From: me Date: Mon, 9 Feb 2015 13:09:40 +0400 Subject: [PATCH 01/12] wsp-10311 Add Apply button --- .../App_Themes/Default/Buttons.skin | 2 ++ .../App_Themes/Default/Images/apply_16.png | Bin 0 -> 682 bytes .../App_Themes/Default/Images/apply_24.png | Bin 0 -> 1160 bytes .../App_Themes/Default/Styles/Skin.css | 2 +- .../ExchangeServer/ExchangeMailboxes.ascx.cs | 2 -- .../ExchangeServer/OrganizationUsers.ascx.cs | 2 -- .../App_LocalResources/UserActions.ascx.resx | 3 +++ .../WebsitePanel/UserControls/UserActions.ascx | 15 ++++++++------- .../UserControls/UserActions.ascx.cs | 13 +++---------- .../UserControls/UserActions.ascx.designer.cs | 9 +++++++++ 10 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_16.png create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_24.png diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Buttons.skin b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Buttons.skin index 99a84757..ffaaaff6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Buttons.skin +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Buttons.skin @@ -32,11 +32,13 @@ Default skin template. The following skins are provided as examples only. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_16.png b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_16.png new file mode 100644 index 0000000000000000000000000000000000000000..4524177685d013019b7d6ff8c0b6a8a4b7d6f486 GIT binary patch literal 682 zcmV;b0#*HqP)djvRmvxnun58#g3e;_h37eVuR)H~l@~P}Eu>A$|#Rn;pz(^w~ zP0$FY4@PCCmqf@6U1oDbb5}PvHg&g$FhoY_dHitB`JB)BFgOajArppl@RXMY%KLcA z-D8g+mIy;eugOl?EEZsS%a4z1Q!+WMo-(xklDS5vgY-uRS7~;Mz0#!M zXJQHE*_8-HgP8d>>!XCa|D4bT1q2EhsAz+_C(h_GN`xUESJ_R3lNxdjc@Q}xp3S`g zOW4-QCRHQog2y5iO*>B3_2i@-n?^T0`-<~4S)5X?n1d~ZQJirK?^h-e-HCQiHmPF( zz=A>h?XngaI02XCTJ+BKx6eNOB8i;gaejK9>#C&zft_VoGD_f&tY9jr`Y1!)drJry zz{rbOORQpZH-tOq+h8xOa#2D@ThFy%ha@2KA~?ch=-V(Tq0R3aC$+yR(FiG&&@S4| zR>buf;(83WLK})D85O3p*uXkY7>eNajbTCax!+!y=-Xd1#SmWmYXkD;_NHPpTMI=&$sFP`xHcwj)Y)K@|vPu$l}alh1;I zi0J+N6x+#!!}sJzAf*8S#9t-`Vvd+RADUOJ<{D%PnaC4N@Gg#FL0fct9pilm#VK*- z`RN|#n>u}PyeTB-tkeJEGpU9b1}pCiRJbcpUZaFIkJNkBR6GFq4J)tFe*XqI Q5dZ)H07*qoM6N<$g1HzuTmS$7 literal 0 HcmV?d00001 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_24.png b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/apply_24.png new file mode 100644 index 0000000000000000000000000000000000000000..420e923e43ecdf8d41e00babec8e76650a436e92 GIT binary patch literal 1160 zcmV;31b6$1P)=F5ps6Y^ohwS!u0RbX}NnwnS)?is zJuqN=;BBgL*R*epv@u(mWuiEVu1S^}A#^GEZT><|s$%a0140p9uddvMjm>C&442d} z-2p;Ikc)+3EN7wPbZjX3K){l2e|vMNrD?VKIFqFb%1#N7?q-?4j@&|)TsfQQj}3ML z-1i}yA1;X+(%2Vke1)Pt$L0AXZe6Fw9YmLsv8lnFP(}R4`s={Em?*>m6NLnOICCdJ zDC+(#4ckm91cS4KlquqoZoDox=Q0C0j@@x`>*?f8;2oO0(%ZYHrp5F~55u{$OuUym zghHG*$lV$q{HUt6F|Z=`Wbi32&nKCvq;N|Ybw({SrD?LobmFJ2{hhb&ktlrr<`eB^ z*r;c2ah@0I*7JS(yV#LbPgEQb>#W^Y4j}Y#&{R;m+8VatC^qBeB!=!G?5)M4x#&xs z%L(OXH8)1ZQKR)ngt6HR98P}Cv56BbbvMu!+1jKD*&FEcM*&ntZC@8zAFcP-lPp~Z zVN>lj2^%3sGDA3y-En+NU-G|zuygZvk;1|pHa26qU-&V75>558F|xVIr}+lLpM+ko zc31CvuI_mXR-Wu)2EWT-nJ>a@F-zuJCh^1Olb!z#zYZw8eQ5kMYP~@$$D*)Ups-lr zV&M`lX|R3OPSengu5Bw`#-n-owR8zxlSGUN}SLK&aSM|1dDR+%fAEKe|FWvTW&My)r*&*OdM%lWqwFP=DZX8@pwFXr0{ zQHzD92LB2S-9yb)IT27T>*eX{8~I$neHCR z^|M6x6Y3GF1?meFyB%t|d^hMEy zhAuT~T_G}sG*kJh#5bD~x4kuY1ptyeuXI+dQhaRYESf5bcp`*cA;96x#F=}l=6?Zz zk?rTZD^@u^nmr4SgHIX^|2~9m+Z|tR_%?a3z+FH6wTD|`n$Y%Zsx+k{yL&bq-FvU$ a0Dl5N8=HY+0OybZ0000 Ok + + Apply + - Actions - diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx index 93583c75..9c16f527 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx @@ -8,15 +8,16 @@ - - Actions + + <%--Actions--%> Disable Enable SetServiceLevel SetVIP + + @@ -39,7 +40,7 @@ + CausesValidation="false" /> @@ -63,7 +64,7 @@ + CausesValidation="false" /> @@ -89,7 +90,7 @@ + CausesValidation="false" /> @@ -118,7 +119,7 @@ + CausesValidation="false" /> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs index ab5b3c8f..a19336c9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs @@ -77,7 +77,7 @@ namespace WebsitePanel.Portal } } - protected void ddlUserActions_OnSelectedIndexChanged(object sender, EventArgs e) + protected void cmdApply_OnClick(object sender, ImageClickEventArgs e) { switch (SelectedAction) { @@ -94,6 +94,8 @@ namespace WebsitePanel.Portal case UserActionTypes.SetVIP: Modal.PopupControlID = VIPPanel.ID; break; + default: + return; } Modal.Show(); @@ -121,15 +123,6 @@ namespace WebsitePanel.Portal if (ExecutingUserAction != null) ExecutingUserAction(this, new EventArgs()); } - protected void btnModalCancel_OnClick(object sender, EventArgs e) - { - ResetSelection(); - } - - public void ResetSelection() - { - ddlUserActions.ClearSelection(); - } protected int ChangeUsersSettings(List userIds, bool? disable, int? serviceLevelId, bool? isVIP) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.designer.cs index c5b3a377..6a6aaf52 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.designer.cs @@ -58,6 +58,15 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.DropDownList ddlUserActions; + /// + /// cmdApply control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdApply; + /// /// Modal control. /// From 349862410f02c7d3a7cd62a2afc549285191132e Mon Sep 17 00:00:00 2001 From: me Date: Sun, 15 Feb 2015 21:28:12 +0400 Subject: [PATCH 02/12] wsp-10316 Create list of actions for WebSites page and Domains page --- .../WebsitePanel_SharedResources.ascx.resx | 8 +- .../DesktopModules/WebsitePanel/Domains.ascx | 31 ++- .../WebsitePanel/Domains.ascx.cs | 6 +- .../WebsitePanel/Domains.ascx.designer.cs | 37 +--- .../ExchangeServer/ExchangeMailboxes.ascx | 2 +- .../ExchangeServer/ExchangeMailboxes.ascx.cs | 36 ---- .../ExchangeServer/OrganizationUsers.ascx | 2 +- .../ExchangeServer/OrganizationUsers.ascx.cs | 36 ---- .../OrganizationUsers.ascx.designer.cs | 28 --- .../UserControls/ActionListControlBase.cs | 144 ++++++++++++++ .../DomainActions.ascx.resx | 138 ++++++++++++++ .../WebsiteActions.ascx.resx | 135 +++++++++++++ .../UserControls/DomainActions.ascx | 37 ++++ .../UserControls/DomainActions.ascx.cs | 179 ++++++++++++++++++ .../DomainActions.ascx.designer.cs | 42 ++++ .../UserControls/SpaceServiceItems.ascx | 32 +++- .../UserControls/SpaceServiceItems.ascx.cs | 9 +- .../SpaceServiceItems.ascx.designer.cs | 37 +--- .../UserControls/UserActions.ascx.cs | 44 ++--- .../UserControls/WebsiteActions.ascx | 34 ++++ .../UserControls/WebsiteActions.ascx.cs | 125 ++++++++++++ .../WebsiteActions.ascx.designer.cs | 42 ++++ .../WebsitePanel.Portal.Modules.csproj | 21 ++ 23 files changed, 998 insertions(+), 207 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/ActionListControlBase.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainActions.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/WebsiteActions.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.designer.cs 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 8b25c269..e37d0db3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3136,14 +3136,14 @@ User general settings have been successfully updated. - + Action has been successfully performed. - + Failed to perform action. - - Please select the users for which you want to perform actions. + + Please select the items for which you want to perform action. User password has been successfully updated. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx index fd5adb81..914c6f12 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx @@ -3,10 +3,15 @@ <%@ Register Src="UserControls/ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %> <%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="wsp" %> <%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/DomainActions.ascx" TagName="DomainActions" TagPrefix="wsp" %> + - - +
@@ -16,14 +21,32 @@
- + + + + + + +
+ + + +
+ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs index 35358317..dad53715 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs @@ -55,10 +55,10 @@ namespace WebsitePanel.Portal // visibility chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User); - gvDomains.Columns[4].Visible = gvDomains.Columns[5].Visible = + gvDomains.Columns[5].Visible = gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked; - gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); - gvDomains.Columns[7].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); + gvDomains.Columns[7].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); + gvDomains.Columns[8].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); if (!IsPostBack) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs index 54cf39ff..6924e9eb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -58,6 +30,15 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.CheckBox chkRecursive; + /// + /// websiteActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.DomainActions websiteActions; + /// /// searchBox control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx index 0c75c06d..9fec7e2d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx @@ -36,7 +36,7 @@
- + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs index 026d6995..ba2707f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs @@ -271,41 +271,5 @@ namespace WebsitePanel.Portal.ExchangeServer odsAccountsPaged.SelectParameters["accountTypes"].DefaultValue = string.Join(",", accountTypes); } - - protected void userActions_OnExecutingUserAction(object sender, EventArgs e) - { - // Get checked users - var userIds = Utils.GetCheckboxValuesFromGrid(gvMailboxes, "chkSelectedUsersIds"); - - if (userActions.SelectedAction != UserActionTypes.None) - { - if (userIds.Count > 0) - { - try - { - var result = userActions.DoUserActions(userIds); - - if (result < 0) - { - messageBox.ShowResultMessage(result); - return; - } - - messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS"); - } - catch (Exception ex) - { - messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex); - } - - // Refresh users grid - gvMailboxes.DataBind(); - } - else - { - messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS"); - } - } - } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx index f3c60beb..b83fb036 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx @@ -38,7 +38,7 @@
- + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs index aff68bb0..4b80cb1a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs @@ -389,41 +389,5 @@ namespace WebsitePanel.Portal.HostedSolution } } - - protected void userActions_OnExecutingUserAction(object sender, EventArgs e) - { - // Get checked users - var userIds = Utils.GetCheckboxValuesFromGrid(gvUsers, "chkSelectedUsersIds"); - - if (userActions.SelectedAction != UserActionTypes.None) - { - if (userIds.Count > 0) - { - try - { - var result = userActions.DoUserActions(userIds); - - if (result < 0) - { - messageBox.ShowResultMessage(result); - return; - } - - messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS"); - } - catch (Exception ex) - { - messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex); - } - - // Refresh users grid - gvUsers.DataBind(); - } - else - { - messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS"); - } - } - } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs index 17643c1b..668d3539 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/ActionListControlBase.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/ActionListControlBase.cs new file mode 100644 index 00000000..09414ad8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/ActionListControlBase.cs @@ -0,0 +1,144 @@ +// Copyright (c) 2015, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Web.UI.WebControls; + + +namespace WebsitePanel.Portal.UserControls +{ + public abstract class ActionListControlBase : WebsitePanelControlBase + { + public event CancelEventHandler ExecutingAction; + + public event EventHandler ExecutedAction; + + #region Properties + + public string GridViewID { get; set; } + + public string CheckboxesName { get; set; } + + private string _message = "ACTIONS_MESSAGE"; + public string Message + { + get { return _message; } + set { _message = value; } + } + + #endregion + + protected abstract DropDownList ActionsList { get; } + + protected abstract int DoAction(List ids); + + public TEnum SelectedAction + { + get + { + return (TEnum)(object)Convert.ToInt32(ActionsList.SelectedValue); + } + } + + protected GridView GridView + { + get { return Parent.FindControl(GridViewID) as GridView; } + } + + public void ResetSelection() + { + ActionsList.ClearSelection(); + } + public void RemoveActionItem(TNum value) + { + ActionsList.Items.Remove(ActionsList.Items.FindByValue(((int)(object)value).ToString())); + } + + protected void FireExecuteAction() + { + if (ExecutingAction != null) + { + var e = new CancelEventArgs(); + ExecutingAction(this, e); + + if (e.Cancel) + return; + } + + DoAction(); + + if (ExecutedAction != null) + ExecutedAction(this, new EventArgs()); + } + + protected void DoAction() + { + if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName)) + return; + + // Get checked users + var ids = Utils.GetCheckboxValuesFromGrid(GridView, CheckboxesName); + + if ((int)(object)SelectedAction != 0) + { + if (ids.Count > 0) + { + try + { + var result = DoAction(ids); + + if (result < 0) + { + HostModule.ShowResultMessage(result); + return; + } + + HostModule.ShowSuccessMessage(Message); + } + catch (Exception ex) + { + HostModule.ShowErrorMessage(Message, ex); + } + + // Refresh users grid + GridView.DataBind(); + } + else + { + HostModule.ShowWarningMessage(Message); + } + } + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainActions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainActions.ascx.resx new file mode 100644 index 00000000..636571fc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainActions.ascx.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Apply + + + - Actions - + + + Create Instant Alias + + + Delete Instant Alias + + + Disable Dns + + + Enable Dns + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/WebsiteActions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/WebsiteActions.ascx.resx new file mode 100644 index 00000000..1d05ea79 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/WebsiteActions.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Apply + + + - Actions - + + + Restart App Pool + + + Start + + + Stop + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx new file mode 100644 index 00000000..8e4d30a6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx @@ -0,0 +1,37 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainActions.ascx.cs" Inherits="WebsitePanel.Portal.DomainActions" %> + + + + + + + Actions + EnableDns + DisableDns + CreateInstantAlias + DeleteInstantAlias + + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.cs new file mode 100644 index 00000000..2b1819dc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.cs @@ -0,0 +1,179 @@ +// Copyright (c) 2015, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +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 Microsoft.Web.Services3.Referral; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.Portal.UserControls; +using WebsitePanel.Providers; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public enum DomainActionTypes + { + None = 0, + EnableDns = 1, + DisableDns = 2, + CreateInstantAlias = 3, + DeleteInstantAlias = 4, + } + + public partial class DomainActions : ActionListControlBase + { + protected void Page_Load(object sender, EventArgs e) + { + // Remove DNS items if current Hosting plan does not allow it + if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.Dns)) + { + RemoveActionItem(DomainActionTypes.EnableDns); + RemoveActionItem(DomainActionTypes.DisableDns); + } + + // Remove Instant Alias items if current Hosting plan does not allow it + PackageSettings packageSettings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS); + if (packageSettings == null || String.IsNullOrEmpty(packageSettings["InstantAlias"])) + { + RemoveActionItem(DomainActionTypes.CreateInstantAlias); + RemoveActionItem(DomainActionTypes.DeleteInstantAlias); + } + + // hide control if no actions allowed + if (ActionsList.Items.Count <= 1) + { + Visible = false; + } + } + + protected override DropDownList ActionsList + { + get { return ddlDomainActions; } + } + + protected override int DoAction(List ids) + { + switch (SelectedAction) + { + case DomainActionTypes.EnableDns: + return EnableDns(true, ids); + case DomainActionTypes.DisableDns: + return EnableDns(false, ids); + case DomainActionTypes.CreateInstantAlias: + return CreateInstantAlias(true, ids); + case DomainActionTypes.DeleteInstantAlias: + return CreateInstantAlias(false, ids); + } + + return 0; + } + + protected void btnApply_Click(object sender, EventArgs e) + { + switch (SelectedAction) + { + case DomainActionTypes.EnableDns: + case DomainActionTypes.DisableDns: + case DomainActionTypes.CreateInstantAlias: + case DomainActionTypes.DeleteInstantAlias: + FireExecuteAction(); + break; + } + } + + private int EnableDns(bool enable, List ids) + { + foreach (var id in ids) + { + // load domain + DomainInfo domain = ES.Services.Servers.GetDomain(id); + if (domain == null) + continue; + + // load package context + PackageContext cntx = PackagesHelper.GetCachedPackageContext(domain.PackageId); + bool dnsEnabled = cntx.Groups.ContainsKey(ResourceGroups.Dns); + if (!dnsEnabled) + continue; + + int result; + + if (enable) + result = ES.Services.Servers.EnableDomainDns(id); + else + result = ES.Services.Servers.DisableDomainDns(id); + + + if (result < 0) + return result; + } + + return 0; + } + + private int CreateInstantAlias(bool enable, List ids) + { + foreach (var id in ids) + { + // load domain + DomainInfo domain = ES.Services.Servers.GetDomain(id); + if (domain == null) + continue; + + // instant alias + bool instantAliasAllowed = !String.IsNullOrEmpty(domain.InstantAliasName); + if (!instantAliasAllowed || domain.IsDomainPointer || domain.IsInstantAlias) + continue; + + int result; + + if (enable) + result = ES.Services.Servers.CreateDomainInstantAlias("", id); + else + result = ES.Services.Servers.DeleteDomainInstantAlias(id); + + if (result < 0) + return result; + } + + return 0; + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.designer.cs new file mode 100644 index 00000000..9dfafc7e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// 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 DomainActions { + + /// + /// tblActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel tblActions; + + /// + /// ddlDomainActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlDomainActions; + + /// + /// btnApply control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnApply; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx index 5f8ff48f..ec4d44cf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx @@ -2,6 +2,16 @@ <%@ Register Src="Quota.ascx" TagName="Quota" TagPrefix="wsp" %> <%@ Register Src="ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %> <%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> +<%@ Register Src="WebsiteActions.ascx" TagName="WebsiteActions" TagPrefix="wsp" %> + + + + +
@@ -9,7 +19,17 @@ meta:resourcekey="chkRecursive" AutoPostBack="true" Checked="True" CssClass="Normal" />
- + + + + + + +
+ + + +
@@ -19,9 +39,17 @@ + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.cs index a98eef00..3a55d3e5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.cs @@ -108,11 +108,11 @@ namespace WebsitePanel.Portal.UserControls // visibility chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User); - gvItems.Columns[1].Visible = !String.IsNullOrEmpty(ViewLinkText); - gvItems.Columns[2].Visible = gvItems.Columns[3].Visible = + gvItems.Columns[2].Visible = !String.IsNullOrEmpty(ViewLinkText); + gvItems.Columns[3].Visible = gvItems.Columns[4].Visible = (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked; - gvItems.Columns[4].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); - gvItems.Columns[5].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); + gvItems.Columns[5].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); + gvItems.Columns[6].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); if (!IsPostBack) { @@ -206,5 +206,6 @@ namespace WebsitePanel.Portal.UserControls string localizedLinkText = HostModule.GetLocalizedString(ViewLinkText + ".Text"); lnkView.Text = localizedLinkText != null ? localizedLinkText : ViewLinkText; } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.designer.cs index 31363f1d..5dfd3221 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SpaceServiceItems.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -58,6 +30,15 @@ namespace WebsitePanel.Portal.UserControls { /// protected global::System.Web.UI.WebControls.CheckBox chkRecursive; + /// + /// websiteActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.WebsiteActions websiteActions; + /// /// searchBox control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs index b202ca35..8525040c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/UserActions.ascx.cs @@ -42,6 +42,7 @@ using System.Web.UI.HtmlControls; using Microsoft.Web.Services3.Referral; using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.Portal.UserControls; using WebsitePanel.Providers.HostedSolution; namespace WebsitePanel.Portal @@ -57,40 +58,30 @@ namespace WebsitePanel.Portal SetMailboxPlan = 6 } - public partial class UserActions : WebsitePanelControlBase + public partial class UserActions : ActionListControlBase { - public event EventHandler ExecutingUserAction; - - private bool showSetMailboxPlan = false; - public bool ShowSetMailboxPlan - { - get { return showSetMailboxPlan; } - set { showSetMailboxPlan = value; } - } + public bool ShowSetMailboxPlan { get; set; } protected void Page_Load(object sender, EventArgs e) { // Remove Service Level item and VIP item from Action List if current Hosting plan does not allow Service Levels if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels)) { - ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetServiceLevel).ToString())); - ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetVIP).ToString())); - ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.UnsetVIP).ToString())); + RemoveActionItem(UserActionTypes.SetServiceLevel); + RemoveActionItem(UserActionTypes.SetVIP); + RemoveActionItem(UserActionTypes.UnsetVIP); } if (!ShowSetMailboxPlan) - ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetMailboxPlan).ToString())); + RemoveActionItem(UserActionTypes.SetMailboxPlan); } - public UserActionTypes SelectedAction + protected override DropDownList ActionsList { - get - { - return (UserActionTypes)Convert.ToInt32(ddlUserActions.SelectedValue); - } + get { return ddlUserActions; } } - public int DoUserActions(List userIds) + protected override int DoAction(List userIds) { switch (SelectedAction) { @@ -111,15 +102,9 @@ namespace WebsitePanel.Portal return 0; } - protected void DoExecutingUserAction() - { - if (ExecutingUserAction != null) - ExecutingUserAction(this, new EventArgs()); - } - protected void btnModalOk_Click(object sender, EventArgs e) { - DoExecutingUserAction(); + FireExecuteAction(); } protected void btnModalCancel_OnClick(object sender, EventArgs e) @@ -127,11 +112,6 @@ namespace WebsitePanel.Portal ResetSelection(); } - public void ResetSelection() - { - ddlUserActions.ClearSelection(); - } - protected int ChangeUsersSettings(List userIds, bool? disable, int? serviceLevelId, bool? isVIP) { foreach (var userId in userIds) @@ -270,7 +250,7 @@ namespace WebsitePanel.Portal case UserActionTypes.Enable: case UserActionTypes.SetVIP: case UserActionTypes.UnsetVIP: - DoExecutingUserAction(); + FireExecuteAction(); break; case UserActionTypes.SetServiceLevel: FillServiceLevelsList(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx new file mode 100644 index 00000000..4c1aa7cf --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx @@ -0,0 +1,34 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebsiteActions.ascx.cs" Inherits="WebsitePanel.Portal.WebsiteActions" %> + + + + + + + Actions + Stop + Start + RestartAppPool + + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.cs new file mode 100644 index 00000000..2229ae83 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.cs @@ -0,0 +1,125 @@ +// Copyright (c) 2015, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +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 Microsoft.Web.Services3.Referral; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using WebsitePanel.Portal.UserControls; +using WebsitePanel.Providers; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public enum WebsiteActionTypes + { + None = 0, + Stop = 1, + Start = 2, + RestartAppPool = 3, + } + + public partial class WebsiteActions : ActionListControlBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected override DropDownList ActionsList + { + get { return ddlWebsiteActions; } + } + + protected override int DoAction(List ids) + { + switch (SelectedAction) + { + case WebsiteActionTypes.Stop: + return ChangeWebsiteState(false, ids); + case WebsiteActionTypes.Start: + return ChangeWebsiteState(true, ids); + case WebsiteActionTypes.RestartAppPool: + return RestartAppPool(ids); + } + + return 0; + } + + protected void btnApply_Click(object sender, EventArgs e) + { + switch (SelectedAction) + { + case WebsiteActionTypes.Stop: + case WebsiteActionTypes.Start: + case WebsiteActionTypes.RestartAppPool: + FireExecuteAction(); + break; + } + } + + private int ChangeWebsiteState(bool enable, List ids) + { + foreach (var id in ids) + { + var state = enable ? ServerState.Started : ServerState.Paused; + int result = ES.Services.WebServers.ChangeSiteState(id, state); + + if (result < 0) + return result; + } + + return 0; + } + + private int RestartAppPool(List ids) + { + foreach (var id in ids) + { + int result = ES.Services.WebServers.ChangeAppPoolState(id, AppPoolState.Recycle); + + if (result < 0) + return result; + } + + return 0; + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.designer.cs new file mode 100644 index 00000000..10d598a0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/WebsiteActions.ascx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// 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 WebsiteActions { + + /// + /// tblActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel tblActions; + + /// + /// ddlWebsiteActions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlWebsiteActions; + + /// + /// btnApply control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnApply; + } +} 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 eee8579f..ba34a5f0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -843,6 +843,9 @@ DomainControl.ascx + + ASPXCodeBehind + ASPXCodeBehind @@ -891,6 +894,20 @@ ItemButtonPanel.ascx + + DomainActions.ascx + ASPXCodeBehind + + + DomainActions.ascx + + + WebsiteActions.ascx + ASPXCodeBehind + + + WebsiteActions.ascx + UserActions.ascx ASPXCodeBehind @@ -4480,6 +4497,8 @@ + + @@ -4550,6 +4569,8 @@ + + From abf88685dc4765a49a0e5cf727eb23a864bfbdf8 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sun, 15 Feb 2015 12:52:47 -0500 Subject: [PATCH 03/12] Added tag build-2.1.0.583 for changeset 67e9eecba485 From f8e3ccc20ea1d03fa0e71be98849e962f1be4115 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 16 Feb 2015 09:15:53 +0400 Subject: [PATCH 04/12] wsp-10316 fix js --- .../WebsitePanel/UserControls/DomainActions.ascx | 3 +++ .../UserControls/DomainActions.ascx.designer.cs | 9 +++++++++ .../WebsitePanel/UserControls/UserActions.ascx | 2 ++ .../WebsitePanel/UserControls/WebsiteActions.ascx | 3 +++ .../UserControls/WebsiteActions.ascx.designer.cs | 9 +++++++++ 5 files changed, 26 insertions(+) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx index 8e4d30a6..dcaf8417 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx @@ -1,4 +1,7 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainActions.ascx.cs" Inherits="WebsitePanel.Portal.DomainActions" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs index 6924e9eb..f286019a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.designer.cs @@ -12,6 +12,15 @@ namespace WebsitePanel.Portal { public partial class Domains { + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + /// /// btnAddDomain control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx index dcaf8417..8e4d30a6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainActions.ascx @@ -1,7 +1,4 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainActions.ascx.cs" Inherits="WebsitePanel.Portal.DomainActions" %> -<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> - -