<%@ Page Language="C#" AutoEventWireup="true" Inherits="System_SubSite_SelectTemplate, QianboCMS" EnableEventValidation="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>选择本地目录</title>
<link rel="stylesheet" href="../Css/layout.css" type="text/css" />
<script language="javascript" type="text/javascript" src="../../Js/Common.js"></script>
<script type="text/javascript">
var api = frameElement.api, W = api.opener, D = W.document;
</script>
<script language="javascript" type="text/javascript">
function PageRedirect(val)
{
    var path="";
    if(val!="/")
    path="SelectFile.aspx?dirName="+val;
    else
    path="SelectFile.aspx";
    window.location.href=path;
}
function SetUrl(obj)
{
    if(obj.checked==true)
    {
        template+=obj.value+",";
    }
    else
    {
        var parten=obj.value+",";
        var reg=new RegExp(parten,"ig");
        template=template.replace(parten,"")
    }
    $("txtUrl").value=template.substring(0,(template.length-1));
}
var template="";
function SetParentValue()
{
    //window.opener.document.all.txtTemplate.value=$("txtUrl").value;
    //window.close();
    var txtTemplate = D.getElementById('txtTemplate');
    txtTemplate.value = $("txtUrl").value;
    api.close();
}
function checkedAll()
{
    template="";
    var s=document.getElementById("tableCheck").getElementsByTagName("input");
    for(var i=0;i<s.length;i++)
    {
        if(s[i].type=="checkbox")
        {
            s[i].checked=document.getElementById("chkBoxChooseAll").checked;
        }
        SetUrl(s[i])
    }
}
</script>
</head>

<body>
<form id="form1" runat="server">
  <div>
    <table width="98%" style="display: block;">
      <tr>
        <td>搜索：<asp:Literal ID="ltSelect" runat="server"></asp:Literal>
          <asp:HiddenField ID="hidPath" runat="server" />
<script language="javascript" type="text/javascript">
var obj=$("selSearch");
for(var i=0;i<obj.length;i++)
{
    if(obj.options[i].value==$("hidPath").value)
    {
        obj.options[i].selected=true;
    }
}
</script></td>
      </tr>
    </table>
    <asp:Repeater ID="repFileList" runat="server">
      <HeaderTemplate>
      <table cellpadding="0" cellspacing="1" class="border" width="99%" align="center" id="tableCheck">
        <tr class="title">
          <td>目录/文件</td>
          <td width="30px">选择</td>
        </tr>
      </HeaderTemplate>
      <ItemTemplate>
        <tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
          <td class="tl"><asp:Literal ID="ltLink" runat="server" Text="<%# Test(Container.DataItem.ToString()) %>"></asp:Literal></td>
          <td><input name="chkSelectTemplate" type="checkbox" value='<%#Container.DataItem %>' onclick="SetUrl(this)" /></td>
        </tr>
      </ItemTemplate>
      <FooterTemplate>
      </table>
      </FooterTemplate>
    </asp:Repeater>
    <table cellpadding="0" cellspacing="1" class="border" width="99%" align="center">
      <tr class="wzlist">
        <td>全选：<input onclick="checkedAll()" id="chkBoxChooseAll" value="" type="checkbox" /></td>
      </tr>
    </table>
    <table cellpadding="0" cellspacing="1" class="border" width="99%" align="center">
      <tr class="wzlist">
        <td>文件目录：<input id="txtUrl" type="text" style="width: 80%;" disabled="false" />
          <input id="btnConfirm" type="button" onclick="SetParentValue()" class="btn" value="确定" />
          <input id="btnCancel" type="button" onclick="javascript:api.close();" class="btn" value="取消" /></td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>