<?
$C_126cmsadmin_tname = 'menu_config';

include(dirname(__FILE__)."/global.php");



@$job = $submitted_vars["job"];

if($job == "del"){
   
   $id = $_GET['id'];
   $query="DELETE FROM `w6_menu` WHERE `id`='$id' ";
   $result=mysql_query($query) or die( mysql_error() );
   if ($result)
     {
       $showmsg = "导航菜单删除成功！";
	   $formurl = "menu.php";
     }
  else
     {
       $showmsg = "导航菜单删除失败！";
	   $formurl = "menu.php";
     }
	 
  include('showmsg.php');
  exit;
  
}if($job == "modifylist"){
   
   $order = $_POST['order'];
   
   foreach( $order AS $key=>$value)
	{
		$result = mysql_query("UPDATE w6_menu SET list='$value' WHERE id='$key'");
	}
	$showmsg = "修改成功！";
	$formurl = "menu.php";
    include('showmsg.php');
    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=gb2312" />
<title>后台管理</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	text-decoration: none;
	color: #000000;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: underline;
	color: #FF0000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style></head>

<body>
<div align="center" class="font12">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#A4B6D7">
    <tr>
      <td width="100%" height="22" align="center" background="images/titlebg.jpg">&nbsp;</td>
    </tr>
  </table>
  <br />
  <table width="100%" height="25" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td align="left" bgcolor="#FFFFFF"> [<a 
      href="menu.php" class="a_bt">菜单管理</a>] 
      [<a 
      href="menu_add.php" class="a_bt">新添加一个链接</a>] </td>
    </tr>
  </table>
  <br />
  <br />
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tr>
      <td height="22" align="left" class="head">菜单管理</td>
    </tr>
    <tr>
      <td height="24" align="left">
	  <br />
      <UL>
      <LI>注意:<FONT color=#ff0000>排序的规则是,数值大的排在前面</FONT> </LI>
      </UL>
</td>
    </tr>
    <tr>
      <td align="center">
	  <FORM name="formlist" action="" method="post">
  <table width="99%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td width="55%" height="30" align="center" background="images/titlebg.jpg">菜单名称</td>
          <td width="15%" align="center" background="images/titlebg.jpg">排序</td>
          <td width="10%" align="center" background="images/titlebg.jpg">状态</td>
          <td width="10%" align="center" background="images/titlebg.jpg">修改</td>
          <td width="10%" align="center" background="images/titlebg.jpg">删除</td>
        </tr>
		<?
	$query="SELECT * FROM `w6_menu` ORDER BY `list` DESC";

  	//echo "<br>".$query."<br><br><br><br>aaaa<br><br><br><br>";
  	$result=mysql_query($query) or die("Could not connect: " . mysql_error());
  	$num=mysql_num_rows($result);

  	$result=mysql_query($query);
  	$i=0;
  	while($row=mysql_fetch_array($result))
  	{
  	$id      =  stripslashes($row["id"]);
  	$name   =  stripslashes($row["name"]);
  	$hide   =  stripslashes($row["hide"]);
  	$color   =  stripslashes($row["color"]);
  	$list   =  stripslashes($row["list"]);
	
	if($hide == "1"){
	$hide="<font color=\"#0000FF\">隐藏</font>";
	}elseif($hide == "0"){
	$hide="显示";
	}
?>
        <tr class=trA onMouseOver="this.className='trB'" 
        onmouseout="this.className='trA'">
          <td align="left" class="td" style="color:<? if($color) echo $color;?>;">【<?=$name?>】</td>
          <td align="center" class="td">
            <input maxlength="4" size="5" value="<?=$list?>" name="order[<?=$id?>]" />
          </td>
          <td align="center" class="td"><?=$hide?></td>
          <td align="center" class="td"><a href="menu_modify.php?id=<?=$id?>">修改</a></td>
          <td align="center" class="td"><a href="?job=del&amp;id=<?=$id?>">删除</a></td>
        </tr>
		<?
		}
		?>
        <tr>
          <td height="30" colspan="5" align="center"><input type="submit" value="修改排序" name="Submit22" />
            <input name="job" type="hidden" id="job" value="modifylist" /></td>
        </tr>
      </table>
	  </form></td>
    </tr>
  </table>
  </div>
</body>
</html>
