<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!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>
<title>程序升级</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#data").val("<?php echo $data;?>");
<?php if(isset($version)){?>
$("#version").val("<?php echo $version;?>");
<?php }?>
});
</script>
<style type="text/css">
.sub td{padding:4px; margin:4px}
select{font-size:13px}
</style>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">数据转换</a></li>	
		</ul>
	</div>
	<div class="main">
		<fieldset>
		<legend><?php echo $lang['RETURN_TIPS'];?></legend>
		1：数据转换请注意程序编码； 2：执行前请先备份原有数据。
		</fieldset>
		<table width="100%">
		<tr><td style="padding-left:20px">
		<table cellspacing="0" class="sub" width="80%">
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<input type="hidden" name="version" id="version" value="<?php echo $version;?>" />
		<tr>
		<td style="padding:8px">
		 需转换数据类型：
			<select name="data" id="data" onchange="window.location.href='<?php echo ADMIN_FILE?>?mod=upgrade&file=upgrade&action=init&data='+$('#data').val()+'&version='+$('#version').val()">
				<option value="article">文章/评论 信息数据</option>
				<option value="member" selected="selected">会员<?php if($install['space']){?>/空间<?php }?><?php if($install['yp']){?>/黄页 信息数据<?php }?></option>
			</select>
		</td></tr>
			<?php 
			if($data=='article'){
			?>
			<tr><td style="padding:8px">
			<?php echo str_replace('dircms','DirCMS ',strtolower($version));?> 系统栏目数据：
			<select name="initcatid" multiple="multiple" size="20">
			<?php 
			foreach($initcatinfo as $r)
			{
				if($r['parentid']==0)
				{
			?>
				<option value="<?php echo $r['id'];?>"><?php echo $r['catname'];?></option>
				<?php
				foreach($initcatinfo as $_r)
				{
					if($_r['parentid']==$r['id'])
					{
				?>
					<option value="<?php echo $_r['id'];?>">|—<?php echo $_r['catname'];?></option>
					<?php
					foreach($initcatinfo as $__r)
					{
						if($__r['parentid']==$_r['id'])
						{
					?>
						<option value="<?php echo $__r['id'];?>">|——<?php echo $__r['catname'];?></option>
					<?php 
						}
					}
					?>
				<?php 
					}
				}
				?>
			<?php 
				}
			}
			?>
			</select> 
			转换至
			DirCMS <?php echo DIRCMS_VERSION.DIRCMS_RELEASE;?> 系统栏目：
			<select name="catid" multiple="multiple" size="20">
			<?php 
			foreach($catinfo as $r)
			{
				if($r['type']==1 && $r['parentid']==0)
				{
			?>
				<option <?php echo isfinalcatid($r['id'])?'':'disabled="disabled"';?> value="<?php echo $r['id'];?>"><?php echo $r['catname'];?></option>
				<?php 
				foreach($catinfo as $_r)
				{
					if($_r['type']==1 && $_r['parentid']==$r['id'])
					{
				?>
				<option <?php echo isfinalcatid($_r['id'])?'':'disabled="disabled"';?> value="<?php echo $_r['id'];?>">|—<?php echo $_r['catname'];?></option>
				<?php 
				foreach($catinfo as $__r)
				{
					if($__r['type']==1 && $__r['parentid']==$_r['id'])
					{
				?>
				<option <?php echo isfinalcatid($__r['id'])?'':'disabled="disabled"';?> value="<?php echo $__r['id'];?>">|—<?php echo $__r['catname'];?></option>
				<?php }}?>
				<?php }}?>
			<?php }}?>
			</select>
			<br />
			<span style="color:#FF0000">操作提示：每次只能转移一个栏目数据!</span>
			<?php }?>
			</td></tr>
			<tr><td style="padding:8px">
			<input type="submit" class="button" onclick="if(!confirm('确认开始数据转换？执行此操作前请先备份数据库!')){return false}else{this.value='开始转换...';this.disabled='disabled';this.form.submit()}" value="开始数据转换" />
			</td></tr>
		</form>
		</table>
		</td></tr></table>
		</div>
	</div>
</div>
</body>
</html>