﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
        <xsl:variable name="PortalItemID" select="AjaxRequest/Params/PortalItemID"></xsl:variable>
        <xsl:variable name="CommunitiesXML" select="AjaxRequest/CommunitiesXML/."></xsl:variable>
        <xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:variable>
        <xsl:variable name="HostName" select="AjaxRequest/HostName"></xsl:variable>

        <table class="tableMaster" cellpadding="3" cellspacing="3">
            <tr>
                <td colspan="7">
                    <div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray"
                         style="width:130px;line-height:30px;float:right;"
                         onclick="LoadAddCommunityBox('{$PortalItemID}','-99');">
                        <img id="img_Addcommunity" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                        <span id="span_Add" class="capitalFont">Add Community</span>
                    </div>
                </td>
            </tr>
            <tr>
				<td width="14%">
					
				</td>
                <td width="36%">
                    <span class="actionCountText">Name</span>
                </td>
                <td width="40%" >
                    <span class="actionCountText" style="margin-left:65px;">Details</span>
                </td>
                <td width="15%"></td>
            </tr>
            <xsl:for-each select="$CommunitiesXML/Community">
				<xsl:variable name="ImageUrl">
					<xsl:choose>
						<xsl:when test="string-length(ImageURL) &gt; 0">
							<xsl:value-of select="ImageURL"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="ParentImage"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:variable name="ItemID" select="ItemID"></xsl:variable>
				
                <tr>
					<td>
						<img src="{$ImageUrl}" class="img-responsive  image_auto" id="Img_{$ItemID}"></img>
					</td>
                    <td>
                        <span class="publicationSummary onMouseOver" style="font-size:14px;">
                            <a class="publicationSummary onMouseOver" style="text-decoration:none;font-size:14px;color:#6D6E71;"
                               href="http://{$HostName}/{PromoteKey}" target="_blank">
                                <xsl:value-of select="Community"/>
                            </a>
                        </span>
                    </td>
                    <td>
                        <table class="tableMaster" cellpadding="2" cellspacing="2">
                            <tr>
                                <td width="30%" class="textRight verticallyMiddle">
                                    <span class="publicationSummary" style="margin-left:5px;font-size:14px;">Publish:</span>
                                </td>
                                <td width="70%" class="verticallyMiddle">
                                    <span id="span_PublishYN_{CommunityID}" class="publicationSummary onMouseOver"
                                          onmouseover="this.style.textDecoration='underline';"
                                          onmouseout="this.style.textDecoration='none';"
                                          onclick="document.getElementById('span_PublishYN_{CommunityID}').style.display='none';
                                                   document.getElementById('ddlPublish_{CommunityID}').style.display='inline';">
                                        <xsl:choose>
                                            <xsl:when test="PublishYN = 1">
                                                <xsl:text>Yes</xsl:text>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:text>No</xsl:text>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </span>
                                    <select id="ddlPublish_{CommunityID}" class="smallDropdown" style="width:60px;display:none;"
                                            onchange="UpdateCommunityPublishSetting('ddlPublish_{CommunityID}','{ItemID}','span_PublishYN_{CommunityID}');">
                                        <xsl:choose>
                                            <xsl:when test="PublishYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <option value="1">
                                                    <xsl:text>Yes</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>No</xsl:text>
                                                </option>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="textRight verticallyMiddle">
                                    <span class="publicationSummary" style="margin-left:5px;font-size:14px;">Secure:</span>
                                </td>
                                <td class="verticallyMiddle">
                                    <span id="span_Secure_{CommunityID}" class="publicationSummary onMouseOver"
                                          onmouseover="this.style.textDecoration='underline';"
                                          onmouseout="this.style.textDecoration='none';"
                                          onclick="document.getElementById('span_Secure_{CommunityID}').style.display='none';
                                                   document.getElementById('ddlSecure_{CommunityID}').style.display='inline';">
                                        <xsl:choose>
                                            <xsl:when test="PublicYN = 1">
                                                <xsl:text>Open</xsl:text>
                                            </xsl:when>
                                            <xsl:when test="PublicYN = 0">
                                                <xsl:text>Member</xsl:text>
                                            </xsl:when>
                                            <xsl:when test="PublicYN = -1">
                                                <xsl:text>Hidden</xsl:text>
                                            </xsl:when>
                                        </xsl:choose>
                                    </span>
                                    <select id="ddlSecure_{CommunityID}" class="smallDropdown" style="width:70px;display:none;"
                                            onchange="UpdateCommunitySecureSetting('ddlSecure_{CommunityID}','{ItemID}','span_Secure_{CommunityID}');">
                                        <xsl:choose>
                                            <xsl:when test="PublicYN = 1">
                                                <option value="1" selected="selected">
                                                    <xsl:text>Open</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>Member</xsl:text>
                                                </option>
                                                <option value="-1">
                                                    <xsl:text>Hidden</xsl:text>
                                                </option>
                                            </xsl:when>
                                            <xsl:when test="PublicYN = 0">
                                                <option value="1" >
                                                    <xsl:text>Open</xsl:text>
                                                </option>
                                                <option value="0" selected="selected">
                                                    <xsl:text>Member</xsl:text>
                                                </option>
                                                <option value="-1">
                                                    <xsl:text>Hidden</xsl:text>
                                                </option>
                                            </xsl:when>
                                            <xsl:when test="PublicYN = -1">
                                                <option value="1">
                                                    <xsl:text>Open</xsl:text>
                                                </option>
                                                <option value="0">
                                                    <xsl:text>Member</xsl:text>
                                                </option>
                                                <option value="-1" selected="selected">
                                                    <xsl:text>Hidden</xsl:text>
                                                </option>
                                            </xsl:when>
                                        </xsl:choose>

                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="textRight verticallyMiddle">
                                    <span class="publicationSummary" style="margin-left:5px;font-size:14px;"># of Followers:</span>
                                </td>
                                <td class="verticallyMiddle">
                                    <span class="publicationSummary">
                                        <xsl:value-of select="FollowerCount"/>
                                    </span>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <select id="ddlCommAdmin_{CommunityID}" class="smallDropdown"
                                onchange="SelectCommAdminOption('{ItemID}','ddlCommAdmin_{CommunityID}','{$PortalItemID}');">
                            <option value="-99">-Select-</option>
                            <option value="1">Edit</option>
                            <!--<option value="2">Delete</option>-->
                        </select>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>
