﻿<?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="currentSourcePath" select="/AjaxRequest/Params/path"></xsl:variable>
		<xsl:variable name="sourceFolderID" select="/AjaxRequest/Params/sourceFolderID"></xsl:variable>
    <xsl:variable name="accesscode" select="/AjaxRequest/Params/AccessToken"></xsl:variable>   
    <xsl:variable name="selectedFolderPath" select="/AjaxRequest/DropBox/DropBoxItems/selectedFolderPath"></xsl:variable>
    
		<style type="text/css">
      .top-outer{width:100%;float:left;height:40px; line-height:40px;border-bottom:1px solid #EBEDEF;color:#47525D!important;font-size:13px;}
      .top-headL{width:48%;float:left;padding-left:2%;}
      .top-headR{width:48%;float:left;text-align:right;padding-left:2%;}
      .top-H{width:100%;float:left;}
      .leftcontent{width:9%;float:left;height:46px;line-height:46px;padding-left:1%;}
      .ritecontent{width:90%;float:left;height:46px;line-height:46px;}
      div.top-H:hover{background:#F5FAFE;}
      .button-primary{background: #007ee5; border: 1px solid #0c6ebe; color: white; display: inline-block; text-align: center;
      font-size: 13px;  font-weight: 600;margin: 2px 0 5px; min-height: 30px; line-height: normal;
      box-sizing: border-box; border-radius: 3px;-webkit-appearance: none;padding: 6px 16px;}
      .not-active {
      pointer-events: none;
      cursor: default;
      color: #CCC;
      }
    </style>
		<div class="top-outer">
			<div class="top-headL">
				<a href="#access_token={$accesscode}" onclick="dropboxFetchSubfolder('divDropBoxOperations','{Path}','{$sourceFolderID}')" >
					DropBox
				</a>
				<a href="#access_token={accesscode}" onclick="dropboxFetchSubfolder('divDropBoxOperations','{$currentSourcePath}','{$sourceFolderID}')" id="breadcrumPath" >
          <xsl:value-of select="$selectedFolderPath"/>
        </a>
			</div>
			<div class="top-headR">
				<button class="button-primary" onClick="ChooseDropBoxFetchTree('divDropBoxOperations','{$currentSourcePath}','{$sourceFolderID}'); return false;">Choose</button>
			</div>
		</div>
		<div>
			<div id="divExceptionSummary"></div>
			<img id="imgExceptionSummary"></img>
		</div>

		<xsl:for-each select="AjaxRequest/DropBox/DropBoxItems">
      <xsl:sort select="Name"/>
			<!--<xsl:variable name="path" select="path"-->
			<div class="top-H">
				<a href="#access_token={accesscode}" onclick="dropboxFetchSubfolder('divDropBoxOperations','{Path}','{AsFolderID}')" >
          <xsl:choose>
            <xsl:when test="IsFolder = 'false' ">
					  <span class="leftcontent not-active">
						  <img src="../image/folder-icon.jpg"></img>
					  </span>
					  <span class="ritecontent not-active">
						  <xsl:value-of  select="Name" />
					  </span>
            </xsl:when>
            <xsl:otherwise>
              <span class="leftcontent">
                <img src="../image/folder-icon.jpg"></img>
              </span>
              <span class="ritecontent">
                <xsl:value-of  select="Name" />
              </span>
            </xsl:otherwise>
          </xsl:choose>
				</a>
			</div>
		</xsl:for-each>

	</xsl:template>
</xsl:stylesheet>
