<?php 
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	$ls_msg="修改文章操作";
	$id=$_GET['id'];

	$article_sql="select * from ls_article where ID=".$id." ";
	$article_query=$opendb->query($article_sql);
	$article_rows=mysql_fetch_assoc($article_query);
	$selectcate=$_GET['selectcate'];
	$selectfunctionName=$_GET['selectfunctionName'];
	

?>
<!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/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="articleform" enctype="multipart/form-data" method="post" action="savearticle.php?selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>" onSubmit="return checkSubmitForm('articleDate,cateName,functionName,Num,articleTitle','日期,子栏目,栏目,序号,新闻标题');">
					<input type="hidden" value="update" name="ls">
					<input type="hidden" value="<?php echo $id;?>" name="id">
					<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="managearticle.php?selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>"><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="3"></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:50px;" width="20%">文章标题：</td>
						<td width="40%"><input type="text" name="articleTitle"  id="articleTitle" style="width:300px;" value="<?php echo ($selectfunction?$_GET[articleTitle]:$article_rows['articleTitle']);?>"></td>
						<td width="40%" style="padding-left:20px;"> 序号：
						  <input name="Num" id="Num" type="text" style="width:40px;" value="<?php echo $selectfunction?$_GET[Num]:$article_rows['Num'];?>" size="6" maxlength="6">
						  日期：
                          <input name="articleDate" id="articleDate" type="text" style="width:90px;" value="<?=$article_rows['articleDate']?>" size="20"  /></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
						<td style="padding-left:50px;">文章说明：</td>
						<td colspan="2"><input name="articleBrief" type="text" style="width:600px;" value="<?php echo ($selectfunction?$_GET[articleBrief]:$article_rows['articleBrief']);?>"></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
						<td style="padding-left:50px;">栏目：</td>
						<td colspan="2"><input name="functionName" type="text"  id="functionName"  value="<?php echo $selectfunction?$_GET[functionName]:$article_rows['functionName'];?>" size="30" readonly>
							<span style="padding-left:20px;">
							<select name="select2" id="select2"  onChange="articleform.functionName.value=this.value;window.open('?id=<?=$id?>&articleTitle='+articleform.articleTitle.value+'&articleBrief='+articleform.articleBrief.value+'&functionName='+this.value +'&Num='+articleform.Num.value +'&selectfunction='+this.value,'right','');">
							  <option value="0">请选择一个栏目：</option>
							  <?
			$news_sql="SELECT distinct(functionName) FROM ls_functioncates   where functionName!='新闻分类' and functionName!='singlePages' 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['functionName'].">".$news_rows2['functionName']."</option>";
			}

			?>
							</select>
						  </span></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
						<td style="padding-left:50px;">子栏目：</td>
						  <?
			$news_sql=$selectfunction?"SELECT distinct(cateName) FROM ls_functioncates   where functionName='".$selectfunction."' order by Num":"SELECT distinct(cateName) FROM ls_functioncates   where functionName!='新闻分类' and functionName!='singlePages' order by Num";//count the error by searchtype
			$news_query=$opendb->query($news_sql);
			$news_rows2=mysql_fetch_assoc($news_query);
			
			?>
						<td colspan="2"><input name="cateName" type="text"  id="cateName"   value="<?php echo $selectfunction?$news_rows2['cateName']:$article_rows['cateName'];?>" size="30" readonly>
						  <span style="padding-left:20px;">
						  <select name="select" id="select"  onChange="articleform.cateName.value=this.value;">
							<option value="0">请选择一个子栏目：</option> 
						  <?
									 
					  	echo "<option value=".$news_rows2['cateName'].">".$news_rows2['cateName']."</option>";


			while($news_rows2=mysql_fetch_assoc($news_query))
		  	{
				echo "<option value=".$news_rows2['cateName'].">".$news_rows2['cateName']."</option>";
			}

			?>
						  </select>
						  </span></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td colspan="2" style="padding-left:50px;" >文章内容：</td>
						<td style="padding-left:150px;" ><div align="center">
						  <input type="submit" value="修改文章">
						  <input type="reset" name="button" id="button" value="重置" />
						</div></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:50px;" colspan="3" >
						<!--<input type="hidden" name="articleText" value="<?php //echo htmlspecialchars($article_rows['articleText']);?>">
						<iframe ID="eWebEditor1" src="ewebeditor/ewebeditor.php?id=articleText&style=coolblue" frameborder="0" scrolling="no" width="90%" HEIGHT="350"></iframe>-->
							<?php
								require_once('fckeditor/fckeditor.php');
								$sBasePath=$_SERVER['PHP_SELF'];
								$sBasePath=substr($sBasePath,0,strpos($sBasePath,"ls_admin"));
								$sBasePath.="ls_admin/fckeditor/";
									
								$oFCKeditor=new FCKeditor('articleText');
								$oFCKeditor->BasePath=$sBasePath;
								$oFCKeditor->Config['SkinPath']=$sBasePath.'editor/skins/silver/';
								$oFCKeditor->Config['AutoDetectLanguage']=true;
								$oFCKeditor->ToolbarSet='Default';
								$oFCKeditor->Height='350';
								$oFCKeditor->Value=$article_rows['articleText'];
								$oFCKeditor->Create();
							?>
						</td>
						</tr>
					  <tr bgcolor="#B9DAFF"> 
						<td height="25" align="center">&nbsp;</td>
						<td height="25" align="right"><input type="submit" value="修改文章" />
					    <input type="reset" name="button2" id="button2" value="重置" /></td>
						<td height="25" align="right"><img src="images/shao.gif" alt="" />&nbsp;<a href="managearticle.php?selectcate=<?=$selectcate?>&selectfunctionName=<?=$selectfunctionName?>"><u>返回</u></a></td>
					  </tr>
					</table>
					<br />
                 </form>
				</td>
			</tr>
		</table>
	</body>
</html>