X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmircoders%2Fservlet%2FServletModuleAdmin.java;h=ac41a31601f6929eee627195b38a4c4fb088eca6;hb=4451d4c8c25d46e9c405e966ff6bd016a1512f4f;hp=678290991db89384de9d349039a2c858222190e4;hpb=d90c1bbdd5e1823253436f24dce80de4f0abbfcb;p=mir.git diff --git a/source/mircoders/servlet/ServletModuleAdmin.java b/source/mircoders/servlet/ServletModuleAdmin.java index 67829099..ac41a316 100755 --- a/source/mircoders/servlet/ServletModuleAdmin.java +++ b/source/mircoders/servlet/ServletModuleAdmin.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,30 +18,30 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; -import java.io.PrintWriter; +import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import mir.log.LoggerToWriterAdapter; +import mir.entity.adapter.EntityIteratorAdapter; import mir.log.LoggerWrapper; import mir.servlet.ServletModule; -import mir.servlet.ServletModuleException; +import mir.servlet.ServletModuleFailure; +import mir.util.CachingRewindableIterator; import mir.util.URLBuilder; +import mircoders.global.MirGlobal; public class ServletModuleAdmin extends ServletModule { @@ -50,18 +50,15 @@ public class ServletModuleAdmin extends ServletModule private ServletModuleAdmin() { logger = new LoggerWrapper("ServletModule.Admin"); - defaultAction = "showSuperUserMenu"; + defaultAction = "start"; } - public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException { - // ML: experiment in using the producer's generation system instead of the - // old one... - + public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) { URLBuilder urlBuilder = new URLBuilder(); int count; try { - Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest)); + Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); urlBuilder.setValue("module", "Admin"); urlBuilder.setValue("do", "superusermenu"); @@ -70,9 +67,38 @@ public class ServletModuleAdmin extends ServletModule ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template"); } catch (Throwable e) { - e.printStackTrace(new PrintWriter(new LoggerToWriterAdapter(logger, LoggerWrapper.ERROR_MESSAGE))); + throw new ServletModuleFailure(e); + } + } + + public void start(HttpServletRequest aRequest, HttpServletResponse aResponse) { + String startTemplate = configuration.getString("Mir.StartTemplate"); + String sessionUrl = aResponse.encodeURL(""); - throw new ServletModuleException(e.getMessage()); + try { + Map mergeData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] {getLocale(aRequest), getFallbackLocale(aRequest)} + , "bundles.admin", "bundles.adminlocal"); + mergeData.put("messages", + new CachingRewindableIterator( + new EntityIteratorAdapter("", "webdb_create desc", 10, + MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0))); + + mergeData.put("fileeditentries", ( (ServletModuleFileEdit) ServletModuleFileEdit.getInstance()).getEntries()); + mergeData.put("administeroperations", ( (ServletModuleLocalizer) ServletModuleLocalizer.getInstance()).getAdministerOperations()); + + mergeData.put("searchvalue", null); + mergeData.put("searchfield", null); + mergeData.put("searchispublished", null); + mergeData.put("searcharticletype", null); + mergeData.put("searchorder", null); + mergeData.put("selectarticleurl", null); + mergeData.put("recipes", MirGlobal.localizer().producers().getRecipeNames()); + + ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate); + } + catch (Exception e) { + throw new ServletModuleFailure(e); } } + }