<?php 
	require_once('_approot.php');
	$ls_msg="修改博客操作";
	$id=$_GET['id'];
	$selectcate=$_GET['selectcate'];
	$page=$_GET['page'];

	$news_sql="select * from ls_news where ID=".$id." ";
	$news_query=$opendb->query($news_sql);
	$news_rows=mysqli_fetch_assoc($news_query);
	$selectcate=$_GET['selectcate'];

	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysqli_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>
        <link rel="stylesheet" href="css/style2.css" />
        <link href="ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="ueditor/lang/zh-cn/zh-cn.js"></script>
<link rel="stylesheet" href="kindeditor-4.1.10/themes/default/default.css" />
<link rel="stylesheet" href="kindeditor-4.1.10/plugins/code/prettify.css" />
<script charset="utf-8" src="kindeditor-4.1.10/kindeditor.js"></script>
<script charset="utf-8" src="kindeditor-4.1.10/lang/zh_CN.js"></script>
<script charset="utf-8" src="kindeditor-4.1.10/plugins/code/prettify.js"></script>
<script>
    KindEditor.ready(function(K) {
        var editor1 = K.create('textarea[name="newsText"]', {
            cssPath : 'kindeditor-4.1.10/plugins/code/prettify.css',
            uploadJson : 'kindeditor-4.1.10/php/upload_json.php',
            fileManagerJson : 'kindeditor-4.1.10/php/file_manager_json.php',
            allowFileManager : true,
			afterBlur: function(){
				this.sync();
			},
            afterCreate : function() {
                var self = this;
                K.ctrl(document, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function() {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
</script>
	</head>

	<body>
		<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1">
			<tr>
				<td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">修改博客</font></div>
				</td>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top"><br>
				 <form name="newsform" enctype="multipart/form-data" method="post" action="saveblog.php?selectcate=<?=$selectcate?>&page=<?=$page?>" onSubmit="return checkSubmitForm('newsDate,cate,Num,newsTitle2','日期,博客分类,序号,博客标题');">
					<input type="hidden" value="update" name="ls">
					<input type="hidden" value="<?php echo $id;?>" name="id">
                    <input type="hidden" value="<?php echo $news_rows['img'];?>" name="Pic">
                    <input type="hidden" name="ChangecatePagePic" value="no">
					<table border="0" width="96%" align="center">
						<tr>
							<td width="56%">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
							<td align="right"><img src="images/shao.gif">&nbsp;<a href="blog.php?selectcate=<?=$selectcate?>&page=<?=$page?>">返回</a></td>
						</tr>
					</table>
					<table width="96%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#f0f0ee">
					  <tr> 
						<td height="20" colspan="3"></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:20px;" width="9%">分类</td>
						<td width="42%"><input type="text" name="cate" id="cate" style="width:200px;" value="<?php echo $news_rows['cate'];?>" readonly />
						  <span style="padding-left:10px;">
						  <select name="select2" id="select2"  onchange="newsform.cate.value=this.value;">
						    <option value="0">请选择一个类别：</option>
						    <?php 			$news_sql="SELECT cateName FROM ls_functioncates  where functionName='博客分类' order by Num";//count the error by searchtype
			$news_query=$opendb->query($news_sql);
			while($news_rows2=mysqli_fetch_assoc($news_query))
		  	{
				echo "<option value=".$news_rows2['cateName'].">".$news_rows2['cateName']."</option>";
			}

			?>
					      </select>
					    </span></td>
						<td width="49%" rowspan="3" style="padding-left:20px;"><table border="0" width="98%">
						  <tr>
						    <td bgcolor="#f4f4f4" >标题 Title</td>
						    <td><input name="newsTitle" id="newsTitle" type="text" value="<?php echo $news_rows['title'];?>" size="70" /></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4" >关键字 Keywords</td>
						    <td><input name="newsKeywords" id="newsKeywords" type="text" value="<?php echo $news_rows['keywords'];?>" size="70" /></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4"  >描述 Description<br /></td>
						    <td><textarea name="newsDescription" cols="72" rows="3" id="newsDescription"><?php echo $news_rows['description'];?></textarea></td>
					      </tr>
					    </table></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
						<td style="padding-left:20px;">标题 *</td>
						<td >
				      <input type="text" name="newsTitle2"  id="newsTitle2" style="width:340px;" value="<?php echo $news_rows['newsTitle'];?>" />
						</td>
					  </tr>
                      <tr bgcolor="#f4f4f4">
                      <td style="padding-left:20px;"> 序号</td>
                      <td><input name="Num"  id="Num" type="text" style="width:40px;" value="<?php echo $news_rows['Num'];?>" size="6" maxlength="6"> &nbsp;
						  日期：
                          <input name="newsDate" id="newsDate" type="text" style="width:90px;" value="<?php echo $news_rows['newsDate'];?>" size="20"  /></td>
                      </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td colspan="2" style="padding-left:20px;" >内容 *</td>
						<td style="padding-left:150px;" ><div align="center">
						  <input type="submit" value="保存"> &nbsp; 
						  <input type="reset" name="button" id="button" value="重置" /> &nbsp; 
                          <input type="button" name="button" id="button" value="SEO"  onclick="
                            if(confirm('您确定要修改SEO设置吗？')){
                            $('#newsTitle').val($('#newsTitle2').val()+' - '+$('#cate').val()); 
						$('#newsKeywords').val('<?=$title_value['siteKeywords']?>');
						$('#newsDescription').val($('#newsText').val().substr(0, 86).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
	}else{
		return false;
	}"/>
						</div></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td colspan="3" >
                        <textarea name="newsText" id="newsText" style="width:100%;height:350px;visibility:hidden;"><?php echo $news_rows['newsText']; ?></textarea>
						</td>
						</tr>
                        
                        
                        
                        
                        
                        
					 <!-- <tr bgcolor="#B9DAFF"> 
						<td height="25" colspan="3" align="center"><span style="float:right;"><img src="images/shao.gif" alt="" />&nbsp;<a href="blog.php?selectcate=<?=$selectcate?>">返回</a></span><input type="submit" value="保存" /> &nbsp; 
					    <input type="reset" name="button2" id="button2" value="重置" /></td>
					  </tr>-->
                      
                      <tr bgcolor="#f0f0ee">
						<td height="47" colspan="3" align="center"> <button name="submit3" type="submit" value="确定" onClick="
                        if($('#productDescription').val().length <= 0){
                        	$('#productDescription').val(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix1']?><?=$lan['seoSufix2']?>'+', '+document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].text+'<?=$lan['seoFrefix2']?><?=$lan['seoSufix2']?>');
                        }"/> 确定</button>
						<button type="reset" name="button" id="button" value="重置" />重置</button>
			          </td>
					</tr>
                      
                      
					</table>
					<br />
                 </form>
				</td>
			</tr>
		</table>
	</body>
</html>