added Hidden articles servlet module
authormh <mh>
Sun, 2 Jun 2002 17:04:08 +0000 (17:04 +0000)
committermh <mh>
Sun, 2 Jun 2002 17:04:08 +0000 (17:04 +0000)
bundles/admin_de.properties
bundles/admin_en.properties
source/config.properties-dist
source/mircoders/servlet/ServletModuleHidden.java [new file with mode: 0755]

index 9dbe0c2..cc30d23 100755 (executable)
@@ -5,6 +5,8 @@ yes=ja
 no=nein
 dontcare=egal
 all=alle
+year=Jahr
+month=Monat
 
 # actions
 insert=einf&uuml;gen
@@ -205,6 +207,7 @@ start.content.feature=feature
 start.content.topicspecial=themenspecials
 start.content.startspecial=startspecials
 start.content.not_published=nicht veröffentlichte nachrichten
+start.content.hidden=versteckte Artikel
 start.content.with_media=mit medien
 start.content.last_changes=letzte &auml;nderungen
 start.content.with_comments=mit internen kommentaren
index 0b4a69e..a08730a 100755 (executable)
@@ -5,6 +5,8 @@ yes=yes
 no=no
 dontcare=dontcare
 all=alle
+month=month
+year=year
 
 # actions
 insert=insert
@@ -204,6 +206,7 @@ start.content.newswire=newswire
 start.content.feature=feature
 start.content.topicspecial=topic-specials
 start.content.startspecial=startpage-specials
+start.content.hidden=hidden articles
 start.content.not_published=not (yet) published articles
 start.content.with_media=with media
 start.content.last_changes=latest changes
index fcb4a80..938bed4 100755 (executable)
@@ -292,6 +292,12 @@ ServletModule.Comment.ObjektTemplate=admin/comment.template
 ServletModule.Comment.ListTemplate=admin/commentlist.template
 
 #
+# config for ServletModuleHidden - lists all hidden articles of one month
+ServletModule.Hidden.Logfile=log/hidden.log
+ServletModule.Hidden.ListTemplate=admin/hiddenlist.template
+
+
+#
 # config for Breaking - browsing/editing/deleting breaking news
 Module.Breaking.Logfile=log/breaking.log
 ServletModule.Breaking.Logfile=log/comment.log
diff --git a/source/mircoders/servlet/ServletModuleHidden.java b/source/mircoders/servlet/ServletModuleHidden.java
new file mode 100755 (executable)
index 0000000..173a96a
--- /dev/null
@@ -0,0 +1,98 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import java.net.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import mir.servlet.*;
+import mir.module.*;
+import mir.misc.*;
+import mir.entity.*;
+import mir.storage.*;
+
+import mir.entity.*;
+import mircoders.storage.*;
+import mircoders.module.*;
+
+/*
+ *  ServletModuleHidden - output of so called "censored" articles
+ *  @author mh
+ *  @version $Id
+ *
+ */
+
+public class ServletModuleHidden extends ServletModule
+{
+
+       // Singelton / Kontruktor
+       private static ServletModuleHidden instance = new ServletModuleHidden();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleHidden() {
+               theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Hidden.Logfile"));
+               templateListString = MirConfig.getProp("ServletModule.Hidden.ListTemplate");
+               try {
+                       mainModule = new ModuleContent(DatabaseContent.getInstance());
+               }
+               catch (StorageObjectException e) {
+                       theLog.printError("servletmoduleHidden could not be initialized");
+               }
+       }
+
+
+       public void list(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+                       // Parameter auswerten
+                       SimpleHash mergeData = new SimpleHash();
+      String query_year = req.getParameter("year"); 
+      String query_month = req.getParameter("month"); 
+      String order = "webdb_create";
+
+                       // sql basteln
+      String whereClause = "is_published=false AND webdb_create LIKE '"+
+                            query_year+"-"+query_month+"%'";
+
+                       theLog.printDebugInfo("sql-whereclause: " + whereClause);
+
+                       // fetch und ausliefern
+                       try {
+
+                               if ((query_year!=null && !query_year.equals("")) 
+            && (query_month!=null && !query_month.equals(""))) {
+          EntityList theList = mainModule.getByWhereClause(whereClause, order, -1);
+                                       if (theList!=null && theList.size()>0) {
+
+                                               //make articleHash for comment
+                                               StringBuffer buf= new StringBuffer("id in (");boolean first=true;
+                                               for(int i=0;i<theList.size();i++) {
+                                                       if (first==false) buf.append(",");
+                                                       first=false;
+                                                       buf.append(theList.elementAt(i).getValue("to_media"));
+                                               }
+                                               buf.append(")");
+                                               SimpleHash articleHash =
+                HTMLTemplateProcessor.makeSimpleHash(
+                 mainModule.getByWhereClause(buf.toString(),-1));
+                                               mergeData.put("articleHash", articleHash);
+
+            // send the year and month for use in the list template
+            mergeData.put("year", query_year);
+            mergeData.put("month", query_month);
+                                               // get comment
+                                               mergeData.put("contentlist",theList);
+                                       }
+                               }
+                               // raus damit
+                               HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+                       }
+                       catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+                       catch (IOException e) {throw new ServletModuleException(e.toString());}
+                       catch (Exception e) {throw new ServletModuleException(e.toString());}
+       }
+}