X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmircoders%2Fservlet%2FServletModuleLinksImcs.java;h=2e5d0228862076c0c27ae3f5eb0f199d008c3cc9;hb=ba775502000c2f4f213251a549781dc22dad5a94;hp=32d91b6b70af165b2c4eb382f02814a46f20628b;hpb=cb5d5c9553643eeefab08ffdf4ca42a73ad3400b;p=mir.git diff --git a/source/mircoders/servlet/ServletModuleLinksImcs.java b/source/mircoders/servlet/ServletModuleLinksImcs.java index 32d91b6b..2e5d0228 100755 --- a/source/mircoders/servlet/ServletModuleLinksImcs.java +++ b/source/mircoders/servlet/ServletModuleLinksImcs.java @@ -13,6 +13,7 @@ import mir.module.*; import mir.misc.*; import mir.entity.*; import mir.storage.*; +import mir.servlet.ServletModuleException; import mircoders.entity.*; import mircoders.storage.*; @@ -32,6 +33,7 @@ public class ServletModuleLinksImcs extends ServletModule private static ServletModuleLinksImcs instance = new ServletModuleLinksImcs(); public static ServletModule getInstance() { return instance; } + private ServletModuleLinksImcs() { theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.LinksImcs.Logfile")); templateListString = Configuration.getProperty("ServletModule.LinksImcs.ListTemplate"); @@ -44,5 +46,39 @@ public class ServletModuleLinksImcs extends ServletModule theLog.printDebugInfo("ServletModuleLinksImcs konnte nicht initialisiert werden"); } } + + public void add(HttpServletRequest req, HttpServletResponse res) + throws ServletModuleException { + try { + SimpleHash modelRoot = new SimpleHash(); + EntityList theList; + int offset = 0; + + theList = mainModule.getByWhereClause("to_parent_id=0", offset); + modelRoot.put("new", "1"); + modelRoot.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList)); + PrintWriter out = res.getWriter(); + + if (theList == null || theList.getCount() == 0 || theList.getCount()>1){ + //HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, theList, out); + HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, modelRoot, out); + + } else { + //deliver(req, res, theList.elementAt(0), templateObjektString); + deliver(req, res, modelRoot, templateObjektString); + } + + } catch(ModuleException e) { + throw new ServletModuleException(e.toString()); + } catch (HTMLParseException e) { + throw new ServletModuleException(e.toString()); + } catch (IOException e) { + throw new ServletModuleException(e.toString()); + } catch(StorageObjectException e) { + throw new ServletModuleException(e.toString()); + } + + + } }