<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="themes/jquery/css/themes/default/jquery.mobile-1.4.5.min.css">
	<link rel="stylesheet" href="themes/home/css/fonts/font-awesome.min.css">
    <link rel="stylesheet" href="themes/home/css/ui-box.css">
    <link rel="stylesheet" href="themes/home/css/ui-base.css">
    <link rel="stylesheet" href="themes/home/css/ui-color.css">
    <link rel="stylesheet" href="themes/home/css/icon.css">
    <link rel="stylesheet" href="themes/home/css/control.css">
    <link rel="stylesheet" href="themes/home/css/main.css">
	<script src="themes/jquery/js/jquery.js"></script>
	<script src="themes/jquery/js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body class="um-vp c-wh " ontouchstart>
<div data-role="page" data-quicklinks="true" class="ub ub-ver ">
      <div data-role="header" id="header" data-position="fixed" data-fullscreen="true" data-tap-toggle="false" >
	  <div class="uh bc-text-head ub bc-head">
	  			<?php if($father!=0){
						$fathers = $db->fetch_one_array("SELECT title,father,id FROM ".DB_TABLEPRE."document_type  WHERE id = '".$father."'");
						?>
                <div class="nav-btn" id="nav-left" onClick="javascript:window.location='index.php?ac=<?php echo $ac;?>&fileurl=plugin&type=<?php echo $type;?>&father=<?php echo $fathers['father'];?>'">
				<?php }else{?>
				<div class="nav-btn" id="nav-left" onClick="javascript:window.location='index.php'">
				<?php }?>
                    <div class="fa fa-angle-left fa-2x"></div>
                </div>
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">
				<?php
				if($father!=0){
					echo $fathers['title'];
				}else{
					
					echo $type_name;
				}
				?>
				
				</h1>
				
                <div class="nav-btn nav-bt" id="nav-right" onClick="javascript:window.location='index.php?ac=<?php echo $ac;?>&fileurl=plugin&do=add&type=<?php echo $type;?>&father=<?php echo $father;?>'">
                    <div class="ub-img icon-edit umw2 umh4"></div>
                </div>
				
       </div>
	  
</div>
<!-- /header -->
  <div data-role="content" id="content">
		<div style="padding-left:5px; padding-right:5px;">
				<?php 
				if(!$documenttype && !$result){
					echo '<div id="error-bg"></div>';
				}
				?>
				<ul data-role="listview" data-inset="true">
					<?php
					foreach ($documenttype as $row) {
					$filenum = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."document WHERE type = '".$type."' and documentid='".$row['id']."' ORDER BY id desc");
						echo '<li onClick=javascript:window.location="index.php?ac='.$ac.'&fileurl=plugin&type='.$type.'&father='.$row['id'].'"><img class="ui-li-icon ui-corner-none" src="themes/home/css/myImg/accIcon1.png">'.$row['title'].'<span class="ui-li-count">';
						if($filenum>0){
							echo $filenum;
						}else{
							echo '0';
						}
						echo '</span></li>';
					}
					?>
					<?php
					foreach ($result as $row) {
					$filetype=preg_replace('/.*\.(.*[^\.].*)*/iU','\\1',$row['title']);
					if(file_exists('../template/default/content/ico/'.$filetype.'.gif')!=''){
						$ico=$filetype;
					}else{
						$ico='ini';
					}
						echo '<li onClick=javascript:window.location="index.php?ac='.$ac.'&fileurl=plugin&do=views&id='.$row['id'].'&type='.$type.'&father='.$father.'"><img class="ui-li-icon ui-corner-none" src="../template/default/content/ico/'.$ico.'.gif">'.str_replace('.'.$filetype,'',$row['title']).'<span class="ui-li-count">';
						if($row['content']>=1000000000){
							echo sprintf("%.2f", ($row['content']*0.000000001)).'GB';
						}elseif($row['content']>=1000000){
							echo sprintf("%.2f", ($row['content']*0.000001)).'MB';
						}else{
							echo sprintf("%.2f", ($row['content']*0.001)).'KB';
						}
						echo '</span></li>';
					}
					?>
				</ul>
		</div>
  </div>
	</div><!-- /page -->
 <script type="text/javascript"> 
    window.onload = function(){ 
        var heg=document.getElementById("header").offsetHeight;
		var content=document.getElementById("content"); 
		content.style.cssText="margin-top:"+heg+"px;";
    }
</script> 
</body>
</html>
