📄 addtopic_new.jsp
字号:
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="cn.js.fan.util.*"%>
<%@ page import="com.redmoon.forum.person.*"%>
<%@ page import="com.redmoon.forum.plugin2.*"%>
<%@ page import="com.redmoon.forum.plugin.*"%>
<%@ page import="com.redmoon.forum.plugin.base.*"%>
<%@ page import="com.redmoon.blog.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
<jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
<%
String targeturl = StrUtil.getUrl(request);
if (!privilege.isUserLogin(request)) {
response.sendRedirect("../door.jsp?targeturl="+targeturl);
return;
}
String boardcode = ParamUtil.get(request, "boardcode");
String userName = privilege.getUser(request);
if (!privilege.canUserDo(request, boardcode, "add_topic")) {
response.sendRedirect("../info.jsp?info= " + StrUtil.UrlEncode(SkinUtil.LoadString(request, "pvg_invalid")));
return;
}
Leaf curleaf = new Leaf();
curleaf = curleaf.getLeaf(boardcode);
if (curleaf==null || !curleaf.isLoaded()) {
out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "res.label.forum.addtopic", "board_none"))); // "版块不存在"));
return;
}
String boardname = curleaf.getName();
String blogUserDir = ParamUtil.get(request, "blogUserDir");
// 取得皮肤路径
String skincode = curleaf.getSkin();
if (skincode.equals("") || skincode.equals(UserSet.defaultSkin)) {
skincode = UserSet.getSkin(request);
if (skincode==null || skincode.equals(""))
skincode = UserSet.defaultSkin;
}
SkinMgr skm = new SkinMgr();
Skin skin = skm.getSkin(skincode);
String skinPath = skin.getPath();
com.redmoon.forum.Config cfg1 = new com.redmoon.forum.Config();
int msgTitleLengthMin = cfg1.getIntProperty("forum.msgTitleLengthMin");
int msgTitleLengthMax = cfg1.getIntProperty("forum.msgTitleLengthMax");
int msgLengthMin = cfg1.getIntProperty("forum.msgLengthMin");
int msgLengthMax = cfg1.getIntProperty("forum.msgLengthMax");
int maxAttachmentCount = cfg1.getIntProperty("forum.maxAttachmentCount");
int maxAttachmentSize = cfg1.getIntProperty("forum.maxAttachmentSize");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><lt:Label res="res.label.forum.addtopic" key="addtopic"/> - <%=Global.AppName%></title>
<link href="<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
<STYLE>TABLE {
BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px
}
TD {
BORDER-RIGHT: 0px; BORDER-TOP: 0px
}
body {
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
}
</STYLE>
<script language="javascript">
<!--
function findObj(theObj, theDoc)
{
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
return foundObj;
}
var attachCount = 1;
function addImg(attchId, imgPath) {
var img = "<img alt='<%=cn.js.fan.web.SkinUtil.LoadString(request, "res.cn.js.fan.util.StrUtil", "click_open_win")%>' style='cursor:hand' onclick=\"window.open('" + imgPath + "')\" onload=\"if(this.width>screen.width*0.4) this.style.width='98%'\" src='" + imgPath + "'>";
if ((IframeID.document.selection)&&(IframeID.document.selection.type == "Text")) {
var range = IframeID.document.selection.createRange();
range.pasteHTML(range.htmlText + "<BR>" + img + "<BR>");
}
else {
IframeID.document.body.innerHTML = IframeID.document.body.innerHTML + "<BR>" + img + "<BR>";
}
divTmpAttachId.innerHTML += "<input type=hidden name=tmpAttachId value='" + attchId + "'>";
attachCount++;
if (attachCount><%=maxAttachmentCount%>) {
// uploadTable.style.display = "none"; // 隐藏了,但是如果已选择了文件,还是会被上传
uploadTable.outerHTML = "";
}
}
function getAttachCount() {
return attachCount - 1;
}
function showvote(isshow)
{
if (frmAnnounce.isvote.checked)
{
frmAnnounce.vote.style.display = "";
}
else
{
frmAnnounce.vote.style.display = "none";
}
}
function frmAnnounce_onsubmit()
{
if (!cws_validateMode())
return false;
if (document.frmAnnounce.topic.value.length<<%=msgTitleLengthMin%>)
{
alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_title"/><%=msgTitleLengthMin%>");
return false;
}
if (document.frmAnnounce.topic.value.length><%=msgTitleLengthMax%>)
{
alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_title"/><%=msgTitleLengthMax%>");
return false;
}
var html;
html=cws_getText();
html=cws_rCode(html,"<a> </a>","");
document.frmAnnounce.Content.value=html;
if (document.frmAnnounce.Content.value.length<<%=msgLengthMin%>)
{
alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_content"/><%=msgLengthMin%>");
return false;
}
if (document.frmAnnounce.Content.value.length><%=msgLengthMax%>)
{
alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_content"/><%=msgLengthMax%>");
return false;
}
}
function AddAttach() {
if (attachCount>=<%=maxAttachmentCount%>) {
alert("<lt:Label res="res.label.forum.addtopic" key="topic_max_attach"/><%=maxAttachmentCount%>");
return;
}
updiv.insertAdjacentHTML("BeforeEnd", "<table width=100%><tr><lt:Label res="res.label.forum.addtopic" key="file"/> <input type='file' name='filename" + attachCount + "' size=10><td></td></tr></table>");
// updiv.innerHTML += "<table width=100%><tr><lt:Label res="res.label.forum.addtopic" key="file"/> <input type='file' name='filename" + attachCount + "' size=10><td></td></tr></table>";
attachCount += 1;
}
//-->
</script>
<script src="inc/ubbcode.jsp"></script>
</head>
<body>
<script src="../inc/calendar.js"></script>
<%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
<%@ include file="inc/header.jsp"%>
<%@ include file="inc/position.jsp"%>
<%}%>
<jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
<jsp:useBean id="userservice" scope="page" class="com.redmoon.forum.person.userservice"/>
<%
String privurl = ParamUtil.get(request, "privurl");
String notwe = request.getParameter("notwe");
if (notwe==null) {
//if (privilege.canWebEdit(request)) {
// response.sendRedirect("addtopic_we.jsp?privurl="+StrUtil.UrlEncode(privurl, "utf-8")+"&boardcode="+boardcode+"&boardname="+StrUtil.UrlEncode(boardname, "utf-8"));
// return;
//}
}
%>
<%
int i=0;
String addFlag = ParamUtil.get(request, "addFlag");
%>
<table width="98%" border="1" align="center" cellpadding="4" cellspacing="0" borderColor="<%=skin.getTableBorderClr()%>">
<form name=frmAnnounce method="post" action="addtopictodb.jsp?addFlag=<%=StrUtil.UrlEncode(addFlag)%>" enctype="MULTIPART/FORM-DATA" onSubmit="return frmAnnounce_onsubmit()">
<TBODY>
<tr>
<td height="26" colspan="2" background="<%=skinPath%>/images/bg1.gif" class="td_title"><lt:Label res="res.label.forum.addtopic" key="topic_add_to"/><a href="listtopic.jsp?boardcode=<%=boardcode%>"><%=boardname%></a></td>
</tr>
</TBODY>
<TBODY>
<tr>
<td><lt:Label res="res.label.forum.addtopic" key="topic_add_to_board"/></td>
<td>
<%
if (blogUserDir.equals(""))
blogUserDir = UserDirDb.DEFAULT;
UserConfigDb ucd = new UserConfigDb();
ucd = ucd.getUserConfigDb(privilege.getUser(request));
// 如果用户的博客未开通,则不能选择版块
if (Global.hasBlog && ucd!=null && ucd.isLoaded()) {
%>
<script>
var bcode<%=i%> = "<%=boardcode%>";
</script>
<select name="boardcode" onChange="if(this.options[this.selectedIndex].value=='not'){alert(this.options[this.selectedIndex].text+' <lt:Label res="res.label.forum.addtopic" key="can_not_sel"/>'); this.value=bcode<%=i%>; return false;}">
<option value="not" selected><lt:Label res="res.label.forum.addtopic" key="sel_board"/></option>
<%
com.redmoon.forum.Directory directory = new com.redmoon.forum.Directory();
com.redmoon.forum.Leaf lf = directory.getLeaf("root");
com.redmoon.forum.DirectoryView dv = new com.redmoon.forum.DirectoryView(lf);
dv.ShowDirectoryAsOptions(out, lf, lf.getLayer());
%>
<option value="<%=Leaf.CODE_BLOG%>"> <lt:Label res="res.label.forum.addtopic" key="blog"/></option>
</select>
<script>
frmAnnounce.boardcode.value = "<%=boardcode%>";
</script>
<%if (boardcode.equals(Leaf.CODE_BLOG)) {%>
<lt:Label res="res.label.forum.addtopic" key="info_board_blog"/>
<%}
}else{%>
<%=boardname%><input type="hidden" name="boardcode" value="<%=boardcode%>">
<%}%> </td>
</tr>
<%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -