<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_label.php");
include_once("../loginstate.php");
SystemPer('2_2');
$ac=CS_Request("ac");
$id=CS_Request("id");
$row=$db->getRow("select * from ".Getdbname('gbook')." where CS_ID=".$id."");
?>
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>csdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<script language="javascript" src="../res/js/jquery.js"></script>
<style> 
body{width:440px;}
</style>
<script language="javascript">
$(document).ready(function(){
	$("#addhf").click(function(){
		var CS_Hfneir=$("#CS_Hfneir").val();
	$("#CS_Hfneir").css("border-color","#666 #ccc #ccc #666");
	if(CS_Hfneir==""){
		$("#CS_Hfneir").css("border","1px solid red");
		$("#Msg").text("请填写回复内容！").css("color","red");
		return false;
		}
	});
});

function dhcolok(){
    this.parent.$('.webox').css({display:'none'});
    this.parent.$('.background').css({display:'none'});
}
</script>
</head>
<body class="body_none">
<div>
<!-- mod start -->
<form method="post" class="J_ajaxForm" action="?ac=edit" data-role="edit">
<div class="pop_cont pop_table2">
	<table width="100%" style="table-layout:fixed;">
		<tr><input name="id" type="hidden" value="<?php echo $id?>" />
			<td>
				<div class="mb5"><textarea class="length_6" id="CS_Hfneir" name="CS_Hfneir"><?php echo $row['CS_Hfneir']?></textarea></div>
			</td>
		</tr>
	</table>
</div>
<!-- mod end -->
<div class="pop_bottom">
    <div class="tips_error" id="Msg"></div>
	<button class="btn fr" onclick="dhcolok();" type="button">取消</button>
	<button class="btn btn_submit J_ajax_submit_btn mr10 fr" id="addhf" type="submit">提交</button>
</div>
</form>
<!-- end -->
</div>
<?php
if($ac=='edit'){
    $CS_Hfneir=CS_Request("CS_Hfneir");

    if(empty($CS_Hfneir)) exit("<script>document.getElementById('Msg').innerHTML='请把资料填写完整!';</script>");

    $sql="update ".Getdbname('gbook')." set CS_Hfneir='".$CS_Hfneir."',CS_FID=".$id." where CS_ID=".$id;

    if($db->query($sql)){
        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,回复成功!").css("color","#026E12");</script>';
	echo "<script>setTimeout(\"this.parent.$('.webox').css({display:'none'});this.parent.$('.background').css({display:'none'});window.parent.location.reload();\",2000);</script>";
    }else{
        echo '<script>$("#Msg").text("抱歉,回复失败!").css("color","red");</script>';
        echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
    }
}
?>
</body>
</html>
