<?php 
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$ls_msg="添加下载";
	$selectcate=$_GET['selectcate'];
	$opendb=new mydb();
	require_once('inc/char_set.php');
	
	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysql_fetch_assoc($title_query);
	
?>
<!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 href="css/admin.css" rel="stylesheet" type="text/css">
        <script language="JavaScript" src="js/jquery.js"></script>
		<script language="JavaScript" src="js/ls.js"></script>
		<title>无标题文档</title>
	</head>
	<body>
		<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
			<tr>
				<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>添加下载</strong></font></div>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top" bgcolor="#dee7ff"><br>
				 <form name="newsform" enctype="multipart/form-data" method="post" action="savedownload.php?selectcate=<?=$selectcate?>" onSubmit="return Checkaddnews()">
					<input type="hidden" value="insert" name="ls">
					<table border="0" width="90%" align="center">
						<tr>
							<td>提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
							<td align="right"><img src="images/shao.gif">&nbsp;<a href="download.php?selectcate=<?=$selectcate?>"><u>返回</u></a></td>
						</tr>
					</table>
					<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
					  <tr bgcolor="#B9DAFF"> 
						<td height="28" colspan="4"></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
					    <td style="padding-left:20px;">分类：</td>
					    <td width="40%"><input type="text" name="cateName"  id="cateName" value="<?=$selectcate==""?"":$selectcate?>" style="width:150px;"  />
					      <select name="select2" id="select2"  onchange="this.form.cateName.value=this.value;">
					        <option value="0">请选择分类：</option>
					        <?
			$news_sql="SELECT distinct(cateName) FROM ls_download  where enable=1 and cateName!='' order by Num";//count the error by searchtype
			$news_query=$opendb->query($news_sql);
			while($news_rows2=mysql_fetch_assoc($news_query))
		  	{
				echo "<option value=".$news_rows2['cateName'].">".$news_rows2['cateName']."</option>";

			}

			?>
				          </select>
					      可直接添分类</td>
                          <td width="13%" style="padding-left:20px;">标题 Title</td>
                          <td width="37%"><input name="newsTitle" id="newsTitle" type="text" value="<?php echo $_POST['productTitle'];?>" size="70" /></td>
				      </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:20px;" width="10%">标题：</td>
						<td><input type="text" name="downloadTitle" style="width:300px;" onblur="if($('#newsTitle').val().length <= 0){$('#newsTitle').val(this.value+' - '+$('#cateName').val()); 
                        $('#newsKeywords').val('<?=$title_value['siteKeywords']?>');
                        $('#newsDescription').val('<?=$title_value['siteDescription']?>');
                        }" ></td>
                        <td style="padding-left:20px;">关键字 Keywords</td>
                        <td><input name="newsKeywords" id="newsKeywords" type="text" value="<?php echo $_POST['productKeywords'];?>" size="70" /></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:20px;" width="10%">下载文件：</td>
						<td><input type="file" name="downloadName" style="width:300px;" ></td>
                        <td style="padding-left:20px;">描述 Description</td>
                        <td><textarea name="newsDescription" cols="71" rows="3" id="newsDescription"></textarea></td>
					  </tr>
					  <tr bgcolor="#B9DAFF"> 
						<td height="25" colspan="4" align="center"><input type="submit" value="确定"></td>
					  </tr>
					</table>
				</form>
				</td>
			</tr>
		</table>
	</body>
</html>