修复登录页问题,添加论坛表情

This commit is contained in:
FJY
2017-11-30 17:24:00 +08:00
parent 5e87ddf1ba
commit 40483bae6a
22 changed files with 788 additions and 198 deletions

View File

@@ -16,6 +16,7 @@
<link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="forum/css/animate.css" rel="stylesheet">
<link href="forum/css/style.css" rel="stylesheet">
<link href="css/emoji.css" rel="stylesheet">
<script type="text/javascript">
function validateSubject(field) {
@@ -27,8 +28,7 @@
function validate(form) {
fail = validateSubject(form.subject.value)
fail += validateContent(form.content.value)
if (fail == "") return true;
else {
if (fail == "") return true;else {
alert(fail);return false;
} //判断表单的内容不能为空
}
@@ -49,7 +49,6 @@
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+"; //正则表达式
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
%>
<%@ include file="module/top.jsp"%>
<div class="container">
@@ -76,6 +75,7 @@
Statement sql;
ResultSet rs;
String content = "";
String regex = "<(?!image).*?>";
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
@@ -91,7 +91,9 @@
while (rs.next()) {
%>
<%
if (!adminuser.equals("")) {
%>
<%
if (rs.getInt("flag") == 0) {
@@ -110,45 +112,68 @@
<%
}
%>
<%
} else {
out.print("");
}
%>
</div>
<div class="row">
<div class="mail_box col-lg-10 col-md-10">
<div class="mail-tools tooltip-demo m-t-md">
<div class="mail-body">
<h3>
<%
if (rs.getInt("flag") == 1) {
%>
<span class="font-noraml">主题: </span><strong style="color=red"><%=rs.getString("subject")%></strong>
<%
} else {
%>
<span class="font-noraml">主题: </span>><%=rs.getString("subject")%>
<%
}
%>
</h3>
</div>
<div class="mail-body">
<h3>
<%
if (rs.getInt("flag") == 1 && rs.getString("subject").matches(regex)) {
//置顶且匹配
%>
<span class="font-noraml">主题: </span><strong><script type='text/html' style='display:inline;color:red;'><%=rs.getString("subject")%></script></strong>
<%
}
if (rs.getInt("flag") == 0 && rs.getString("subject").matches(regex)) {
//不置顶但匹配
%>
<span class="font-noraml">主题: </span><script type='text/html' style='display:inline;color:red;'><%=rs.getString("subject")%></script>
<%
}
if (rs.getInt("flag") == 1 && !(rs.getString("subject").matches(regex))) {
//置顶但不匹配
%>
<span class="font-noraml">主题: </span><strong><script type='text/html' style='display:inline;color:red;'><%=rs.getString("subject")%></script></strong>
<%
}
if (rs.getInt("flag") == 0 && !(rs.getString("subject").matches(regex))) {
//不置顶且不匹配
%>
<span class="font-noraml">主题: </span><%=rs.getString("subject")%>
<%} %>
</h3>
</div>
<div class="mail-body">
<div class="mail-Content">
<h3>内容</h3>
<%=rs.getString("content")%>
<h5>
<span class="pull-right font-noraml"><%=rs.getString("username")%>&nbsp<%=rs.getDate("time")%>&nbsp<%=rs.getTime("time")%></span>
<div class="mail-body">
<div class="mail-Content">
<h3>内容</h3>
<%if(rs.getString("content").matches(regex)) {%>
<script type='text/html' style='display:block;'><%=rs.getString("content")%></script>
<%
}else{
%>
<%=rs.getString("content")%>
<%} %>
<h5>
<span class="pull-right font-noraml"><%=username%>&nbsp;<%=rs.getDate("time")%>&nbsp;<%=rs.getTime("time")%></span>
</h5>
<%
}
sql.close();
rs.close();
con.close();
%>
</h5>
<%
}
sql.close();
rs.close();
con.close();
%>
@@ -177,14 +202,28 @@
%>
<div class="mail-body">
<%
if (!adminuser.equals("")) {
%>
<a class="btn btn-danger btn-xs"
href="forum/deleteComment.jsp?commentid=<%=comrs.getInt("commentid")%>"
role="button"> <span class="glyphicon glyphicon-remove"></span></a>
role="button"> <span class="glyphicon glyphicon-remove"></span></a><%
} else {
out.print("");
}
%>
<%if(comrs.getString("comment").matches(regex)) {%>
<script type='text/html' style='display:inline;'><%=comrs.getString("comment")%></script>
<%
}else{
%>
<%=comrs.getString("comment")%>
<%} %>
<h5>
<span class="pull-right font-noraml"><%=floor++%>L&nbsp<%=comrs.getString("username")%>&nbsp<%=comrs.getDate("time")%>&nbsp<%=comrs.getTime("time")%></span>
<span class="pull-right font-noraml"><%=floor++%>&nbsp<%=comrs.getString("username")%>&nbsp<%=comrs.getDate("time")%>&nbsp<%=comrs.getTime("time")%></span>
</h5>
</div>
@@ -203,12 +242,13 @@
</div>
<br> <br> <br> <br>
<div class="mail-text h-200">
<form action="forum/sendComment.jsp" onsubmit="return validate(this)">
<form action="forum/sendComment.jsp"
onsubmit="return validate(this)">
<input type="hidden" name="subid" value=<%=result%>>
<h4>评论</h4>
<textarea rows="10" cols="135" name="comment"
class="form-control"></textarea>
class="form-control" id="form-control"></textarea><img src="chartroom/arclist/1.gif" class="emotion" style="margin-left: 30px;">
<input class="btn btn-default pull-right createNew"
type="submit" value="提交"> <input type="hidden"
name="username" value="<%=user1%>" />
@@ -251,6 +291,46 @@
});
});
</script>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.qqFace_forum.js"></script>
<script type="text/javascript">
$(function() {
$('.emotion').qqFace({
id : 'facebox',
assign : 'form-control',
path : 'chartroom/arclist/' //表情存放的路径
});
$(".send").click(function() {
var str = $("#form-control").val();
$("#show").html(replace_em(str));
});
});
//查看结果
function replace_em(str) {
str = str.replace(/\</g, '&lt;');
str = str.replace(/\>/g, '&gt;');
str = str.replace(/\n/g, '<br/>');
str = str.replace(/\[em_([0-9]*)\]/g, '< img src="chartroom/arclist/$1.gif" border="0" />');
return str;
}
</script>
</body>
</html>