<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="HTCOMNET.Main" %>
<%@ Page CodeBehind="viewzipcontent.aspx.vb" Language="vb" AutoEventWireup="false" Inherits="HTCOMNET.viewzipcontent" %>
<html>
	<%
			If Request.querystring("content")<>"" Then
				Session(SK_ZIP_CONTENT_PATH)=Session(SK_ROOT) & Session(SK_DIR) & slfordir(Session(SK_DIR)) 
				Session(SK_ZIP_CONTENT_FILE)=DeleteDangerouseRoots(Request.querystring("content"))
			End If
	%>
	<head>
		<title><%=Session(SK_ZIP_CONTENT_FILE)%> content</title>
		<meta http-equiv="Content-Type" content="text/html; charset=<%=Session(SK_CHARSET)%>">
		<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
		<link rel="stylesheet" href="Scripts<%=JS_CSS_VERSION%>/Style.css" type="text/css">
		<SCRIPT language="JavaScript" src="Scripts<%=JS_CSS_VERSION%>/<%=Session(SK_LANGUAGE).Language%>.js"></SCRIPT>
		<SCRIPT language="JavAscript" src="Scripts<%=JS_CSS_VERSION%>/Main.js"></SCRIPT>
		<SCRIPT language="JavAscript" src="Scripts<%=JS_CSS_VERSION%>/Upload.js"></SCRIPT>
	</head>
	<body oncontextmenu="return false;" onselectstart="return false;" bgcolor="#FFFFFF" text="#000000" leftmargin="5" topmargin="5">
		<SCRIPT language="JavAscript">
			drawupwin('<font color="#FFFF66">&nbsp;&nbsp;<%=javaformat(Session(SK_ZIP_CONTENT_FILE))%></font>',Innerwidth()-15, Innerheight()-15,'#F8F6E6');
		</SCRIPT>
		<table height="20" width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr height="20" id="ListHeader" style="background-image:url(images/XP_listcenter.gif);position:static;" oncontextmenu="return false;">
			<td id="sort1" style="cursor:hand;border-right: #C7C5B2 1px solid;" onmouseout="javascript: this.className='Sort';" onmouseover="javascript: this.className='active-box-item';"  class="Sort"><font style="font-size:12px;" class="Sort">&nbsp;&nbsp;&nbsp;&nbsp;<%=Session(SK_LANGUAGE).GetText("FILE_NAME")%>&nbsp;</font></td>
			<td align="right" id="sort2" style="cursor:hand;border-right: #C7C5B2 1px solid;" onmouseout="javascript: this.className='Sort';" onmouseover="javascript: this.className='active-box-item';" width="50" class="Sort"><font style="font-size:12px;" class="Sort">&nbsp;<%=Session(SK_LANGUAGE).GetText("SIZE")%>&nbsp;&nbsp;</font></td> 
			<td  align="center" id="sort3" style="cursor:hand;border-right: #C7C5B2 1px solid;" onmouseout="javascript: this.className='Sort';" onmouseover="javascript: this.className='active-box-item';" width="50" class="Sort"><font style="font-size:12px;" class="Sort">&nbsp;<%=Session(SK_LANGUAGE).GetText("RATIO")%>&nbsp;</font></td>
		</tr>
		</table>
		<SCRIPT language="JavAscript">
			hidesel();
			<%If Request.QueryString("refresh")<>"" Then%>
			window.opener.parent.List.location.href="List.aspx?task=Nothing" 
			<%End If%>
		</SCRIPT>
<table onMouseUp="javascript: lastMouseSelected=-1; MouseSelection=false;" onMouseDown="javascript: MouseSelection=true;" height="200" width="100%" border="0" cellspacing="0" cellpadding="0" ID="Table1">
  <tr>
    <td width="10">&nbsp;</td>
    <td valign="top">
<%If Session(SK_ERROR_MESSAGE)<>"" Then%>
<p align="center"><font class="subactionsfont"><%=BigErrorHTML%>&nbsp;<%=Session(SK_ERROR_MESSAGE)%>!</font></p>
<%
Session(SK_ERROR_MESSAGE)=""
End If%>


<%
Const UNZIP_GETINDEXEDZIPINFO = 7
Const UNZIP_COUNTALLZIPMEMBERS = 1
		
Dim  k, count As Integer 
Dim locerror As boolean 
Dim ratio, orsize, unsize As Double
Dim objUnZip  As new CDUnZipNET
Dim attribstr As String
dim isfolder as boolean

If Not File.Exists(Session(SK_ZIP_CONTENT_PATH) &  Session(SK_ZIP_CONTENT_FILE)) Then
	Response.write( "Zip file Not exists" )		
	locerror = True
End If

If locerror = False Then%>
<form name="zipform" action="extractcontent.aspx"  method="post">
<table  width="100%" border="0" cellspacing="0" cellpadding="0">
<SCRIPT language="JavAscript">
<%
objUnZip.ZIPFile = Session(SK_ZIP_CONTENT_PATH)  & Session(SK_ZIP_CONTENT_FILE)
objUnZip.FileSpec = "*"

objUnZip.ActionDZ = CDUnZipNET.DUZACTION.UNZIP_COUNTALLZIPMEMBERS
count = objUnZip.ReturnCount

FOR k = 0 to count  - 1
	objUnZip.UnZIPIndex = k
	objUnZip.ActionDZ = CDUnZipNET.DUZACTION.UNZIP_GETINDEXEDZIPINFO
	orsize = CDbl(objUnZip.zi_oSize)
	unsize = CDbl(objUnZip.zi_cSize)
	If orsize = 0 Then
		ratio = 100
	Else
		ratio = unsize/orsize
		ratio = Int(ratio * 100)
	End If
	attribstr = getattribstr(objUnZip.zi_attr)
	isfolder=Instr(attribstr, "Directory")<>0%>
It('<%=k+1%>','<%=javaformat(Server.HTMLEncode(objUnZip.zi_FileName))%>','<%=javaformat(FormatSize(orsize))%>','<%=ratio%>',<%=ASPBooleantoJava(isfolder)%>)<%	
NEXT
objUnZip = Nothing
%>
</SCRIPT>
</table>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<font class="subactionsfont">&nbsp;<input type="checkbox" name="overwrite" id="overwrite" value="1"><%=Session(SK_LANGUAGE).GetText("OVERWRITE_EXISTING_FILES")%></font><BR><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<input id="extractbut" disabled="true" type="button" onclick="extractcontent()" class="button" value="<%=Session(SK_LANGUAGE).GetText("EXTRACT_SELECTED")%>">
&nbsp;&nbsp;&nbsp;&nbsp;<input id="selectallbut" type="button" onclick="zipselectall()" class="button" value="<%=Session(SK_LANGUAGE).GetText("SELECT_ALL")%>"><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;<input id="deletebut" disabled="true" type="button" onclick="deletecontent()" class="button" value="<%=Session(SK_LANGUAGE).GetText("DELETE_SELECTED")%>">
</form>
<%End If%>
    </td>
  </tr>
</table>

<SCRIPT language="JavAscript">
	vZIPItems=<%=k%>
	drawdownwin('');
</SCRIPT>

</body>
</html>

