NewsR.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <%@ page language="java" contentType="text/html; charset=utf-8"
  2. pageEncoding="utf-8"%>
  3. <%
  4. String path = request.getContextPath();
  5. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  6. %>
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <link rel="stylesheet" href="<%=basePath %>resource/ext/resources/css/ext-all-gray.css" type="text/css"></link>
  12. <!--[if IE]>
  13. <link rel="stylesheet" href="<%=basePath %>resource/ext/resources/css/ext-ie-scoped.css" type="text/css"></link>
  14. <![endif]-->
  15. <link rel="stylesheet" href="<%=basePath %>resource/css/main.css" type="text/css"></link>
  16. <style type="text/css">
  17. h1{
  18. padding-top: 10px;
  19. font-size: 15px;
  20. }
  21. .comment{
  22. padding-left: 15px;
  23. }
  24. .comment .title{
  25. color: #999;
  26. font-size: 14px;
  27. font-weight: bold;
  28. font-family: fantasy;
  29. }
  30. .input{
  31. margin-right: 5px;
  32. background-color: #9ABACD;
  33. font-weight: bold;
  34. height: 30;
  35. width: 70;
  36. }
  37. .input:hover{
  38. background-color: #3CD60D;
  39. }
  40. form{
  41. padding-left: 15px;
  42. }
  43. form textarea{
  44. height: 100;
  45. width: 100%;
  46. background: #fefefe;
  47. border: 1px solid #EEDFCC;
  48. }
  49. form textarea:focus{
  50. background: #ffffff;
  51. border: 2px solid #FFA07A;
  52. }
  53. form input{
  54. font-weight: bold;
  55. height: 30;
  56. width: 70;
  57. color: #fdfdfd;
  58. float: right;
  59. cursor: pointer;
  60. background-color: #6A5ACD;
  61. padding-right: 5px;
  62. }
  63. form input:hover{
  64. background-color: #6CA6CD;
  65. }
  66. form font {
  67. color: #999;
  68. font-size: 14px;
  69. font-weight: bold;
  70. font-family: fantasy;
  71. }
  72. form #user{
  73. font-size: 13px;
  74. font-weight: normal;
  75. }
  76. /* .feel{
  77. padding-left: 15px;
  78. }
  79. .feel font{
  80. color: #7D9EC0;
  81. font-size: 14px;
  82. font-weight: bold;
  83. font-family: fantasy;
  84. }
  85. #myfeel li{
  86. margin-left: 36px;
  87. margin-top: 8px;
  88. padding: 0px;
  89. white-space: nowrap;
  90. display: inline;
  91. float: left;
  92. }
  93. #myfeel li div,img{
  94. margin-top: 8px;
  95. color: #999;
  96. }
  97. #myfeel li img:hover{
  98. background: #FFEC8B;
  99. background-position: 0 -30px;
  100. cursor: pointer;
  101. }*/
  102. .pill{
  103. height: 60px;
  104. width: 13px;
  105. border: 1px solid #E5E5E5;
  106. background: #fefefe url(<%=basePath%>resource/images/pill.gif) no-repeat scroll center center;
  107. }
  108. .main{
  109. }
  110. #content{
  111. padding-left: 15px;
  112. }
  113. #submitBtn{
  114. font-size:12px;
  115. height:30px;
  116. width:100px;
  117. border-width:2;
  118. }
  119. </style>
  120. <script type="text/javascript" src="<%=basePath %>resource/ext/ext-all.js"></script>
  121. <script type="text/javascript" src="<%=basePath %>resource/i18n/i18n.js"></script>
  122. <script type="text/javascript">
  123. /*新闻浏览界面*/
  124. Ext.onReady(function(){
  125. var id = getUrlParam('formCondition').replace(/IS/g, '=').split('=')[1];
  126. Ext.Ajax.request({
  127. url : basePath + 'oa/news/getNews.action',
  128. params: {
  129. id: id
  130. },
  131. method : 'post',
  132. callback : function(options,success,response){
  133. var localJson = new Ext.decode(response.responseText);
  134. if(localJson.success){
  135. var news = localJson.news;
  136. Ext.get('theme').insertHtml('afterBegin', news.ne_theme);
  137. Ext.get('date').insertHtml('afterBegin', Ext.Date.format(new Date(news.ne_releasedate), 'Y-m-d H:i:s'));
  138. Ext.get('releaser').insertHtml('afterBegin', news.ne_releaser);
  139. Ext.get('count').insertHtml('afterBegin', news.ne_browsenumber);
  140. Ext.get('content').insertHtml('afterBegin', news.ne_content);
  141. Ext.get('user').insertHtml('afterBegin', '&nbsp;&nbsp;欢迎您:&nbsp;&nbsp;' + em_code + "(" + em_name + ")");
  142. //审核人 可编辑和修改新闻
  143. if(news.ne_releaser != em_name){
  144. Ext.get('edit').destroy();
  145. Ext.get('delete').destroy();
  146. }
  147. Ext.create('Ext.form.HtmlEditor', {
  148. width: 1039,
  149. height: 150,
  150. id:'comment',
  151. renderTo:'textcomment'
  152. });
  153. //设置心情
  154. /* var count = 0;
  155. news.ne_feel = news.ne_feel || '0#0#0#0#0#0#0#0';
  156. Ext.each(news.ne_feel.split('#'), function(){
  157. count += Number(this);
  158. });
  159. Ext.each(news.ne_feel.split('#'), function(f, index){
  160. if(count > 0){
  161. document.getElementById("feel_p_" + (index + 1)).style.backgroundPosition = "center " + (60 - 60*Number(f)/count) + "px";
  162. Ext.get("feel_n_" + (index + 1)).insertHtml('afterBegin', f);
  163. } else {
  164. document.getElementById("feel_p_" + (index + 1)).style.backgroundPosition = "center 60px";
  165. Ext.get("feel_n_" + (index + 1)).insertHtml('afterBegin', 0);
  166. }
  167. }); */
  168. var comments=news.comments;
  169. Ext.Array.each(comments,function(comment){
  170. Ext.get('newscomment').insertHtml('afterBegin','<li><div style="height:50px; background-color:#FFF0F5;">'+comment.nc_comment+'</div></br><div style="float: right;">'+comment.nc_caster+"&nbsp&nbsp&nbsp"+comment.nc_date+'</div></li></br>');
  171. });
  172. //console.log(news);
  173. var prevstr=news.prevNews!=null?news.prevNews.ne_theme:"没有上一条";
  174. var nextstr=news.nextNews!=null?news.nextNews.ne_theme:"没有下一条";
  175. if(!news.prevNews&&!news.nextNews){
  176. Ext.get('change').insertHtml('afterBegin',' <div align="right" style="margin-right:20px">上一条:<a href="#"><font >'+prevstr+'</font></a>&nbsp;&nbsp;下一条 <a href="#">'+nextstr+'<font ></font></a></div>');
  177. }
  178. else if(!news.prevNews){
  179. Ext.get('change').insertHtml('afterBegin',' <div align="right" style="margin-right:20px">上一条:<a href="#"><font >'+prevstr+'</font></a>&nbsp;&nbsp;下一条 <a href="javascript:openFormUrl(\'' + news.nextNews.ne_id + '\',\'ne_id\',\'jsps/oa/news/NewsR.jsp\',\'新闻\');">'+nextstr+'<font ></font></a></div>');
  180. }else if(!news.nextNews){
  181. Ext.get('change').insertHtml('afterBegin',' <div align="right" style="margin-right:20px">上一条:<a href="javascript:openFormUrl(\'' + news.prevNews.ne_id + '\',\'ne_id\',\'jsps/oa/news/NewsR.jsp\',\'新闻\');"><font >'+prevstr+'</font></a>&nbsp;&nbsp;下一条 <a href="#">'+nextstr+'<font ></font></a></div>');
  182. }else {
  183. Ext.get('change').insertHtml('afterBegin',' <div align="right" style="margin-right:20px">上一条:<a href="javascript:openFormUrl(\'' + news.prevNews.ne_id + '\',\'ne_id\',\'jsps/oa/news/NewsR.jsp\',\'新闻\');"><font >'+prevstr+'</font></a>&nbsp;&nbsp;下一条 <a href="javascript:openFormUrl(\'' + news.nextNews.ne_id + '\',\'ne_id\',\'jsps/oa/news/NewsR.jsp\',\'新闻\');">'+nextstr+'<font ></font></a></div>');
  184. }
  185. } else {
  186. if(localJson.exceptionInfo){
  187. showError(localJson.exceptionInfo);
  188. window.location.href = basePath + 'jsps/error/e-500.jsp';
  189. }
  190. }
  191. }
  192. });
  193. });
  194. function sendComment() {
  195. var id = getUrlParam('formCondition').replace(/IS/g, '=').split('=')[1];
  196. var comment=Ext.getCmp('comment').getValue( );
  197. Ext.Ajax.request({
  198. url : basePath + 'oa/news/sendComment.action',
  199. params: {
  200. id: id,
  201. comment:comment,
  202. },
  203. method : 'post',
  204. callback : function(options,success,response){
  205. Ext.getCmp('comment').setValue(null);
  206. window.location.href = basePath + 'jsps/oa/news/NewsR.jsp?formCondition=id='+id;
  207. }
  208. });
  209. }
  210. function deleteNews() {
  211. var id = getUrlParam('formCondition').replace(/IS/g, '=').split('=')[1];
  212. var comment=Ext.getCmp('comment').getValue( );
  213. console.log(basePath + 'oa/news/deleteNews.action');
  214. Ext.Ajax.request({
  215. url : basePath + 'oa/news/deleteNews.action',
  216. params: {
  217. id: id
  218. },
  219. method : 'post',
  220. callback : function(options,success,response){
  221. Ext.getCmp('comment').setValue(null);
  222. window.location.href = basePath + 'jsps/oa/news/NewsR.jsp?formCondition=id='+id;
  223. }
  224. });
  225. }
  226. function editNews() {
  227. var id = getUrlParam('formCondition').replace(/IS/g, '=').split('=')[1];
  228. window.location.href = basePath + 'jsps/oa/news/News.jsp?formCondition=ne_id='+id;
  229. }
  230. </script>
  231. </head>
  232. <body >
  233. <center>
  234. <h1><span id="theme"></span></h1><br/>
  235. <font color=#999;><span id="date"></span></font>&nbsp;&nbsp;&nbsp;
  236. 编辑:<font color=#999;><span id="releaser"></span></font>&nbsp;&nbsp;&nbsp;
  237. 浏览:<font color=red><span id="count"></span></font>次&nbsp;&nbsp;&nbsp;
  238. <a href="#">评论:(<font color=red;>0</font>人参与)</a>
  239. <input type="button" value="编&nbsp;辑" class="input" onclick="editNews();" id="edit">
  240. <input type="button" value="删&nbsp;除" class="input" onclick="deleteNews();" id="delete">
  241. <div id="change"></div>
  242. </center>
  243. <hr>
  244. &nbsp;&nbsp;&nbsp;<div class="main"><span id="content"></span></div>
  245. <!-- <div class="feel">
  246. <font>读完这篇新闻后,您心情如何?</font>
  247. <ul id="myfeel">
  248. <li>
  249. <div id="feel_n_1"></div>
  250. <div id="feel_p_1" class="pill"></div>
  251. <img src="<%=basePath %>resource/images/face/1.gif">
  252. <div id="feel_i_1">高兴</div>
  253. </li>
  254. <li>
  255. <div id="feel_n_2"></div>
  256. <div id="feel_p_2" class="pill"></div>
  257. <img src="<%=basePath %>resource/images/face/2.gif">
  258. <div id="feel_i_2">感动</div>
  259. </li>
  260. <li>
  261. <div id="feel_n_3"></div>
  262. <div id="feel_p_3" class="pill"></div>
  263. <img src="<%=basePath %>resource/images/face/3.gif">
  264. <div id="feel_i_3">同情</div>
  265. </li>
  266. <li>
  267. <div id="feel_n_4"></div>
  268. <div id="feel_p_4" class="pill"></div>
  269. <img src="<%=basePath %>resource/images/face/4.gif">
  270. <div id="feel_i_4">愤怒</div>
  271. </li>
  272. <li>
  273. <div id="feel_n_5"></div>
  274. <div id="feel_p_5" class="pill"></div>
  275. <img src="<%=basePath %>resource/images/face/5.gif">
  276. <div id="feel_i_5">搞笑</div>
  277. </li>
  278. <li>
  279. <div id="feel_n_6"></div>
  280. <div id="feel_p_6" class="pill"></div>
  281. <img src="<%=basePath %>resource/images/face/6.gif">
  282. <div id="feel_i_6">难过</div>
  283. </li>
  284. <li>
  285. <div id="feel_n_7"></div>
  286. <div id="feel_p_7" class="pill"></div>
  287. <img src="<%=basePath %>resource/images/face/7.gif">
  288. <div id="feel_i_7">新奇</div>
  289. </li>
  290. <li>
  291. <div id="feel_n_8"></div>
  292. <div id="feel_p_8" class="pill"></div>
  293. <img src="<%=basePath %>resource/images/face/8.gif">
  294. <div id="feel_i_8">流汗</div>
  295. </li>
  296. </ul>
  297. </div>
  298. -->
  299. <div>
  300. <br/><br/><br/><br/><br/>
  301. <ul id="newscomment">
  302. <li></li>
  303. </ul>
  304. </div>
  305. <div>
  306. <form >
  307. <br/><br/><br/><br/><br/>
  308. <font>填写您的评论:</font><font id='user'></font><br/>
  309. <div id="textcomment"></div>
  310. <!-- <textarea rows="10" name="comment" id="comment"></textarea> -->
  311. <input type="button" id="submitBtn" onclick="sendComment();" value="&nbsp;提&nbsp;&nbsp;交" />
  312. </form>
  313. </div>
  314. <br/>
  315. <!-- <div action="">
  316. <font id='comment'></font><br/>
  317. <font id='div'></font><br/>
  318. <input type='button' value="&nbsp;回&nbsp;&nbsp;复"/>
  319. </div>
  320. <div class="comment"><span class="title">查看最新评论(</span><font color=red;>0</font><span class="title">人参与)</span></div> -->
  321. </body>
  322. </html>