session-tracking over get-param, if browser does not allow cookies.
[mir.git] / source / mircoders / servlet / ServletModuleLinksImcs.java
index 32d91b6..761d8fb 100755 (executable)
@@ -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,36 @@ 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=NULL", offset);
+      modelRoot.put("new", "1");
+      modelRoot.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+
+      if (theList == null || theList.getCount() == 0 || theList.getCount()>1){
+        HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateObjektString, modelRoot, res.getWriter());
+
+      } else {
+        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());
+    }
+
+
+  }
 }