﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">

        <xsl:variable name="statusID" select="normalize-space(EditAdGroup/AdGroup/StatusID)"/>

        <table class="tableMaster" style="margin: 10px;">
            <tr>
                <td>
                    <span class="label">Group Name</span>
                </td>
                <td>
                    <input id="txt_AdGroup_Title" type="text"
                               runat="server" class="text" value ="{normalize-space(EditAdGroup/AdGroup/GroupName)}" maxlength="50"/>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="label">Description</span>
                </td>
                <td>
                    <input id="txt_AdGroup_Description" type="text" runat="server" class="text" value ="{normalize-space(EditAdGroup/AdGroup/Description)}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="label">Priority</span>
                </td>
                <td>
                    <input id="txt_AdGroup_Priority" type="text" runat="server" class="text" value ="{normalize-space(EditAdGroup/AdGroup/Priority)}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="label">Status</span>
                </td>
                <td>
                    <select id="ddl_AdGroup_Status" name="status" class="dropdown">
                        <xsl:for-each select="EditAdGroup/AdStatuses/Status">
                            <xsl:if test ="$statusID = ID">
                                <option value="{ID/.}" selected="selected">
                                    <xsl:value-of select="normalize-space(Status/.)"/>
                                </option>
                            </xsl:if>
                            <xsl:if test ="$statusID != ID">
                                <option value="{ID/.}">
                                    <xsl:value-of select="normalize-space(Status/.)"/>
                                </option>
                            </xsl:if>
                        </xsl:for-each>

                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="label lineHeight">Category Keys</span>
                </td>
                <td>
                    <table class="tableMaster" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td width="46%">
                                <select id="listLeftCategoryKeys" size="15" style="height:100%;width:100%;">
                                    <xsl:for-each select="EditAdGroup/CategoryList/Item">
                                        <xsl:variable name="CategoryItemID" select="ID"></xsl:variable>
                                        <xsl:if test="count(../../AdGroup/Categories/Category[AdCategoryID = $CategoryItemID]) = 0">
                                            <option style="font-family: Calibri, Verdana, Arial; font-size: 8pt; line-height: 1.5em;" value="{ID/.}">
                                                <xsl:value-of select="normalize-space(Name/.)"/>
                                            </option>
                                        </xsl:if>
                                    </xsl:for-each>
                                </select>
                            </td>
                            <td width="5%">
                                <div>
                                    <input type="button" class="button" value="&gt;" onclick="publication_MoveCategoryKeysList(this)"></input>
                                </div>&#xa0;
                                <div>
                                    <input type="button" class="button" value="X" onclick="publication_MoveCategoryKeysList(this)"></input>
                                </div>
                            </td>
                            <td width="46%">
                                <select id="listRightCategoryKeys" size="15" style="height:100%;width:100%;">
                                    <xsl:for-each select="EditAdGroup/AdGroup/Categories/Category">
                                        <option style="font-family: Calibri, Verdana, Arial; font-size: 8pt; line-height: 1.5em;" value="{AdCategoryID/.}">
                                            <xsl:value-of select="normalize-space(CategoryName/.)"/>
                                        </option>
                                    </xsl:for-each>
                                </select>
                            </td>
                            <td width="3%"></td>                            
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="button" class="button" value="Update"
                           onClick="return updateAdGroup({normalize-space(EditAdGroup/AdGroupID)},
                                                       'txt_AdGroup_Title', 
                                                       'txt_AdGroup_Description', 
                                                       'ddl_AdGroup_Status',
                                                       'txt_AdGroup_Priority',
                                                       'listRightCategoryKeys',
                                                       'divAdGroup_Operation');"></input>
                </td>
                <td>
                    <input type="button" class="button" value="Cancel"
                           onclick='return Ads_CloseUpdateMode("divAdGroup_Operation");'>
                    </input>
                </td>
            </tr>
        </table>
    </xsl:template>
</xsl:stylesheet>
