<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CSEasyWMDefinitionOutputFormat.aspx.vb" Inherits="CSEasyWM.CSEasyWMDefinitionOutputFormat" %>
<%@ 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">
        #AssignedCorpTagText span.corptag, .Label
        {
            white-space: nowrap;
        }

        .WaitMessage
        {
            height: 100%;
        }

        div.TaggingControl a:link, div.TaggingControl a:visited,
        div.TaggingControl a:active, div.TaggingControl a:hover
        {
            color: #00F;
            font-size: 10px;
        }

        div.TaggingControl a.disabledTag:link, div.TaggingControl a.disabledTag:visited,
        div.TaggingControl a.disabledTag:hover, div.TaggingControl a.disabledTag:active
        {
            color: #000;
            text-decoration: none;
            cursor: default;
            font-size: 10px;
        }

        div.TaggingControl div.sourceTagsDiv
        {
            width: 196px;
            height: 147px;
            border: 1px solid #7F9DB9;
            font-family: Verdana, Arial, Sans-Serif;
            font-size: 11px;
            line-height: 15px;
            padding-left: 3px;
            overflow: auto;
        }

        div.TaggingControl div.linkedTagsDiv
        {
            width: 198px;
            height: 177px;
            border: 1px solid #7F9DB9;
            font-family: Verdana, Arial, Sans-Serif;
            font-size: 11px;
            line-height: 15px;
            padding-left: 3px;
            overflow: auto;
        }

        div.TaggingControl span.tagHeader,
        div.TaggingControl .tagHeader span
        {
            font-family: Verdana;
            font-size: 11px;
            font-weight: bold;
            height: 13px;
        }

        div.TaggingControl .tagHeaderImg
        {
            float: right;
            width: 10px;
            height: 10px;
            vertical-align: middle;
            border: 0;
            margin: 0px 2px;
        }
        
        #tagControl_InputTagDiv
        {
            width:405px!important;
        }
        button.exButton
        {
            margin-left:2px!important;
        }
        select#NewsType
        {
            float:none;
        }
    </style>
    <script language="javascript" type="text/javascript" src="jquery.js"></script>
    <script language="javascript" type="text/javascript" src="CSEasyWMDefinitionPopup.js"></script>
    <script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $('.tagHeader:eq(1)').text(SysTerm(421223, 'Available columns'));

        $('#DocumentName').focus(function () {
            if ($('#SaveDocument').is(':checked') && $('#DocumentName').val() == '') {
                $('#DocumentName').val('Document.' + $('#Format option:selected').text().toLowerCase());
            }
        });

        $('#SaveDocument').change(function () {
            SaveDocumentClick();
        });
        $('#cfWarning td:nth-child(2)').css('color', 'red');
        $('#cfWarning td:nth-child(2)').css('font-weight', 'bold');
        SaveDocumentClick();

        $('img[src="images/insert.png"').css('cursor', 'pointer');
    });

    var textElementName;
    function ShowInsert(elementName) {
        textElementName = elementName;

        SysShowModalPopup('CSEasyWMDefinitionInsertTag.aspx?DefinitionID=' + SysGet('DefID'), "", "640px", "480px", function () { ModalWindowClosed(); }, null);
    }

    function ModalWindowClosed() {
        var res = SysDialog.returnValue;
        if (res == null || res.length == 0) return;

        var selector = '#' + textElementName;
        $(selector).val($(selector).val() + res[0]);
    }

    function SaveDocumentClick() {
        if ($('#SaveDocument').is(':checked')) {
            $('#cfDocumentSubject').show();
            $('#cfDocumentName').show();
            $('#cfDocumentType').show();
            $('#csDocumentColumns').show();
        } else {
            $('#cfDocumentSubject').hide();
            $('#cfDocumentName').hide();
            $('#cfDocumentType').hide();
            $('#csDocumentColumns').hide();
        }
        ShowHideWarning();
    }
    function ShowHideWarning() {
        if ($('#SaveDocument').is(':checked'))
            $('#cfWarning').hide();
        else
            $('#cfWarning').show();
    }
    </script>
</head>
<body>

<ep:form id="frm" runat="server">

<ex:InputField runat="server" Hidden="True" ID="DoClose" ValidationAs="Int" ValidationDefault="0" CreateClientControl="True" />
<ex:InputField runat="server" Hidden="True" ID="DefID" ValidationAs="Guid" datasource="bc" CreateClientControl="True" />

