﻿<?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"  omit-xml-declaration ="yes"/>
  <xsl:template match="/">
    <xsl:variable name="BrandID" select="normalize-space(Publication/BrandID)"></xsl:variable>
    <xsl:variable name="BrandCommunityID" select="normalize-space(Publication/BrandCommunityID)"></xsl:variable>
    <xsl:variable name="Mode" select="normalize-space(Publication/Mode)"></xsl:variable>
    <xsl:variable name="TemplateURL" select="normalize-space(Publication/TemplateURL)"></xsl:variable>
    <xsl:variable name="SelectedStatus" select="normalize-space(Publication/SelectedStatus)"></xsl:variable>
    <xsl:variable name="Search" select="normalize-space(Publication/Search)"></xsl:variable>
    <xsl:variable name="SelectedTypeFilter" select="normalize-space(Publication/SelectedTypeFilter)"></xsl:variable>

    <table id="tblCommunityAdmin" class="tableMaster" cellpadding="5" cellspacing="0">
      <xsl:choose>
        <xsl:when test="count(Publication/Output/Item) &gt; 0">
          <tr>
            <td  align="right" class="paddingTop20 paddingBottom20" style="font-weight:bold;width:100%;" colspan="5">
              <div style="width:42%">
                <xsl:choose>
                  <xsl:when test="$SelectedStatus=0">
                    <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                  </xsl:when>
                  <xsl:when test="$SelectedStatus !=6 and $SelectedStatus !=7 and $SelectedStatus !=8">
                    <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                  </xsl:when>
                  <xsl:otherwise>
                    <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                  </xsl:otherwise>
                </xsl:choose>

                <xsl:choose>
                  <xsl:when test="$SelectedStatus=6">
                    <div id="DivContent-Featured" style="float:left;width:20%" StatusID="6" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',6)">Featured</div>
                  </xsl:when>
                  <xsl:otherwise>
                    <div id="DivContent-Featured" style="float:left;width:20%" StatusID="6" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',6)">Featured</div>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:choose>
                  <xsl:when test="$SelectedStatus=7">
                    <div id="DivContent-HelpDesk" style="float:left;width:20%" StatusID="7" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',7)">Help Desk</div>
                  </xsl:when>
                  <xsl:otherwise>
                    <div id="DivContent-HelpDesk" style="float:left;width:20%" StatusID="7" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',7)">Help Desk</div>
                  </xsl:otherwise>
                </xsl:choose>

                <xsl:choose>
                  <xsl:when test="$SelectedStatus=8">
                    <div id="DivContent-Resources" style="float:left;width:20%" StatusID="8" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',8)">Resources</div>
                  </xsl:when>
                  <xsl:otherwise>
                    <div id="DivContent-Resources" style="float:left;width:20%" StatusID="8" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',8)">Resources</div>
                  </xsl:otherwise>
                </xsl:choose>

              </div>
              <div style="float:left;width:26%;    margin-top: 0.9%;
    margin-left: 1%;" >
                <span class="packageTitle"> Search:</span>
                <input style="" type="text" id="txt_Title_Description_Tag_Search" onblur="ClientPortal_LoadClinetCommunityData_Search('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}',event,0)"      onkeyup="ClientPortal_LoadClinetCommunityData_Search('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}',event,1)" value="{$Search}"></input>
              </div>
              <div style="float:left ;width:20%;margin-top: 0.9%;" >
                <select  class="smallDropdown"  style="" id="ddl_Type_Search" onchange="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}')">
                  <option value="-1">Select Type</option>
                  <xsl:for-each select="Publication/ContentType/Type">
                    <xsl:choose>
                      <xsl:when test="$SelectedTypeFilter=Name">
                        <option value="{Name/.}" selected="selected">
                          <xsl:value-of select="normalize-space(Name/.)"/>
                        </option>
                      </xsl:when>
                      <xsl:otherwise>
                        <option value="{Name/.}">
                          <xsl:value-of select="normalize-space(Name/.)"/>
                        </option>

                      </xsl:otherwise>
                    </xsl:choose>

                  </xsl:for-each>
                </select>

              </div>
              <div  class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:120px;line-height:30px;float:right;"
                  onmouseover="document.getElementById('img_AddContent').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                  onmouseout="document.getElementById('img_AddContent').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                  onclick="Portal_LoadAddCommunityContent('{$BrandCommunityID}','{$BrandID}','{$Mode}', 'divClientPortalOperations_Container','{$SelectedStatus}');">
                <img id="img_AddContent" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                <span id="span_AddContent" class="capitalFont">Add Content</span>
              </div>
            </td>
          </tr>
          <xsl:if test="count(Publication/Output/Item) &gt; 0">
            <tr  style="padding: 20px; border-style: solid; border-width: thin; border-top-color: #000080;">
              <!--<td width="15%" valign="top">
                                <span class="packageTitle">Community</span>
                            </td>-->
              <td width="65%" colspan="2" >
                <span class="packageTitle">Content</span>
              </td>
              <td width="20%">
                <span class="packageTitle">Posted By</span>
              </td>
              <td width="15%" align="right" style="padding-right: 10px;">
                <span class="packageTitle">Admin</span>
              </td>
              <td></td>
            </tr>
          </xsl:if>
          <xsl:for-each select="Publication/Output/Item">
            <xsl:variable name="display">
              <xsl:choose>
                <xsl:when test="position() mod 2 = 0">
                  <xsl:text>background-color: #DCDCDC;</xsl:text>
                </xsl:when>
                <xsl:when test="position() mod 2 != 0">
                  <xsl:text></xsl:text>
                </xsl:when>
              </xsl:choose>
            </xsl:variable>

            <tr id="tr_item_{normalize-space(ContentItemID)}" style="{$display}">
              <td width="10%" valign="top">
                <xsl:choose>
                  <xsl:when test="normalize-space(imageAttach) != ''">
                    <a class="link" target="_blank" href="Content.aspx?ID={normalize-space(ContentItemID)}">
                      <img style="display:inline; margin-left: 0px; vertical-align: middle; display: none;"
                             src="{normalize-space(imageAttach)}" onload='setWidthAndHeightImage(this,"100");'/>
                    </a>
                  </xsl:when>
                  <xsl:otherwise>
                    <a class="link" target="_blank" href="Content.aspx?ID={normalize-space(ContentItemID)}">
                      <img style="display:inline; margin-left: 0px; vertical-align: middle; display: none;"
                             src="{$TemplateURL}Web/Images/Ver_2_0/WEB-GENERIC-Icon.png" onload='setWidthAndHeightImage(this,"100");'/>
                    </a>

                  </xsl:otherwise>
                </xsl:choose>

              </td>
              <td width="55%" valign="top">
                <div class="packageTitle" style="display: inline;">

                  <a class="link" target="_blank" href="Content.aspx?ID={normalize-space(ContentItemID)}" style="font-weight: normal;">
                    <span class="packageTitle">
                      <xsl:value-of select="ContentName"/>
                    </span>
                    <!--<span class="publicationSummary"> (Open)</span>-->
                  </a>
                </div>
                <div class="label" style="color: rgb(55, 96, 146); text-align: justify;">
                  <xsl:value-of select="ContentMemo"/>
                </div>
              </td>
              <td width="20%" valign="top">
                <div style="color: rgb(55, 96, 146);" class="label">
                  <xsl:variable name="Status" select ="Status"></xsl:variable>
                  <span class="packageTitle">Status</span>

                  <a href="#" id="anc_{normalize-space(ContentItemID)}"
                     onClick="return content_EditStatus('anc_{normalize-space(ContentItemID)}','ddl_{normalize-space(ContentItemID)}')" style="padding-left:5px; color:black;">
                    <span class="publicationSummary">
                      <xsl:value-of select="Status"/>
                    </span>
                  </a>
                  <select class="smallDropdown" style="display:none;font-size:8pt;" id="ddl_{normalize-space(ContentItemID)}"
                                 onChange="return content_UpdateStatus('{normalize-space(ContentItemID)}','anc_{normalize-space(ContentItemID)}','ddl_{normalize-space(ContentItemID)}')">
                    <xsl:for-each select="../../ContentStatus/Status">
                      <xsl:if test="StatusText = $Status">
                        <option value="{ID}" selected="selected"  >
                          <xsl:value-of select="StatusText"/>
                        </option>
                      </xsl:if>

                      <xsl:if test="StatusText != $Status">
                        <option value="{ID}" >
                          <xsl:value-of select="StatusText"/>
                        </option>
                      </xsl:if>
                    </xsl:for-each>
                  </select>
                </div>
                <div  style="color: rgb(55, 96, 146);" class="label">
                  <xsl:variable name="Type" select ="Type"></xsl:variable>
                  <span class="packageTitle">Type</span>
                  <a href="#" id="anc_Type_{normalize-space(ContentItemID)}"
                    onClick="return content_EditType('anc_Type_{normalize-space(ContentItemID)}','ddl_Type_{normalize-space(ContentItemID)}')"  style="padding-left:5px; color:black;margin-left:9.5px;">
                    <span class="publicationSummary">
                      <xsl:value-of select="Type"/>
                    </span>
                  </a>
                  <select class="smallDropdown" style="display:none;font-size:8pt;margin-left:9.5px;" id="ddl_Type_{normalize-space(ContentItemID)}" onChange="return content_UpdateType('{normalize-space(ContentItemID)}','anc_Type_{normalize-space(ContentItemID)}','ddl_Type_{normalize-space(ContentItemID)}')">
                    <xsl:for-each select="../../ContentType/Type">
                      <xsl:choose>
                        <xsl:when test="Name=$Type">
                          <option value="{ID/.}" selected="selected">
                            <xsl:value-of select="normalize-space(Name/.)"/>
                          </option>
                        </xsl:when>
                        <xsl:otherwise>
                          <option value="{ID/.}">
                            <xsl:value-of select="normalize-space(Name/.)"/>
                          </option>
                        </xsl:otherwise>
                      </xsl:choose>


                    </xsl:for-each>
                  </select>
                </div>
                <div class="packageTitle">
                  <a href="#" style="text-decoration: underline;"
                      onClick='return filterOwner("{normalize-space(OwnerID)}", "tblCommunityAdmin");'>
                    <span class='publicationSummary'>
                      <xsl:value-of select="OwnerName"/>
                    </span>
                  </a>
                </div>
                <div class="publicationSummary">
                  <xsl:value-of select="CreatedDate"/>
                </div>


              </td>
              <td width="15%" valign="top">
                <div class="verticallyMiddle marginBottom10">
                  <select id="ddl_AdminAction_{normalize-space(ContentItemID)}" class="smallDropdown" style="font-size:8pt;" onchange="return ContentAdmin_Action('{normalize-space(ContentItemID)}','{normalize-space(ParentID)}')">
                    <option value="-99">
                      --Select Action--
                    </option>
                    <option value="1">Update</option>
                    <option value="2">Delete</option>
                  </select>
                </div>
                <!--<div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray marginBottom10 textCenter" style="width:70px;line-height:25px;">
                                    <a href="AddCommunityContent.aspx?ID={normalize-space(ParentID)}&amp;ItemID={normalize-space(ContentItemID)}"
                                        style="text-decoration: none;font-family: 'PT Sans' , sans-serif;font-size: 13px;color: #4B4B4B;" target="_blank">
                                        <span id="span_UpdateContent" class="capitalFont onMouseOver">Update</span>
                                    </a>
                                </div>
                                <div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray textCenter" style="width:70px;line-height:25px;"
                                      onclick='return deleteContent("{normalize-space(ContentItemID)}","tr_item_{normalize-space(ContentItemID)}");'>
                                    <span id="span_UpdateContent" class="capitalFont onMouseOver">Delete</span>
                                </div>-->

                <div class="publicationSummary">
                  Views: <xsl:value-of select="ViewCount"/>
                </div>
                <!--<div class="publicationSummary">
                                    Likes: <xsl:value-of select="Like"/>% &#xa0; Dislikes: <xsl:value-of select="Dislike"/>%
                                </div>-->
              </td>
              <td>
                <input type="hidden" id="tr_item_{normalize-space(ContentItemID)}_hiddenCommunityItemID" value="{normalize-space(ParentID)}"></input>
                <input type="hidden" id="tr_item_{normalize-space(ContentItemID)}_hiddenOwnerID" value="{normalize-space(OwnerID)}"></input>
              </td>
            </tr>
          </xsl:for-each>

          <tr>
            <td align="right" class="paddingTop20 paddingBottom20" style="font-weight:bold;" colspan="5">
              <div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:12%;line-height:30px;float:right;"
                 onmouseover="document.getElementById('img_AddContent2').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                 onmouseout="document.getElementById('img_AddContent2').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                 onclick="Portal_LoadAddCommunityContent('{$BrandCommunityID}','{$BrandID}','{$Mode}', 'divClientPortalOperations_Container','{$SelectedStatus}');">
                <img id="img_AddContent2" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                <span id="span_AddContent2" class="capitalFont">Add Content</span>
              </div>
            </td>
          </tr>
        </xsl:when>
        <xsl:otherwise>
          <table class="tableMaster" cellpadding="5" cellspacing="0">
            <tr>
              <td  align="right" class="paddingTop20 paddingBottom20" style="font-weight:bold;width:100%;" colspan="5">
                <div style="width:42%">
                  <xsl:choose>
                    <xsl:when test="$SelectedStatus=0">
                      <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                    </xsl:when>
                    <xsl:when test="$SelectedStatus !=6 and $SelectedStatus !=7 and $SelectedStatus !=8">
                      <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                    </xsl:when>
                    <xsl:otherwise>
                      <div id="DivContent-ALL" style="float:left;width:20%" StatusID="0" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',0)">All</div>
                    </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                    <xsl:when test="$SelectedStatus=6">
                      <div id="DivContent-Featured" style="float:left;width:20%" StatusID="6" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',6)">Featured</div>
                    </xsl:when>
                    <xsl:otherwise>
                      <div id="DivContent-Featured" style="float:left;width:20%" StatusID="6" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',6)">Featured</div>
                    </xsl:otherwise>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="$SelectedStatus=7">
                      <div id="DivContent-HelpDesk" style="float:left;width:20%" StatusID="7" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',7)">Help Desk</div>
                    </xsl:when>
                    <xsl:otherwise>
                      <div id="DivContent-HelpDesk" style="float:left;width:20%" StatusID="7" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',7)">Help Desk</div>
                    </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                    <xsl:when test="$SelectedStatus=8">
                      <div id="DivContent-Resources" style="float:left;width:20%" StatusID="8" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',8)">Resources</div>
                    </xsl:when>
                    <xsl:otherwise>
                      <div id="DivContent-Resources" style="float:left;width:20%" StatusID="8" class="packageTitle textCenter onMouseOver singleCellLayoutSubMenuUnSelected" onClick="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container',8)">Resources</div>
                    </xsl:otherwise>
                  </xsl:choose>

                </div>
                <div style="float:left;width:26%;    margin-top: 0.9%;
    margin-left: 1%;" >
                  <span class="packageTitle"> Search:</span>
                  <input style="" type="text" id="txt_Title_Description_Tag_Search" onblur="ClientPortal_LoadClinetCommunityData_Search('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}',event,0)"      onkeyup="ClientPortal_LoadClinetCommunityData_Search('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}',event,1)" value="{$Search}"></input>
                </div>
                <div style="float:left ;width:20%;margin-top: 0.9%;" >
                  <select  class="smallDropdown"  style="" id="ddl_Type_Search" onchange="ClientPortal_LoadClinetCommunityData_ByTab('{$Mode}','{$BrandID}','divClientPortalOperations_Container','{$SelectedStatus}')">
                    <option value="-1">Select Type</option>
                    <xsl:for-each select="Publication/ContentType/Type">
                      <xsl:choose>
                        <xsl:when test="$SelectedTypeFilter=Name">
                          <option value="{Name/.}" selected="selected">
                            <xsl:value-of select="normalize-space(Name/.)"/>
                          </option>
                        </xsl:when>
                        <xsl:otherwise>
                          <option value="{Name/.}">
                            <xsl:value-of select="normalize-space(Name/.)"/>
                          </option>

                        </xsl:otherwise>
                      </xsl:choose>

                    </xsl:for-each>
                  </select>

                </div>
                <div id="btn_AddNewContent"  class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:12%;line-height:30px;float:right;"
                         onmouseover="document.getElementById('img_AddContent').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                         onmouseout="document.getElementById('img_AddContent').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                         onclick="Portal_LoadAddCommunityContent('{$BrandCommunityID}','{$BrandID}','{$Mode}', 'divClientPortalOperations_Container','{$SelectedStatus}');">
                  <img id="img_AddContent" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                  <span id="span_AddContent" class="capitalFont">Add Content</span>
                </div>

                <!--<div  id="btn_AddNewContent"  class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:120px;line-height:30px;"
                                 onmouseover="document.getElementById('img_AddContent3').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                                 onmouseout="document.getElementById('img_AddContent3').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                                 onclick="Portal_LoadAddCommunityContent('{$BrandCommunityID}','{$BrandID}','{$Mode}', 'divClientPortalOperations_Container','{$SelectedStatus}');">
                            <img id="img_AddContent3" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                            <span id="span_AddContent" class="capitalFont">Add Content</span>
                        </div>-->

              </td>
            </tr>

          </table>


          <div class="packageTitle marginTop10 marginBottom10">There is no Content</div>
        </xsl:otherwise>
      </xsl:choose>
    </table>

  </xsl:template>
</xsl:stylesheet>
