<%@ Page Language="C#" MasterPageFile="~/masterpages/eReport.master" AutoEventWireup="true" Inherits="site_Reports_BundleAdmin" Title="eSecuritel: Report Bundle Administration"
    Theme="eMain" Codebehind="BundleAdmin.aspx.cs" %>

<%@ Register Assembly="eSecuritel.HITS.UI.Components" Namespace="eSecuritel.HITS.UI.Components" TagPrefix="cc1" %>
<%@ Register Src = "~/Controls/PopupWindow.ascx" TagPrefix = "uc" TagName = "PopupWindow" %>
<%@ Import Namespace="HITSBundleService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="eContent" runat="Server">
    <h1>
        <asp:Localize ID="Localize1" runat="server" Text="<%$ Resources: ReportsManagement, LabelReportBundleAdministration %>"></asp:Localize></h1>
    <h2>
        <asp:Localize ID="Localize2" runat="server" Text="<%$ Resources: ReportsManagement, LabelCurrentBundleWorkflow %>"></asp:Localize></h2>
    <br />
    <asp:UpdatePanel ID="updateWorkFlowSteps" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div style="margin-bottom:5px;">
                <asp:Label ID="lblNoWorkflowSteps" runat="server" Text="<%$ Resources: ReportsManagement, LabelNoWorkflowStepsSet %>" />
            </div>
            <cc1:HitsSearchGridView ID="grdWorkflowSteps" runat="server" AutoGenerateColumns="False"
                AllowPaging="False" OnRowDataBound="grdWorkflowSteps_RowDatabound" OnMenuItemCommand="grdWorkflowSteps_OnMenuItemCommand"
                ShowMenu="True" ShowSelectField="True" ShowActivateMenu="False" ShowDeActivateMenu="False"
                ShowEmailMenu="False" ShowPrintMenu="False" ShowHotlineMenu="False" ShowDeHotlineMenu="False"
                ShowDeleteMenu="True" ShowNewMenu="True" ShowDeSelectMenu="True" ShowSelectMenu="True"
                ShowExportMenu="False" ShowSetStatus="False" PageSize="20">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center">
                        <itemtemplate>
                    <asp:ImageButton ID="ibtnDown" runat="server" ToolTip="<%$ Resources: ReportsManagement, ToolTipPushGateBackOneStep %>" ImageUrl="~/images/arrow_down_blue.png" OnClick="ibtnDown_Click" CausesValidation="false" />
                    <asp:ImageButton ID="ibtnUp" runat="server" ToolTip="<%$ Resources: ReportsManagement, ToolTipPushGateBackOneStep %>" ImageUrl="~/images/arrow_up_blue.png" OnClick="ibtnUp_Click" CausesValidation="false" />
                </itemtemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources: ReportsManagement, LabelWorkflowSteps %>">
                        <itemtemplate>
                    <asp:Label ID = "lblGate" runat = "server" />
                </itemtemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources: ReportsManagement, LabelUpload %>" ItemStyle-Wrap="false">
                        <itemtemplate>                        
                    <asp:RadioButtonList ID = "rblCanUpload" runat = "server" RepeatDirection="Horizontal" OnSelectedIndexChanged = "rblCanUpload_SelectedIndexChanged">
                        <asp:ListItem Text = "<%$ Resources: ReportsManagement, LabelEnabled %>" Value = "Enabled" />
                        <asp:ListItem Text = "<%$ Resources: ReportsManagement, LabelDisabled %>" Value = "Disabled" />
                    </asp:RadioButtonList>
                </itemtemplate>
                    </asp:TemplateField>
                </Columns>
            </cc1:HitsSearchGridView>
            <asp:Panel ID="pnlNewWorkflowStep" runat="server" Visible="false">
                <h2>
                    <asp:Localize ID="Localize3" runat="server" Text="<%$ Resources: ReportsManagement, LabelCreateNewWorkflowStep %>" /></h2>
                <div class="greyblock">
                    <table class="gvTable">
                        <tr>
                            <td align="right">
                                <asp:Localize ID="Localize4" runat="server" Text="<%$ Resources: ReportsManagement, LabelExistingGateColon %>" />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlExistingWorkflowGates" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td id="tdNewGate1" align="right">
                                <asp:Localize ID="Localize5" runat="server" Text="<%$ Resources: ReportsManagement, LabelNewGateColon %>" />
                            </td>
                            <td id="tdNewGate2">
                                <asp:TextBox ID="txtNewWorkflowGate" runat="server" />
                                <asp:RequiredFieldValidator ID="rfvNewWorkflowGate" runat="server" ControlToValidate="txtNewWorkflowGate"
                                    ValidationGroup="NewWorkflowItem" Text="Required" ErrorMessage="<%$ Resources: ReportsManagement, ErrorYouMustProvideGateName %>"
                                    ToolTip="<%$ Resources: ReportsManagement, ErrorYouMustProvideGateName %>" />
                                <asp:CustomValidator ID = "cvNewWorkflowGate_NameExists" runat = "server" ControlToValidate = "txtNewWorkflowGate"
                                    ValidationGroup="NewWorkflowItem" Text="Invalid" ErrorMessage ="<%$ Resources: ReportsManagement, ErrorGateAlredyExists %>" ToolTip = "<%$ Resources: ReportsManagement, ErrorGateAlredyExists %>"
                                    OnServerValidate = "cvNewWorkflowGate_NameExists_ServerValidate" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                <asp:Localize ID="Localize6" runat="server" Text="<%$ Resources: ReportsManagement, LabelCanUploadColon %>" />
                            </td>
                            <td>
                                <asp:CheckBox ID="chkCanUpload" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Button ID="btnApplyNewWorkflowGate" runat="server" Text="<%$ Resources : ReportsManagement, LabelApply %>" Width="65px"
                                    OnClick="btnApplyNewWorkflowGate_Click" ValidationGroup="NewWorkflowItem" />
                                <asp:Button ID="btnCancelNewWorkflowGate" runat="server" Text="<%$ Resources : Default,ButtonCancel %>" Width="65px"
                                    OnClick="btnCancelNewWorkflowGate_Click" />
                            </td>
                        </tr>
                    </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Button ID = "btnSave" runat = "server" Text = "<%$ Resources : ReportsManagement, LabelSaveWorkflow %>" OnClick = "btnSave_Click" />
    <uc:PopupWindow ID = "ucPopupSaveComplete" runat = "server" />
    <h2>
        <asp:Localize ID="Localize7" runat="server" Text="<%$ Resources : ReportsManagement, LabelManageNotifications %>"></asp:Localize>
    </h2>
    <br />
    <asp:UpdatePanel ID="updateGateEmail" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:GridView ID="grdBundleGateEmailAddresses" runat="server" OnRowDataBound="grdBundleGateEmailAddresses_RowDataBound"
                OnRowEditing="grdBundleGateEmailAddresses_RowEditing" OnRowCancelingEdit="grdBundleGateEmailAddresses_RowCancelingEdit"
                OnRowUpdating="grdBundleGateEmailAddresses_RowUpdating" AutoGenerateColumns="false">
                <Columns>
                    <asp:BoundField HeaderText="<%$ Resources : ReportsManagement, LabelGate %>" DataField="Description" ReadOnly="true" />
                    <asp:TemplateField HeaderText="<%$ Resources : ReportsManagement, LabelEmailAddresses %>">
                        <ItemTemplate>
                            <asp:Label ID="lblEmailAddresses" runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:UpdatePanel ID="update" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td>
                                                <asp:Localize ID="Localize10" runat="server" Text="<%$ Resources : ReportsManagement, LabelNewEmailColon %>" />
                                                <asp:TextBox ID="txtEmailAddress" runat="server" Width="200px" />
                                                <table id="validatorCalloutWrapper">
                                                    <tr>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="rfvEmailAddress" runat="server" ValidationGroup="AddEmailValidationGroup"
                                                                Display="None" ErrorMessage="<%$ Resources : ReportsManagement, ErrorEmailAddressRequired %>" ControlToValidate="txtEmailAddress" />
                                                            <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server"
                                                                TargetControlID="rfvEmailAddress" HighlightCssClass="validatorCalloutHighlight"
                                                                CloseImageUrl="../../images/close.gif" WarningIconImageUrl="../../images/warning.gif" />
                                                            <asp:RegularExpressionValidator ID="revEmailAddress" runat="server" Display="None"
                                                                ValidationGroup="AddEmailValidationGroup" ErrorMessage="<%$ Resources : ReportsManagement, ErrorEmailFormatInvalid %>" 
                                                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmailAddress" />
                                                            <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server"
                                                                TargetControlID="revEmailAddress" HighlightCssClass="validatorCalloutHighlight"
                                                                CloseImageUrl="../../images/close.gif" WarningIconImageUrl="../../images/warning.gif" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td>
                                                <div>
                                                    <asp:ImageButton ID="ibtnAddEmailAddress" runat="server" ValidationGroup="AddEmailValidationGroup"
                                                        ImageUrl="~/images/arrow_right_24.png" OnClick="ibtnAddEmailAddress_Click" />
                                                </div>
                                                <div style="margin-top: 10px;">
                                                    <asp:ImageButton ID="ibtnRemoveEmailAddress" runat="server" CausesValidation="false"
                                                        ImageUrl="~/images/arrow_left_24.png" OnClick="ibtnRemoveEmailAddress_Click" />
                                                </div>
                                            </td>
                                            <td>
                                                <asp:ListBox ID="lbEmailAddresses" runat="server" Width="250px" />
                                            </td>
                                        </tr>
                                    </table>       
                                    <asp:HiddenField ID="hdnBundleGateDescription" runat="server" />                             
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </EditItemTemplate>
                    </asp:TemplateField>                   
                    <asp:CommandField ShowEditButton="true" />
                </Columns>
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
