<?php require("../conn.php");
ob_start();
session_start();


//require('login_user_check.php');
$id=str_sql($_GET['id']);?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url();
}
-->
</style>
<script language="javascript">
function sort_check()
{
if(sort_form.sort_name.value=="")
{
alert('请输入类别名！');
sort_form.sort_name.focus();
return false;
}
}

function sort_edit_check()
{
if(sort_edit_form.sort_edit_name.value=="")
{
alert('请输入类别名！');
sort_edit_form.sort_edit_name.focus();
return false;
}
}

function sort_div(sort_id,input_id)
{
sort_id.style.display='none';
input_id.style.display='';
}

function input_div(sort_id,input_id)
{
sort_id.style.display='';
input_id.style.display='none';
}

function del_confirm(id)
{
if(confirm('真的要删除吗？'))
{
location.href='sort_main_action.php?type_action=del&disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&page=<?=$_GET['page']?>&sort_id=<?=$_GET['id']?>&id='+id;
}
}

function select_on(form_id,form_value)
{
if (form_id.value==form_value)
{
form_id.value='';
}
}

function select_off(form_id,form_value)
{
if (form_id.value=='')
{
form_id.value=form_value;
}
}

function search_check(sort_name,subject_code,subject_name)
{
location.href='sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&id=<?=$_GET['id']?>&submit_action=search&sort_name='+sort_name+'&subject_code='+subject_code+'&subject_name='+subject_name;
}

function add_yes_check(id)
{
if (confirm('确定要添加吗?'))
{
location.href='sort_main_action.php?type_action=<?=$_GET['disp_type']?>_yes&disp_type=<?=$_GET['disp_type']?>&page=<?=$page?>&id='+id;
}
}

function del_yes_check(id)
{
if (confirm('确定要删除吗?'))
{
location.href='sort_main_action.php?type_action=del&disp_type=<?=$_GET['disp_type']?>&page=<?=$page?>&id='+id;
}
}

function del_no_check(id)
{
if (confirm('确定要删除吗?'))
{
location.href='sort_main_action.php?type_action=<?=$_GET['disp_type']?>_no&disp_type=<?=$_GET['disp_type']?>&page=<?=$page?>&id='+id;
}
}

function edit_yes_check(id)
{
if (confirm('确定要更名吗?'))
{
location.href='sort_main_action.php?type_action=<?=$_GET['disp_type']?>_yes&disp_type=<?=$_GET['disp_type']?>&page=<?=$page?>&id='+id;
}
}

function edit_no_check(id)
{
if (confirm('要取消更名吗?'))
{
location.href='sort_main_action.php?type_action=<?=$_GET['disp_type']?>_no&disp_type=<?=$_GET['disp_type']?>&page=<?=$page?>&id='+id;
}
}
</script>


