<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CSEasyScriptSection.aspx.vb" Inherits="CSEasyScript.CSEasyScriptSection" %>
<%@ register tagprefix="ex" namespace="Exact.Web.UI.Controls" assembly="Exact.Web.UI.Controls" %>

<html>
<head>
	<meta name="save" content="history" />
	<link rel="stylesheet" type="text/css" href="Exact.css" />
    <style type="text/css">
        #Criteria, #Script
        {
            font-family: Consolas, Courier New, Courier, monospace !important;
        }
    </style>
    <script type="text/javascript">
        function TranslateSubmit() {
            SysSet('DoTranslate', 1);
            SysSet('BCAction', 7);
            SysSubmit(1);
        }

        function showTranslate(url) {
            var callback = function () {
                SysSet('BCAction', 7);
                SysSubmit(1);
            }
            var wh = ($(window).height() / 100) * 90;
            var ww = ($(window).width() / 100) * 40;
            SysShowModalPopup(url, null, ww + 'px', wh + 'px', callback);
        }

        function ShowWizard(type) {
            var url = 'CSEasyScriptSectionWizard.aspx?MyPageMode=' + type + '&PageID=' + SysGetValue('PageID') + "&IsRequest=" + SysGetValue('IsRequest') + "&IsSearch=" + SysGetValue('IsSearch');

            var callback = function () {
                if (SysDialog.returnValue != null && SysDialog.returnValue != '') {
                    var CurrentScript = SysGetValue('Script');
                    if (CurrentScript != null && CurrentScript != '')
                        CurrentScript += '\r\r';

                    CurrentScript += SysDialog.returnValue;

                    SysSetValue('Script', CurrentScript);
                }
            }

            var wh = ($(window).height() / 100) * 90;
            var ww = ($(window).width() / 100) * 90;
            SysShowModalPopup(url, null, ww + 'px', wh + 'px', callback);
        }

        function MoveUpDown(direction, id) {
            SysSetValue('MoveDirection', direction);
            SysSetValue('MoveID', id);
            SysSubmit(1);
        }
        function ChangeActive(id) {
            SysSetValue('ChangeActiveID', id);
            SysSubmit(1);
        }

        function AddProperty(comboID, textareaID) {
            var PropName = $('#' + comboID).val();
            if (PropName != '') {
                var c = document.getElementById(textareaID);
                if (c != null) {
                    var s = '@' + PropName + ' ';
                    SysInsertAtCaret(c, s);
                    c.focus();
                }
                $('#' + comboID).val('');
            }
        }
    </script>
