some indy.nl related updates
[mir.git] / source / mircoders / servlet / ServletModuleContent.java
index 919f4e3..7f5cb12 100755 (executable)
@@ -48,7 +48,7 @@ public class ServletModuleContent extends ServletModule
     try {
                theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile"));
       templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
-      templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
+      //templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
       templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
       templateConfirmString = MirConfig.getProp("ServletModule.Content.ConfirmTemplate");
       mainModule = new ModuleContent(DatabaseContent.getInstance());
@@ -188,8 +188,12 @@ public class ServletModuleContent extends ServletModule
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
-      if (withValues.get("creator").toString().equals(""))
-        withValues.put("creator","Anonym");
+
+//      ML: this is not multi-language friendly and this can be done in a template
+//      if (withValues.get("creator").toString().equals(""))
+//        withValues.put("creator","Anonym");
+
+
       String id = mainModule.add(withValues);
       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
       //theLog.printDebugInfo(":: content :: inserted");
@@ -339,8 +343,11 @@ public class ServletModuleContent extends ServletModule
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
-      if (withValues.get("creator").toString().equals(""))
-        withValues.put("creator","Anonym");
+
+//      ML: this is not multi-language friendly and this can be done in a template
+//      if (withValues.get("creator").toString().equals(""))
+//        withValues.put("creator","Anonym");
+
       //theLog.printDebugInfo("updating. ");
       String id = mainModule.set(withValues);
       DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
@@ -368,48 +375,31 @@ public class ServletModuleContent extends ServletModule
   private void _showObject(String id, HttpServletRequest req, HttpServletResponse res)
     throws ServletModuleException {
 
+    SimpleHash extraInfo = new SimpleHash();
     try {
       EntityContent entContent=(EntityContent)mainModule.getById(id);
-      SimpleHash mergeData =  HTMLTemplateProcessor.makeSimpleHash(entContent);
-      EntityList topicToContent = DatabaseContentToTopics.getInstance().getTopics(entContent);
-      if (topicToContent!=null && topicToContent.size()>0){
-        theLog.printDebugInfo("topicanzahl: "+topicToContent.size());
-        Entity topics = null;
-        SimpleList topicList = new SimpleList();
-        for(int i=0;i<topicToContent.size();i++){
-          topics = (EntityTopics)topicToContent.elementAt(i);
-          topicList.add(topics.getId());
-        }
-        mergeData.put("to_topic",topicList);
-      }
-      //obsolete, because of psqgl 7.1.x
-      //mergeData.put("content_data", entContent.getContentData());
-      mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+
+      extraInfo.put("themenPopupData", themenModule.getTopicsAsSimpleList());
       try {
-        mergeData.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
+        extraInfo.put("articletypePopupData",
+                        DatabaseArticleType.getInstance().getPopupData());
       } catch (Exception e) {
         theLog.printError("articletype could not be fetched.");
       }
       try {
-        mergeData.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
+        extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
       } catch (Exception e) {
         theLog.printError("language-popup could not be fetched.");
       }
-      // get the images
-      EntityList currentMedia = DatabaseContentToMedia.getInstance().getMedia(entContent);
-      if (currentMedia!=null && currentMedia.getCount()>=1) {
-                               mergeData.put("to_media", currentMedia);
-      }
-
 
-      mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
+      extraInfo.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
       // hier code um zur liste zurueckzukommen
       String offsetParam, whereParam, orderParam;
-      if ((offsetParam = req.getParameter("offset"))!=null) mergeData.put("offset", offsetParam);
-      if ((whereParam = req.getParameter("where"))!=null) mergeData.put("where", whereParam);
-      if ((orderParam = req.getParameter("order"))!=null) mergeData.put("order", orderParam);
-      mergeData.put("login_user", _getUser(req));
-      deliver(req, res, mergeData, templateObjektString);
+      if ((offsetParam = req.getParameter("offset"))!=null) extraInfo.put("offset", offsetParam);
+      if ((whereParam = req.getParameter("where"))!=null) extraInfo.put("where", whereParam);
+      if ((orderParam = req.getParameter("order"))!=null) extraInfo.put("order", orderParam);
+      extraInfo.put("login_user", _getUser(req));
+      deliver(req, res, entContent, extraInfo, templateObjektString);
     } catch (Exception e) {
       throw new ServletModuleException(e.toString());
     }