<?php
if ($_GET['disp_type']=='sort_list')
{
if ($_GET['submit_action']=='search')
{














$sort_list="select * from sort_info_manage where sort_id='$id' and sort_title like '%$sort_name%' order by order_id";
}
else
{
$sort_list="select * from sort_info_manage where sort_id='$id' order by order_id";
}
$rs_sort_list=mysql_query($sort_list);
?>
                  <div align="center">
				  
				  
				  
				  
                    <table width="750"  border="0" cellpadding="0" cellspacing="0" class="news_css">
<form name="sort_form" method="post" action="sort_main_action.php?type_action=add&disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&province_id=<?=$_GET['province_id']?>&city_id=<?=$_GET['city_id']?>&high_school_id=<?=$_GET['high_school_id']?>&school_id=<?=$_GET['school_id']?>&school_sort_id=<?=$_GET['school_sort_id']?>&subject_id=<?=$_GET['subject_id']?>&id=<?=$_GET['id']?>&page=<?=$rows_count?>" onSubmit="return sort_check()">
                    <tr>
                      <td height="20" colspan="3" align="center" valign="middle" bordercolor="#FFFFFF">&nbsp;</td>
                    </tr>
                    <tr>					    
                      <td width="440" height="20" align="right" bordercolor="#FFFFFF">请输入分类名称：
                        <input name="sort_name" type="text" style="width:200px;height:20px;"></td>
                      <td width="10" bordercolor="#FFFFFF">&nbsp;</td>
                      <td width="300" valign="middle" bordercolor="#FFFFFF"><input name="imageField" type="image" src="../images/manage_add.jpg" align="middle" width="50" height="20" border="0"></td>
                    </tr>
                    </form>			      
<?php
     if (mysql_num_rows($rs_sort_list)/20>intval(mysql_num_rows($rs_sort_list)/20))
     {
	 $rows_count=intval(mysql_num_rows($rs_sort_list)/20)+1; 
	 }
	 else
	 {
	 $rows_count=intval(mysql_num_rows($rs_sort_list)/20);
	 }
	 $page=$_GET['page'];
	 if($page==0 || $page=='') { $page=1; }
	 if($page>$rows_count) { $page=$rows_count; }
	 if($rows_count<1) { $rows_count=1; } ?>
                  <tr>
                    <td colspan="3" align="center" valign="top" bordercolor="#FFFFFF"><table width="375" height="30" border="0" cellpadding="0" cellspacing="0" class="news_css">
     <?php
	 if(mysql_fetch_object($rs_sort_list))
	 {
	 if(mysql_data_seek($rs_sort_list,($page-1)*20))
	 {
	 for($i=1;$i<=10;$i++)
	  {
	  ?>
                      <tr>
                        <?php
		for($k=1;$k<=2;$k++)
		{
		if($rs_list=mysql_fetch_object($rs_sort_list))
		{
		?>
                        <td width="502" height="30">
					      <div style="width:370px;height:30px;margin-top:20px;" id="sort_<?=$rs_list->id?>">
						    <div style="width:7px;height:30px;background-image:url(../images/sort_left.jpg);margin-left:10px;display:inline;float:left;"></div>
						   <div style="width:200px;height:30px;background-image:url(../images/sort_middle_background.jpg);display:inline;float:left;">	
			 
			 
			 
			 
			  <div style="width:50px;height:30px;float:left;"><?=$rs_list->order_id?></div><div style="width:150px;height:30px;float:left;"><?php if ($_GET['id']=='province' || $_GET['id']=='subject') { ?><a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&id=<?=$rs_list->id?>"><?=$rs_list->sort_title?></a><?php } else { ?><?=$rs_list->sort_title?><?php } ?></div>
		      </div>


		  <div style="width:140px;height:20px;background-image:url(../images/sort_center.jpg);float:left;" align="right">[ <a href="javascript:del_confirm(<?=$rs_list->id?>)"><font color="#0000FF">删除</font></a><?php if ($_GET['id']=='province' || $_GET['id']=='subject') { ?> <a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&id=<?=$rs_list->id?>" title="添加二级分类"><font color="#0000FF">+</font></a><?php } ?> ]</div>
		      <div style="width:7px;height:20px;background-image:url(../images/sort_right.jpg);float:left;"></div></div>
			  
                            <div style="width:370px;height:30px;margin-top:20px;display:none;" id="input_<?=$rs_list->id?>">
                              <form name="sort_edit_form" method="post" action="sort_main_action.php?type_action=edit&id=<?=$rs_list->id?>&disp_type=<?=$_GET['disp_type']?>&sort_id=<?=$_GET['id']?>&page=<?=$_GET['page']?>" onSubmit="return sort_edit_check()">
                                <div style="width:275px;height:20px;float:left;"><input name="sort_name_<?=$rs_list->id?>" type="text" style="width:265px;height:20px;" value="<?=$rs_list->sort_title?>"></div>
                                <div style="width:50px;height:20px;float:left;"><input name="imageField" type="image" src="../images/manage_edit.jpg" width="40" height="20" border="0"></div>
							    <div style="width:40px;height:20px;float:left;"><img src="../images/cancel.jpg" width="40" height="20" onClick="javascript:input_div(sort_<?=$rs_list->id?>,input_<?=$rs_list->id?>)" style="cursor:pointer;"></div>
                              </form>
                          </div>						
						  
						    
                            <div style="width:370px;height:30px;margin-top:20px;display:none;" id="order_<?=$rs_list->id?>">
							
                              <form name="sort_edit_form" method="post" action="sort_main_action.php?type_action=order_edit&id=<?=$rs_list->id?>&disp_type=<?=$_GET['disp_type']?>&sort_id=<?=$_GET['id']?>&now_order=<?=$rs_list->order_id?>&page=<?=$_GET['page']?>" onSubmit="return sort_edit_check()">
                                
								<div style="width:75px;height:20px;line-height:20px;float:left;">请输入序号：</div><div style="width:200px;height:20px;float:left;"><input name="order_name_<?=$rs_list->id?>" type="text" style="width:190px;height:20px;" value="<?=$rs_list->order_id?>"></div><div style="width:50px;height:20px;float:left;"><input name="imageField" type="image" src="../images/manage_edit.jpg" width="40" height="20" border="0"></div>
                                <div style="width:40px;height:20px;float:left;"><img src="../images/cancel.jpg" width="40" height="20" onClick="javascript:input_div(sort_<?=$rs_list->id?>,order_<?=$rs_list->id?>)" style="cursor:pointer;"></div>
                              </form>
                          </div>
						  
						  
						  
						  
						  
					    </td>
                        <?php
		  }
		  }
		  ?>
                      </tr>
                      <?php
		}
		}
		}
		?>
                      </table>
                      <table width="700" height="70" border="0" cellpadding="0" cellspacing="0" class="news_css">
                        <tr>
                          <td align="center"><a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&submit_action=<?=$_GET['submit_action']?>&sort_name=<?=$_GET['sort_name']?>&subject_code=<?=$_GET['subject_code']?>&subject_name=<?=$_GET['subject_name']?>&id=<?=$_GET['id']?>&page=1">第一页</a>　　　　<a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&submit_action=<?=$_GET['submit_action']?>&sort_name=<?=$_GET['sort_name']?>&subject_code=<?=$_GET['subject_code']?>&subject_name=<?=$_GET['subject_name']?>&id=<?=$_GET['id']?>&page=<?=$page-1?>">上一页</a>　　　　　　　　　<?=$page?>　　共 <?=$rows_count?> 页　　　　　　　<a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&submit_action=<?=$_GET['submit_action']?>&sort_name=<?=$_GET['sort_name']?>&subject_code=<?=$_GET['subject_code']?>&subject_name=<?=$_GET['subject_name']?>&id=<?=$_GET['id']?>&page=<?=$page+1?>">下一页</a>　　　　<a href="sort_main.php?disp_type=<?=$_GET['disp_type']?>&disp_type=<?=$_GET['disp_type']?>&id=<?=$_GET['id']?>&submit_action=<?=$_GET['submit_action']?>&sort_name=<?=$_GET['sort_name']?>&subject_code=<?=$_GET['subject_code']?>&subject_name=<?=$_GET['subject_name']?>&page=<?=$rows_count?>">最后一页</a></td>
                        </tr>
                      </table></td>
                      </tr>
                    </table>
                    <?php } ?>
</div>
</body>
</html>