<?php
require 'inc.php';
$obj_ctl_file = new cls_ctl_file();
$_SESSION["file_up_mode"]="file_file";

if(!isset($get_me_folder)){
	(isset($_SESSION["file_file_folder"]))? $get_me_folder=$_SESSION["file_file_folder"]:$get_me_folder="";
}

if(!isset($get_me_name)) $get_me_name="";
if(!isset($get_win_type)) $get_win_type="";
if(!isset($get_win_objid)) $get_win_objid="";



//$obj_ctl_file->set_perms("path",$get_me_folder);
$folder_path="<a href=\"javascript:meOpenFolder('');\">顶级</a>";
$folder_path.=me_folder_path($get_me_folder);

$page_footer_info=<<<HTML
<script>function frmSetName(msgx){frmMain.me_name.value=msgx;}
function meOpenFolder(msgx){frmMain.me_folder.value=msgx;frmExecute('list');}
function meSetType(msgval){frmMain.win_type.value=msgval;frmExecute('list');}
function meSelVal(msgval)
{
	if(this.parent){
	obj=parent.document.getElementById("$get_win_objid");
	obj.value=msgval;
	parent.div_hide_show("winpic_{$get_win_objid}");
   }else{
	window.open(msgval,"_blank");   
   }
}
</script>
<input type="hidden" name="win_type" value="$get_win_type">
<input type="hidden" name="win_objid" value="$get_win_objid">

<input type='hidden' name='me_folder' value='$get_me_folder'>
<input type='hidden' name='me_name' value=''>

HTML;

$arr_file=array();
$arr_dir=array();
$arr_dir=$obj_ctl_file->get_dirs($get_me_folder);
$arr_file=$obj_ctl_file->get_files($get_me_folder);
include "tpl/file_file.tpl.php";


//****************函数区*******
/*获取当前文件目录路径
msg_folderid:当前目录id号
msg_rootid:当前顶级目录，默认为：0，即最顶层，主要用于权限管理 如进入时为：?me_root=5 那么就只能访问目录id=5以后的文件目录了
*/
function me_folder_path($mepath)
{
	$mepath=format_path($mepath);
	if($mepath=="") return "";
	$stry=split('/', $mepath);
	$strv=$stry;
	for($i=0;$i<count($strv);$i++)
	{

		$strx="";
		for($j=0;$j<$i;$j++)
		{
			$strx.="/".$stry[$j];
		}
		$strv[$i]="<a href=\"javascript:meOpenFolder('".$strx."/".$stry[$i]."');\">".$stry[$i]."</a>";
	}
	//$mepath=str_replace("/"," -> ",$mepath);
	$mepath=implode(' -> ', $strv);
	return $mepath;
}

?>