<%@ Page Title="" Language="C#" MasterPageFile="~/2ColMaster.Master" AutoEventWireup="true" CodeBehind="ProcessType.aspx.cs" Inherits="ProcessDefinition.ProcessType" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentMain" runat="server">

        <h1>
            <asp:Literal ID="litProcTemplate" runat="server" /></h1>

        <dp:ValidatedTextBox ID="txtTypeName" runat="server" ValidationGroup="pType" LabelText="Type name" Columns="85" AddLineBreak="true" />
            
            <asp:Label runat="server" ID="lblIcon" Text="Icon:" AssociatedControlID="plcIcons" />
            <div id='typeIcon'><asp:PlaceHolder runat="server" ID="plcIcons" /></div>
            
            <div id="iconUpload"> 
            </div> 
            <!--
            <asp:FileUpload ID="uploadIcon" runat="server" /><asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
            -->
            
            <asp:Panel runat="server" ID="pnlTemplateEditor">
            
            <label>Additional default description:</label>
            <div class="postBody">
                <dp:DpHtmlEditorMce ID="htmlType" runat="server" CssClass="htmlEditor" EditorHeight="200px"  
                    EditorWidth="100%" ShowHtmlMode="true">
                    <CustomUserCommands>
                        <dp:CustomUserCommand UserCommand="Images" CommandDialog="~/EditorModals/InsertImageLink.aspx"
                            CommandTitle="Insert Image Link" ButtonUrl="~/App_Themes/Default/images/ImageManager.gif"
                            DialogWidth="850" DialogHeight="600" />
                        <dp:CustomUserCommand UserCommand="Files" CommandDialog="~/EditorModals/InsertFilesLink.aspx"
                            CommandTitle="Insert File Link" ButtonUrl="~/App_Themes/Default/images/TemplateManager.gif"
                            DialogWidth="850" DialogHeight="640" />
                    </CustomUserCommands>
                </dp:DpHtmlEditorMce>
</div>
        <h2>Sections</h2>

       <p style="margin:10px 0px 8px 0px;"> <a href='#' id='addSection' class="ui-corner-all ui-state-default dpButton dpLButton">Add Section</a>    </p>

        <div class="templateBody" id="procTypeTempBody">
        
            <asp:Literal runat="server" ID="litTemplate" EnableViewState="false" />
            
        </div>
        
        <div id="sectionDialog" title="Edit section">
                <dp:JqTextBox ID="sectionName" runat="server" AddLineBreak="true" LabelText="Section name" Columns="60" />
                <dp:JqTextBox ID="tutorialText" runat="server" AddLineBreak="true" LabelText="Tailoring instruction" TextBoxMode="MultiLine" Columns="65" />
                <br />
                <label for='dir'>Direction:</label>
                <input type='radio' name='dir' value='in' title='In' />In
                <input type='radio' name='dir' value='out' title='Out'/>Out
                <input type='radio' name='dir' value='inout' title='InOut'/>InOut
                <br />
                <label for='multip'>Multiplicity:</label>
                <input type='radio' name='multip' value='0..1'/>0..1 
                <input type='radio' name='multip' value='0..n'/>0..N 
                <input type='radio' name='multip' value='1..1'/>1..1 
                <input type='radio' name='multip' value='1..n'/>1..N        
                <br />
                <label for='linkToType'>Links to component type:</label>
                <dp:MissingDropDownList ID="ddlProcessType" runat="server" DataSourceID="odsProcessTypes"
                    DataTextField="ProcessTypeName" DataValueField="ProcessTypeId" AppendDataBoundItems="true" CssClass="ddlProcessType">
                    <asp:ListItem Value="-1" Text="Not specified" />
                </dp:MissingDropDownList>
        </div>                   
    <asp:ObjectDataSource ID="odsProcessTypes" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetProcessTypes" TypeName="DevProcess.ProcessDefinitionService.ProcessDefinitionManager">
        <SelectParameters>
            <asp:Parameter Name="repositoryName" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

        <script id="sectionTemplate" type="text/x-jquery-tmpl">
            <div>
                <h2 data-direction="${direction}" data-multiplicity="${multiplicity}" class="dd_head" data-linktypeid="${linktypeid}" data-linktypename="${linktypename}"><a href="#">${sectionName}</a></h2>
                <div class='section'>
                    <span class="editBar"><span class="edit blueIcon ui-icon ui-icon-pencil" title="Edit section"></span><span class="delete blueIcon ui-icon ui-icon-close" title="Delete section"></span></span>
                    <div class='content'>
                        <blockquote>${tutorialText}</blockquote>
                        {{html sectionContent}}
                    </div>
                </div>                    
            </div>
        </script>

    </asp:Panel>
    <asp:Panel runat="server" ID="pnlEditDirect" Visible="false">
    
    <div class="postBody">
                    
                <dp:DpHtmlEditorMce ID="hBody" runat="server" CssClass="htmlEditor" EditorHeight="700px" EditorWidth="100%" ShowHtmlMode="true">
                    <CustomUserCommands>
                        <dp:CustomUserCommand UserCommand="Images" CommandDialog="~/EditorModals/InsertImageLink.aspx"
                            CommandTitle="Insert Image Link" ButtonUrl="~/App_Themes/Default/images/ImageManager.gif"
                            DialogWidth="850" DialogHeight="600" />
                        <dp:CustomUserCommand UserCommand="Files" CommandDialog="~/EditorModals/InsertFilesLink.aspx"
                            CommandTitle="Insert File Link" ButtonUrl="~/App_Themes/Default/images/TemplateManager.gif"
                            DialogWidth="850" DialogHeight="640" />
                    </CustomUserCommands>
                </dp:DpHtmlEditorMce>     
    </div>
    </asp:Panel>               

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentOptions" runat="server">

    <ul class='ui-widget-content'>
        <li class="btn"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span><a href="../ProcessTypes">Cancel</a></li>
    </ul>
    <ul class='ui-widget-content'>
        <li class="btn btnSave"><span class="ui-icon ui-icon-disk"></span><asp:LinkButton ID="LinkButton1" runat="server" Text="Save" OnClick="btnSave_Click" OnClientClick="javascript:saveTemplate(true);"  />
    </ul>

    <ul class='ui-widget-content' runat="server" id="ulEditDirect">
        <li class="btn btnEdit"><span class="ui-icon ui-icon-pencil"></span><asp:LinkButton ID="LinkButton2" runat="server" Text="Edit directly" OnClick="btnEditDirect_Click" OnClientClick="javascript:saveTemplate(false);"  />
    </ul>

</asp:Content>
