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

📄 addpost.jsp

📁 用java 写的论坛
💻 JSP
📖 第 1 页 / 共 3 页
字号:
<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/user/addpost.jsp,v 1.33 2003/06/09 19:52:27 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.33 $
 - $Date: 2003/06/09 19:52:27 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002, 2003 by MyVietnam.net
 -
 - 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.
 -
 - 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 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@MyVietnam.net
 -
 - @author: Minh Nguyen  minhnn@MyVietnam.net
 - @author: Mai  Nguyen  mai.nh@MyVietnam.net
 --%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ 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.mvnplugin.mvnforum.MVNForumGlobal" %>
<%@ page import="net.myvietnam.mvnplugin.mvnforum.MyUtil" %>
<%@ page import="net.myvietnam.mvnplugin.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 )
 */
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<%
int parentPostID = 0;
try {
    parentPostID = ParamUtil.getParameterInt(request, "parent");
} catch (BadInputException e) {
    // do nothing
}
boolean isPreviewing = ParamUtil.getParameterBoolean(request, "preview");
boolean attachMore = ParamUtil.getParameterBoolean(request, "AttachMore");
String action = (String)request.getAttribute("action");
if (action == null) action = "";

String mode;
String fullmode;
String replyTopic = "";
String postTopic = "";
String postBody = "";
String postIcon = "";
String previewUrl = "";

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

if (action.equals("addnew")) {
    previewUrl = "addpost";
    if (parentPostID == 0) {
        mode = "Nova debata";
        fullmode = mode;
        replyTopic = "";
    } else {
        mode = "Odgovori";
        // 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;
        }
        replyTopic = parentPostBean.getPostTopic();
        fullmode = mode + " : " + replyTopic;
    }
} else if (action.equals("update")) {
    previewUrl = "editpost";
    mode = "Spremeni sporocilo";
    postToEdit = (PostBean)request.getAttribute("PostToEdit");
    postTopic = postToEdit.getPostTopic();
    postBody = postToEdit.getPostBody();
    postIcon = postToEdit.getPostIcon();
    fullmode = mode + " : " + postTopic;
} else {
    throw new BadInputException("Cannot find the action!");
}

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

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

    postIcon = ParamUtil.getParameter(request, "PostIcon");
    postIcon = DisableHtmlTagFilter.filter(postIcon);// always disable HTML
}
%>
<html>
<head>
    <title>mvnForum - <%=fullmode%></title>
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
</head>
<link href="<%=contextPath%>/mvnplugin/mvnforum/css/style.css" rel=stylesheet type=text/css>
<script 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 language="JavaScript" src="<%=contextPath%>/mvnplugin/mvnforum/js/mvnnav.js"></script>

<!-- Language specific string constants used in mvncode.js -->
<script language="JavaScript">
// DO NOT ADD LINE-BREAKS BETWEEN THE "...." QUOTES!

// MINI-HELP MESSAGES
b_text = "Insert BOLD text";
i_text = "Insert ITALIC text";
u_text = "Insert UNDERLINED text";
s_text = "Insert STRIKING text";

size_text = "Alter the SIZE of your text";
font_text = "Alter the FONT of your text";
color_text = "Alter the COLOR of your text";

url_text = "Insert a hyperlink into your message";
email_text = "Insert an email-link into your message";
img_text = "Insert an image into your message";

code_text = "Insert monospace text into your message";
php_text = "Insert text with PHP syntax highlighting";
list_text = "Insert an ordered list into your message";
quote_text = "Insert a quote into your message";

norm_text = "Switch to normal code-editing mode";
enha_text = "Enhanced mode: allows complex nesting of tags";

closecurrent_text = "Close the current mvnCode tag";
closeall_text = "Close all open mvnCode tags";

// ERROR MESSAGES
enhanced_only_text = "<< This is only available in Enhanced Mode >>";
no_tags_text = "<< No open mvnCode tags detected. >>";
already_open_text = "<< You already have an open tag of this type >>";

// TEXT FOR POP-UP PROMPTS
tag_prompt = "Enter the text to be formatted:";
font_formatter_prompt = "Enter the text to be formatted with the specified font";

link_text_prompt = "Enter the text to be displayed for the link (optional)";
link_url_prompt = "Enter the full URL for the link";
link_email_prompt = "Enter the email address for the link";

list_type_prompt = "What type of list do you want? Enter '1' for a numbered list, enter 'a' for an alphabetical list, or leave blank for a list with bullet points.";
list_item_prompt = "Enter a list item.\nLeave the box empty or press 'Cancel' to complete the list.";
</script>

<script language="JavaScript">
function showMoreEmotion() {
    document.getElementById("MoreEmotion").style.display = '';
    document.getElementById("showlink").style.display = 'none';
    document.getElementById("hidelink").style.display = '';
}
function hideMoreEmotion() {
    document.getElementById("MoreEmotion").style.display = 'none';
    document.getElementById("showlink").style.display = '';
    document.getElementById("hidelink").style.display = 'none';
}
function checkPostIcon() {
    var iconToCheck = "<%=EnableHtmlTagFilter.filter(postIcon)%>";
    var currentIcon;
    for (i = 1; i <= 12; i++) {
        currentIcon = document.getElementById("PostIcon" + i);
        if (currentIcon.value == iconToCheck) {
            currentIcon.checked = true;
            break;
        }
    }
}
</script>

<body leftmargin=0 topmargin=0>
<%@ include file="header.jsp"%>

<%
CategoryCache categoryCache = CategoryCache.getInstance();
ForumCache forumCache = ForumCache.getInstance();
Collection forumBeans = forumCache.getBeans();

int forumID_int;
if (action.equals("addnew")) {
    if (parentPostID == 0) {// new thread
        forumID_int = ParamUtil.getParameterInt(request, "forum");
    } else {//reply to a post
        forumID_int = parentPostBean.getForumID();
    }
} else {//edit mode
    forumID_int = postToEdit.getForumID();
}
String forumID = String.valueOf(forumID_int);
String forumName = forumCache.getBean(forumID_int).getForumName();
%>
<p>
<table width="95%" align="center">
<tr class="nav">
    <td><img src="<%=contextPath%>/mvnplugin/mvnforum/images/nav.gif"></td>

⌨️ 快捷键说明

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