📄 actioninusermodule.java
字号:
/*
* $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/user/ActionInUserModule.java,v 1.57 2006/04/14 17:05:27 minhnn Exp $
* $Author: minhnn $
* $Revision: 1.57 $
* $Date: 2006/04/14 17:05:27 $
*
* ====================================================================
*
* Copyright (C) 2002-2006 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
*/
package com.mvnforum.user;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import net.myvietnam.mvncore.exception.BadInputException;
import net.myvietnam.mvncore.exception.MissingURLMapEntryException;
import net.myvietnam.mvncore.util.*;
import com.mvnforum.MVNForumResourceBundle;
import com.mvnforum.auth.AbstractLocalizableAction;
import com.mvnforum.auth.Action;
public class ActionInUserModule extends AbstractLocalizableAction implements Action {
public ActionInUserModule(HttpServletRequest request, String requestURI) throws MissingURLMapEntryException {
// lastRequestTime = System.currentTimeMillis();
// firstRequestTime = lastRequestTime;// be very careful
url = null;// url may be null after the code below
desc = null;// but desc is never be null
// the request SHOULD ONLY be used to get the queryString
String queryString = StringUtil.getEmptyStringIfNull(request.getQueryString());
Locale locale = I18nUtil.getLocaleInRequest(request);
if (requestURI.equals("/error")) {
desc = "mvnforum.user.action.desc.Error";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.Error");
} else if (requestURI.equals("/index") || requestURI.equals("") || requestURI.equals("/")) {
url = "index";
desc = "mvnforum.user.action.desc.Index";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.Index");
} else if (requestURI.equals("/listonlineusers")) {
url = "listonlineusers";
desc = "mvnforum.user.action.desc.ListOnlineUsers";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ListOnlineUsers");
} else if (requestURI.equals("/listforums")) {
url = "listforums";
desc = "mvnforum.user.action.desc.ListForums";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ListForums");
} else if (requestURI.equals("/listthreads")) {
url = "listthreads" + "?" + queryString;
try {
int forum = ParamUtil.getParameterInt(request, "forum");
desc = "mvnforum.user.action.desc.ListThreads.without_forum";
this.params = new Object[]{new Integer(forum)};
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ListThreads.without_forum", new Object[]{new Integer(forum)});
} catch (BadInputException ex) {
desc = "mvnforum.user.action.desc.ListThreads.with_forum";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ListThreads.with_forum");
}
} else if (requestURI.equals("/listrecentthreads")) {
url = "listrecentthreads" + "?" + queryString;
desc = "mvnforum.user.action.desc.ListRecentThreads";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ListRecentThreads");
} else if (requestURI.equals("/addpost")) {
//url = "addpost";//@todo review and support it later
desc = "mvnforum.user.action.desc.AddPost";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.AddPost");// write a better desc here
} else if (requestURI.equals("/addpostprocess")) {
desc = "mvnforum.user.action.desc.AddPostProcess";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.AddPostProcess");
} else if (requestURI.equals("/editpost")) {
//url = "editpost";
// maybe we can allow other users to view the post
desc = "mvnforum.user.action.desc.EditPost";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.EditPost");
} else if (requestURI.equals("/updatepost")) {
// maybe we can allow other users to view the post
desc = "mvnforum.user.action.desc.UpdatePost";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.UpdatePost");
} else if (requestURI.equals("/addattachment")) {
desc = "mvnforum.user.action.desc.AddAttachment";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.AddAttachment");
} else if (requestURI.equals("/addattachmentprocess")) {
desc = "mvnforum.user.action.desc.AddAttachmentProcess";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.AddAttachmentProcess");
} else if (requestURI.equals("/myfavoritethread")) {
url = "myfavoritethread";
desc = "mvnforum.user.action.desc.MyFavoriteThread";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.MyFavoriteThread");
} else if (requestURI.equals("/addfavoritethreadprocess")) {
url = "addfavoritethreadprocess" + "?" + queryString;
desc = "mvnforum.user.action.desc.AddFavoriteThreadProcess";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.AddFavoriteThreadProcess");
} else if (requestURI.equals("/deletefavoritethreadprocess")) {
desc = "mvnforum.user.action.desc.DeleteFavoriteThreadProcess";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.DeleteFavoriteThreadProcess");
} else if (requestURI.equals("/viewthread")) {
url = "viewthread" + "?" + queryString;
try {
int thread = ParamUtil.getParameterInt(request, "thread");
desc = "mvnforum.user.action.desc.ViewThread.without_thread";
params = new Object[]{new Integer(thread)};
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ViewThread.without_thread", new Object[]{new Integer(thread)});
} catch (BadInputException ex) {
desc = "mvnforum.user.action.desc.ViewThread.with_thread";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.ViewThread.with_thread");
}
} else if (requestURI.equals("/printthread")) {
url = "printthread" + "?" + queryString;
try {
int thread = ParamUtil.getParameterInt(request, "thread");
desc = "mvnforum.user.action.desc.PrintThread.without_input_error";
params = new Object[]{new Integer(thread)};
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.PrintThread.without_input_error", new Object[] {new Integer(thread)});
} catch (BadInputException ex) {
desc = "mvnforum.user.action.desc.PrintThread.with_input_error";
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.PrintThread.with_input_error");
}
} else if (requestURI.equals("/printpost")) {
url = "printpost" + "?" + queryString;
try {
int post = ParamUtil.getParameterInt(request, "post");
desc = "mvnforum.user.action.desc.PrintPost.without_input_error";
params = new Object[] {new Integer(post)};
//MVNForumResourceBundle.getString(locale, "mvnforum.user.action.desc.PrintPost.without_input_error", new Object[] {new Integer(post)});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -