<?php
if (!defined('USING_SYSTEM')) exit;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="admin/images/page.css" />
<script type="text/javascript" src="skins/common/images/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="admin/images/page.js"></script>
<title>Filiant Control Panel</title>
</head>
<body>
<div class="bigTips"<?php echo ($tips=='')?'':' style="display:block;"' ?>><?php echo $tips ?></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th colspan="3">语言编辑</th>
  </tr>
  <tr>
    <td class="title" width="150">语言</td>
    <td width="400" class="dropdown">
      <select name="langDirsTxt">
<?php
$langDir = dir(__ROOT__.'lang/');
while($folder = $langDir->read()) {
	if(is_dir(__ROOT__.'lang/'.$folder)) {
		if($folder != '.' && $folder != '..') {
			echo '<option value="'.$folder.'">'.$folder.'</option>';
		}
	}
}
$langDir->close();
?>
      </select>
<script type="text/javascript">
$('[name=langDirsTxt]').val('<?php echo ($_GET['lang']!='')?$_GET['lang']:'zh-cn' ?>');
</script>
    <td class="tips">请选择要编辑的语言包</td>
  </tr>
</table>
<div class="controls">
  <a class="button" href="javascript:void(0);" onclick="window.location.href='admin.php?ac=p502&lang='+$('[name=langDirsTxt]').val();return false;">获取列表<i></i></a>
</div>
<?php
if($_GET['lang'] != '') {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th colspan="3">语言编辑</th>
  </tr>
  <tr>
    <td class="title" width="150">文件</td>
    <td width="400" class="dropdown">
      <select name="langFilesTxt">
<?php
	$langDir = dir(__ROOT__.'lang/'.$_GET['lang'].'/');
	while($file = $langDir->read()) {
		if(is_file(__ROOT__.'lang/'.$_GET['lang'].'/'.$file)) {
			if($file != 'index.php') {
				$file = str_replace('.php', '', $file);
				echo '<option value="'.$file.'">'.$file.'</option>';
			}
		}
	}
	$langDir->close();
?>
      </select>
<script type="text/javascript">
$('[name=langFilesTxt]').val('<?php echo ($_GET['file']!='')?$_GET['file']:'example' ?>');
</script>
    <td class="tips">请选择要编辑的语言文件</td>
  </tr>
</table>
<div class="controls">
  <a class="button" href="javascript:void(0);" onclick="window.location.href='admin.php?ac=p502&lang=<?php echo $_GET['lang'] ?>&file='+$('[name=langFilesTxt]').val();return false;">获取语言<i></i></a> <a class="button" href="javascript:void(0);" onclick="window.location.href='admin.php?ac=p502&lang='+$('[name=langDirsTxt]').val();return false;">新建空白<i></i></a>
</div>
<?php
}
?>
</body>
</html>