001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/admin/AdminModuleURLMapHandler.java,v 1.98 2007/11/13 09:33:33 minhnn Exp $
003: * $Author: minhnn $
004: * $Revision: 1.98 $
005: * $Date: 2007/11/13 09:33:33 $
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.admin;
042:
043: import java.util.Locale;
044:
045: import net.myvietnam.mvncore.exception.MissingURLMapEntryException;
046: import net.myvietnam.mvncore.mvnframework.URLMap;
047: import net.myvietnam.mvncore.util.GenericParamUtil;
048: import net.myvietnam.mvncore.util.I18nUtil;
049: import net.myvietnam.mvncore.web.GenericRequest;
050:
051: import com.mvnforum.MVNForumResourceBundle;
052:
053: public class AdminModuleURLMapHandler {
054:
055: public AdminModuleURLMapHandler() {
056: }
057:
058: /**
059: * We must pass the requestURI to this method, instead of from request,
060: * because requestURI may be changed from Processor before call this method
061: * NOTE: Currently we dont use the param request
062: */
063: public URLMap getMap(String requestURI, GenericRequest request)
064: throws MissingURLMapEntryException {
065: URLMap map = new URLMap();
066:
067: // ADMIN module
068: if (requestURI.equals("") || requestURI.equals("/")) {
069: map.setResponse(AdminModuleConfig.getUrlPattern()
070: + "/index");
071: } else if (requestURI.equals("/index")) {
072: map.setResponse("/mvnplugin/mvnforum/admin/index.jsp");
073: } else if (requestURI.equals("/changemode")) {
074: map.setResponse(AdminModuleConfig.getUrlPattern()
075: + "/index");
076: } else if (requestURI.equals("/clearcache")) {
077: map.setResponse(AdminModuleConfig.getUrlPattern()
078: + "/index");
079: } else if (requestURI.equals("/error")) {
080: map.setResponse("/mvnplugin/mvnforum/admin/error.jsp");
081:
082: } else if (requestURI.equals("/login")) {
083: map.setResponse("/mvnplugin/mvnforum/admin/login.jsp");
084: } else if (requestURI.equals("/loginprocess")) {
085: map.setResponse(AdminModuleConfig.getUrlPattern()
086: + "/index");
087: } else if (requestURI.equals("/logout")) {
088: map.setResponse("/mvnplugin/mvnforum/admin/login.jsp");
089: } else if (requestURI.equals("/testsystem")) {
090: map.setResponse("/mvnplugin/mvnforum/admin/testsystem.jsp");
091: } else if (requestURI.equals("/misctasks")) {
092: map.setResponse("/mvnplugin/mvnforum/admin/misctasks.jsp");
093: } else if (requestURI.equals("/importexport")) {
094: map
095: .setResponse("/mvnplugin/mvnforum/admin/importexport.jsp");
096: } else if (requestURI.equals("/exportprocess")) {
097: map
098: .setResponse("/mvnplugin/mvnforum/admin/exportsuccess.jsp");
099: } else if (requestURI.equals("/deleteexportprocess")) {
100: map
101: .setResponse("/mvnplugin/mvnforum/admin/importexport.jsp"); //go back to importexport
102: /* "/importprocess" and "/getexportprocess" are handled without
103: * using this url map handler, since they directly commit output, and
104: * there should be no redirection/forward to JSPs
105: */
106: } else if (requestURI.equals("/rebuildindex")) {
107: map
108: .setResponse("/mvnplugin/mvnforum/admin/rebuildindexsuccess.jsp");
109:
110: } else if (requestURI.equals("/rankmanagement")) {
111: map
112: .setResponse("/mvnplugin/mvnforum/admin/rankmanagement.jsp");
113: } else if (requestURI.equals("/addrankprocess")) {
114: map
115: .setResponse("/mvnplugin/mvnforum/admin/addranksuccess.jsp");
116: } else if (requestURI.equals("/deleterankprocess")) {
117: map
118: .setResponse("/mvnplugin/mvnforum/admin/deleteranksuccess.jsp");
119: } else if (requestURI.equals("/editrank")) {
120: map.setResponse("/mvnplugin/mvnforum/admin/editrank.jsp");
121: } else if (requestURI.equals("/editrankprocess")) {
122: map
123: .setResponse("/mvnplugin/mvnforum/admin/editranksuccess.jsp");
124:
125: } else if (requestURI.equals("/usermanagement")) {
126: map
127: .setResponse("/mvnplugin/mvnforum/admin/usermanagement.jsp");
128: } else if (requestURI.equals("/permissionsummary")) {
129: map
130: .setResponse("/mvnplugin/mvnforum/admin/permissionsummary.jsp");
131: } else if (requestURI.equals("/viewmemberpermissions")) {
132: map
133: .setResponse("/mvnplugin/mvnforum/admin/viewmemberpermissions.jsp");
134: } else if (requestURI.equals("/deletenonactivatedmembers")) {
135: map
136: .setResponse("/mvnplugin/mvnforum/admin/deletenonactivatedmembers.jsp");
137: } else if (requestURI
138: .equals("/deletenonactivatedmembersprocess")) {
139: map
140: .setResponse("/mvnplugin/mvnforum/admin/deletenonactivatedmemberssuccess.jsp");
141: } else if (requestURI.equals("/listpendingusers")) {
142: map
143: .setResponse("/mvnplugin/mvnforum/admin/listpendingusers.jsp");
144: } else if (requestURI.equals("/listpendingusersprocess")) {
145: map
146: .setResponse("/mvnplugin/mvnforum/admin/listpendinguserssuccess.jsp");
147:
148: } else if (requestURI.equals("/addmember")) {
149: map.setResponse("/mvnplugin/mvnforum/admin/addmember.jsp");
150: } else if (requestURI.equals("/addmemberprocess")) {
151: map.setResponse(AdminModuleConfig.getUrlPattern()
152: + "/usermanagement");
153: } else if (requestURI.equals("/changememberstatusprocess")) {
154: map
155: .setResponse("/mvnplugin/mvnforum/admin/changememberstatussuccess.jsp");
156: } else if (requestURI.equals("/viewmember")) {
157: map.setResponse("/mvnplugin/mvnforum/admin/viewmember.jsp");
158: } else if (requestURI.equals("/editmember")) {
159: map.setResponse("/mvnplugin/mvnforum/admin/editmember.jsp");
160: } else if (requestURI.equals("/updatemember")) {
161: map
162: .setResponse("/mvnplugin/mvnforum/admin/editmembersuccess.jsp");
163: } else if (requestURI.equals("/changepassword")) {
164: map
165: .setResponse("/mvnplugin/mvnforum/admin/changepassword.jsp");
166: } else if (requestURI.equals("/changepasswordprocess")) {
167: map
168: .setResponse("/mvnplugin/mvnforum/admin/editmembersuccess.jsp");
169: } else if (requestURI.equals("/editmembertitle")) {
170: map
171: .setResponse("/mvnplugin/mvnforum/admin/editmembertitle.jsp");
172: } else if (requestURI.equals("/editmembertitleprocess")) {
173: map
174: .setResponse("/mvnplugin/mvnforum/admin/editmembertitlesuccess.jsp");
175: } else if (requestURI.equals("/resetsignatureprocess")) {
176: map
177: .setResponse("/mvnplugin/mvnforum/admin/resetsignaturesuccess.jsp");
178: } else if (requestURI.equals("/resetavatarprocess")) {
179: map
180: .setResponse("/mvnplugin/mvnforum/admin/resetavatarsuccess.jsp");
181: } else if (requestURI.equals("/resetactivationprocess")) {
182: map
183: .setResponse("/mvnplugin/mvnforum/admin/resetactivationsuccess.jsp");
184: } else if (requestURI.equals("/deletewatch")) {
185: map.setResponse(AdminModuleConfig.getUrlPattern()
186: + "/viewmember?memberid="
187: + GenericParamUtil
188: .getParameter(request, "memberid"));
189:
190: } else if (requestURI.equals("/groupmanagement")) {
191: map
192: .setResponse("/mvnplugin/mvnforum/admin/groupmanagement.jsp");
193: } else if (requestURI.equals("/addgroup")) {
194: map.setResponse("/mvnplugin/mvnforum/admin/addgroup.jsp");
195: } else if (requestURI.equals("/addgroupprocess")) {
196: map.setResponse(AdminModuleConfig.getUrlPattern()
197: + "/groupmanagement");
198: } else if (requestURI.equals("/deletegroup")) {
199: map
200: .setResponse("/mvnplugin/mvnforum/admin/deletegroup.jsp");
201: } else if (requestURI.equals("/deletegroupprocess")) {
202: map.setResponse(AdminModuleConfig.getUrlPattern()
203: + "/groupmanagement");
204: } else if (requestURI.equals("/viewgroup")) {
205: map.setResponse("/mvnplugin/mvnforum/admin/viewgroup.jsp");
206: } else if (requestURI.equals("/assignforumtogroup")) {
207: map
208: .setResponse("/mvnplugin/mvnforum/admin/assignforumtogroup.jsp");
209: } else if (requestURI.equals("/assigngrouptoforum")) {
210: map
211: .setResponse("/mvnplugin/mvnforum/admin/assigngrouptoforum.jsp");
212: } else if (requestURI.equals("/editgroupinfo")) {
213: map
214: .setResponse("/mvnplugin/mvnforum/admin/editgroupinfo.jsp");
215: } else if (requestURI.equals("/updategroupinfo")) {
216: map
217: .setResponse("/mvnplugin/mvnforum/admin/editgroupinfosuccess.jsp");
218: } else if (requestURI.equals("/editgroupowner")) {
219: map
220: .setResponse("/mvnplugin/mvnforum/admin/editgroupowner.jsp");
221: } else if (requestURI.equals("/updategroupowner")) {
222: map
223: .setResponse("/mvnplugin/mvnforum/admin/editgroupinfosuccess.jsp");
224: } else if (requestURI.equals("/listmembergroup")) {
225: map
226: .setResponse("/mvnplugin/mvnforum/admin/listmembergroup.jsp");
227: } else if (requestURI.equals("/addmembergroup")) {
228: map
229: .setResponse("/mvnplugin/mvnforum/admin/addmembergroup.jsp");
230: } else if (requestURI.equals("/addmembergroupprocess")) {
231: map.setResponse(AdminModuleConfig.getUrlPattern()
232: + "/listmembergroup?group="
233: + GenericParamUtil.getParameter(request, "group"));
234: } else if (requestURI.equals("/deletemembergroupprocess")) {
235: map.setResponse(AdminModuleConfig.getUrlPattern()
236: + "/listmembergroup?group="
237: + GenericParamUtil.getParameter(request, "group"));
238: } else if (requestURI.equals("/editgrouppermission")) {
239: map
240: .setResponse("/mvnplugin/mvnforum/admin/editgrouppermission.jsp");
241: } else if (requestURI.equals("/updategrouppermission")) {
242: map.setResponse(AdminModuleConfig.getUrlPattern()
243: + "/editgrouppermission?group="
244: + GenericParamUtil.getParameter(request, "group"));
245:
246: } else if (requestURI.equals("/forummanagement")) {
247: map
248: .setResponse("/mvnplugin/mvnforum/admin/forummanagement.jsp");
249: } else if (requestURI.equals("/updatecategoryorder")) {
250: map.setResponse(AdminModuleConfig.getUrlPattern()
251: + "/forummanagement");
252: } else if (requestURI.equals("/updateforumorder")) {
253: map.setResponse(AdminModuleConfig.getUrlPattern()
254: + "/forummanagement");
255: } else if (requestURI.equals("/editgroupforumpermission")) {
256: map
257: .setResponse("/mvnplugin/mvnforum/admin/editgroupforumpermission.jsp");
258: } else if (requestURI.equals("/editmemberforumpermission")) {
259: map
260: .setResponse("/mvnplugin/mvnforum/admin/editmemberforumpermission.jsp");
261: } else if (requestURI.equals("/editmemberpermission")) {
262: map
263: .setResponse("/mvnplugin/mvnforum/admin/editmemberpermission.jsp");
264: } else if (requestURI.equals("/deletemember")) {
265: map
266: .setResponse("/mvnplugin/mvnforum/admin/deletemember.jsp");
267: } else if (requestURI.equals("/deletememberprocess")) {
268: map
269: .setResponse("/mvnplugin/mvnforum/admin/deletemembersuccess.jsp");
270: } else if (requestURI.equals("/updategroupforumpermission")) {
271: map.setResponse(AdminModuleConfig.getUrlPattern()
272: + "/editgroupforumpermission?group="
273: + GenericParamUtil.getParameter(request, "group")
274: + "&forum="
275: + GenericParamUtil.getParameter(request, "forum"));
276: } else if (requestURI.equals("/updatememberforumpermission")) {
277: map.setResponse(AdminModuleConfig.getUrlPattern()
278: + "/editmemberforumpermission?memberid="
279: + GenericParamUtil
280: .getParameter(request, "memberid")
281: + "&forum="
282: + GenericParamUtil.getParameter(request, "forum"));
283: } else if (requestURI.equals("/updatememberpermission")) {
284: map.setResponse(AdminModuleConfig.getUrlPattern()
285: + "/editmemberpermission?memberid="
286: + GenericParamUtil
287: .getParameter(request, "memberid"));
288:
289: } else if (requestURI.equals("/addforum")) {
290: map.setResponse("/mvnplugin/mvnforum/admin/addforum.jsp");
291: } else if (requestURI.equals("/addforumprocess")) {
292: map
293: .setResponse("/mvnplugin/mvnforum/admin/addforumsuccess.jsp");
294: } else if (requestURI.equals("/deleteforum")) {
295: map
296: .setResponse("/mvnplugin/mvnforum/admin/deleteforum.jsp");
297: } else if (requestURI.equals("/deleteforumprocess")) {
298: map
299: .setResponse("/mvnplugin/mvnforum/admin/deleteforumsuccess.jsp");
300: } else if (requestURI.equals("/editforum")) {
301: map.setResponse("/mvnplugin/mvnforum/admin/editforum.jsp");
302: } else if (requestURI.equals("/updateforum")) {
303: map
304: .setResponse("/mvnplugin/mvnforum/admin/editforumsuccess.jsp");
305:
306: } else if (requestURI.equals("/addcategory")) {
307: map
308: .setResponse("/mvnplugin/mvnforum/admin/addcategory.jsp");
309: } else if (requestURI.equals("/addcategoryprocess")) {
310: map
311: .setResponse("/mvnplugin/mvnforum/admin/addcategorysuccess.jsp");
312: } else if (requestURI.equals("/deletecategory")) {
313: map
314: .setResponse("/mvnplugin/mvnforum/admin/deletecategory.jsp");
315: } else if (requestURI.equals("/deletecategoryprocess")) {
316: map
317: .setResponse("/mvnplugin/mvnforum/admin/deletecategorysuccess.jsp");
318: } else if (requestURI.equals("/editcategory")) {
319: map
320: .setResponse("/mvnplugin/mvnforum/admin/editcategory.jsp");
321: } else if (requestURI.equals("/updatecategory")) {
322: map
323: .setResponse("/mvnplugin/mvnforum/admin/editcategorysuccess.jsp");
324: } else if (requestURI.equals("/listcategories")) {
325: map
326: .setResponse("/mvnplugin/mvnforum/admin/listcategories.jsp");
327:
328: } else if (requestURI.equals("/sendmail")) {
329: map.setResponse("/mvnplugin/mvnforum/admin/sendmail.jsp");
330: } else if (requestURI.equals("/sendmailprocess")) {
331: map
332: .setResponse("/mvnplugin/mvnforum/admin/sendmailsuccess.jsp");
333: } else if (requestURI.equals("/sendactivatemailtoallprocess")) {
334: map
335: .setResponse("/mvnplugin/mvnforum/admin/sendactivatemailtoallsuccess.jsp");
336:
337: } else if (requestURI.equals("/assignforumtomember")) {
338: map
339: .setResponse("/mvnplugin/mvnforum/admin/assignforumtomember.jsp");
340: } else if (requestURI.equals("/assignmembertoforum")) {
341: map
342: .setResponse("/mvnplugin/mvnforum/admin/assignmembertoforum.jsp");
343:
344: } else if (requestURI.equals("/configindex")) {
345: map
346: .setResponse("/mvnplugin/mvnforum/admin/configindex.jsp");
347: } else if (requestURI.equals("/configstepone")) {
348: map
349: .setResponse("/mvnplugin/mvnforum/admin/configstepone.jsp");
350: } else if (requestURI.equals("/configsteponeprocess")) {
351: map
352: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
353: } else if (requestURI.equals("/configsteptwo")) {
354: map
355: .setResponse("/mvnplugin/mvnforum/admin/configsteptwo.jsp");
356: } else if (requestURI.equals("/configsteptwoprocess")) {
357: map
358: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
359: } else if (requestURI.equals("/configstepthree")) {
360: map
361: .setResponse("/mvnplugin/mvnforum/admin/configstepthree.jsp");
362: } else if (requestURI.equals("/configstepthreeprocess")) {
363: map
364: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
365: } else if (requestURI.equals("/configmvncore")) {
366: map
367: .setResponse("/mvnplugin/mvnforum/admin/configmvncore.jsp");
368: } else if (requestURI.equals("/configmvncoreprocess")) {
369: map
370: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
371: } else if (requestURI.equals("/configurlpattern")) {
372: map
373: .setResponse("/mvnplugin/mvnforum/admin/configurlpattern.jsp");
374: } else if (requestURI.equals("/configurlpatternprocess")) {
375: map
376: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
377: } else if (requestURI.equals("/commitconfigs")) {
378: map
379: .setResponse("/mvnplugin/mvnforum/admin/updateconfigurationsuccess.jsp");
380: } else if (requestURI.equals("/configbackupprocess")) {
381: map
382: .setResponse("/mvnplugin/mvnforum/admin/backupconfigurationsuccess.jsp");
383:
384: } else if (requestURI.equals("/edittemplate")) {
385: map
386: .setResponse("/mvnplugin/mvnforum/admin/edittemplate.jsp");
387: } else if (requestURI.equals("/updatetemplate")) {
388: map
389: .setResponse("/mvnplugin/mvnforum/admin/edittemplate.jsp");
390:
391: } else if (requestURI.equals("/editcss")) {
392: map.setResponse("/mvnplugin/mvnforum/admin/editcss.jsp");
393: } else if (requestURI.equals("/updatecss")) {
394: map.setResponse("/mvnplugin/mvnforum/admin/editcss.jsp");
395: } else if (requestURI.equals("/restorecss")) {
396: map
397: .setResponse("/mvnplugin/mvnforum/admin/restorecsssuccess.jsp");
398:
399: }
400: if (requestURI.equals("/viewlogsystem")) {
401: map
402: .setResponse("/mvnplugin/mvnforum/admin/viewlogsystem.jsp");
403: } else if (requestURI.equals("/logframe")) {
404: map.setResponse("/mvnplugin/mvnforum/admin/logframe.jsp");
405: } else if (requestURI.equals("/backupsystemlog")) {
406: map
407: .setResponse("/mvnplugin/mvnforum/admin/backupsystemlogsuccess.jsp");
408: } else if (requestURI.equals("/listlogfiles")) {
409: map
410: .setResponse("/mvnplugin/mvnforum/admin/listlogfiles.jsp");
411: } else if (requestURI.equals("/deletelogfile")) {
412: map.setResponse(AdminModuleConfig.getUrlPattern()
413: + "/listlogfiles");
414: /*
415: "/downloadlogfile" will return null in Processor, so we dont need mapping here
416: */
417:
418: } else if (requestURI.equals("/searchmember")) {
419: map
420: .setResponse("/mvnplugin/mvnforum/admin/searchmember.jsp");
421:
422: } else if (requestURI.equals("/updatememberexpireprocess")) {
423: map
424: .setResponse("/mvnplugin/mvnforum/admin/updatememberexpiresuccess.jsp");
425: } else if (requestURI.equals("/listuserexpire")) {
426: map
427: .setResponse("/mvnplugin/mvnforum/admin/listuserexpire.jsp");
428:
429: } else if (requestURI.equals("/bbcode")) {
430: map.setResponse("/mvnplugin/mvnforum/user/bbcode.jsp");
431: } else if (requestURI.equals("/eventlogs")) {
432: map
433: .setResponse("/mvnplugin/mvnforum/admin/listeventlogs.jsp");
434: }
435:
436: Locale locale = I18nUtil.getLocaleInRequest(request);
437:
438: // unknown module, we throw an exception
439: if (map.getResponse() == null) {
440: //String errorMessage = "Cannot find matching entry in URLMap for '" + requestURI + "'. Please contact the administrator.";
441: String localizedMessage = MVNForumResourceBundle
442: .getString(
443: locale,
444: "mvncore.exception.MissingURLMapEntryException.cannot_find_matching_entry.AdminModule",
445: new Object[] { requestURI });
446: throw new MissingURLMapEntryException(localizedMessage);
447: //throw new MissingURLMapEntryException(errorMessage);
448: }
449: return map;
450: }
451: }
|