⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addpost.jsp

📁 免费的java企业级论坛可执行程序
💻 JSP
📖 第 1 页 / 共 5 页
字号:
<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/user/addpost.jsp,v 1.203 2007/11/26 11:37:03 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.203 $
 - $Date: 2007/11/26 11:37:03 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002-2007 by MyVietnam.net
 -
 - All copyright notices regarding mvnForum MUST remain 
 - intact in the scripts and in the outputted HTML.
 - The "powered by" text/logo with a link back to
 - http://www.mvnForum.com and http://www.MyVietnam.net in 
 - the footer of the pages MUST remain visible when the pages
 - are viewed on the internet or intranet.
 -
 - This program is free software; you can redistribute it and/or modify
 - it under the terms of the GNU General Public License as published by
 - the Free Software Foundation; either version 2 of the License, or
 - any later version.
 -
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - GNU General Public License for more details.
 -
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 -
 - Support can be obtained from support forums at:
 - http://www.mvnForum.com/mvnforum/index
 -
 - Correspondence and Marketing Questions can be sent to:
 - info at MyVietnam net
 -
 - @author: Minh Nguyen  
 - @author: Mai  Nguyen  
 --%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="net.myvietnam.mvncore.exception.BadInputException" %>
<%@ page import="net.myvietnam.mvncore.util.ParamUtil" %>
<%@ page import="net.myvietnam.mvncore.filter.EnableEmotionFilter" %>
<%@ page import="net.myvietnam.mvncore.filter.DisableHtmlTagFilter" %>
<%@ page import="net.myvietnam.mvncore.filter.EnableHtmlTagFilter" %>
<%@ page import="net.myvietnam.mvncore.filter.EnableMVNCodeFilter" %>
<%@ page import="net.myvietnam.mvncore.interceptor.InterceptorService"%>
<%@ page import="net.myvietnam.mvncore.security.Encoder" %>
<%@ page import="com.mvnforum.MVNForumResourceBundle" %>
<%@ page import="com.mvnforum.MVNForumGlobal" %>
<%@ page import="com.mvnforum.MyUtil" %>
<%@ page import="com.mvnforum.db.*" %>
<%--
 This page is used to do 2 actions
 1. add new post ( action=addnew ), either new thread or reply to a thread
 2. edit a post  ( action=update )
--%>
<%@ include file="inc_common.jsp"%>
<%@ include file="inc_doctype.jsp"%>
<fmt:bundle basename="mvnForum_i18n">
<%
int parentPostID = 0;
try {
    parentPostID = ParamUtil.getParameterInt(request, "parent");
} catch (BadInputException e) {
    // do nothing
}
boolean isQuote = ParamUtil.getParameterBoolean(request, "quote");
boolean isPreviewing = ParamUtil.getParameterBoolean(request, "preview");
boolean attachMore = ParamUtil.getParameterBoolean(request, "AttachMore");
boolean addPoll = ParamUtil.getParameterBoolean(request, "AddPoll");
boolean addFavoriteThread = ParamUtil.getParameterBoolean(request, "AddFavoriteParentThread");
boolean addWatchThread = ParamUtil.getParameterBoolean(request, "AddWatchParentThread");
boolean uploadApplet = false;
if (environmentService.isEnterprise()) {
    uploadApplet = ParamUtil.getParameterBoolean(request, "UploadApplet");
}    
String action = ParamUtil.getAttribute(request, "action");
if (action == null) action = "";

String actionParam = urlResolver.getActionParam();

boolean checkActionParam = true;
if (actionParam == null || "".equals(actionParam.trim())) {
    checkActionParam = false;
}
boolean watched = ((Boolean) request.getAttribute("isWatched")).booleanValue();

String mode;
String fullmode;
String replyTopic = "";
String postTopic = "";
String postBody = "";
String postIcon = "";
String previewUrl = "";
int threadPriority = 0;

