001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/user/ActionInUserModule.java,v 1.95 2008/01/24 04:57:01 phuongpdd Exp $
003: * $Author: phuongpdd $
004: * $Revision: 1.95 $
005: * $Date: 2008/01/24 04:57:01 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Minh Nguyen
039: * @author: Mai Nguyen
040: */
041: package com.mvnforum.user;
042:
043: import java.util.Locale;
044:
045: import net.myvietnam.mvncore.exception.BadInputException;
046: import net.myvietnam.mvncore.exception.MissingURLMapEntryException;
047: import net.myvietnam.mvncore.util.*;
048: import net.myvietnam.mvncore.web.GenericRequest;
049:
050: import com.mvnforum.MVNForumResourceBundle;
051: import com.mvnforum.auth.AbstractLocalizableAction;
052: import com.mvnforum.auth.Action;
053:
054: public class ActionInUserModule extends AbstractLocalizableAction {
055:
056: public ActionInUserModule(GenericRequest request, String requestURI)
057: throws MissingURLMapEntryException {
058: // lastRequestTime = System.currentTimeMillis();
059: // firstRequestTime = lastRequestTime;// be very careful
060:
061: url = null;// url may be null after the code below
062: localeKey = null;// but desc is never be null
063: // the request SHOULD ONLY be used to get the queryString
064: String queryString = StringUtil.getEmptyStringIfNull(request
065: .getQueryString());
066: Locale locale = I18nUtil.getLocaleInRequest(request);
067:
068: if (requestURI.equals("/error")) {
069: localeKey = "mvnforum.user.action.desc.Error";
070: } else if (requestURI.equals("/index") || requestURI.equals("")
071: || requestURI.equals("/")) {
072: url = "index";
073: localeKey = "mvnforum.user.action.desc.Index";
074: } else if (requestURI.equals("/listonlineusers")) {
075: url = "listonlineusers";
076: localeKey = "mvnforum.user.action.desc.ListOnlineUsers";
077: } else if (requestURI.equals("/listforums")) {
078: url = "listforums";
079: localeKey = "mvnforum.user.action.desc.ListForums";
080: } else if (requestURI.equals("/listthreads")) {
081: url = "listthreads" + "?" + queryString;
082:
083: pageID = Action.PAGE_ID_LISTTHREADS;
084:
085: try {
086: int forum = GenericParamUtil.getParameterInt(request,
087: "forum");
088: this .localeParams = new Object[] { new Integer(forum) };
089:
090: pageParam = new Integer(forum);
091:
092: localeKey = "mvnforum.user.action.desc.ListThreads.without_forum";
093: } catch (BadInputException ex) {
094: localeKey = "mvnforum.user.action.desc.ListThreads.with_forum";
095: }
096: } else if (requestURI.equals("/listrecentthreads")) {
097: url = "listrecentthreads" + "?" + queryString;
098: localeKey = "mvnforum.user.action.desc.ListRecentThreads";
099: } else if (requestURI.equals("/listunansweredthreads")) {
100: url = "listunansweredthreads" + "?" + queryString;
101: try {
102: int forum = GenericParamUtil.getParameterInt(request,
103: "forum");
104: this .localeParams = new Object[] { new Integer(forum) };
105: localeKey = "mvnforum.user.action.desc.ListUnansweredThreads";
106: } catch (BadInputException ex) {
107: localeKey = "mvnforum.user.action.desc.ListUnansweredThreads";
108: }
109: } else if (requestURI.equals("/listattachments")) {
110: localeKey = "mvnforum.user.action.desc.ListAttachments";
111:
112: } else if (requestURI.equals("/addpost")) {
113: localeKey = "mvnforum.user.action.desc.AddPost";
114: } else if (requestURI.equals("/addpostprocess")) {
115: localeKey = "mvnforum.user.action.desc.AddPostProcess";
116: } else if (requestURI.equals("/editpost")) {
117: // maybe we can allow other users to view the post
118: localeKey = "mvnforum.user.action.desc.EditPost";
119: } else if (requestURI.equals("/updatepost")) {
120: // maybe we can allow other users to view the post
121: localeKey = "mvnforum.user.action.desc.UpdatePost";
122: } else if (requestURI.equals("/addattachment")) {
123: localeKey = "mvnforum.user.action.desc.AddAttachment";
124: } else if (requestURI.equals("/addattachmentprocess")) {
125: localeKey = "mvnforum.user.action.desc.AddAttachmentProcess";
126: } else if (requestURI.equals("/myfavoritethread")) {
127: url = "myfavoritethread";
128: localeKey = "mvnforum.user.action.desc.MyFavoriteThread";
129: } else if (requestURI.equals("/addfavoritethreadprocess")) {
130: url = "addfavoritethreadprocess" + "?" + queryString;
131: localeKey = "mvnforum.user.action.desc.AddFavoriteThreadProcess";
132: } else if (requestURI.equals("/deletefavoritethreadprocess")) {
133: localeKey = "mvnforum.user.action.desc.DeleteFavoriteThreadProcess";
134: } else if (requestURI.equals("/viewthread")) {
135: url = "viewthread" + "?" + queryString;
136:
137: pageID = Action.PAGE_ID_VIEWTHREAD;
138:
139: try {
140: int thread = GenericParamUtil.getParameterInt(request,
141: "thread");
142: localeParams = new Object[] { new Integer(thread) };
143:
144: pageParam = new Integer(thread);
145:
146: localeKey = "mvnforum.user.action.desc.ViewThread.without_thread";
147: } catch (BadInputException ex) {
148: localeKey = "mvnforum.user.action.desc.ViewThread.with_thread";
149: }
150: } else if (requestURI.equals("/printthread")) {
151: url = "printthread" + "?" + queryString;
152: try {
153: int thread = GenericParamUtil.getParameterInt(request,
154: "thread");
155: localeParams = new Object[] { new Integer(thread) };
156:
157: localeKey = "mvnforum.user.action.desc.PrintThread.without_input_error";
158: } catch (BadInputException ex) {
159: localeKey = "mvnforum.user.action.desc.PrintThread.with_input_error";
160: }
161: } else if (requestURI.equals("/printpost")) {
162: url = "printpost" + "?" + queryString;
163: try {
164: int post = GenericParamUtil.getParameterInt(request,
165: "post");
166: localeParams = new Object[] { new Integer(post) };
167:
168: localeKey = "mvnforum.user.action.desc.PrintPost.without_input_error";
169: } catch (BadInputException ex) {
170: localeKey = "mvnforum.user.action.desc.PrintPost.with_input_error";
171: }
172:
173: } else if (requestURI.equals("/viewmember")) {
174: url = "viewmember" + "?" + queryString;
175: localeKey = "mvnforum.user.action.desc.ViewMember";
176: localeParams = new Object[] { queryString };
177: } else if (requestURI.equals("/listmembers")) {
178: url = "listmembers" + "?" + queryString;
179: localeKey = "mvnforum.user.action.desc.ListMembers";
180: } else if (requestURI.equals("/editmember")) {
181: localeKey = "mvnforum.user.action.desc.EditMember";
182: } else if (requestURI.equals("/updatemember")) {
183: localeKey = "mvnforum.user.action.desc.UpdateMember";
184: } else if (requestURI.equals("/login")) {
185: url = "login";
186: localeKey = "mvnforum.user.action.desc.Login";
187: } else if (requestURI.equals("/loginprocess")) {// will be sendRedirect
188: localeKey = "mvnforum.user.action.desc.LoginProcess";
189: } else if (requestURI.equals("/logout")) {
190: localeKey = "mvnforum.user.action.desc.Logout";
191: } else if (requestURI.equals("/deletecookieprocess")) {
192: localeKey = "mvnforum.user.action.desc.DeleteCookiesProcess";
193: } else if (requestURI.equals("/rsssummary")) {
194: url = "rsssummary" + "?" + queryString;
195: localeKey = "mvnforum.user.action.desc.RSS";
196: } else if (requestURI.equals("/atom")) {
197: url = "atom" + "?" + queryString;
198: localeKey = "mvnforum.user.action.desc.RSS";
199: } else if (requestURI.equals("/rss")) {
200: url = "rss" + "?" + queryString;
201: localeKey = "mvnforum.user.action.desc.RSS";
202: } else if (requestURI.equals("/rss2")) {
203: url = "rss2" + "?" + queryString;
204: localeKey = "mvnforum.user.action.desc.RSS";
205:
206: } else if (requestURI.equals("/help")) {
207: url = "help";
208: localeKey = "mvnforum.user.action.desc.Help";
209: } else if (requestURI.equals("/helpintro")) {
210: url = "helpintro";
211: localeKey = "mvnforum.user.action.desc.HelpIntro";
212: } else if (requestURI.equals("/helpinstall")) {
213: url = "helpinstall";
214: localeKey = "mvnforum.user.action.desc.HelpInstall";
215: } else if (requestURI.equals("/helpuser")) {
216: url = "helpuser";
217: localeKey = "mvnforum.user.action.desc.HelpUser";
218: } else if (requestURI.equals("/helpadmin")) {
219: url = "helpadmin";
220: localeKey = "mvnforum.user.action.desc.HelpAdmin";
221: } else if (requestURI.equals("/helpdeveloper")) {
222: url = "helpdeveloper";
223: localeKey = "mvnforum.user.action.desc.HelpDeveloper";
224: } else if (requestURI.equals("/faq")) {
225: url = "faq";
226: localeKey = "mvnforum.user.action.desc.FAQ";
227:
228: } else if (requestURI.equals("/search")) {
229: url = "search";
230: localeKey = "mvnforum.user.action.desc.Search";
231:
232: } else if (requestURI.equals("/searchattachments")) {
233: url = "searchattachments";
234: localeKey = "mvnforum.user.action.desc.SearchAttachments";
235:
236: } else if (requestURI.equals("/searchmember")) {
237: url = "searchmember" + "?" + queryString;
238: localeKey = "mvnforum.user.action.desc.SearchMember";
239: } else if (requestURI.equals("/registermember")) {
240: url = "registermember";
241: localeKey = "mvnforum.user.action.desc.RegisterMember";
242: } else if (requestURI.equals("/registermemberprocess")) {
243: localeKey = "mvnforum.user.action.desc.RegisterMemberProcess";
244:
245: } else if (requestURI.equals("/myprofile")) {
246: localeKey = "mvnforum.user.action.desc.MyProfile";
247: } else if (requestURI.equals("/changemypassword")) {
248: localeKey = "mvnforum.user.action.desc.ChangePassword";
249: } else if (requestURI.equals("/changemypasswordprocess")) {
250: localeKey = "mvnforum.user.action.desc.ChangePasswordProcess";
251: } else if (requestURI.equals("/changeemail")) {
252: localeKey = "mvnforum.user.action.desc.ChangeEmail";
253: } else if (requestURI.equals("/changeemailprocess")) {
254: localeKey = "mvnforum.user.action.desc.ChangeEmailProcess";
255: } else if (requestURI.equals("/changesignature")) {
256: localeKey = "mvnforum.user.action.desc.ChangeSignature";
257: } else if (requestURI.equals("/changesignatureprocess")) {
258: localeKey = "mvnforum.user.action.desc.ChangeSignatureProcess";
259: } else if (requestURI.equals("/changeavatar")) {
260: localeKey = "mvnforum.user.action.desc.ChangeAvatar";
261: } else if (requestURI.equals("/uploadavatar")) {
262: localeKey = "mvnforum.user.action.desc.UploadAvatar";
263: } else if (requestURI.equals("/updateavatar")) {
264: localeKey = "mvnforum.user.action.desc.UpdateAvatar";
265:
266: } else if (requestURI.equals("/mywatch")) {
267: localeKey = "mvnforum.user.action.desc.MyWatch";
268: } else if (requestURI.equals("/addwatch")) {
269: localeKey = "mvnforum.user.action.desc.AddWatch";
270: } else if (requestURI.equals("/addwatchprocess")) {
271: localeKey = "mvnforum.user.action.desc.AddWatchProcess";
272: } else if (requestURI.equals("/deletewatchprocess")) {
273: localeKey = "mvnforum.user.action.desc.DeleteWatchProcess";
274: } else if (requestURI.equals("/editwatch")) {
275: localeKey = "mvnforum.user.action.desc.EditWatch";
276: } else if (requestURI.equals("/editwatchprocess")) {
277: localeKey = "mvnforum.user.action.desc.EditWatchProcess";
278:
279: } else if (requestURI.equals("/mymessage")) {
280: localeKey = "mvnforum.user.action.desc.UsingMessage";
281: } else if (requestURI.equals("/addmessage")) {
282: localeKey = "mvnforum.user.action.desc.UsingMessage";
283: } else if (requestURI.equals("/addmessageprocess")) {
284: localeKey = "mvnforum.user.action.desc.UsingMessage";
285: } else if (requestURI.equals("/viewmessage")) {
286: localeKey = "mvnforum.user.action.desc.UsingMessage";
287: } else if (requestURI.equals("/sendmessageprocess")) {
288: localeKey = "mvnforum.user.action.desc.UsingMessage";
289: } else if (requestURI.equals("/deletemessageprocess")) {
290: localeKey = "mvnforum.user.action.desc.UsingMessage";
291: } else if (requestURI.equals("/processmessage")) {
292: localeKey = "mvnforum.user.action.desc.UsingMessage";
293: } else if (requestURI.equals("/addmessageattachment")) {
294: localeKey = "mvnforum.user.action.desc.UsingMessage";
295: } else if (requestURI.equals("/addmessageattachmentprocess")) {
296: localeKey = "mvnforum.user.action.desc.UsingMessage";
297: } else if (requestURI.equals("/mymessagefolder")) {
298: localeKey = "mvnforum.user.action.desc.UsingMessage";
299: } else if (requestURI.equals("/addmessagefolder")) {
300: localeKey = "mvnforum.user.action.desc.UsingMessage";
301: } else if (requestURI.equals("/addmessagefolderprocess")) {
302: localeKey = "mvnforum.user.action.desc.UsingMessage";
303: } else if (requestURI.equals("/deletemessagefolder")) {
304: localeKey = "mvnforum.user.action.desc.UsingMessage";
305: } else if (requestURI.equals("/deletemessagefolderprocess")) {
306: localeKey = "mvnforum.user.action.desc.UsingMessage";
307: } else if (requestURI.equals("/updatefolderorder")) {
308: localeKey = "mvnforum.user.action.desc.UsingMessage";
309:
310: } else if (requestURI.equals("/splitthread")) {
311: localeKey = "mvnforum.user.action.desc.ModerateForum";
312: } else if (requestURI.equals("/splitthreadprocess")) {
313: localeKey = "mvnforum.user.action.desc.ModerateForum";
314:
315: } else if (requestURI.equals("/deletethread")) {
316: localeKey = "mvnforum.user.action.desc.ModerateForum";
317: } else if (requestURI.equals("/deletethreadprocess")) {
318: localeKey = "mvnforum.user.action.desc.ModerateForum";
319:
320: } else if (requestURI.equals("/movethread")) {
321: localeKey = "mvnforum.user.action.desc.ModerateForum";
322: } else if (requestURI.equals("/movethreadprocess")) {
323: localeKey = "mvnforum.user.action.desc.ModerateForum";
324:
325: } else if (requestURI.equals("/editthreadstatus")) {
326: localeKey = "mvnforum.user.action.desc.ModerateForum";
327: } else if (requestURI.equals("/editthreadstatusprocess")) {
328: localeKey = "mvnforum.user.action.desc.ModerateForum";
329: } else if (requestURI.equals("/editthreadtype")) {
330: localeKey = "mvnforum.user.action.desc.ModerateForum";
331: } else if (requestURI.equals("/editthreadtypeprocess")) {
332: localeKey = "mvnforum.user.action.desc.ModerateForum";
333:
334: } else if (requestURI.equals("/modcp")) {
335: localeKey = "mvnforum.user.action.desc.ModerateForum";
336: } else if (requestURI.equals("/listrecentpendingthreads")) {
337: localeKey = "mvnforum.user.action.desc.ModerateForum";
338: } else if (requestURI.equals("/listthreadswithpendingposts")) {
339: localeKey = "mvnforum.user.action.desc.ModerateForum";
340: } else if (requestURI
341: .equals("/listrecentthreadswithpendingposts")) {
342: localeKey = "mvnforum.user.action.desc.ModerateForum";
343: } else if (requestURI.equals("/moderatependingthreads")) {
344: localeKey = "mvnforum.user.action.desc.ModerateForum";
345: } else if (requestURI.equals("/moderatependingthreadsprocess")) {
346: localeKey = "mvnforum.user.action.desc.ModerateForum";
347: } else if (requestURI.equals("/moderatependingposts")) {
348: localeKey = "mvnforum.user.action.desc.ModerateForum";
349: } else if (requestURI.equals("/moderatependingpostsprocess")) {
350: localeKey = "mvnforum.user.action.desc.ModerateForum";
351:
352: } else if (requestURI.equals("/listpendingthreadsxml")) {
353: localeKey = "mvnforum.user.action.desc.ModerateForum";
354:
355: } else if (requestURI.equals("/deletepost")) {
356: localeKey = "mvnforum.user.action.desc.ModerateForum";
357: } else if (requestURI.equals("/deletepostprocess")) {
358: localeKey = "mvnforum.user.action.desc.ModerateForum";
359:
360: } else if (requestURI.equals("/deleteattachment")) {
361: localeKey = "mvnforum.user.action.desc.ModerateForum";
362: } else if (requestURI.equals("/deleteattachmentprocess")) {
363: localeKey = "mvnforum.user.action.desc.ModerateForum";
364: } else if (requestURI.equals("/editattachment")) {
365: localeKey = "mvnforum.user.action.desc.ModerateForum";
366: } else if (requestURI.equals("/editattachmentprocess")) {
367: localeKey = "mvnforum.user.action.desc.ModerateForum";
368:
369: } else if (requestURI.equals("/iforgotpasswords")) {
370: url = "iforgotpasswords";
371: localeKey = "mvnforum.user.action.desc.IForgotPasswords";
372: } else if (requestURI.equals("/forgotpasswordprocess")) {
373: localeKey = "mvnforum.user.action.desc.ForgotPasswordProcess";
374: } else if (requestURI.equals("/resetpassword")) {
375: url = "resetpassword";
376: localeKey = "mvnforum.user.action.desc.ResetPassword";
377: } else if (requestURI.equals("/resetpasswordprocess")) {
378: localeKey = "mvnforum.user.action.desc.ResetPasswordProcess";
379:
380: } else if (requestURI.equals("/sendactivationcode")) {
381: url = "sendactivationcode";
382: localeKey = "mvnforum.user.action.desc.SendActivationCode";
383: } else if (requestURI.equals("/sendactivationcodeprocess")) {
384: localeKey = "mvnforum.user.action.desc.SendActivationCodeProcess";
385: } else if (requestURI.equals("/activatemember")) {
386: url = "activatemember";
387: localeKey = "mvnforum.user.action.desc.ActivateMember";
388: } else if (requestURI.equals("/activatememberprocess")) {
389: localeKey = "mvnforum.user.action.desc.ActivateMemberProcess";
390:
391: } else if (requestURI.equals("/getmvncoreimage")) {
392: localeKey = "mvnforum.user.action.desc.GetImage";
393: } else if (requestURI.equals("/getmvnforumimage")) {
394: localeKey = "mvnforum.user.action.desc.GetImage";
395: } else if (requestURI.equals("/getavatar")) {
396: localeKey = "mvnforum.user.action.desc.GetImage";
397: } else if (requestURI.equals("/captchaimage")) {
398: localeKey = "mvnforum.user.action.desc.GetImage";
399:
400: } else if (requestURI.equals("/getattachment")) {
401: localeKey = "mvnforum.user.action.desc.GetAttachment";
402: } else if (requestURI.equals("/getpmattachment")) {
403: localeKey = "mvnforum.user.action.desc.GetAttachment";
404:
405: } else if (requestURI.equals("/sendmail")) {
406: localeKey = "mvnforum.user.action.desc.SendMail";
407: } else if (requestURI.equals("/sendmailprocess")) {
408: localeKey = "mvnforum.user.action.desc.SendEmailProcess";
409: } else if (requestURI.equals("/bbcode")) {
410: url = "bbcode";
411: localeKey = "mvnforum.user.action.desc.BBCodeHelp";
412: }
413:
414: // this desc should never be null
415: if (localeKey == null) {
416: //String errorMessage = "Cannot find matching entry in ActionInUserModule for '" + requestURI + "'. Please contact the administrator.";
417: String localizedMessage = MVNForumResourceBundle
418: .getString(
419: locale,
420: "mvncore.exception.MissingURLMapEntryException.cannot_find_matching_entry",
421: new Object[] { requestURI });
422: MissingURLMapEntryException e = new MissingURLMapEntryException(
423: localizedMessage);
424: throw e;
425: }
426: }
427:
428: }
|