</head>
<body>

	<ep:form id="frm" runat="server">
        <ex:InputField runat="server" ID="DoTranslate" CreateClientControl="True" Hidden="True" ValidationAs="Int" ValidationDefault="0" />

        <ex:InputField runat="server" ID="FilterEnabled" CreateClientControl="True" Hidden="True" ValidationAs="Int" ValidationDefault="-1" />
        <ex:InputField runat="server" ID="FilterTitleOperator" CreateClientControl="True" Hidden="True" ValidationAs="Int" ValidationDefault="-1" />
        <ex:InputField runat="server" ID="FilterTitle" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="FilterSectionType" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="FilterTabPage" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="FilterPage" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="FilterModified_From" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="FilterModified_To" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="MoveDirection" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="MoveID" CreateClientControl="True" Hidden="True" ValidationAs="Guid" />
        <ex:InputField runat="server" ID="ChangeActiveID" CreateClientControl="True" Hidden="True" ValidationAs="Guid" />
        <ex:InputField runat="server" ID="IsRequest" CreateClientControl="True" Hidden="True" />
        <ex:InputField runat="server" ID="IsSearch" CreateClientControl="True" Hidden="True" />

        <ex:CardControl runat="server" ID="Card" Action="Show" Customizable="false">

            <ex:Header runat="server" ID="hdr">
            </ex:Header>

            <ex:headerproperties runat="server" id="hdrProps" headerpropertiesstyle="CreatedModified" datasource="bc" 
                datafieldcreated="Created" datafieldcreator="Creator" datafieldcreatorname="CreatorFullName"
	            datafieldmodified="Modified" datafieldmodifier="Modifier" datafieldmodifiername="ModifierFullName" />

            <ex:ButtonBar runat="server" ID="Buttons">
                <ex:Button runat="server" ID="btnSave" ButtonStyle="Save" DataSource="bc" />
                <ex:Button runat="server" ID="btnSaveNew" ButtonStyle="SaveNew" DataSource="bc" />
                <ex:Button runat="server" ID="btnDelete" ButtonStyle="Delete" DataSource="bc" />
                <ex:Button runat="server" ID="btnClose" ButtonStyle="Close" />
            </ex:ButtonBar>

            <ex:bcerrormessages runat="server" id="errMsg" />

            <ex:BCDataSource runat="server" ID="bc" Component="CSEasyScriptSections" AddNewProps="PageID,ParentSectionID" />
                
              <ex:cardrow runat="server" id="cr">
	            <ex:cardcolumn runat="server" id="cc">
		            <ex:cardsection runat="server" id="csPage" caption="Page" captionid="8435">
			            <ex:cardfield runat="server" id="cfPage" caption="Page" captionid="8435">
				            <ex:combobox runat="server" id="PageID" datasource="bc" AutoPostBack="True" />
			            </ex:cardfield>
                    </ex:cardsection>
                    <ex:cardsection runat="server" id="csTitle" caption="Title" captionid="10189">
			            <ex:cardfield runat="server" id="cfTitle" caption="Title" captionid="10189">
				            <ex:inputfield runat="server" id="Caption" datasource="bc" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfCaptionID" caption="Term" captionid="991" CaptionSuffix=":ID" CaptionSuffixID="0">
				            <ex:inputfield runat="server" id="CaptionID" datasource="bc" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfTitleTranslated" caption="Title" captionid="10189" CaptionSuffix=":Translated" CaptionSuffixID="21600">
				            <div style="width:16;cursor:pointer" class="imgButton"><ex:image runat="server" id="imgTerm" onClick="TranslateSubmit();" imagesource="doc_edit.svg" tooltip="Edit the label for this field and translate it to other languages" tooltipid="37576" /></div> <ex:image runat="server" id="imgTranslated" onClick="TranslateSubmit();" imagesource="check.svg" tooltip="Translated" tooltipid="21600" Visible="False" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfSectionType" caption="Type" captionid="3801">
                            <ex:combobox runat="server" id="SectionType" datasource="bc" Autopostback="True" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfShowCaption" caption="Show" captionid="8804" CaptionSuffix=":Title" CaptionSuffixID="10189">
		                    <ex:checkbox runat="server" id="ShowCaption" datasource="bc" />
	                    </ex:cardfield>
                        <ex:cardfield runat="server" id="cfEnabled" caption="Enabled" captionid="9086">
		                    <ex:checkbox runat="server" id="Enabled" datasource="bc" />
	                    </ex:cardfield>
                        <ex:cardfield runat="server" id="cfDescription" caption="Description" captionid="4243">
                            <ex:memofield runat="server" id="Description" datasource="bc" width="100%" height="6" htmlencoded="False" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfRoleIDs" caption="Role" captionid="27454">
                            <ex:BrowseField runat="server" id="RoleIDs" BrowserName="HRRole" InputHidden="True" Multiple="True" BrowserResultColumns="ID,Description" BrowserWhereClause="Type in (0, 1)" RefSQL="select Description from HRRoleDefs where ID = @P1" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfParentSectionID" caption="Parent" captionid="275" captionsuffix=":Tab" captionsuffixid="15938">
                            <ex:combobox runat="server" id="ParentSectionID" datasource="bc" AutoPostBack="True" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfFullRow" caption="Row" captionid="2655" CaptionSuffix=":Complete" CaptionSuffixID="8471">
		                    <ex:checkbox runat="server" id="FullRow" datasource="bc" />
	                    </ex:cardfield>
                    </ex:cardsection>
                    <ex:cardsection runat="server" id="csScript" caption="Script" captionid="0">
			            <ex:cardfield runat="server" id="cfScript" caption="Script" captionid="0">
                            <ex:memofield runat="server" id="Script" datasource="bc" width="100%" height="24" htmlencoded="False" />
                            <ex:Button runat="server" ID="btnAddEasyList" ButtonStyle="Custom" Visible="False" Caption="Add" CaptionID="8343" CaptionSuffix=":Easy List" CaptionSuffixID="0" OnClick="ShowWizard(1);" />
                            <ex:Button runat="server" ID="btnAddButtons" ButtonStyle="Custom" Visible="False" Caption="Add" CaptionID="8343" CaptionSuffix=":Buttons" CaptionSuffixID="22116" OnClick="ShowWizard(2);" />
                            <ex:Button runat="server" ID="btnAddButtonsToButtonBar" ButtonStyle="Custom" Visible="False" Caption="Add" CaptionID="8343" CaptionSuffix=":Knoppen op knoppenbalk" CaptionSuffixID="0" OnClick="ShowWizard(5);" />
                            <ex:Button runat="server" ID="btnAddMonitor" ButtonStyle="Custom" Visible="False" Caption="Add" CaptionID="8343" CaptionSuffix=":Monitor" CaptionSuffixID="225" OnClick="ShowWizard(3);" />
                            <ex:Button runat="server" ID="btnAddMonitorReplace" ButtonStyle="Custom" Visible="False" Caption="Add" CaptionID="8343" OnClick="ShowWizard(4);" />
			            </ex:cardfield>
		            </ex:cardsection>
                    <ex:cardsection runat="server" id="csCriteria" caption="Criteria" captionid="9822">
                        <ex:cardfield runat="server" id="cfConnection" caption="Connection" captionid="27055">
                            <ex:combobox id="Connection" runat="server" datasource="bc" />
			            </ex:cardfield>
			            <ex:cardfield runat="server" id="cfIsSqlCriteria" caption="Criteria" captionid="9822" captionsuffix=":SQL" captionsuffixid="280804">
                            <ex:checkbox runat="server" id="IsSqlCriteria" datasource="bc" AutoPostback="True" />
			            </ex:cardfield>
			            <ex:cardfield runat="server" id="cfCriteria" caption="Criteria" captionid="9822">
                            <ex:memofield runat="server" id="Criteria" datasource="bc" width="100%" height="4" htmlencoded="False" />
                            <ex:combobox runat="server" id="cmbPropsCriteria" AllowEmpty="True" /><ex:button runat="server" id="btnPropsCriteria" buttonstyle="Custom" Caption="Add" CaptionID="8343" OnClick="AddProperty('cmbPropsCriteria', 'Criteria');" />
			            </ex:cardfield>
                        <ex:cardfield runat="server" id="cfTableName" caption="Table name" captionid="10700">
                            <ex:inputfield runat="server" id="PageTableName" datasource="bc" ReadOnly="True" />
			            </ex:cardfield>
		            </ex:cardsection>
                    <ex:cardlistview runat="server" id="csSections" showheader="False" customizecolumns="False" customizerows="False" caption="Tabs" captionid="41469">
	                    <ex:listview runat="server" id="List" caption="Tabs" captionid="41469" onquery="List_OnQuery" ongetdata="List_OnGetData" showwaitmessage="True" ScrollBar="None" ShowPageSize="False">
                            <Columns>
				                <ex:listviewcolumn runat="server" id="colCaption" width="93%" caption="Title" captionid="10189" />
				                <ex:listviewcolumn runat="server" id="colEnabled" width="5%" caption="Enabled" captionid="9086" />
                                <ex:listviewcolumn runat="server" id="colUp" width="1%" caption="" captionid="0" />
                                <ex:listviewcolumn runat="server" id="colDown" width="1%" caption="" captionid="0" />
                            </Columns>
		                </ex:listview>
		                <ex:bcerrormessages runat="server" id="errNoDataFound" Mode="Notification" />
                    </ex:cardlistview>
                    </ex:cardsection>
	            </ex:cardcolumn>
            </ex:cardrow>

        </ex:CardControl>
    </ep:form>
</body>
</html>