PostBean postToEdit = null;// use when edit a post
PostBean parentPostBean = null;//use when reply to a post

if (action.equals("addnew")) {
    previewUrl = urlResolver.encodeURL(request, response, "addpost", URLResolverService.ACTION_URL);
    if (parentPostID == 0) {
        mode = MVNForumResourceBundle.getString(onlineUser.getLocale(), "mvnforum.user.addpost.mode.addnew");
        fullmode = mode;
        replyTopic = "";
    } else {
        mode = MVNForumResourceBundle.getString(onlineUser.getLocale(), "mvnforum.user.addpost.mode.reply");
        // this is the parent of the reply
        parentPostBean = (PostBean)request.getAttribute("ParentPostBean");

        String REPLY_PREFIX = "Re: ";
        String parentPostTopic = parentPostBean.getPostTopic();
        if (parentPostTopic.startsWith(REPLY_PREFIX)) {
            postTopic = parentPostTopic;
        } else {
            postTopic = REPLY_PREFIX + parentPostTopic;
        }
        if (isQuote) {
            postBody = "[quote]" + parentPostBean.getPostBody() + "[/quote]\n";
        }
        replyTopic = parentPostBean.getPostTopic();
        fullmode = mode + " : " + replyTopic;
    }
} else if (action.equals("update")) {
    previewUrl = urlResolver.encodeURL(request, response, "editpost", URLResolverService.ACTION_URL);
    mode = MVNForumResourceBundle.getString(onlineUser.getLocale(), "mvnforum.user.addpost.mode.update");
    postToEdit = (PostBean)request.getAttribute("PostToEdit");
    postTopic = postToEdit.getPostTopic();
    postBody = postToEdit.getPostBody();
    postIcon = postToEdit.getPostIcon();
    fullmode = mode + " : " + postTopic;
    threadPriority = ((Integer)request.getAttribute("Priority")).intValue();
    
    parentPostID = postToEdit.getParentPostID();// minhnn: this line code is added on 17 Sep, 2007, not sure if it will cause side effect in Java file or not ???
} else {
    throw new BadInputException("Cannot find the action!");
}

if (isPreviewing) {
    postTopic = ParamUtil.getParameter(request, "PostTopic", true);
    postTopic = DisableHtmlTagFilter.filter(postTopic);// always disable HTML
    //postTopic = InterceptorService.getInstance().validateContent(postTopic);

    postBody = ParamUtil.getParameter(request, "message", true);// use message instead of MessageBody
    postBody = DisableHtmlTagFilter.filter(postBody);// always disable HTML
    //postBody = InterceptorService.getInstance().validateContent(postBody);

    postIcon = ParamUtil.getParameter(request, "PostIcon");
    postIcon = DisableHtmlTagFilter.filter(postIcon);// always disable HTML
    
    if (parentPostID == 0) {
        threadPriority = ParamUtil.getParameterInt(request, "ThreadPriority");
    }
}
%>
<mvn:html locale="${currentLocale}">
<mvn:head>
  <mvn:title><fmt:message key="mvnforum.common.forum.title_name"/> - <%=fullmode%></mvn:title>
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
<link href="<%=onlineUser.getCssPath()%>" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/mvnplugin/mvnforum/css/prettify.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" language="JavaScript" src="<%=contextPath%>/mvnplugin/mvnforum/js/mvncode.js"></script>
<script language="JavaScript1.2" src="<%=contextPath%>/mvnplugin/mvnforum/js/vietuni.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=contextPath%>/mvnplugin/mvnforum/js/prettify.js"> </script>

<script type="text/javascript">
//<![CDATA[
function SubmitForm() {
  if (ValidateForm() == true) {
    <mvn:servlet>
    document.mvnform.submitbutton.disabled=true;
    document.mvnform.previewbutton.disabled=true;
    </mvn:servlet>
    document.mvnform.submit();
  }
}

function PreviewForm() {
  if (ValidateForm() == true) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -