<%@ Page Language="C#" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_Include_SelectFile" Codebehind="SelectFile.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<!doctype html>
<html>
<head>
<title>选择文件</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit"> 
<meta http-equiv="pragma" content="no-cache"> 
<script src="../../ks_inc/jQuery.js"></script>
<script src="../../KS_Inc/Kesion.Common.js"></script>
<link href="/admin/images/style.css" rel="stylesheet" type="text/css" />
<STYLE type="text/css">
PreviewStyle {border: 2px outset #CCCCCC;}
ImgOver {cursor: default;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: solid;border-right-style: solid;border-bottom-style: solid;border-left-style: solid;border-top-color: #FFFFFF;border-right-color: #999999;border-bottom-color: #999999;border-left-color: #FFFFFF;}
BODY{border: 0; margin: 0; background: buttonface; cursor: default; font-family:宋体; font-size:9pt;} BUTTON {width:5em}
TABLE{font-family:宋体; font-size:9pt}
P{text-align:center}
.bTable td{ padding:0 !important;}
</STYLE>
</head>
<body leftMargin=0 class="righttd" scroll="no" style="background:#fff;">
 <form id="form1" runat="server" enctype="multipart/form-data">
  <table cellSpacing=0 cellPadding=0 width="100%" align=center border=0 class="sTable">
    <tr>
      <td colSpan=2>
        <table cellSpacing=0 cellPadding=0 width="100%" border=0>
          <tr>
            <td noWrap align=center width=80>选择目录： </td>
            <td width=660>
            <asp:DropDownList ID="FolderSelectList" style='width:100%;' runat="server"></asp:DropDownList>
            </td>
            <td  width=279 height=26>
              <table cellSpacing=0 cellPadding=0 width="100%" border=0>
                <tr>
                  <td width=25>&nbsp;</td>
                  <td onMouseOver="this.className='ImgOver'" onMouseOut="this.className=''" width=25><img id=Img1 title=关闭预览区 onclick=ChangeViewArea(this); src="../../SysImg/FileIcon/R.gif" align=absMiddle></td>
                  <td onMouseOver="this.className='ImgOver'" onMouseOut="this.className=''" width=25><img title=返回上一级目录 onClick="frames['FolderList'].OpenParentFolder();" height=22 src="../../SysImg/FileIcon/Back.gif" width=21 align=absMiddle></td>
                  <td onMouseOver="this.className='ImgOver'" onMouseOut="this.className=''" width=25><img title=添加新目录 onClick="frames['FolderList'].AddFolderOperation();" height=17 src="../../SysImg/FileIcon/AddFolder.gif" width=19 align=absMiddle></td>
                  <td width=25>&nbsp;</td>
                  <td width=25>&nbsp;</td>
                  <td width=25>&nbsp;</td>
                  <td width=25>&nbsp;</td>
                  <td width=25>&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td align=center width="80%"><iframe id="FolderList" name="FolderList" src="FileList.aspx?ChannelID=<%=ChannelID %>&CurrPath=<%=UpfilesDir %>" style="border:1px solid #ebebeb" width="100%" scrolling="yes" height="380"></iframe></td>
      <td id=ViewArea  width="20%"><iframe id="PreviewArea" src="Preview.aspx" style="border:1px solid #ebebeb; margin-right:0; padding:0;" class="textbox" width="100%" scrolling=yes height=380></iframe></td>
    </tr>
    <tr>
      <td colSpan=2 height=35>
        <table height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0 class="bTable">
          <tr>
            <td width=80 height=40><strong>URL地址：</strong></td>
            <td>
              	<Input style="WIDTH: 450px" class="textbox" name="FileUrl" id="FileUrl" /> 
              	<Input onClick="SetFileUrl();" class="button button_on mr15" type="button" value=" 确 定 " name=Submit> 
             	<Input onClick="winClose()" class="button" type="button" value=" 取 消 " name=Submit3>
            </td>
          </tr>
          <%if (Kesion.BLL.KSSecurity.CheckCommonUploadPower() || ChannelID>0){ %>
          <tr>
            <td width=80 height=40><strong>上传文件：</strong></td>
            <td>  <iframe id="upload" name="upload" src="about:blank" marginheight="0" marginwidth="0" frameborder="0" width="100%" height="36" scrolling="no" style="margin-top:10px;"></iframe>
</td>
          </tr>
          <%} %>
        </table>
      </td>

  </table>
  
 

  
<script type="text/JavaScript">

<%if (Kesion.BLL.KSSecurity.CheckCommonUploadPower() || ChannelID > 0)
        { %>
jQuery(document).ready(function(){
  
  uploadBtn("<%=UpfilesDir %>");
});
function uploadBtn(path){
    jQuery("#upload").attr("src", "UpLoad.aspx?bgcolor=ffffff&FieldID=-1&module=<%=KSCMS.S("module")%>&ChannelID=<%=ChannelID %>&CurrPath=" + path + "&UpType=UpByBar&from=selectfile");
}
    <%}%>
function winClose(){
     try{
      <%if (KSCMS.S("showtype") == "vision"){%>
         top.closePopup(window.name);
      <%}else{%>
        top.box.close(); 
      <%} %>
     }catch(e){
       window.close();
     }
} 
function ChangeFolder(FolderName){    
frames["FolderList"].location='FileList.aspx?CurrPath='+FolderName;}

function SetFileUrl(){    
var v=jQuery("#FileUrl").val();
if (v=='') KesionJS.Alert('请填写Url地址');    
else   
{
	

    <%if (KSCMS.S("fieldID")!=""){ %>
       
       
      <%if (KSCMS.S("showtype") == "vision"){%>
        //可视化上传
        top.SelectImgBack(v,"<%=KSCMS.S("fieldID").Trim() %>",window.name);

      <%}else{%>
        function getTopFrameId(id){
          if(top.frames["main"] && top.frames["main"].document && top.frames["main"].document.getElementById(id)){
            return top.frames["main"].document.getElementById(id)
          }else{
            return false
          }
        } 
        
        if(getTopFrameId('<%=KSCMS.S("fieldID").Trim() %>')){
          getTopFrameId('<%=KSCMS.S("fieldID").Trim() %>').value = v;
        }
        if(getTopFrameId('show<%=KSCMS.S("fieldID")%>')){
          getTopFrameId('show<%=KSCMS.S("fieldID")%>').style.display = '';
          getTopFrameId('show<%=KSCMS.S("fieldID")%>').src = v;
        }
        top.box.close();
       <%} %> 

        <%if (KSCMS.S("fieldID").ToLower()=="defaultpic"){%>
          if(top.frames["main"].document.getElementById("BigPhoto")){
              top.frames["main"].document.getElementById("BigPhoto").value = v;
          }
        <%}%>
       
        <%if (!string.IsNullOrEmpty(KSCMS.S("fun")) && KSCMS.S("fun")!="undefined"){%>
          
        top.frames["main"].<%=KSCMS.S("fun")%>;
        <%}%>

      
      <%}else{%>
         window.returnValue=v;     
         window.close();    
      <%} %>

   
 }
}
 window.onunload=CheckReturnValue;
 function CheckReturnValue(){    
  if (typeof(window.returnValue)!='string') 
  window.returnValue='';
 }
 var displayBar=true;
 function ChangeViewArea(obj) {  
  if (displayBar) {  
  ViewArea.style.display='none';    
  displayBar=false;    
  obj.src='../../SysImg/FileIcon/L.gif';    
  obj.title='打开预览区';  } 
  else {   
  ViewArea.style.display='';    
  displayBar=true;    
  obj.src='../../SysImg/FileIcon/R.gif';    
  obj.title='关闭预览区';  }
 }
 </script>
 </body>
</form>
</html>