<?php 
	require_once('_approot.php');
	$ls_msg="修改单页，模版及生成文件名不要使用保留字如 history.html， aboutus.html";;
	$id=$_GET['id'];

	$page_sql="select * from ls_singlepages where ID=".$id." ";
	$page_query=$opendb->query($page_sql);
	$page_rows=mysqli_fetch_assoc($page_query);
	$selectcate=$_GET['selectcate'];
	
	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysqli_fetch_assoc($title_query);
	
	$pos = strpos($title_value['companyName'], '-', 1);
	$subCompanyName = substr($title_value['companyName'], (mb_strlen($title_value['companyName'],'utf-8') - $pos) * -1 );

?>
<!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 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="pageText"]', {
            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,
            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>
			</tr>
			<tr>
				<td height="213" valign="top"><br>
				 <form name="pageform" enctype="multipart/form-data" method="post" action="savesinglepage.php" onSubmit="return Checkaddnews()">
					<input type="hidden" value="update" name="ls">
					<input type="hidden" value="<?php echo $id;?>" name="id">
					<table border="0" width="98%" align="center">
						<tr>
							<td>提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
							<td align="right"><img src="images/shao.gif">&nbsp;<a href="singlepage.php?selectcate=<?=$selectcate?>">返回</a></td>
					  </tr>
					</table>
					<table width="98%" 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="11%">标题 *</td>
						<td width="35%"><input name="pageTitle" id="pageTitle" type="text" style="width:96%;" value="<?php echo $page_rows['pageTitle'];?>" size="60"></td>
						<td width="54%" rowspan="4" style="padding-left:20px;"><table border="0" width="98%">
						  <tr>
						    <td width="29%" bgcolor="#f4f4f4" >标题 Title *</td>
						    <td width="71%"><input name="newsTitle" id="newsTitle" type="text" value="<?php echo $page_rows['newsTitle'];?>" style="width:96%;" /></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4" >关键字 Keywords</td>
						    <td><input name="newsKeywords" id="newsKeywords" type="text" value="<?php echo $page_rows['newsKeywords'];?>" style="width:96%;" /></td>
					      </tr>
						  <tr>
						    <td bgcolor="#f4f4f4"  >描述 Description *<br /></td>
						    <td><textarea name="newsDescription" style="width:96%;" rows="3" id="newsDescription"><?php echo $page_rows['newsDescription'];?></textarea><br/><?=$promlv>1?$seo:""?></td>
					      </tr>
					    </table></td>
					  </tr>
					  <tr bgcolor="#f4f4f4">
						<td style="padding-left:20px;">说明</td>
						<td><input name="pageBrief" type="text" style="width:96%;" value="<?php echo $page_rows['pageBrief'];?>"></td>
                      </tr>
                      <tr bgcolor="#f4f4f4">
						<td style="padding-left:20px;">模版</td>
						<td><input name="tpl" type="text" style="width:96%;" value="<?php echo $page_rows['static_tpl'];?>"></td>
                      </tr>
                      <tr bgcolor="#f4f4f4">
						<td style="padding-left:20px;">生成文件名</td>
						<td><input name="name" type="text" style="width:96%;" value="<?php echo $page_rows['singlepage_name'];?>"></td>
                      </tr>
                      <tr bgcolor="#f4f4f4">
                        <td style="padding-left:20px;">主题图</td>
                        <td><input name="banner" type="text" style="width:96%;" value="<?php echo $page_rows['banner'];?>" /></td>
                        <td>（无需加 _banner.jpg）</td>
                      </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td colspan="2" style="padding-left:20px;" >内容</td>
						<td style="padding-left:150px;" ><div 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>
                          <button type="button" name="button" id="button" value="SEO"  onclick="
                            if(confirm('您确定要修改SEO设置吗？')){
                            $('#newsTitle').val($('#pageTitle').val()+'<?php if(strpos($title_value['companyName'],"-")){echo " ".$subCompanyName;}else{echo " - ".$title_value['companyName'];}?>');
                        $('#newsKeywords').val('<?=$title_value['siteKeywords']?>');
                        var newsDescription = '<?=str_replace('\\r','',$title_value['siteDescription']);?>';
                        $('#newsDescription').val(newsDescription.substr(0, 200).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
	}else{
		return false;
	}"/>SEO</button>
						</div></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:20px;" colspan="3" ><!--
						<input type="hidden" name="pageText" value="<?php //echo $page_rows['pageText'];?>">
						<iframe ID="eWebEditor1" src="ewebeditor/ewebeditor.php?id=pageText&style=coolblue" frameborder="0" scrolling="no" width="100%" HEIGHT="350"></iframe>-->
                        <textarea name="pageText" style="width:100%;height:400px;visibility:hidden;"><?php echo  $page_rows['pageText'] ; ?></textarea>
                        <?=$promlv>1?$detail_tips:""?></td>
						</tr>
					  <tr bgcolor="#f0f0ee"> 
						<td height="25" colspan="3" align="center"><button type="submit" value="保存">确定</button> &nbsp; 
					    <button type="reset" name="button2" id="button2" value="重置" />重置</button></td>
					  </tr>
					</table>
					<br />
                 </form>
				</td>
			</tr>
		</table>
	</body>
</html>