<ex:CardControl runat="server" ID="Card" Action="Show">
    <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="btnDelete" ButtonStyle="Delete" DataSource="bc" />
        <ex:Button runat="server" ID="btnClose" ButtonStyle="Close" />
    </ex:ButtonBar>

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

    <ex:BCDataSource runat="server" ID="bc" Component="CSEasyWMDefFormats" AddNewProps="DefID" />

    <ex:cardrow runat="server" id="cr">
	    <ex:cardcolumn runat="server" id="cc">
		    <ex:cardsection runat="server" id="csGeneral" caption="Definition format" captionid="421011">
                <ex:cardfield runat="server" id="cfDefinition" caption="WordMerge Definition" captionid="421008" ReadOnly="True">
				    <ex:inputfield runat="server" id="DefIDTitle" datasource="bc" ReadOnly="True" />
			    </ex:cardfield>
			    <ex:cardfield runat="server" id="cfFormat" caption="Output format" captionid="421012">
				    <ex:combobox runat="server" id="Format" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfDefault" caption="Default" captionid="8521">
				    <ex:checkbox runat="server" id="IsDefault" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfWarning" caption="Warning" captionid="3749">
				    <ex:literal runat="server" id="Warning" Caption="You have not selected to save the document. This means that there will be generated 1 document." CaptionID="421054" />
			    </ex:cardfield>
		    </ex:cardsection>
	    </ex:cardcolumn>
    </ex:cardrow>

    <ex:cardrow runat="server" id="crDocument">
	    <ex:cardcolumn runat="server" id="ccDocument">
		    <ex:cardsection runat="server" id="csDocument" caption="Document" captionid="7226">
                <ex:cardfield runat="server" id="cfSaveDocument" caption="Save generated document" captionid="421013">
				    <ex:checkbox runat="server" id="SaveDocument" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfDocumentSubject" caption="Subject" captionid="213">
				    <ex:inputfield runat="server" id="DocumentSubject" datasource="bc" InputSize="90" />
                    <ex:Image runat="server" id="imgDocumentSubject" ImageSource="insert.png" onClick="ShowInsert('DocumentSubject');" ToolTip="Insert field code" ToolTipID="421172" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfDocumentName" caption="Filename" captionid="35018">
				    <ex:inputfield runat="server" id="DocumentName" datasource="bc" InputSize="90" />
                    <ex:Image runat="server" id="imgDocumentName" ImageSource="insert.png" onClick="ShowInsert('DocumentName');" ToolTip="Insert field code" ToolTipID="421172" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfDocumentType" caption="Type" captionid="3801">
				    <ex:combobox runat="server" id="DocumentType" datasource="bc" AutoPostBack="True" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfVersion" caption="Version" captionid="3823" Visible="False">
				    <ex:inputfield runat="server" id="Version" datasource="bc" />
			    </ex:cardfield>
		    </ex:cardsection>
		    <ex:cardsection runat="server" id="csDocumentColumns" caption="Document" captionid="7226" captionsuffix=":Properties" captionsuffixid="19786">
                <ex:cardfield runat="server" id="cfAssociate" caption="Account" captionid="8">
				    <ex:combobox runat="server" id="Associate" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfContact" caption="Contact person" captionid="8484">
				    <ex:combobox runat="server" id="Contact" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfProjectNr" caption="Project" captionid="8657">
				    <ex:combobox runat="server" id="ProjectNr" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfAssortment" caption="Assortment" captionid="222">
				    <ex:combobox runat="server" id="Assortment" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfItemCode" caption="Item" captionid="8702">
				    <ex:combobox runat="server" id="ItemCode" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfOpportunity" caption="Opportunity" captionid="34831">
                    <ex:combobox runat="server" id="Opportunity" datasource="bc" />
                </ex:cardfield>
                <ex:cardfield runat="server" id="cfSecurityLevel" caption="Security level" captionid="209">
				    <ex:combobox runat="server" id="SecurityLevel" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfResource" caption="Person" captionid="12">
				    <ex:combobox runat="server" id="Resource" datasource="bc" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfTagDocument" caption="Tags" captionid="36841">
                    <ex:taggingcontrol runat="server" id="tagDocument"></ex:taggingcontrol>
			    </ex:cardfield>
		    </ex:cardsection>
	    </ex:cardcolumn>
        <ex:cardcolumn runat="server" id="ccRights" visible="false" >
            <ex:cardsection runat="server" id="csRights" caption="Rights" captionid="3194">
                <ex:cardfield runat="server" id="cfRights" caption="Rights" captionid="3194">
					<ex:combobox runat="server" id="OwnerType" allowempty="false" datasource="bc" autopostback="true" >
						<ex:listitem value="0" caption="Creator" captionid="257" captionsuffix="/Owner" captionsuffixid="398" />
						<ex:listitem value="1" caption="Division" captionid="64" captionsuffix="-Document"
									captionsuffixid="7226" />
						<ex:listitem value="2" caption="Division" captionid="64" captionsuffix="-Creator"
									captionsuffixid="257" />
						<ex:listitem value="3" caption="Role" captionid="27454" />
						<ex:listitem value="4" caption="Cost center" captionid="8494" />
						<ex:listitem value="6" caption="Cost center group" captionid="32869" />
						<ex:listitem value="5" caption="Project" captionid="8657" captionsuffix="-Member"
									captionsuffixid="6282" />
					</ex:combobox>
                </ex:cardfield>
                <ex:cardfield runat="server" id="cfOwner" caption="Owner" captionid="398" visible="false">
					<ex:browsefield runat="server" id="Owner" datasource="bc" 
						autopostback="true" browserresultcolumns="humres.res_id,humres.fullname"
						refsql="SELECT fullname FROM humres WHERE res_id=@P1" />
                </ex:cardfield>
                <ex:cardfield runat="server" id="cfRole" caption="Role" captionid="27454" visible="false">
					<ex:browsefield runat="server" id="Role" autopostback="true"
						browsername="HRRole" datafieldreference="Description" browserresultcolumns="ID,Description"
						refsql="SELECT Description FROM HrRoleDefs WHERE ID=@P1" validationas="Int" />
                </ex:cardfield>
                <ex:cardfield runat="server" id="cfCostCenter" caption="Cost center" captionid="8494" visible="false">
					<ex:browsefield runat="server" id="CostCenter" browsername="CostCenter" datafieldreference="kstplcode,oms25_0"
						autopostback="true" browserresultcolumns="kstplcode,oms25_0" 
                        refsql="SELECT oms25_0 FROM kstpl WHERE enabled = 1 AND kstplcode=@P1" />
                </ex:cardfield>
                <ex:cardfield runat="server" id="cfCostCenterGroup" caption="Cost center group" captionid="32869" visible="false">
					<ex:combobox runat="server" id="CostCenterGroup" allowempty="false" />
                </ex:cardfield>
            </ex:cardsection>
        </ex:cardcolumn>
    </ex:cardrow>
</ex:CardControl>

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