 <?php
    require_once '../service/NewsService.class.php';
    require_once '../phpbean/News.class.php';
    $newsId = $_GET['newsId'];
    $newsService = new NewsService();
    $news = $newsService->GetNews($newsId);
 ?>
<html>
<head>
<title>查看新闻信息</title>
<link href="/css/add_modify.css" rel="stylesheet" type="text/css" />
<script src="/js/util.js" type="text/javascript"></script>
<script src="../js/calendar.js"></script>
<script type="text/javascript">
        function CheckForm() {
            var re = /^[0-9]+.?[0-9]*$/;
            var resc=/^[1-9]+[0-9]*]*$/ ;
            var newsTitle = document.getElementById("newsTitle").value;
            if (newsTitle == "") {
                alert("请输入新闻标题...");
                document.getElementById("newsTitle").focus();
                return false;
            }

            var newsContent = document.getElementById("newsContent").value;
            if (newsContent == "") {
                alert("请输入新闻内容...");
                document.getElementById("newsContent").focus();
                return false;
            }

            var newsDate = document.getElementById("newsDate").value;
            if (newsDate == "") {
                alert("请输入发布日期...");
                document.getElementById("newsDate").focus();
                return false;
            }

            document.forms[0].submit();
       } 
    </script>
</head>
<body>
	<div id="container">
		<div id="title">
			<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">
				<tr>
					<td height="21"><img src="../images/ico/ico29.gif" width="32" height="32" hspace="2" vspace="2" align="absmiddle">
					    <strong> 新闻信息修改 </strong>
					</td>
				</tr>
			</table>
		</div>

		<div id="content">
			<form id="form1" method="post" action="/controller/NewsAction.php?action=update" enctype="multipart/form-data">
				<p>
					记录编号: &nbsp;
					<input id="newsId" class="text" type="text" readOnly style="width: 60px" value="<?php echo $news->getNEWSID()?>" name="news[newsId]" />
					<font color=red>*</font>
				</p>
				<p>
					新闻标题: &nbsp;
					<input id="newsTitle" class="text" type="text" style="width: 500px" value="<?php echo $news->getNewsTitle()?>" name="news[newsTitle]" />
					<font color=red>*</font>
				</p>
				<p>
					新闻内容: &nbsp;
					<textarea name="news[newsContent]" id="newsContent" cols="60" rows="8"><?php echo $news->getNewsContent()?></textarea>
					<font color=red>*</font>
				</p>
				<p>

					发布日期:&nbsp; <input id="newsDate" type="text" class="text" readonly id="news[newsDate]" name="news[newsDate]" value="<?php echo date("Y-m-d",strtotime($news->getNewsDate()));?>" onclick="setDay(this);" />
					<font color=red>*</font>
				</p>
				<p>
					新闻图片:&nbsp; <img src="<?php echo $news->getNewsPhoto()?>" width="200px" border="0px" /><br/>
				</p>
			</form>
		</div>
	</div>
</body>
</html>
