<%@ Page language="c#" Codebehind="mypane.aspx.cs" AutoEventWireup="True" Inherits="Webdisk.mypane" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<% @ Import Namespace="Webdisk" %>
		<link href="<%=xml.GetStyle()%>" type=text/css rel=stylesheet>
			<style type="text/css">.STYLE2 {
	FONT-SIZE: 12px
}
</style>
			<script type="text/javascript" language="javascript" src="js/dialog.js"></script>
			<script language="javascript">
function show(tips,flag,url){
var my_tips=document.all.mytips;
if(flag){
	if (my_tips.style.display=="none") 
	{
		my_tips.style.display="";
		if (url!=null){my_tips.innerHTML="<div align=center><img src='"+url+"' width=100 height=100 onload=DrawImage(this)><br>"+tips+"</div>";}
		else{ my_tips.innerHTML=tips;}
	}
	my_tips.style.left=event.clientX+10;
	my_tips.style.top=event.clientY+10;
}
else 
{
my_tips.style.display="none";
}
}
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
	flag=true;
	if(image.width/image.height>= 120/80){
	if(image.width>120){  
	ImgD.width=100;
	ImgD.height=(image.height*100)/image.width;
	}else{
	ImgD.width=image.width;  
	ImgD.height=image.height;
	}

	}
	else{
	if(image.height>100){  
	ImgD.height=100;
	ImgD.width=(image.width*100)/image.height;     
	}else{
	ImgD.width=image.width;  
	ImgD.height=image.height;
	}

	}
	}
}
function over(obj){
obj.className=(obj.className == "GridMove" ? "GridItem" : "GridMove")
}
function btnover(obj){
obj.className="butdiv";
}
function btnout(obj){
obj.className="";
}
function getUrlParam(paramName){	
	var s=location.search;
	if(s!=null){
	var sarr=s.substr(1).split("&");
	var tarr;
	for(i=0;i<sarr.length;i++){
	tarr=sarr[i].split("=");
	if(tarr.length==2&&tarr[0].toLowerCase()==paramName){
	return tarr[1];
	}
	}
	return "";
	}
}
function newFolder()
{
	document.all.pathurl.value=document.all.hidpath.value;
	var d = new dialog();d.init();
	d.set('src','');
	d.set('title','新建目录');
	d.event('<table width="100%" border="0"><tr><td><div align="right">输入新名称：</div></td><td><input name="txt" type="text" class="kuan" id="txt" onchange="document.all.txttmp.value=document.all.txt.value;" size="24" maxlength="96" /></td></tr><tr><td><div align="right">目录描述：</div></td><td><textarea name="txt1" id="txt1" cols="22" rows="3" class="kuan" onchange="document.all.txttmp1.value=document.all.txt1.value;"></textarea></td></tr></table>', 'newdir()','','');
}
function newdir()
{
	if (document.getElementById("txttmp").value!="")
	{
		Init();
		Webdisk.mypane.AddDir(document.all.pathurl.value,document.getElementById("txttmp").value,document.getElementById("txttmp1").value,Isnewdir_callback);
	}
}
function Isnewdir_callback(res)
{
	document.all.loading.style.display='none';
	var bRet = res.value;
	if (bRet != "")
	{
		var d = new dialog();d.init();
		d.set('src','pics/dlgico_excal.gif');
		d.set('title','系统提示信息');
		d.event(bRet, 'window.close();','','');	
	}
	else window.location.reload();
}
function uploadfile()
{
	document.all.pathurl.value=document.all.hidpath.value;
	Webdisk.mypane.UploadFile(document.all.hidpath.value,Isuploadfile_callback);
}
function Isuploadfile_callback(res)
{
	var bRet = res.value;
	if (bRet != "")
	{
		var d = new dialog();d.init();
		d.set('src','pics/dlgico_excal.gif');
		d.set('title','系统提示信息');
		d.event(bRet, 'window.close();','','');	
	}
	else window.location='upload.aspx?out=1&Path='+document.all.hidpathutf8.value;
}
function Init()
{
	document.all.loading.style.top =Math.round((document.body.clientHeight-100)/2)+document.body.scrollTop-50;
	document.all.loading.style.left =Math.round((document.body.clientWidth-100)/2)-100;
	document.all.loading.style.display='';
}

			</script>
			<style type="text/css">BODY {
	MARGIN-TOP: 5px
}
</style>
	</HEAD>
	<body>
		<DIV id="mytips" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; DISPLAY: none; FONT-SIZE: 9pt; FILTER: progid: DXImageTransform.Microsoft.Shadow(color=#999999,direction=135,strength=3); BORDER-LEFT: gray 1px solid; WIDTH: 150px; COLOR: red; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; HEIGHT: 16px; BACKGROUND-COLOR: #ffffff"></DIV>
		<div id="loading" style=" BORDER-RIGHT:#dbdce3 1px solid; BORDER-TOP:#dbdce3 1px solid; DISPLAY:none; BORDER-LEFT:#dbdce3 1px solid; BORDER-BOTTOM:#dbdce3 1px solid; POSITION:absolute; BACKGROUND-COLOR:#ffffae"><img src="pics/loading.gif" width="32" height="32" align="absMiddle">
			<b>正在处理，请稍候……</b></div>
		<form id="Form1" name="fm" runat="server">
			<TABLE height="29" cellSpacing="0" cellPadding="1" width="98%" border="0">
				<tr>
					<td width="80%">&nbsp;&nbsp;当前位置：
						<%=Postion%>
						<asp:textbox id="currentPathTxt" runat="server" Visible="False" Width="24px" Font-Size="9" Font-Names="Verdana, Arial"
							CssClass="headerInputBox" BorderWidth="1px" BorderStyle="solid"></asp:textbox></td>
				</tr>
				<tr>
					<td>
						<table width="814" align="center" border="0" height="30">
							<tr>
								<td width="100"><DIV align="center" onClick="document.all.Up_btn.click();" onMouseMove="btnover(this)"
										onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/back.gif" width="18" align="absMiddle"><asp:linkbutton id="Up_btn" runat="server" onclick="LinkButton1_Click">向上</asp:linkbutton></DIV>
								</td>
								<TD width="100"><DIV align="center" onClick="document.all.GoRoot.click();" onMouseMove="btnover(this)"
										onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/home2.gif" width="18" align="absMiddle"><asp:linkbutton id="GoRoot" runat="server" onclick="GoRoot_Click">根目录</asp:linkbutton></DIV>
								</TD>
								<TD width="100"><DIV align="center" onClick="document.all.Refresh.click();" onMouseMove="btnover(this)"
										onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/refresh.gif" width="18" align="absMiddle"><asp:linkbutton id="Refresh" runat="server" onclick="Refresh_Click">刷新</asp:linkbutton></DIV>
								</TD>
								<td width="100"><DIV align="center" onClick="document.all.Search.click();" onMouseMove="btnover(this)"
										onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/find.gif" width="18" align="absMiddle"><asp:linkbutton id="Search" runat="server" onclick="Search_Click">搜索</asp:linkbutton></DIV>
								</td>
								<TD width="100"><DIV align="center" onClick="document.all.imglist.click();" onMouseMove="btnover(this)"
										onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/icon_normal.gif" width="18" align="absMiddle"><asp:linkbutton id="imglist" runat="server" onclick="imglist_Click">缩略图</asp:linkbutton></DIV>
								</TD>
								<TD width="100"><DIV align="center" onClick="newFolder();" onMouseMove="btnover(this)" onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/tree_folder2.gif" width="18" align="absMiddle">
										添加目录</DIV>
								</TD>
								<TD width="100"><DIV align="center" onClick="uploadfile();" onMouseMove="btnover(this)" onMouseOut="btnout(this)"><IMG height="18" alt="" src="pics/outupload.gif" width="18" align="absMiddle">
										上传文件</DIV>
								</TD>
							</tr>
						</table>
					</td>
				</tr>
			</TABLE>
			<div align="center"><asp:datagrid id="DataGrid" runat="server" Width="98%" CssClass="GridBody" EnableViewState="False"
					AutoGenerateColumns="False" AllowSorting="True" PageSize="2" AllowPaging="True">
					<AlternatingItemStyle CssClass="GridLine"></AlternatingItemStyle>
					<ItemStyle CssClass="GridItem"></ItemStyle>
					<HeaderStyle CssClass="GridHead"></HeaderStyle>
					<Columns>
						<asp:TemplateColumn HeaderText="类">
							<HeaderStyle HorizontalAlign="Center" Width="5%"></HeaderStyle>
							<ItemStyle HorizontalAlign="Center"></ItemStyle>
							<HeaderTemplate>
								<%=headico%>
							</HeaderTemplate>
							<ItemTemplate>
								<asp:Label id=Label3 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.pic") %>'>
								</asp:Label>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:TemplateColumn HeaderText="名称">
							<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
							<HeaderTemplate>
								<%=headname%>
							</HeaderTemplate>
							<ItemTemplate>
								<asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.name") %>'>
								</asp:Label>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:TemplateColumn SortExpression="size" HeaderText="大小">
							<HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
							<ItemStyle HorizontalAlign="Right"></ItemStyle>
							<HeaderTemplate>
								<%=headsize%>
							</HeaderTemplate>
							<ItemTemplate>
								<asp:Label id=Label2 runat="server" NAME="Label2" Text='<%# ShowSize(Convert.ToInt64(DataBinder.Eval(Container, "DataItem.size"))) %>'>
								</asp:Label>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:TemplateColumn HeaderText="最后更新">
							<HeaderStyle HorizontalAlign="Center" Width="17%"></HeaderStyle>
							<ItemStyle HorizontalAlign="Center"></ItemStyle>
							<HeaderTemplate>
								<%=headupdate%>
							</HeaderTemplate>
							<ItemTemplate>
								<asp:Label id=Label4 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.update") %>'>
								</asp:Label>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:TemplateColumn HeaderText="下载次数">
							<HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
							<ItemStyle HorizontalAlign="Center"></ItemStyle>
							<HeaderTemplate>
								<%=headcount%>
							</HeaderTemplate>
							<ItemTemplate>
								<asp:Label id=Label5 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.downcount") %>'>
								</asp:Label>
							</ItemTemplate>
						</asp:TemplateColumn>
					</Columns>
					<PagerStyle Visible="False" HorizontalAlign="Right" ForeColor="#4A3C8C" BackColor="#E7E7FF"
						Mode="NumericPages"></PagerStyle>
				</asp:datagrid><asp:panel id="Panel1" runat="server">
					<DIV class="STYLE2">排序：&nbsp;
						<select name="select" id="sort" runat="server" onChange="javascript:window.location='mypane.aspx?type='+this.value+'&amp;page='+getUrlParam('page')+'&amp;path='+getUrlParam('path');">
							<option value="name asc" selected>名称升序</option>
							<option value="name desc">名称降序</option>
							<option value="update asc">时间升序</option>
							<option value="update desc">时间降序</option>
							<option value="size asc">大小升序</option>
							<option value="size desc">大小降序</option>
							<option value="pic asc">类型升序</option>
							<option value="pic desc">类型降序</option>
						</select>&nbsp;</DIV>
				</asp:panel><asp:panel id="Panel3" runat="server" Visible="False">
					<TABLE class="tableborder1" style="WIDTH: 100%; WORD-BREAK: break-all" cellSpacing="1"
						cellPadding="2">
						<TR>
							<TD class="tablebody1" vAlign="middle" align="center" width="100%" height="130">没有任何图片文件</TD>
						</TR>
					</TABLE>
				</asp:panel><asp:repeater id="DataList" runat="server" EnableViewState="False">
					<ItemTemplate>
						<div style="width:198px;margin-right:3px;margin-bottom:3px;float:left;">
							<table cellpadding="2" cellspacing="1" class="tableborder1" style="width:100%;height=100%;word-break:break-all;">
								<tr>
									<td width="100%" height="130" align="center" valign="middle" class="tablebody1">
										<%# DataBinder.Eval(Container, "DataItem.link") %>
									</td>
								</tr>
								<tr>
									<td class="tablebody2"><div align="center">
											<%# DataBinder.Eval(Container.DataItem, "newname") %>
											<br>
											<%# ShowSize(Convert.ToInt64(DataBinder.Eval(Container, "DataItem.size"))) %>
											&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem, "update") %></div>
									</td>
								</tr>
							</table>
						</div>
					</ItemTemplate>
				</asp:repeater></div>
			<TABLE width="98%" border="0">
				<TR>
					<TD width="33%">&nbsp;
						<asp:label id="info" runat="server" Width="432" Height="18"></asp:label></TD>
					<TD width="67%">
						<DIV align="right"><%=v_page%></DIV>
					</TD>
				</TR>
			</TABLE>
			<INPUT id="HdnSelectedValues" type="hidden" size="1" name="HdnSelectedValues" runat="server">
			<INPUT id="cmd" type="hidden" size="1" runat="server"><INPUT id="pathurl" type="hidden" size="1" runat="server">
			<INPUT id="temp" type="hidden" size="1" runat="server"><INPUT id="txttmp" type="hidden" size="1" runat="server"><INPUT id="txttmp1" type="hidden" size="1"><INPUT id="hidpath" type="hidden" size="1" runat="server"><INPUT id="hidpathutf8" type="hidden" size="1" runat="server">
			<div align="center"><%=adv6%></div>
		</form>
	</body>
</HTML>
