Initial revision
authorfh <fh>
Tue, 28 Aug 2001 21:12:32 +0000 (21:12 +0000)
committerfh <fh>
Tue, 28 Aug 2001 21:12:32 +0000 (21:12 +0000)
76 files changed:
source/mircoders/entity/EntityArticleType.java [new file with mode: 0755]
source/mircoders/entity/EntityBreaking.java [new file with mode: 0755]
source/mircoders/entity/EntityComment.java [new file with mode: 0755]
source/mircoders/entity/EntityContent.java [new file with mode: 0755]
source/mircoders/entity/EntityFeature.java [new file with mode: 0755]
source/mircoders/entity/EntityGruppen.java [new file with mode: 0755]
source/mircoders/entity/EntityImage.java [new file with mode: 0755]
source/mircoders/entity/EntityImageColor.java [new file with mode: 0755]
source/mircoders/entity/EntityImageFormat.java [new file with mode: 0755]
source/mircoders/entity/EntityImageLayout.java [new file with mode: 0755]
source/mircoders/entity/EntityImageType.java [new file with mode: 0755]
source/mircoders/entity/EntityLanguage.java [new file with mode: 0755]
source/mircoders/entity/EntityMediafolder.java [new file with mode: 0755]
source/mircoders/entity/EntityMessage.java [new file with mode: 0755]
source/mircoders/entity/EntityRights.java [new file with mode: 0755]
source/mircoders/entity/EntityTopics.java [new file with mode: 0755]
source/mircoders/entity/EntityUsers.java [new file with mode: 0755]
source/mircoders/entity/EntityVideo.java [new file with mode: 0755]
source/mircoders/input/XmlFilenameFilter.java [new file with mode: 0755]
source/mircoders/input/XmlHandler.java [new file with mode: 0755]
source/mircoders/input/XmlInputParser.java [new file with mode: 0755]
source/mircoders/module/ModuleBreaking.java [new file with mode: 0755]
source/mircoders/module/ModuleComment.java [new file with mode: 0755]
source/mircoders/module/ModuleContent.java [new file with mode: 0755]
source/mircoders/module/ModuleFeature.java [new file with mode: 0755]
source/mircoders/module/ModuleGruppen.java [new file with mode: 0755]
source/mircoders/module/ModuleImages.java [new file with mode: 0755]
source/mircoders/module/ModuleMediafolder.java [new file with mode: 0755]
source/mircoders/module/ModuleMessage.java [new file with mode: 0755]
source/mircoders/module/ModuleSchwerpunkt.java [new file with mode: 0755]
source/mircoders/module/ModuleTopics.java [new file with mode: 0755]
source/mircoders/module/ModuleUsers.java [new file with mode: 0755]
source/mircoders/producer/DEADJOE [new file with mode: 0755]
source/mircoders/producer/Producer.java [new file with mode: 0755]
source/mircoders/producer/ProducerAll.java [new file with mode: 0755]
source/mircoders/producer/ProducerContent.java [new file with mode: 0755]
source/mircoders/producer/ProducerFeature.java [new file with mode: 0755]
source/mircoders/producer/ProducerImages.java [new file with mode: 0755]
source/mircoders/producer/ProducerList.java [new file with mode: 0755]
source/mircoders/producer/ProducerNavigation.java [new file with mode: 0755]
source/mircoders/producer/ProducerOpenPosting.java [new file with mode: 0755]
source/mircoders/producer/ProducerOverview.java [new file with mode: 0755]
source/mircoders/producer/ProducerStartPage.java [new file with mode: 0755]
source/mircoders/producer/ProducerTopics.java [new file with mode: 0755]
source/mircoders/producer/ProducerWap.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleBreaking.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleComment.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleContent.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleGroups.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleImages.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleMediafolder.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleMessage.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleOpenIndy.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleProducer.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleSchwerpunkt.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleTopics.java [new file with mode: 0755]
source/mircoders/servlet/ServletModuleUsers.java [new file with mode: 0755]
source/mircoders/storage/DatabaseArticleType.java [new file with mode: 0755]
source/mircoders/storage/DatabaseBreaking.java [new file with mode: 0755]
source/mircoders/storage/DatabaseComment.java [new file with mode: 0755]
source/mircoders/storage/DatabaseContent.java [new file with mode: 0755]
source/mircoders/storage/DatabaseContentToTopics.java [new file with mode: 0755]
source/mircoders/storage/DatabaseFeature.java [new file with mode: 0755]
source/mircoders/storage/DatabaseGroups.java [new file with mode: 0755]
source/mircoders/storage/DatabaseImageColor.java [new file with mode: 0755]
source/mircoders/storage/DatabaseImageFormat.java [new file with mode: 0755]
source/mircoders/storage/DatabaseImageLayout.java [new file with mode: 0755]
source/mircoders/storage/DatabaseImageType.java [new file with mode: 0755]
source/mircoders/storage/DatabaseImages.java [new file with mode: 0755]
source/mircoders/storage/DatabaseLanguage.java [new file with mode: 0755]
source/mircoders/storage/DatabaseMediafolder.java [new file with mode: 0755]
source/mircoders/storage/DatabaseMessages.java [new file with mode: 0755]
source/mircoders/storage/DatabaseRights.java [new file with mode: 0755]
source/mircoders/storage/DatabaseTopics.java [new file with mode: 0755]
source/mircoders/storage/DatabaseUsers.java [new file with mode: 0755]
source/mircoders/storage/DatabaseVideos.java [new file with mode: 0755]

diff --git a/source/mircoders/entity/EntityArticleType.java b/source/mircoders/entity/EntityArticleType.java
new file mode 100755 (executable)
index 0000000..69ee99f
--- /dev/null
@@ -0,0 +1,32 @@
+package mircoders.entity;
+
+/**
+ * Title: EntityArticleType
+ * Description: Maps table "article_type" to Java Object
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia.de
+ * @author /rk
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+public class EntityArticleType extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityArticleType() {    super(); instances++;   }
+       public EntityArticleType(StorageObject theStorage) {    this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityBreaking.java b/source/mircoders/entity/EntityBreaking.java
new file mode 100755 (executable)
index 0000000..bb8016f
--- /dev/null
@@ -0,0 +1,41 @@
+package mircoders.entity;
+
+/**
+ * Title: EntityBreaking
+ * Description: Maps table "breaking" to Java Object
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia.de
+ * @author /rk
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+public class EntityBreaking extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityBreaking() {       super(); instances++;   }
+       public EntityBreaking(StorageObject theStorage) {       this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+
+       public HashMap getValues() {
+               HashMap returnHash = super.getValues();
+               String date=null;
+
+               if ((date=(String)returnHash.get("webdb_create"))!=null)
+                       returnHash.put("webdb_create_formatted", StringUtil.dateToReadableDate(date));
+               return returnHash;
+       }
+}
diff --git a/source/mircoders/entity/EntityComment.java b/source/mircoders/entity/EntityComment.java
new file mode 100755 (executable)
index 0000000..462a636
--- /dev/null
@@ -0,0 +1,69 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+
+/**
+ * This class maps one line of the comment-table to a java-object.
+ *
+ * @author RK
+ * @version 1.0
+ */
+
+
+public class EntityComment extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityComment()
+       {
+               super();
+               instances++;
+       }
+
+       public EntityComment(StorageObject theStorage) {
+               this();
+               setStorage(theStorage);
+       }
+
+       public HashMap getValues() {
+               HashMap returnHash = super.getValues();
+               String create = (String)returnHash.get("webdb_create");
+               returnHash.put("date",StringUtil.dateToReadableDate(create));
+
+               return returnHash;
+       }
+
+/**
+ * overridden method setValues to patch creator_main_url
+ */
+
+       public void setValues(HashMap theStringValues)
+       {
+               if (theStringValues != null) {
+                       if (!theStringValues.containsKey("is_published"))
+                        theStringValues.put("is_published","0");
+                       if (theStringValues.containsKey("main_url"))
+                               if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {
+                                       theStringValues.remove("main_url");
+        } else if (!((String)theStringValues.get("main_url")).startsWith("http://")){
+          theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
+        }
+               }
+               super.setValues(theStringValues);
+       }
+
+
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+}
diff --git a/source/mircoders/entity/EntityContent.java b/source/mircoders/entity/EntityContent.java
new file mode 100755 (executable)
index 0000000..0345cea
--- /dev/null
@@ -0,0 +1,205 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+
+/**
+ * this class implements mapping of one line of the database table content
+ * to a java object
+ *
+ * @author RK
+ * @version 2001
+ */
+
+
+public class EntityContent extends AbstractEntity implements Entity
+{
+
+       private static int      instances;
+
+       // constructors
+
+       public EntityContent()
+       {
+               super();
+               instances++;
+    //content_data is now filed-type "text"
+               //streamedInput = new ArrayList();
+               //streamedInput.add("content_data");
+       }
+
+       public EntityContent(StorageObject theStorage) {
+               this();
+               setStorage(theStorage);
+       }
+
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+       //
+       // methods
+
+ /**
+       * set is_produced flag for the article
+       */
+
+       public void setProduced(boolean yesno)
+       {
+               Connection con=null;Statement stmt=null;
+               String value = (yesno) ? "1":"0";
+               String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
+               try {
+                               con = theStorageObject.getPooledCon();
+                               /** @todo should be preparedStatement: faster!! */
+                               stmt = con.createStatement();
+                               theStorageObject.executeUpdate(stmt,sql);
+               } catch (StorageObjectException e) {
+                       theLog.printDebugInfo(e.toString() + "\n -- set produced failed");
+               } catch (SQLException e) {
+                       theLog.printDebugInfo(e.toString() + "\n -- set produced failed");
+               } finally {
+                       theStorageObject.freeConnection(con,stmt);
+               }
+       }
+
+
+ /**
+       * make openposting to newswire
+       */
+
+       public void newswire()
+       {
+               String sql = "update content set to_article_type='1', is_produced='0' where id='" + getId()+"'";
+               try {
+                               theStorageObject.executeUpdate(sql);
+               } catch (StorageObjectException e) {
+                       theLog.printError(e.toString() + "newswire failed");
+               } catch (SQLException e) {
+                       theLog.printError(e.toString() + "newswire failed");
+               }
+       }
+
+
+ /**
+       * dettach from media
+       */
+
+       public void dettach()
+       {
+               String sql = "update content set to_media=null, is_produced='0' where id='" + getId()+"'";
+               try {
+                               theStorageObject.executeUpdate(sql);
+               } catch (StorageObjectException e) {
+                       theLog.printError(e.toString() + "dettach failed");
+               } catch (SQLException e) {
+                       theLog.printError(e.toString() + "dettach failed");
+               }
+       }
+
+ /**
+       * attach to media
+       */
+
+       public void attach(String mid)
+       {
+               if (mid!=null) {
+                       String sql = "update content set to_media='" + mid + "', is_produced='0' where id='" + getId()+"'";
+                       try {
+                                       theStorageObject.executeUpdate(sql);
+                       } catch (StorageObjectException e) {
+                               theLog.printError(e.toString() + "attach failed");
+                       } catch (SQLException e) {
+                               theLog.printError(e.toString() + "attach failed");
+                       }
+               }
+               else
+                       theLog.printError("EntityContent: attach without mid");
+       }
+
+       /**
+        * overridden method getValues to include formatted date into every
+        * entityContent
+        */
+
+       public HashMap getValues() {
+               HashMap returnHash = super.getValues();
+               String date=null;
+
+               if ((date=(String)returnHash.get("date"))!=null)
+                       returnHash.put("date_formatted", StringUtil.webdbDate2readableDate(date));
+               if ((date=(String)returnHash.get("webdb_create"))!=null)
+                       returnHash.put("webdb_create_formatted", StringUtil.dateToReadableDate(date));
+               if ((date=(String)returnHash.get("webdb_lastchange"))!=null)
+                       returnHash.put("webdb_lastchange_formatted", StringUtil.dateToReadableDate(date));
+               return returnHash;
+       }
+
+       /**
+        * overridden method setValues to patch creator_main_url
+        */
+       public void setValues(HashMap theStringValues) {
+               if (theStringValues != null) {
+                       if (theStringValues.containsKey("creator_main_url")){
+                               if (((String)theStringValues.get("creator_main_url")).equalsIgnoreCase("http://")){
+                                       theStringValues.remove("creator_main_url");
+        } else if (!((String)theStringValues.get("creator_main_url")).startsWith("http://")){
+          theStringValues.put("creator_main_url","http://"+((String)theStringValues.get("creator_main_url")));
+        }
+      }
+               }
+               super.setValues(theStringValues);
+       }
+
+       /**
+        * return the content_data as string
+        * is obsolete, because content_data is now sql-type text
+
+  public String getContentData()
+       {
+               Connection con=null;Statement stmt=null;
+               byte[] content_data=null;
+
+               try {
+                       con = theStorageObject.getPooledCon();
+                       con.setAutoCommit(false);
+                       stmt = con.createStatement();
+                       ResultSet rs = theStorageObject.executeSql(stmt,"select content_data from content where id="+getId());
+                       if(rs!=null) {
+                               if (rs.next()) {
+                                        content_data = rs.getBytes(1);
+                               }
+                               rs.close();
+                       }
+               }
+               catch (Exception e) {theLog.printError("EntityContent :: getContent failed! "+e.toString());}
+               finally {
+                       try {con.setAutoCommit(true); } catch (Exception e) {;}
+                       theStorageObject.freeConnection(con,stmt); }
+
+               return StringUtil.encodeHtml(StringUtil.unquote( new  String(content_data) ));
+       }
+*/
+
+       /**
+        * fetches all the comments belonging to an article
+        *
+        * @return freemarker.template.SimpleList
+        */
+       public SimpleList getComments() {
+               return ((DatabaseContent)theStorageObject).getComments(this);
+       }
+
+
+}
diff --git a/source/mircoders/entity/EntityFeature.java b/source/mircoders/entity/EntityFeature.java
new file mode 100755 (executable)
index 0000000..5f85c9f
--- /dev/null
@@ -0,0 +1,47 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 29.6.1999
+ */
+
+
+public class EntityFeature extends AbstractEntity implements Entity
+{
+               private static int instances;
+
+
+               public EntityFeature()
+               {
+       super();
+                               instances++;
+               }
+
+               public EntityFeature(StorageObject theStorage) {
+                       this();
+       setStorage(theStorage);
+               }
+
+       public void update() throws StorageObjectException{
+               super.update();
+               DatabaseContent dbContent = DatabaseContent.getInstance();
+               dbContent.setUnproduced("to_feature="+getId());
+       }
+
+  public void finalize() {
+         instances--;
+    super.finalize();
+  }
+}
diff --git a/source/mircoders/entity/EntityGruppen.java b/source/mircoders/entity/EntityGruppen.java
new file mode 100755 (executable)
index 0000000..7c0a217
--- /dev/null
@@ -0,0 +1,47 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 29.6.1999
+ */
+
+
+public class EntityGruppen extends AbstractEntity implements Entity
+{
+    private static int instances;
+
+    public EntityGruppen()
+    {
+       super();
+        instances++;
+    }
+
+    public EntityGruppen(StorageObject theStorage) {
+      this();
+      setStorage(theStorage);
+    }
+
+  public void update() throws StorageObjectException{
+    super.update();
+    DatabaseContent dbContent = DatabaseContent.getInstance();
+    dbContent.setUnproduced("urheber_id="+getId());
+  }
+
+  public void finalize() {
+         instances--;
+    super.finalize();
+  }
+}
diff --git a/source/mircoders/entity/EntityImage.java b/source/mircoders/entity/EntityImage.java
new file mode 100755 (executable)
index 0000000..6ab1a8f
--- /dev/null
@@ -0,0 +1,155 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 11.11.2000
+ */
+
+
+public class EntityImage extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityImage()
+       {
+               super();
+               instances++;
+       }
+
+       public EntityImage(StorageObject theStorage) {
+               this();
+               setStorage(theStorage);
+       }
+
+       //
+       // methods
+
+
+
+       public byte[] getImage()
+       {
+               theLog.printDebugInfo("--getimage started");
+               Connection con=null;Statement stmt=null;
+               byte[] img_data=null;
+
+               try {
+                       con = theStorageObject.getPooledCon();
+                       con.setAutoCommit(false);
+                       stmt = con.createStatement();
+                       ResultSet rs = theStorageObject.executeSql(stmt,"select image_data from images where id="+getId());
+                       if(rs!=null) {
+                               if (rs.next()) {
+                                        img_data = rs.getBytes(1);
+                               }
+                               rs.close();
+                       }
+               }
+               catch (Exception e) {theLog.printDebugInfo("-- getImage gescheitert: "+e.toString());}
+               finally {
+                       try {con.setAutoCommit(true); } catch (Exception e) {;}
+                       theStorageObject.freeConnection(con,stmt); }
+
+               return img_data;
+       }
+
+       public void setImage(byte[] uploadData, int imageType)
+       {
+               if (uploadData!=null) {
+                       Connection con=null;PreparedStatement pstmt=null;
+                       try {
+
+                               theLog.printDebugInfo("settimage :: making internal representation of image");
+                               WebdbImage webdbImage= new WebdbImage(uploadData,imageType);
+                               theLog.printDebugInfo("settimage :: made internal representation of image");
+                               byte[] imageData = webdbImage.getImage();
+                               theLog.printDebugInfo("settimage :: getImage");
+                               byte[] iconData = webdbImage.getIcon();
+                               theLog.printDebugInfo("settimage :: getIcon");
+
+                               if (iconData!=null && imageData!=null) {
+                                       con = theStorageObject.getPooledCon();
+                                       con.setAutoCommit(false);
+                                       theLog.printDebugInfo("settimage :: trying to insert image");
+
+                                       // setting values
+                                       String sql = "update images set img_height='"+webdbImage.getImageHeight() +
+                                               "',img_width='"   + webdbImage.getImageWidth() +
+                                               "',icon_height='" + webdbImage.getIconHeight() +
+                                               "',icon_width='"  + webdbImage.getIconWidth()  +  "', image_data=?, icon_data=? where id="+getId();
+                                       theLog.printDebugInfo("settimage :: updating sizes: "+ sql);
+                                       pstmt = con.prepareStatement(sql);
+                                       pstmt.setBytes(1, imageData);
+                                       pstmt.setBytes(2, iconData);
+                                       pstmt.executeUpdate();
+                                       sql="update content set is_produced='0' where to_media="+getId();
+                                       pstmt = con.prepareStatement(sql);
+                                       pstmt.executeUpdate();
+                               }
+                       }
+                       catch (Exception e) {theLog.printDebugInfo("settimage :: setImage gescheitert: "+e.toString());}
+                       finally {
+                               try {con.setAutoCommit(true); } catch (Exception e) {;}
+                               theStorageObject.freeConnection(con,pstmt); }
+               }
+       }
+
+       public void update() throws StorageObjectException {
+               super.update();
+               try {
+                       theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
+               } catch (SQLException e) {
+                       theLog.printError("EntityImage :: update :: failed!! "+ e.toString());
+               }
+       }
+
+       public void setValues(HashMap theStringValues)
+       {
+               if (theStringValues != null) {
+                       if (!theStringValues.containsKey("is_published"))
+                        theStringValues.put("is_published","0");
+               }
+               super.setValues(theStringValues);
+       }
+
+       public byte[] getIcon()
+       {
+               Connection con=null;Statement stmt=null;
+               byte[] img_data=null;
+
+               try {
+                       con = theStorageObject.getPooledCon();
+                       con.setAutoCommit(false);
+                       stmt = con.createStatement();
+                       ResultSet rs = theStorageObject.executeSql(stmt,"select icon_data from images where id="+getId());
+                       if(rs!=null) {
+                               if (rs.next()) {
+                                        img_data = rs.getBytes(1);
+                               }
+                               rs.close();
+                       }
+               }
+               catch (Exception e) {theLog.printDebugInfo("-- getIcon gescheitert: "+e.toString());}
+               finally {
+                       try {con.setAutoCommit(true); } catch (Exception e) {;}
+                       theStorageObject.freeConnection(con,stmt); }
+
+               return img_data;
+       }
+
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityImageColor.java b/source/mircoders/entity/EntityImageColor.java
new file mode 100755 (executable)
index 0000000..0f42e8c
--- /dev/null
@@ -0,0 +1,32 @@
+package mircoders.entity;
+
+/**
+ * Title: EntityImageColor
+ * Description: Maps table "img_color" to Java Object
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia.de
+ * @author /rk
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+public class EntityImageColor extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityImageColor() {     super(); instances++;   }
+       public EntityImageColor(StorageObject theStorage) {     this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityImageFormat.java b/source/mircoders/entity/EntityImageFormat.java
new file mode 100755 (executable)
index 0000000..7e2b3bc
--- /dev/null
@@ -0,0 +1,31 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 15.01.2001
+ */
+
+
+public class EntityImageFormat extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityImageFormat() {    super(); instances++;   }
+       public EntityImageFormat(StorageObject theStorage) {    this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityImageLayout.java b/source/mircoders/entity/EntityImageLayout.java
new file mode 100755 (executable)
index 0000000..f67591c
--- /dev/null
@@ -0,0 +1,31 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 15.01.2001
+ */
+
+
+public class EntityImageLayout extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityImageLayout() {    super(); instances++;   }
+       public EntityImageLayout(StorageObject theStorage) {    this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityImageType.java b/source/mircoders/entity/EntityImageType.java
new file mode 100755 (executable)
index 0000000..d86e654
--- /dev/null
@@ -0,0 +1,31 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 15.01.2001
+ */
+
+
+public class EntityImageType extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityImageType() {      super(); instances++;   }
+       public EntityImageType(StorageObject theStorage) {      this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityLanguage.java b/source/mircoders/entity/EntityLanguage.java
new file mode 100755 (executable)
index 0000000..a34ef2a
--- /dev/null
@@ -0,0 +1,32 @@
+package mircoders.entity;
+
+/**
+ * Title: EntityLanguage
+ * Description: Maps table "language" to Java Object
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia.de
+ * @author /rk
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+public class EntityLanguage extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityLanguage() {       super(); instances++;   }
+       public EntityLanguage(StorageObject theStorage) {       this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityMediafolder.java b/source/mircoders/entity/EntityMediafolder.java
new file mode 100755 (executable)
index 0000000..53a747b
--- /dev/null
@@ -0,0 +1,50 @@
+package mircoders.entity;
+
+/**
+ * Title:        Mir
+ * Description:  Ihre Beschreibung
+ * Copyright:    Copyright (c) 1999
+ * Company:
+ * @author
+ * @version
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 29.6.1999
+ */
+
+
+public class EntityMediafolder extends AbstractEntity implements Entity
+{
+               private static int instances;
+
+               public EntityMediafolder()
+               {
+       super();
+                               instances++;
+               }
+
+               public EntityMediafolder(StorageObject theStorage) {
+                       this();
+                       setStorage(theStorage);
+               }
+
+               public void finalize() {
+      instances--;
+      super.finalize();
+    }
+}
diff --git a/source/mircoders/entity/EntityMessage.java b/source/mircoders/entity/EntityMessage.java
new file mode 100755 (executable)
index 0000000..a2c96e5
--- /dev/null
@@ -0,0 +1,32 @@
+package mircoders.entity;
+
+/**
+ * Title: EntityMessages
+ * Description: Maps table "messages" to Java Object
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia.de
+ * @author /rk
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+public class EntityMessage extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityMessage() {        super(); instances++;   }
+       public EntityMessage(StorageObject theStorage) {        this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityRights.java b/source/mircoders/entity/EntityRights.java
new file mode 100755 (executable)
index 0000000..7cae200
--- /dev/null
@@ -0,0 +1,31 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 15.01.2001
+ */
+
+
+public class EntityRights extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityRights() { super(); instances++;   }
+       public EntityRights(StorageObject theStorage) { this(); setStorage(theStorage); }
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+}
diff --git a/source/mircoders/entity/EntityTopics.java b/source/mircoders/entity/EntityTopics.java
new file mode 100755 (executable)
index 0000000..0a736b3
--- /dev/null
@@ -0,0 +1,47 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.storage.*;
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 29.6.1999
+ */
+
+
+public class EntityTopics extends AbstractEntity implements Entity
+{
+  private static int instances;
+
+  public EntityTopics(){
+         super();
+    instances++;
+  }
+
+  public EntityTopics(StorageObject theStorage)
+  {
+    this();
+    setStorage(theStorage);
+  }
+
+  // Dependencies einhalten
+  public void update() throws StorageObjectException{
+    super.update();
+    DatabaseContent dbContent = DatabaseContent.getInstance();
+    dbContent.setUnproduced("to_topic="+getId());
+  }
+
+  public void finalize() {
+    instances--;
+    super.finalize();
+  }
+}
diff --git a/source/mircoders/entity/EntityUsers.java b/source/mircoders/entity/EntityUsers.java
new file mode 100755 (executable)
index 0000000..8e9459b
--- /dev/null
@@ -0,0 +1,49 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * This class is objectmapping of database webdb_users
+ *
+ * @author RK
+ * @version 11.11.2000
+ */
+
+
+public class EntityUsers extends AbstractEntity implements Entity
+{
+               private static int instances;
+
+               public EntityUsers()
+               {
+                       super();
+                               instances++;
+               }
+
+               public EntityUsers(StorageObject theStorage) {
+                       this();
+                       setStorage(theStorage);
+               }
+
+       public void finalize() {
+    instances--;
+    super.finalize();
+  }
+
+       // Methods
+
+       public boolean isAdmin()
+       {
+               String admin=getValue("is_admin");
+               //theLog.printDebugInfo("admin::::"+admin);
+               return (admin!=null&&admin.equals("1"))?true:false;
+       }
+
+}
diff --git a/source/mircoders/entity/EntityVideo.java b/source/mircoders/entity/EntityVideo.java
new file mode 100755 (executable)
index 0000000..802fc8f
--- /dev/null
@@ -0,0 +1,115 @@
+package mircoders.entity;
+
+import java.lang.*;
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+/**
+ * Diese Klasse enthält die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 11.11.2000
+ */
+
+
+public class EntityVideo extends AbstractEntity implements Entity
+{
+       private static int instances;
+
+       public EntityVideo()
+       {
+               super();
+               instances++;
+       }
+
+       public EntityVideo(StorageObject theStorage) {
+               this();
+               setStorage(theStorage);
+       }
+
+       //
+       // methods
+
+       public byte[] getVideoData()
+       {
+
+               Connection con=null;Statement stmt=null;
+               byte[] video_data=null;
+
+               try {
+                       con = theStorageObject.getPooledCon();
+                       con.setAutoCommit(false);
+                       stmt = con.createStatement();
+                       ResultSet rs = theStorageObject.executeSql(stmt,"select video_data from video where id="+getId());
+                       if(rs!=null) {
+                               if (rs.next()) {
+                                        video_data = rs.getBytes(1);
+                               }
+                               rs.close();
+                       }
+               }
+               catch (Exception e) {theLog.printDebugInfo("-- getImage gescheitert: "+e.toString());}
+               finally {
+                       try {con.setAutoCommit(true); } catch (Exception e) {;}
+                       theStorageObject.freeConnection(con,stmt); }
+
+               return video_data;
+       }
+
+       public void setVideoData(byte[] uploadData)
+       {
+               if (uploadData!=null) {
+                       Connection con=null;PreparedStatement pstmt=null;
+                       try {
+
+                               con = theStorageObject.getPooledCon();
+                               con.setAutoCommit(false);
+                               theLog.printDebugInfo("setvideo :: trying to insert video");
+
+                               // setting values
+                               String sql = "update videos set image_data=? where id="+getId();
+                               theLog.printDebugInfo("setvideo: "+ sql);
+                               pstmt = con.prepareStatement(sql);
+                               pstmt.setBytes(1, uploadData);
+                               pstmt.executeUpdate();
+                               sql="update content set is_produced='0' where to_media="+getId();
+                               pstmt = con.prepareStatement(sql);
+                               pstmt.executeUpdate();
+                       }
+                       catch (Exception e) {theLog.printDebugInfo("setvideo :: setvideo gescheitert: "+e.toString());}
+                       finally {
+                               try {con.setAutoCommit(true); } catch (Exception e) {;}
+                               theStorageObject.freeConnection(con,pstmt); }
+               }
+       }
+
+       public void update() throws StorageObjectException {
+               super.update();
+               try {
+                       theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
+               } catch (SQLException e) {
+                       theLog.printError("video :: update :: failed!! "+ e.toString());
+               }
+       }
+
+       public void setValues(HashMap theStringValues)
+       {
+               if (theStringValues != null) {
+                       if (!theStringValues.containsKey("is_published"))
+                        theStringValues.put("is_published","0");
+               }
+               super.setValues(theStringValues);
+       }
+
+
+       public void finalize() {
+               instances--;
+               super.finalize();
+       }
+
+}
diff --git a/source/mircoders/input/XmlFilenameFilter.java b/source/mircoders/input/XmlFilenameFilter.java
new file mode 100755 (executable)
index 0000000..9c0a9db
--- /dev/null
@@ -0,0 +1,38 @@
+package mircoders.input;
+
+import  java.io.FilenameFilter;
+import  java.io.File;
+
+
+/**
+ * Title:        Indy-Prodsystem
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      indymedia.de
+ * @author idfx
+ * @version 1.0
+ */
+public class XmlFilenameFilter
+    implements FilenameFilter {
+
+  /**
+   * put your documentation comment here
+   */
+  public XmlFilenameFilter () {
+  }
+
+  /**
+   * @param dir
+   * @param name
+   * @return
+   */
+  public boolean accept (File dir, String name) {
+    if (name.endsWith(".xml")) {
+      return  true;
+    }
+    return  false;
+  }
+}
+
+
+
diff --git a/source/mircoders/input/XmlHandler.java b/source/mircoders/input/XmlHandler.java
new file mode 100755 (executable)
index 0000000..8297e89
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * Title:        Indy
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      indymedia.de
+ * @author idfx
+ * @version 1.0
+ *
+ * formatted with JxBeauty (c) johann.langhofer@nextra.at
+ */
+
+
+package mircoders.input;
+
+import  org.xml.sax.helpers.DefaultHandler;
+import  org.xml.sax.Attributes;
+import  java.util.HashMap;
+
+
+/**
+ * put your documentation comment here
+ */
+public class XmlHandler extends DefaultHandler {
+  static HashMap valueHash = new HashMap();
+
+  /**
+   * parses every starting XML-Element
+   * @param uri
+   * @param name
+   * @param qname
+   * @param atts
+   */
+  public void startElement (String uri, String name, String qname, Attributes atts) {
+    HashMap values = new HashMap();
+    if (name.equals("content")) {
+      //table content
+      valueHash.put("table", "Content");
+      valueHash.put("values", values);
+      // content-articles should be published immediatly
+      ((HashMap)valueHash.get("values")).put("is_published", "1");
+    }
+    else if (name.equals("breaking")) {
+      //table content
+      valueHash.put("table", "Breaking");
+      valueHash.put("values", values);
+    }
+    else {
+      //System.out.println(name + ": " + atts.getValue("value"));
+      ((HashMap)valueHash.get("values")).put(name, atts.getValue("value"));
+    }
+  }
+
+  /**
+   * Returns the HashMap filled with the Values of the parsed XML-File
+   * @return
+   */
+  public static HashMap returnHash () {
+    return  valueHash;
+  }
+}
+
+
+
diff --git a/source/mircoders/input/XmlInputParser.java b/source/mircoders/input/XmlInputParser.java
new file mode 100755 (executable)
index 0000000..f27902d
--- /dev/null
@@ -0,0 +1,189 @@
+/**
+ * Title:        Indy
+ * Description:  Parses Xml-Files into the Database
+ * Copyright:    Copyright (c) 2001
+ * Company:      indymedia.de
+ * @author idfx
+ * @version 1.0
+ *
+ * formatted with JxBeauty (c) johann.langhofer@nextra.at
+ */
+
+
+package mircoders.input;
+
+import  java.io.*;
+import  java.util.*;
+import  java.lang.reflect.*;
+import  webdb.misc.*;
+import  webdb.storage.*;
+import  webdb.module.*;
+import  mir.storage.*;
+import  mir.module.*;
+import  org.xml.sax.*;
+import  org.xml.sax.helpers.*;
+import  com.icl.saxon.aelfred.*;
+
+
+/**
+ * put your documentation comment here
+ */
+public class XmlInputParser {
+  static Logfile logger;
+
+  /**
+   * the main-method
+   * a DirectoryName should be given
+   */
+  public static void main (String[] args) {
+    //logging
+    File logDir = new File(args[0] + "LOG");
+    if (!logDir.exists()) {
+      logDir.mkdir();
+    }
+    logger = Logfile.getInstance(args[0] + "LOG/xml.log");
+    XmlInputParser xmlInputParser = new XmlInputParser();
+    //get the config-file
+    Configuration.initConfig("config");
+    //parse the xml-files in the given directory
+    xmlInputParser.parse(args[0]);
+    // stop freemarker templateCache (cracy)
+    HTMLTemplateProcessor.stopAutoUpdate();
+    //stop it
+    System.exit(0);
+  }
+
+  /**
+   * this method parses the xml-file an
+   * returns 0 if succesful
+   * returns -1 if failed
+   */
+  private boolean loadXml (String fileName) {
+    try {
+      XMLReader reader = new SAXDriver();
+      InputSource is = new InputSource(new FileInputStream(fileName));
+      reader.setContentHandler(new XmlHandler());
+      reader.parse(is);
+    } catch (IOException ex) {
+      logger.printError(ex.toString());
+      return  false;
+    } catch (SAXException ex) {
+      logger.printError(ex.toString());
+      return  false;
+    }
+    return  true;
+  }
+
+  /**
+   * Reads all XML-Files in the given Directory
+   * and returns a String[] with the filenames
+   * @param dir
+   * @return
+   */
+  public String[] readDir (String dir) {
+    File file = new File(dir);
+    String[] fileNames = file.list(new XmlFilenameFilter());
+    return  fileNames;
+  }
+
+  /**
+   * parses the XML-Files in the given Directory
+   * @param dir
+   */
+  public void parse (String dir) {
+    File goodDir = new File(dir + "/GOOD");
+    File badDir = new File(dir + "/BAD");
+    boolean result = false;
+    //read the directory
+    String[] fileNames = readDir(dir);
+    for (int i = 0; i < fileNames.length; i++) {
+      //parse every file
+      result = loadXml(dir + "/" + fileNames[i]);
+      if (result == true) {                     //if succesfully parsed
+        HashMap hash = XmlHandler.returnHash();
+        HashMap val = (HashMap)hash.get("values");
+        //set the default user
+        val.put("to_publisher", "5");
+        String table = (String)hash.get("table");
+        AbstractModule moduleInstance = null;
+        try {
+          Class databaseClass = Class.forName("mir.storage.Database" +
+              table);
+          Method m = databaseClass.getMethod("getInstance", null);
+          Database databaseInstance = (Database)m.invoke(null, null);
+          moduleInstance = (AbstractModule)Class.forName("mir.module.Module"
+              + table).newInstance();
+          //AbstractModule moduleInstance = new ModuleContent(databaseInstance);
+          moduleInstance.setStorage(databaseInstance);
+        } catch (Exception e) {
+          //logger.printError(e.toString());
+          result = false;
+        }
+        result = insert(val, moduleInstance);
+      }
+      if (result == false) {                    //if error
+        File file = new File(dir + "/" + fileNames[i]);
+        if (!badDir.exists()) {                 //exits Bad-Dir?
+          badDir.mkdir();
+        }
+        if (!file.renameTo(new File(dir + "/BAD/" + fileNames[i]))) {
+          logger.printError("Failed move to BAD: " + fileNames[i]);
+        }
+      }
+      else {                    //end if(result == false)
+        File file = new File(dir + "/" + fileNames[i]);
+        if (!goodDir.exists()) {                //exists Good-Dir?
+          goodDir.mkdir();
+        }
+        if (!file.renameTo(new File(dir + "/GOOD/" + fileNames[i]))) {
+          logger.printError("Failed move to GOOD: " + fileNames[i]);
+        }
+        logger.printInfo("Successfully parsed: " + fileNames[i]);
+      }         //end else (result == true)
+    }           //end for
+  }             //end parse
+
+  /**
+   *   Holt die Felder aus der Metadatenfelderliste des StorageObjects, die
+   *   im HttpRequest vorkommen und liefert sie als HashMap zurueck
+   *   @return HashMap
+   */
+  public HashMap getIntersectingValues (HashMap values, StorageObject theStorage) {
+    ArrayList theFieldList;
+    try {
+      theFieldList = theStorage.getFields();
+    } catch (StorageObjectException e) {
+      logger.printError("Failed: " + e.toString());
+      return  null;
+    }
+    HashMap withValues = new HashMap();
+    String aField, aValue;
+    for (int i = 0; i < theFieldList.size(); i++) {
+      aField = (String)theFieldList.get(i);
+      aValue = (String)values.get(aField);
+      if (aValue != null)
+        withValues.put(aField, aValue);
+    }
+    return  withValues;
+  }
+
+  /**
+   * Inserts a hash with values in a table
+   * @param values
+   * @param module
+   * @return
+   */
+  public boolean insert (HashMap values, AbstractModule module) {
+    try {
+      HashMap withValues = getIntersectingValues(values, module.getStorageObject());
+      module.add(withValues);
+    } catch (Exception e) {
+      logger.printError("Failed to insert: " + e.toString());
+      return  false;
+    }
+    return  true;
+  }
+}
+
+
+
diff --git a/source/mircoders/module/ModuleBreaking.java b/source/mircoders/module/ModuleBreaking.java
new file mode 100755 (executable)
index 0000000..231b885
--- /dev/null
@@ -0,0 +1,47 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+
+/*
+ *  ContentObjekt -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleBreaking extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleBreaking (StorageObject theStorage)
+       {
+
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Breaking.Logfile"));
+               if (theStorage == null) theLog.printWarning("ModuleBreaking -- StorageObject was null!");
+
+               this.theStorage = theStorage;
+
+       }
+
+       // Methoden
+
+}
diff --git a/source/mircoders/module/ModuleComment.java b/source/mircoders/module/ModuleComment.java
new file mode 100755 (executable)
index 0000000..e8173f7
--- /dev/null
@@ -0,0 +1,44 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+
+/*
+ *  ModuleComment - methods and access for comments
+ *
+ * @author RK
+ */
+
+public class ModuleComment extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Contructor
+       public ModuleComment(StorageObject theStorage)
+       {
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Comment.Logfile"));
+               if (theStorage == null) theLog.printWarning("StorageObject was null!");
+               this.theStorage = theStorage;
+       }
+
+       // Methoden
+       public SimpleList getCommentAsSimpleList() {
+               return ((DatabaseComment)theStorage).getPopupData();
+       }
+}
diff --git a/source/mircoders/module/ModuleContent.java b/source/mircoders/module/ModuleContent.java
new file mode 100755 (executable)
index 0000000..b2b1647
--- /dev/null
@@ -0,0 +1,178 @@
+package mircoders.module;
+
+import java.io.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+
+/*
+ *  ContentObjekt -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleContent extends AbstractModule
+{
+       static Logfile     theLog;
+
+       public ModuleContent() {
+               super();
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Content.Logfile"));
+       }
+
+       public ModuleContent(StorageObject theStorage) {
+               this.theStorage = theStorage;
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Content.Logfile"));
+       }
+
+       //
+       // methoden, um an ContentEntities zu kommen
+
+
+       public EntityList getContent(HashMap searchValues, boolean concat, int offset, EntityUsers user)
+               throws ModuleException {
+
+               try {
+
+                       String whereClause ="", aField, aValue;
+                       boolean first = true;
+
+                       Set set = searchValues.keySet();
+                       Iterator it = set.iterator();
+                                               for (int i=0;i<set.size();i++) {
+                       aField = (String)it.next();
+                       aValue = (String)searchValues.get(aField);
+
+                       if (first == false)
+                               whereClause +=  (concat) ? " and " : " or ";
+                       else
+                               first = false;
+
+                       whereClause += "(";
+
+                       // default: hier splitten der eintraege und verknupfung mit AND OR NOT
+                       StringTokenizer st = new StringTokenizer(aValue);
+                       boolean firstToken = true;
+                       while(st.hasMoreTokens()) {
+                               String notString = "";
+                               String tokenConcat = " OR ";
+                               String nextToken = st.nextToken();
+
+                               if (nextToken.startsWith("+")) {
+                                       nextToken = nextToken.substring(1);
+                                       tokenConcat = " AND ";
+                               }
+                               if (nextToken.startsWith("-")) {
+                                               nextToken = nextToken.substring(1);
+                                               tokenConcat = " AND ";
+                                               notString = " NOT ";
+                               }
+                               if (firstToken == true) {
+                                       tokenConcat = "";
+                                       firstToken = false;
+                               }
+
+
+                               whereClause += tokenConcat + aField + notString + " like '";
+                               whereClause += nextToken + "%'";
+                       }
+                       whereClause += ") ";
+                       }
+                       return theStorage.selectByWhereClause(whereClause, offset);
+       }
+       catch (StorageObjectException e){
+                       throw new ModuleException(e.toString());
+       }
+
+               }
+
+       public EntityList getContentByField(String aField, String aValue, String orderBy, int offset,
+                               EntityUsers user) throws ModuleException
+       {
+               String whereClause = "lower("+aField + ") like lower('%" + StringUtil.quote(aValue) + "%')";
+               return getContent(whereClause, orderBy, offset, user);
+       }
+
+       public EntityList getContent(String whereClause, String orderBy, int offset, int limit, EntityGruppen user)
+               throws ModuleException {
+
+               try {
+                       if (user!=null){
+                       //theLog.printInfo("user!=null admin: "+ user.getValue("admin"));
+                               if (user.getValue("is_admin").equals("0"))
+                                       whereClause += " and to_publisher='" + user.getId()+"'";
+                               }
+                               return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
+                       }
+               catch (StorageObjectException e){       throw new ModuleException(e.toString()); }
+       }
+
+       public EntityList getContent(String whereClause, String orderBy,int offset, int limit)
+               throws ModuleException {
+               try {
+                       return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
+               } catch (StorageObjectException e){
+                       throw new ModuleException(e.toString());
+               }
+       }
+
+       public EntityList getContent(String whereClause, String orderBy, int offset, EntityUsers user)
+               throws ModuleException
+       {
+               try {
+                       if (whereClause !=null) {
+
+                               // for the different article_types
+                               if(whereClause.equals("newswire")) {
+                                       whereClause="is_published='1' and to_article_type='1'";
+                                       orderBy = "webdb_create desc";
+                               }
+                               if(whereClause.equals("feature")) {
+                                       whereClause="is_published='1' and to_article_type='2'";
+                                       orderBy = "webdb_create desc";
+                               }
+                               if(whereClause.equals("themenspecial")) {
+                                       whereClause="is_published='1' and to_article_type='3'";
+                                       orderBy = "webdb_create desc";
+                               }
+                               if(whereClause.equals("special")) {
+                                       whereClause="is_published='1' and to_article_type='4'";
+                                       orderBy = "webdb_create desc";
+                               }
+
+                               if(whereClause.equals("comments")) {
+                                       whereClause="not (comment is null or comment like '')";
+                                       orderBy = "webdb_lastchange desc";
+                               }
+
+                               if(whereClause.equals("nfrei")) {
+                                       whereClause="is_published='0'"; orderBy="date desc";
+                               }
+
+                               if(whereClause.equals("lastchange")) {
+                                       whereClause=""; orderBy="webdb_lastchange desc";
+                               }
+
+                               if(whereClause.equals("media")) {
+                                       whereClause="to_media > 0"; orderBy="webdb_lastchange desc";
+                               }
+                       }
+                       return theStorage.selectByWhereClause(whereClause, orderBy, offset);
+               }
+               catch (StorageObjectException e){       throw new ModuleException(e.toString()); }
+       }
+
+
+}
+
+
diff --git a/source/mircoders/module/ModuleFeature.java b/source/mircoders/module/ModuleFeature.java
new file mode 100755 (executable)
index 0000000..0532a7c
--- /dev/null
@@ -0,0 +1,45 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+/*
+ *  SchwerpunktObjekt -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleFeature extends AbstractModule
+{
+               static Logfile theLog;
+
+               public ModuleFeature(StorageObject theStorage) {
+
+                       this.theStorage = theStorage;
+
+       if (theLog == null)
+       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Feature.Logfile"));
+
+               }
+
+               public SimpleList getSchwerpunktAsSimpleList() {
+                       return ((DatabaseFeature)theStorage).getPopupData();
+               }
+}
+
+
diff --git a/source/mircoders/module/ModuleGruppen.java b/source/mircoders/module/ModuleGruppen.java
new file mode 100755 (executable)
index 0000000..fbf0e98
--- /dev/null
@@ -0,0 +1,64 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+
+/*
+ *  ContentObjekt -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleGruppen extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleGruppen(StorageObject theStorage)
+       {
+
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Gruppen.Logfile"));
+               if (theStorage == null) theLog.printWarning("StorageObject was null!");
+
+               this.theStorage = theStorage;
+
+       }
+
+       // Methoden
+
+               public EntityList getGruppen(String whereClause, int offset, int limit)
+       throws ModuleException
+               {
+       //theLog.printDebugInfo("Module.get (wc,offset, limit)" +
+                               //                        whereClause + " offset: " + offset + " limit: " + limit);
+       try {
+                       return theStorage.selectByWhereClause(whereClause, null, offset, limit);
+       }
+       catch (StorageObjectException e){
+                       throw new ModuleException(e.toString());
+       }
+               }
+
+
+       public SimpleList getGruppenAsSimpleList() {
+               return ((DatabaseGroups)theStorage).getPopupData();
+       }
+}
diff --git a/source/mircoders/module/ModuleImages.java b/source/mircoders/module/ModuleImages.java
new file mode 100755 (executable)
index 0000000..5910da8
--- /dev/null
@@ -0,0 +1,42 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+public class ModuleImages extends AbstractModule {
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleImages(StorageObject theStorage) {
+
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home")+Configuration.getProperty("Module.Bilder.Logfile"));
+               if (theStorage == null) theLog.printWarning("StorageObject was null!");
+               this.theStorage = theStorage;
+
+       }
+
+       // Methoden
+
+               public SimpleList getBilderAsSimpleList() {
+
+               //  String sql = "select id, name from Bilder order by name";
+                       return ((DatabaseImages)theStorage).getPopupData();
+               }
+
+}
diff --git a/source/mircoders/module/ModuleMediafolder.java b/source/mircoders/module/ModuleMediafolder.java
new file mode 100755 (executable)
index 0000000..28420d2
--- /dev/null
@@ -0,0 +1,51 @@
+package mircoders.module;
+
+/**
+ * Title:        Mir
+ * Description:  Ihre Beschreibung
+ * Copyright:    Copyright (c) 1999
+ * Company:
+ * @author
+ * @version
+ */
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+
+public class ModuleMediafolder extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleMediafolder(StorageObject theStorage)
+       {
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Mediafolder.Logfile"));
+               if (theStorage == null) theLog.printWarning("StorageObject was null!");
+               this.theStorage = theStorage;
+       }
+
+       // Methoden
+
+               public SimpleList getPopupData() {
+                       return ((DatabaseMediafolder)theStorage).getPopupData();
+               }
+
+
+}
diff --git a/source/mircoders/module/ModuleMessage.java b/source/mircoders/module/ModuleMessage.java
new file mode 100755 (executable)
index 0000000..223f05f
--- /dev/null
@@ -0,0 +1,49 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+/**
+ * Title: ModuleMessage
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+
+public class ModuleMessage extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleMessage (StorageObject theStorage)
+       {
+
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Messages.Logfile"));
+               if (theStorage == null) theLog.printWarning("ModuleMessage -- StorageObject was null!");
+
+               this.theStorage = theStorage;
+
+       }
+
+       // Methoden
+
+}
diff --git a/source/mircoders/module/ModuleSchwerpunkt.java b/source/mircoders/module/ModuleSchwerpunkt.java
new file mode 100755 (executable)
index 0000000..4f2330d
--- /dev/null
@@ -0,0 +1,45 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+/*
+ *  SchwerpunktObjekt -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleSchwerpunkt extends AbstractModule
+{
+               static Logfile theLog;
+
+               public ModuleSchwerpunkt(StorageObject theStorage) {
+
+                       this.theStorage = theStorage;
+
+       if (theLog == null)
+       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Schwerpunkt.Logfile"));
+
+               }
+
+               public SimpleList getSchwerpunktAsSimpleList() {
+                       return ((DatabaseFeature)theStorage).getPopupData();
+               }
+}
+
+
diff --git a/source/mircoders/module/ModuleTopics.java b/source/mircoders/module/ModuleTopics.java
new file mode 100755 (executable)
index 0000000..837c2e4
--- /dev/null
@@ -0,0 +1,43 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+/*
+ *  ThemenModule -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleTopics extends AbstractModule
+{
+
+    static Logfile theLog;
+
+    public ModuleTopics(StorageObject theStorage) {
+           this.theStorage = theStorage;
+           if (theLog == null)
+             theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Themen.Logfile"));
+    }
+
+    public SimpleList getTopicsAsSimpleList() {
+           return ((DatabaseTopics)theStorage).getPopupData();
+    }
+
+}
diff --git a/source/mircoders/module/ModuleUsers.java b/source/mircoders/module/ModuleUsers.java
new file mode 100755 (executable)
index 0000000..9ef8a13
--- /dev/null
@@ -0,0 +1,75 @@
+package mircoders.module;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.entity.*;
+import webdb.misc.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+
+
+/*
+ *  Users Module -
+ *
+ *
+ * @author RK
+ */
+
+public class ModuleUsers extends AbstractModule
+{
+       static Logfile theLog;
+
+       // Kontruktor
+
+       public ModuleUsers(StorageObject theStorage)
+       {
+
+               if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Users.Logfile"));
+               if (theStorage == null) theLog.printWarning("StorageObject was null!");
+               this.theStorage = theStorage;
+
+       }
+
+       /**
+        * login method
+        */
+
+       public EntityUsers getUserForLogin(String user, String password) throws ModuleException
+       {
+               String whereString = "login='" +user + "' and password='"+ password + "' and is_admin='1'";
+               EntityList userList = getByWhereClause(whereString, -1);
+               if (userList != null && userList.getCount()==1)
+                       return (EntityUsers)userList.elementAt(0);
+               else return null;
+       }
+
+
+
+       public EntityList getUsers(String whereClause, int offset, int limit)
+               throws ModuleException
+       {
+               try {
+                       return theStorage.selectByWhereClause(whereClause, null, offset, limit);
+               }
+               catch (StorageObjectException e){
+                       throw new ModuleException(e.toString());
+               }
+       }
+
+       public SimpleList getUsersAsSimpleList() {
+               //  String sql = "select id, name from Users order by name";
+               return ((DatabaseUsers)theStorage).getPopupData();
+       }
+
+}
diff --git a/source/mircoders/producer/DEADJOE b/source/mircoders/producer/DEADJOE
new file mode 100755 (executable)
index 0000000..2db3a25
--- /dev/null
@@ -0,0 +1,11 @@
+
+*** Modified files in JOE when it aborted on Mon Mar 26 17:47:33 2001
+*** JOE was aborted by signal 1
+
+*** File '(Unnamed)'
+s
+*** Modified files in JOE when it aborted on Mon Mar 26 19:01:32 2001
+*** JOE was aborted because the terminal closed
+
+*** File '(Unnamed)'
+../../../../templates/producer/openposting.template
diff --git a/source/mircoders/producer/Producer.java b/source/mircoders/producer/Producer.java
new file mode 100755 (executable)
index 0000000..d480796
--- /dev/null
@@ -0,0 +1,157 @@
+package mircoders.producer;
+
+import java.io.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+abstract public class Producer {
+
+       protected static String producerDocRoot = Configuration.getProperty("Producer.DocRoot");
+  protected static String producerStorageRoot = Configuration.getProperty("Producer.StorageRoot");
+       protected static String producerProductionHost = Configuration.getProperty("Producer.ProductionHost");
+       protected static String producerOpenAction = Configuration.getProperty("Producer.OpenAction");;
+       protected static Logfile theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Producer.Logfile"));
+       protected static ModuleTopics         topicsModule;
+       protected static ModuleSchwerpunkt    schwerpunktModule;
+       protected static ModuleFeature        featureModule;
+       protected static ModuleGruppen        gruppenModule;
+       protected static ModuleContent        contentModule;
+       protected static ModuleImages         imageModule;
+
+  static {
+               // init
+    try {
+                       contentModule = new ModuleContent(DatabaseContent.getInstance());
+                       gruppenModule = new ModuleGruppen(DatabaseGroups.getInstance());
+                       topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
+                       schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
+                       featureModule = new ModuleFeature(DatabaseFeature.getInstance());
+                       imageModule = new ModuleImages(DatabaseImages.getInstance());
+               } catch(StorageObjectException e) {;}
+  }
+
+       public void handle(PrintWriter htmlout, EntityUsers user)
+               throws StorageObjectException, ModuleException {
+               handle(htmlout,user,false,false);
+       }
+
+       abstract public void handle(PrintWriter htmlout, EntityUsers user, boolean forced, boolean sync)
+               throws StorageObjectException, ModuleException;
+
+//
+// Produktionsroutine
+
+       public boolean produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout) {
+               return _produce(template, filename, model, htmlout, false);
+       }
+
+       public boolean produce_compressed(String template, String filename, TemplateModelRoot model, PrintWriter htmlout) {
+               return _produce(template, filename, model, htmlout, true);
+       }
+
+       private boolean _produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout, boolean compressed) {
+               try {
+                       File f = new File(producerStorageRoot + filename);
+                       File dir = new File(f.getParent());
+                       dir.mkdirs();
+                       FileWriter outputFile = new FileWriter(f);
+                       PrintWriter outStream;
+                       if (compressed==true) {
+                               outStream = new LineFilterWriter(outputFile);
+                       } else {
+                               outStream = new PrintWriter(outputFile);
+                       }
+
+                       HTMLTemplateProcessor.process(template, model, outStream);
+                       outputFile.close();
+                       outStream.close();
+
+                       printHTML(htmlout, "Produced <a href=\"" + producerProductionHost+  filename + "\">" + filename + "</a>");
+                       //theLog.printInfo("Produced: " + producerStorageRoot + filename);
+      //theLog.printDebugInfo("free mem:" + java.lang.Runtime.getRuntime().freeMemory());
+      //theLog.printDebugInfo("total mem:" + java.lang.Runtime.getRuntime().totalMemory());
+                       return true;
+
+               } catch(IOException exception){
+                       logHTML(htmlout, "Producer: File konnte nicht zum schreiben geoeffnet werden: " + filename);
+                       return false;
+               } catch(HTMLParseException exception){
+                       logHTML(htmlout,"Producer: File konnte nicht hatemelisiert  werden: " + filename);
+                       return false;
+               }
+       }
+
+       public boolean produceFile(String filename, byte[] in, PrintWriter htmlout, boolean icon) {
+
+               boolean retVal = false;
+
+               if (in!=null) {
+                       try {
+        File f = null;
+        if(icon==false){
+          f = new File(filename);
+          theLog.printDebugInfo("image: " + filename);
+        } else {
+          f = new File(producerStorageRoot + filename);
+          theLog.printDebugInfo("icon: " + filename);
+        }
+                               File dir = new File(f.getParent());
+                               dir.mkdirs();
+
+                               FileOutputStream outStream;
+                               outStream = new FileOutputStream(f);
+                               outStream.write(in);
+                               outStream.close();
+                               retVal = true;
+                       } catch(IOException exception) {
+        logHTML(htmlout, "Producer: File could not be written: " + filename);
+      }
+               }
+               return retVal;
+       }
+
+
+
+       //
+       // filename routinen
+
+       public String indexFileNameForPageCount(int pc) {
+               return fileNameForPageCount("/index", pc);
+       }
+
+       public String fileNameForPageCount(String stub, int pc) {
+               String fileName = producerDocRoot + stub;
+               if (pc>1) {
+                       fileName+=pc;
+               }
+               fileName += ".html";
+               return fileName;
+       }
+
+       /**
+        * logging
+        */
+       public void logHTML(PrintWriter out, String s) {
+               _print(out, s, true);
+       }
+
+       public void printHTML(PrintWriter out, String s) {
+               _print(out, s, false);
+       }
+
+       private void _print(PrintWriter out, String s, boolean log) {
+               if (out != null) { out.println(s+"<br>");out.flush(); }
+               if (log == true) {
+                       theLog.printInfo(s);
+               }
+       }
+
+}
diff --git a/source/mircoders/producer/ProducerAll.java b/source/mircoders/producer/ProducerAll.java
new file mode 100755 (executable)
index 0000000..c12e706
--- /dev/null
@@ -0,0 +1,105 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+public class ProducerAll extends Producer{
+
+       private boolean rsync;
+
+       public static void main(String argv[])
+       {
+               try {   new ProducerAll().handle(new PrintWriter(System.out), null, false,false);       }
+               catch(Exception e) { System.err.println(e.toString()); }
+       }
+
+       // handle all
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
+               throws StorageObjectException, ModuleException {
+               printHTML(htmlout, "Producer.All: started");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               new ProducerImages().handle(htmlout, user, force,sync);
+               new ProducerStartPage().handle(htmlout, user, force,sync);
+               new ProducerContent().handle(htmlout, user, force,sync);
+               new ProducerOpenPosting().handle(htmlout, user, force,sync);
+               new ProducerTopics().handle(htmlout, user, force,sync);
+    new ProducerNavigation().handle(htmlout, user, force,sync);
+
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");
+
+               // do we have to rsync the site
+               if (sync==true){
+                       sessionConnectTime = 0;
+                       if (Helper.rsync()!=0){
+                               sessionConnectTime = new java.util.Date().getTime() - startTime;
+                               logHTML(htmlout, "Rsync failed: " + sessionConnectTime + " ms.");
+                       } else {
+                               sessionConnectTime = new java.util.Date().getTime() - startTime;
+                               logHTML(htmlout, "Rsync succeded: " + sessionConnectTime + " ms.");
+                       }
+               }
+       }
+
+       // handle all
+       public void handle2(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
+               throws StorageObjectException, ModuleException {
+               printHTML(htmlout, "Producer.All: started");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               EntityContent   currentContent;
+               HashMap         currentContentValues;
+
+               //get all new unproduced content-entities
+               String whereClause="is_produced='0' && to_article_type>0";
+               String orderBy="date desc";
+               EntityList entityList = contentModule.getContent(whereClause,orderBy,0,-1,null);
+
+               //get their values
+               while (entityList != null) {
+                       for(int i=0;i<entityList.size();i++) {
+                               currentContent = (EntityContent)entityList.elementAt(i);
+                               currentContentValues = currentContent.getValues();
+                               EntityList topicEntityList = DatabaseContentToTopics.getInstance().getTopics(currentContent);
+                               SimpleHash topicHash = HTMLTemplateProcessor.makeSimpleHash(topicEntityList);
+
+                               try {
+                                       //check if this content item is related to a topic
+                                       if(currentContent.getId().equals(topicHash.get("content_id"))){
+                                               // produce the ToicsList
+                                               new ProducerTopics().handle(htmlout, user, force,sync,topicHash.get("topic_id").toString());
+                                       }
+                               } catch (TemplateModelException e) {
+                                       logHTML(htmlout, e.toString());
+                               }
+                       }
+               }
+
+               new ProducerContent().handle(htmlout, user, force,sync);
+               new ProducerOpenPosting().handle(htmlout, user, force,sync);
+               new ProducerStartPage().handle(htmlout, user, force,sync);
+               new ProducerTopics().handle(htmlout, user, force,sync);
+
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms.");
+       }
+}
+
diff --git a/source/mircoders/producer/ProducerContent.java b/source/mircoders/producer/ProducerContent.java
new file mode 100755 (executable)
index 0000000..c2a927c
--- /dev/null
@@ -0,0 +1,157 @@
+package mircoders.producer;\r
+\r
+import java.io.*;\r
+import java.lang.*;\r
+import java.util.*;\r
+\r
+import freemarker.template.*;\r
+\r
+import com.icl.saxon.trax.Transformer;\r
+\r
+import webdb.misc.*;\r
+import webdb.storage.*;\r
+import webdb.module.*;\r
+import webdb.entity.*;\r
+\r
+import mir.module.*;\r
+import mir.entity.*;\r
+import mir.storage.*;\r
+\r
+\r
+public class ProducerContent extends Producer {\r
+\r
+       public static void main(String argv[]){\r
+               Configuration.initConfig("config");\r
+               System.out.println(Configuration.getProperty("Producer.DocRoot"));\r
+               try {\r
+                       new ProducerContent().handle(new PrintWriter(System.out), null, false,false);\r
+               } catch(Exception e) { System.err.println(e.toString()); }\r
+       }\r
+\r
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)\r
+               throws StorageObjectException, ModuleException {\r
+               handle(htmlout,user,force,sync,null);\r
+       }\r
+\r
+\r
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync, String id)\r
+               throws StorageObjectException, ModuleException\r
+       {\r
+\r
+               String contentTemplate = Configuration.getProperty("Producer.Content.Template");\r
+               int contentBatchsize = Integer.parseInt(Configuration.getProperty("Producer.Content.Batchsize"));\r
+               String extLinkName = Configuration.getProperty("Producer.ExtLinkName");\r
+               String intLinkName = Configuration.getProperty("Producer.IntLinkName");\r
+               String mailLinkName = Configuration.getProperty("Producer.MailLinkName");\r
+               String imageRoot = Configuration.getProperty("Producer.ImageRoot");\r
+\r
+               long                sessionConnectTime = 0;\r
+               long                startTime = (new java.util.Date()).getTime();\r
+               String              whereClause = " ";\r
+               String              orderBy = " ";\r
+               String              htmlFileName = null;\r
+               String              currentMediaId;\r
+               EntityContent       currentContent;\r
+               EntityList          batchEntityList;\r
+               HashMap             currentContentValues;\r
+               SimpleHash          imageHash = new SimpleHash();\r
+               EntityGruppen       userEntity=null;\r
+\r
+               // production of the content-pages\r
+               orderBy="date desc, webdb_lastchange desc";\r
+               if(force==true){\r
+                       whereClause="is_published='1'";\r
+\r
+                       // if true: produces a single content item\r
+                       if(id !=null){\r
+                               whereClause += " AND id="+id;\r
+                       }\r
+                       batchEntityList = contentModule.getContent(whereClause, orderBy, 0, contentBatchsize, userEntity);\r
+               } else {\r
+                       whereClause="is_produced='0' AND is_published='1'";\r
+\r
+                       //if true produces a single contentitem\r
+                       if(id !=null){\r
+                               whereClause += " AND id="+id;\r
+                       }\r
+                       batchEntityList = contentModule.getContent(whereClause, orderBy, 0, contentBatchsize, userEntity);\r
+               }\r
+\r
+               while (batchEntityList != null) {\r
+                       for(int i=0;i<batchEntityList.size();i++) {\r
+                               currentContent = (EntityContent)batchEntityList.elementAt(i);\r
+                               currentContentValues = currentContent.getValues();\r
+                               //currentContentValues.put("content_data",currentContent.getContentData());\r
+\r
+\r
+                               String date = (String)currentContentValues.get("date");\r
+                               String year = date.substring(0,4);\r
+                               String month = date.substring(4,6);\r
+\r
+                               htmlFileName =  producerDocRoot\r
+                                       + "/" + year + "/" + month + "/" +  currentContentValues.get("id") + ".shtml";\r
+\r
+                               currentContentValues.put("content_data",StringUtil.deleteForbiddenTags((String)currentContentValues.get("content_data")));\r
+                               currentContentValues.put("description",StringUtil.deleteForbiddenTags((String)currentContentValues.get("description")));\r
+\r
+        if (currentContentValues.get("is_html").equals("0")) {\r
+          String temp = (String)currentContentValues.get("content_data");\r
+          theLog.printDebugInfo("länge:"+temp.length());\r
+          if(temp!=null && temp.length()>0){\r
+            temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);\r
+            temp = StringUtil.decodeHTMLinTags(temp);\r
+            currentContentValues.put("content_data",temp);\r
+          }\r
+          temp = (String)currentContentValues.get("description");\r
+          if(temp!=null && temp.length()>0){\r
+            temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);\r
+            temp = StringUtil.decodeHTMLinTags(temp);\r
+            currentContentValues.put("description",temp);\r
+          }\r
+                               } else {\r
+          String temp = (String)currentContentValues.get("content_data");\r
+          if(temp!=null && temp.length()>0){\r
+            temp = StringUtil.decodeHTMLinTags(temp);\r
+            currentContentValues.put("content_data",temp);\r
+          }\r
+          temp = (String)currentContentValues.get("description");\r
+          if(temp!=null && temp.length()>0){\r
+            temp = StringUtil.decodeHTMLinTags(temp);\r
+            currentContentValues.put("description",temp);\r
+          }\r
+        }\r
+\r
+                               SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);\r
+\r
+                               // get the images\r
+                               currentMediaId = currentContent.getValue("to_media");\r
+                               if (currentMediaId!=null && !currentMediaId.equals("")) {\r
+                                       imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));\r
+                               }\r
+                               mergeData.put("images", imageHash);\r
+\r
+                               // get the comments for the article\r
+                               mergeData.put("comments", currentContent.getComments());\r
+\r
+                               // get the topics of this article\r
+                               mergeData.put("topics",HTMLTemplateProcessor.makeSimpleList(DatabaseContentToTopics.getInstance().getTopics(currentContent)));\r
+\r
+                               boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);\r
+                               sessionConnectTime = new java.util.Date().getTime() - startTime;\r
+                               if (retVal == true && !"1".equals(currentContent.getValue("is_produced")))\r
+                                               currentContent.setProduced(true);\r
+                       }\r
+                       if (batchEntityList.hasNextBatch()){\r
+                               batchEntityList = contentModule.getContent(whereClause, orderBy, batchEntityList.getNextBatch(),contentBatchsize, userEntity);\r
+                               //theLog.printDebugInfo("producing next batch");\r
+                       } else {\r
+                               batchEntityList=null;\r
+                       }\r
+               }\r
+               // Finish\r
+               sessionConnectTime = new java.util.Date().getTime() - startTime;\r
+               logHTML(htmlout, "Producer.Content finished: " + sessionConnectTime + " ms.");\r
+\r
+       }\r
+\r
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerFeature.java b/source/mircoders/producer/ProducerFeature.java
new file mode 100755 (executable)
index 0000000..3df75f9
--- /dev/null
@@ -0,0 +1,60 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerFeature extends ProducerList {
+
+
+       public void setAdditional(String key, TemplateModel value) {
+               additional.put(key,value);
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException {
+               orderBy="date desc";
+               listTemplate = Configuration.getProperty("Producer.FeatureList.Template");
+               EntityList featureEntityList = featureModule.getByWhereClause("","title", -1);
+               SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(featureEntityList);
+               boolean first=true;
+               whereClause="is_published!=true AND to_article_type=0 AND id IN (";
+               for(int i=0; i < featureEntityList.size(); i++){
+                       if(first==false) {
+                               whereClause += ",";
+                       }
+
+                       EntityTopics currentTopic = (EntityTopics)featureEntityList.elementAt(i);
+                       EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
+                       whereClause += currentTopic.getId();
+                       fileDesc = currentTopic.getValue("filename").trim();
+                       setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+
+                       first = false;
+               }
+               whereClause += ")";
+               handleIt(htmlout,user,force);
+       }
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerImages.java b/source/mircoders/producer/ProducerImages.java
new file mode 100755 (executable)
index 0000000..526ae37
--- /dev/null
@@ -0,0 +1,109 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerImages extends Producer {
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerContent().handle(new PrintWriter(System.out), null, false,false);
+               } catch(Exception e) { System.err.println(e.toString()); }
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException {
+               handle(htmlout,user,force,sync,null);
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync, String id)
+               throws StorageObjectException, ModuleException
+       {
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              whereClause;
+               String              iconFilename;
+               String              imageFilename;
+               String              productionPath;
+               EntityImage         currentImage;
+               EntityList          batchEntityList;
+
+    int contentBatchsize = Integer.parseInt(Configuration.getProperty("Producer.Content.Batchsize"));
+    String imageHost = Configuration.getProperty("Producer.Image.Host");
+         String imagePath = Configuration.getProperty("Producer.Image.Path");
+         String iconPath = Configuration.getProperty("Producer.Image.IconPath");
+
+               // get batch of non-produced images, that are to be published
+               whereClause="is_published='1'";
+               if (id!= null)
+                       whereClause += " and id="+id;
+               if (force==false) whereClause += " and icon_is_produced='0'";
+
+               batchEntityList = imageModule.getByWhereClause(whereClause, null, 0, contentBatchsize);
+               theLog.printDebugInfo("whereclause: " + whereClause);
+
+
+               while (batchEntityList != null) {
+                       for(int i=0;i<batchEntityList.size();i++) {
+                               theLog.printDebugInfo("trying image: " + i);
+                               currentImage = (EntityImage)batchEntityList.elementAt(i);
+
+                               // make filenames
+                               String date = currentImage.getValue("date");
+
+                               iconFilename = producerDocRoot + iconPath + StringUtil.webdbDate2path(date) +
+                                       currentImage.getId() + (( currentImage.getValue("to_img_type").equals("0") ) ? ".jpg":".gif");
+
+                               imageFilename = currentImage.getId() + (( currentImage.getValue("to_img_type").equals("0") ) ? ".jpg":".gif");
+                               productionPath = imagePath + "/" + imageFilename ;
+
+                               currentImage.setValueForProperty("icon_path",iconFilename);
+                               //currentImage.setValueForProperty("publish_path","imc/germany/" + imageFilename);
+        currentImage.setValueForProperty("publish_path",imageFilename);
+                               currentImage.setValueForProperty("publish_server", imageHost);
+
+                               if (currentImage.getValue("icon_data")!= null && currentImage.getValue("image_data")!= null) {
+                                       // make icon
+                                       boolean iconProduced = produceFile(iconFilename, currentImage.getIcon(), htmlout, true);
+                                       logHTML(htmlout,"icon : " + iconFilename + (( iconProduced==true )? " succeded":" <font color=\"Red\" failed!</font>"));
+                                       // make image
+                                       boolean imageProduced = produceFile(productionPath, currentImage.getImage(), htmlout, false);
+                                       logHTML(htmlout,"image: " + productionPath + ((imageProduced==true)?" succeded":" <font color=\"Red\" failed!</font>"));
+
+                                       // update image-data
+                                       if (iconProduced && imageProduced) {
+                                               currentImage.setValueForProperty("icon_is_produced", "1");
+                                               currentImage.update();
+                                       }
+
+                               }
+                       }
+
+                       // if next batch get it...
+                       if (batchEntityList.hasNextBatch()){
+                               batchEntityList = imageModule.getByWhereClause(whereClause, null, batchEntityList.getNextBatch(),contentBatchsize);
+                       } else {
+                               batchEntityList=null;
+                       }
+               }
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.Images finished: " + sessionConnectTime + " ms.");
+
+       }
+
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerList.java b/source/mircoders/producer/ProducerList.java
new file mode 100755 (executable)
index 0000000..ff8aa70
--- /dev/null
@@ -0,0 +1,160 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+abstract public class ProducerList extends Producer {
+
+       public String listTemplate;
+       public String whereClause;
+       public String orderBy;
+       public String fileDesc;
+       protected HashMap additional = new HashMap();
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean sync, boolean force)
+               throws StorageObjectException, ModuleException {
+               handleIt(htmlout,user,force);
+       }
+
+       public void handleIt(PrintWriter htmlout, EntityUsers user, boolean force)
+               throws StorageObjectException, ModuleException {
+
+               logHTML(htmlout, "Producer.List: started");
+    int newsPerPage = Integer.parseInt(Configuration.getProperty("Producer.StartPage.Newswire"));
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              htmlFileName = "";
+               String              currentMediaId;
+               EntityContent       currentContent;
+               EntityList          list;
+               EntityGruppen       userEntity=null;
+               SimpleHash          imageHash = new SimpleHash();
+               int size = 0;
+               int listSize = 0;
+
+               int maxItemsOnPage = Integer.parseInt(Configuration.getProperty("Lists.Max.Items"));
+
+               try {
+                       listSize = contentModule.getSize(whereClause);
+               } catch (Exception e) {
+                       logHTML(htmlout,e.toString());
+               }
+
+               int modRest = listSize % maxItemsOnPage;
+               int numberOfPages = (listSize - modRest) / maxItemsOnPage;
+               boolean first=true;
+               for (int i = 0;i < numberOfPages+1;i ++) {
+                       //break the loop, if only athe actuell pages should be produced
+                       if (force == false && i==3) {
+                               break;
+                       }
+                       //break, if only the first page has to be produced
+                       if (force == false && modRest != 0 && first==false){
+                               break;
+                       }
+
+
+                       if (first==true) {
+                               //get the data for the first page
+                               size=maxItemsOnPage + modRest;
+                               list = contentModule.getContent(whereClause, orderBy, 0, size, userEntity);
+                               first=false;
+                       } else {
+                               //get the data for the other pages
+                               list = contentModule.getContent(whereClause, orderBy, size, maxItemsOnPage, userEntity);
+                               size = size + maxItemsOnPage;
+                       }
+
+                       //now produce the pages
+                       if (list!=null || force==true) {
+                               SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(list);
+                               //first we try to get the images
+                               SimpleList itemList = HTMLTemplateProcessor.makeSimpleList(list);
+                               if(list!=null){
+                                       for (int k=0; k < list.size();k++) {
+                                               currentContent = (EntityContent)list.elementAt(k);
+            //images to content
+                                               currentMediaId = currentContent.getValue("to_media");
+                                               if (currentMediaId!=null && !currentMediaId.equals("")) {
+                                                       imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+                                               }
+            //content to html
+            if(currentContent.getValue("is_html").equals("0")){
+              String temp = (String)currentContent.getValue("description");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.createHTML(temp);
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContent.setValueForProperty("description",temp);
+              }
+            } else {
+              String temp = (String)currentContent.getValue("description");
+              if(temp!=null && temp.length()>0){
+                temp = StringUtil.decodeHTMLinTags(temp);
+                currentContent.setValueForProperty("description",temp);
+              }
+            }
+                                       }
+                                       mergeData.put("images", imageHash);
+                               }
+
+                               //process hashmap additional and add to mergedata
+                               if (additional != null) {
+                                       Set set = additional.keySet();
+                                       for (Iterator it = set.iterator();it.hasNext();) {
+                                               String key = (String)it.next();
+                                               mergeData.put(key,(TemplateModel)additional.get(key));
+                                       }
+                               }
+
+                               if (i==0){
+                                       htmlFileName = producerDocRoot + "/" + fileDesc + ".shtml";
+                                       mergeData.put("filename",fileDesc + ".shtml");
+                                       mergeData.put("previousPage","");
+                                       if(numberOfPages<=1){
+                                               mergeData.put("nextPage","");
+                                       } else {
+                                               mergeData.put("nextPage",fileDesc + (numberOfPages-1) + ".shtml");
+                                       }
+                               } else {
+                                       if (i==1 && numberOfPages > 2){
+                                               mergeData.put("previousPage",fileDesc + ".shtml");
+                                               mergeData.put("nextPage",fileDesc + (numberOfPages-2) + ".shtml");
+                                       } else {
+                                               if (i==(numberOfPages-1)){
+                                                       mergeData.put("previousPage",fileDesc + (numberOfPages-i+1) + ".shtml");
+                                                       mergeData.put("nextPage","");
+                                               } else {
+                                                       mergeData.put("previousPage",fileDesc + (numberOfPages-(i-1)) + ".shtml");
+                                                       mergeData.put("nextPage",fileDesc + (numberOfPages-(i+1)) + ".shtml");
+                                               }
+                                       }
+                                       htmlFileName = producerDocRoot + "/" + fileDesc + (numberOfPages-i) + ".shtml";
+                                       mergeData.put("filename",fileDesc + (numberOfPages-i) + ".shtml");
+                               }
+
+                               //producing the html-files
+                               boolean retVal = produce(listTemplate, htmlFileName, mergeData, htmlout);
+                       } //end if
+               }//end for
+
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.List finished: " + sessionConnectTime + " ms.");
+       } //end handle
+
+       abstract public void setAdditional(String key, TemplateModel value);
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerNavigation.java b/source/mircoders/producer/ProducerNavigation.java
new file mode 100755 (executable)
index 0000000..a26bbe7
--- /dev/null
@@ -0,0 +1,69 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.storage.*;
+import mir.entity.*;
+
+/**
+ * Title:        mir - another content management system
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      indymedia
+ * @author idefix
+ * @version 1.0
+ */
+
+public class ProducerNavigation extends Producer {
+
+  private static String naviPageTemplate = Configuration.getProperty("Producer.Navigation.Template");
+
+  public void handle(PrintWriter htmlout, EntityUsers user, boolean forced, boolean sync)
+    throws webdb.module.ModuleException, webdb.storage.StorageObjectException {
+
+    printHTML(htmlout, "Producer.Navigation: started");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar());
+               String              whereClause;
+               String              orderBy;
+               FileWriter          outputFile;
+               String              htmlFileName;
+               EntityContent       currentContent;
+               EntityList          entityList;
+               SimpleHash          naviPageModel;
+
+               // get the topiclist
+               entityList = topicsModule.getByWhereClause("","title",-1);
+               SimpleList topicList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+               // put the informations into the navipagemodel
+               naviPageModel = new SimpleHash();
+               naviPageModel.put("topics", topicList);
+
+               htmlFileName = producerDocRoot + "/navigation.inc";
+
+               produce(naviPageTemplate, htmlFileName, naviPageModel, new LineFilterWriter(htmlout));
+
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.Navigation finished: " + sessionConnectTime + " ms.");
+
+               if(sync==true){
+                       Helper.rsync();
+                       logHTML(htmlout, "Producer.Startseite: rsync done");
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerOpenPosting.java b/source/mircoders/producer/ProducerOpenPosting.java
new file mode 100755 (executable)
index 0000000..247d553
--- /dev/null
@@ -0,0 +1,52 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerOpenPosting extends ProducerList {
+
+  public void setAdditional(String key, TemplateModel value) {
+    additional.put(key,value);
+  }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException {
+
+    listTemplate = Configuration.getProperty("Producer.OpenPosting.Template");
+    whereClause="is_published='1'";
+    orderBy="date desc, webdb_create desc";
+    fileDesc="open";
+
+               EntityList topicsEntityList = topicsModule.getByWhereClause("","title", -1);
+               SimpleList topicsList = HTMLTemplateProcessor.makeSimpleList(topicsEntityList);
+    SimpleScalar title = new SimpleScalar();
+    title.setValue("Open-Posting");
+    setAdditional("topicslist",topicsList);
+    setAdditional("title",title);
+
+    handleIt(htmlout,user,force);
+  }
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerOverview.java b/source/mircoders/producer/ProducerOverview.java
new file mode 100755 (executable)
index 0000000..45c1ede
--- /dev/null
@@ -0,0 +1,177 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerOverview extends Producer {
+
+       static String           monthTemplate;
+       static String           yearTemplate;
+       static int              numberOfTermine;
+
+       static {
+               // Initialierung
+               monthTemplate = Configuration.getProperty("Producer.Overview.MonthTemplate");
+               yearTemplate = Configuration.getProperty("Producer.Overview.YearTemplate");
+               numberOfTermine = Integer.parseInt(Configuration.getProperty("Producer.Startseite.Termine"));
+       }
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerOverview().handle(new PrintWriter(System.out), null, false, false);
+               }
+               catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException
+       {
+               logHTML(htmlout, "Producer.Overview: started");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar());
+               String              whereClause;
+               String              orderBy="date";
+               String              fileName;
+               EntityContent       currentContent;
+               EntityList          monatsListe;
+               EntityList          batchEntityList;
+               EntityGruppen       userEntity=null;
+
+               SimpleHash gruppenPopupData = gruppenModule.getHashData();
+               SimpleHash themenPopupData = topicsModule.getHashData();
+               SimpleHash schwerpunktPopupData = schwerpunktModule.getHashData();
+               ArrayList yearArrayList = new ArrayList();
+               HashMap yearHash = new HashMap();
+
+               // Datenstrukturen fuer Themen/Schwerpunkt aufbauen
+               batchEntityList = schwerpunktModule.getByWhereClause("is_published!=0", 0);
+               SimpleList schwerpunktList = HTMLTemplateProcessor.makeSimpleList(batchEntityList);
+               batchEntityList = contentModule.getContent("(date_from<="+ nowWebdbDate +" and date_to>=" + nowWebdbDate+ ")", "", 0, numberOfTermine, null);
+               SimpleList terminList = HTMLTemplateProcessor.makeSimpleList(batchEntityList);
+               batchEntityList = topicsModule.getByWhereClause("","title",-1);
+               SimpleList themenList = HTMLTemplateProcessor.makeSimpleList(batchEntityList);
+
+               Connection con=null;
+               Statement stmt=null;
+               ResultSet rs=null;
+               DatabaseContent dbContent=DatabaseContent.getInstance();
+
+               String sql = "select distinct LEFT(date,6) as date from content order by date desc";
+               try {
+                       con = dbContent.getPooledCon();
+                       stmt = con.createStatement();
+                       rs = dbContent.executeSql(stmt,sql);
+
+                       //jetzt Ã¼bersetzen wir month in text
+                       SimpleHash monatslookup = new SimpleHash();
+                       monatslookup.put("01","Januar");
+                       monatslookup.put("02","Februar");
+                       monatslookup.put("03","M&auml;rz");
+                       monatslookup.put("04","April");
+                       monatslookup.put("05","Mai");
+                       monatslookup.put("06","Juni");
+                       monatslookup.put("07","Juli");
+                       monatslookup.put("08","August");
+                       monatslookup.put("09","September");
+                       monatslookup.put("10","Oktober");
+                       monatslookup.put("11","November");
+                       monatslookup.put("12","Dezember");
+
+
+                       // fuer alle yyyy/mm
+                       while(rs.next()){
+                               //  select * from content_objekt where datum like yyyymm%
+                               String currentDate = rs.getString(1);
+                               whereClause="date like '"+ currentDate + "%' and is_published!=0 and islink=0";
+                       monatsListe = contentModule.getContent(whereClause, orderBy, 0, -1, userEntity);
+
+                               //   baue uebersichtsseite aus erbenis
+       if (monatsListe!=null) {
+                                       SimpleList items = new SimpleList();
+                                       for(int i=0;i<monatsListe.size();i++) {
+                                               currentContent = (EntityContent)monatsListe.elementAt(i);
+                                               items.add(HTMLTemplateProcessor.makeSimpleHash(currentContent));
+                                       }
+                                       String year = currentDate.substring(0,4);
+                                       String month = currentDate.substring(4,6);
+                                       fileName = producerDocRoot + "/"
+                                                                                + year + "/"
+                                                                                + month
+                                                                                + "/index.html";
+
+
+                                       // wir merken uns mal was ...
+
+
+                                       if (!yearArrayList.contains(year)) yearArrayList.add(year);
+                                       if (!yearHash.containsKey(year)) yearHash.put(year, new SimpleList());
+                                       ((SimpleList)yearHash.get(year)).add(month);// hier hab ich wieder month eingefuegt, statt des gepatchten monats
+
+                                       SimpleHash mergeData = new SimpleHash();
+                                       mergeData.put("year",year);
+                                       mergeData.put("month",month); // hier hab ich wieder month eingefuegt, statt des gepatchten monats
+                                       mergeData.put("content", items);
+                                       mergeData.put("schwerpunkt", schwerpunktList);
+                                       mergeData.put("termine", terminList);
+                                       mergeData.put("themen", themenList);
+                                       mergeData.put("gruppenPopupData", gruppenPopupData);
+                                       mergeData.put("themenPopupData", themenPopupData);
+                                       mergeData.put("schwerpunktPopupData", schwerpunktPopupData);
+                                       mergeData.put("producerDocRoot", producerDocRoot);
+                                       mergeData.put("monatslookup",monatslookup);
+               boolean retVal = produce_compressed(monthTemplate, fileName, mergeData, htmlout);
+                               } //end if
+                       }//end while
+
+
+                       SimpleList item = new SimpleList();
+                       for(int i=0;i<yearArrayList.size();i++){
+                               String year = (String)yearArrayList.get(i);
+                               SimpleHash entry = new SimpleHash();
+                               entry.put("name", year);
+                               entry.put("mm",(SimpleList)yearHash.get(year));
+                               item.add(entry);
+                       }
+                       SimpleHash mergeData = new SimpleHash();
+                       mergeData.put("content", item);
+                       mergeData.put("schwerpunkt", schwerpunktList);
+                       mergeData.put("termine", terminList);
+                       mergeData.put("themen", themenList);
+                       mergeData.put("gruppenPopupData", gruppenPopupData);
+                       mergeData.put("themenPopupData", themenPopupData);
+                       mergeData.put("schwerpunktPopupData", schwerpunktPopupData);
+                       mergeData.put("producerDocRoot", producerDocRoot);
+                       mergeData.put("monatslookup", monatslookup);
+                       boolean retVal = produce_compressed(yearTemplate, producerDocRoot+"/uebersicht.html", mergeData, htmlout);
+
+                       } catch (Exception e) {
+                               theLog.printDebugInfo("overview gescheitert! schade"+e.toString());
+                       } finally {
+                               dbContent.freeConnection(con,stmt);
+                       }
+
+                       // Finish
+                       sessionConnectTime = new java.util.Date().getTime() - startTime;
+                       logHTML(htmlout, "Producer.Content finished: " + sessionConnectTime + " ms.");
+
+               } //end handle
+}
diff --git a/source/mircoders/producer/ProducerStartPage.java b/source/mircoders/producer/ProducerStartPage.java
new file mode 100755 (executable)
index 0000000..20248da
--- /dev/null
@@ -0,0 +1,131 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.storage.*;
+import mir.entity.*;
+
+
+public class ProducerStartPage extends Producer {
+
+       private static String startPageTemplate = Configuration.getProperty("Producer.StartPage.Template");
+       private static int itemsPerPage = Integer.parseInt(Configuration.getProperty("Producer.StartPage.Items"));
+  private static int newsPerPage = Integer.parseInt(Configuration.getProperty("Producer.StartPage.Newswire"));
+
+       public static void main(String argv[]){
+               try {
+                       Configuration.initConfig(argv[0]);
+                       new ProducerStartPage().handle(new PrintWriter(System.out), null);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
+               throws StorageObjectException, ModuleException
+       {
+               printHTML(htmlout, "Producer.StartPage: started");
+
+               String extLinkName = Configuration.getProperty("Producer.ExtLinkName");
+               String intLinkName = Configuration.getProperty("Producer.IntLinkName");
+               String mailLinkName = Configuration.getProperty("Producer.MailLinkName");
+               String imageRoot = Configuration.getProperty("Producer.ImageRoot");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar());
+               String              whereClause;
+               String              orderBy;
+               FileWriter          outputFile;
+               String              htmlFileName;
+               EntityContent       currentContent;
+               EntityList          entityList;
+               SimpleHash          startPageModel;
+               SimpleList          contentList;
+               String              currentMediaId;
+               SimpleHash          imageHash = new SimpleHash();
+
+               // get the topiclist
+               entityList = topicsModule.getByWhereClause("","title",-1);
+               SimpleList topicList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+               // get the newswire
+               whereClause="is_published=true AND to_article_type >= 1";
+               entityList = contentModule.getContent(whereClause,"date desc, webdb_create desc",0,newsPerPage);
+               SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+               // get the startarticle and the related images
+               whereClause="is_published=true AND to_article_type=4";
+               entityList = contentModule.getContent(whereClause,"date desc, webdb_create desc",0,1);
+               //if no startspecial exists
+               if (entityList==null || entityList.size()==0){
+                       whereClause="is_published=true AND to_article_type=3";
+                       entityList = contentModule.getContent(whereClause,"date desc, webdb_create desc",0,1);
+               }
+               SimpleList startItemList = HTMLTemplateProcessor.makeSimpleList(entityList);
+               for (int i=0; i < entityList.size();i++) {
+                       currentContent = (EntityContent)entityList.elementAt(i);
+                       currentMediaId = currentContent.getValue("to_media");
+                       if (currentMediaId!=null && !currentMediaId.equals("")) {
+                               imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+                       }
+               }
+
+               // get the breaking news
+               // only the first 5
+               ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
+               entityList = breakingModule.getByWhereClause(null,"webdb_create desc",0,5);
+               SimpleList breakingList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+               // get the articles
+               whereClause="is_published=true AND to_article_type=2";
+               orderBy="date desc, webdb_create desc";
+               entityList = contentModule.getContent(whereClause, orderBy, 0, itemsPerPage);
+               for (int i=0; i < entityList.size();i++) {
+                       currentContent = (EntityContent)entityList.elementAt(i);
+                       /**
+                       if (currentContent.get("is_html").equals("0")) {
+                               currentContent.put("content_data",StringUtil.createHTML((String)currentContent.get("content_data"),imageRoot,mailLinkName,extLinkName,intLinkName));
+                               currentContent.put("description",StringUtil.createHTML((String)currentContent.get("description"),imageRoot,mailLinkName,extLinkName,intLinkName));
+                       }
+                       */
+                       currentMediaId = currentContent.getValue("to_media");
+                       if (currentMediaId!=null && !currentMediaId.equals("")) {
+                               imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+                       }
+               }
+               SimpleList itemList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+               // Zusaetzlich Informationen
+               startPageModel = new SimpleHash();
+               startPageModel.put("breaking", breakingList);
+               startPageModel.put("topics", topicList);
+               startPageModel.put("newswire", newsWireList);
+               startPageModel.put("start", startItemList);
+               startPageModel.put("items", itemList);
+               startPageModel.put("images", imageHash);
+
+               htmlFileName = producerDocRoot + "/index.shtml";
+
+               produce(startPageTemplate, htmlFileName, startPageModel, new LineFilterWriter(htmlout));
+
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.Startseite finished: " + sessionConnectTime + " ms.");
+               if(sync==true){
+                       Helper.rsync();
+                       logHTML(htmlout, "Producer.Startseite: rsync done");
+               }
+       }
+}
+
diff --git a/source/mircoders/producer/ProducerTopics.java b/source/mircoders/producer/ProducerTopics.java
new file mode 100755 (executable)
index 0000000..5597442
--- /dev/null
@@ -0,0 +1,117 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+import java.sql.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.entity.*;
+import mir.storage.*;
+
+
+
+public class ProducerTopics extends ProducerList {
+
+       public String where;
+
+       public void setAdditional(String key, TemplateModel value) {
+               additional.put(key,value);
+       }
+
+  public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync, String id)
+    throws StorageObjectException, ModuleException {
+    where=id;
+    handle(htmlout,user,force,sync);
+  }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException {
+
+               orderBy="date desc, webdb_create desc";
+               listTemplate = Configuration.getProperty("Producer.TopicList.Template");
+
+    EntityList topicsEntityList;
+    if(where==null){
+      topicsEntityList = topicsModule.getByWhereClause("","title", -1);
+    } else {
+      topicsEntityList = topicsModule.getByWhereClause(where,"title", -1);
+    }
+               SimpleList topicsList = HTMLTemplateProcessor.makeSimpleList(topicsEntityList);
+
+               for(int i=0; i < topicsEntityList.size(); i++){
+
+                       EntityTopics currentTopic = (EntityTopics)topicsEntityList.elementAt(i);
+                       EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
+      String whereClauseSpecial=null;
+
+      if (contentEntityList!=null || force==true) {
+        if (contentEntityList!=null){
+          boolean first=true;
+          whereClause="is_published='1' AND to_article_type >= 1 AND to_article_type <=2 AND id IN (";
+          whereClauseSpecial="is_published='1' AND to_article_type=3 AND id IN (";
+          for(int j=0; j < contentEntityList.size(); j++){
+            if(first==false) {
+              whereClause += ",";
+              whereClauseSpecial += ",";
+            }
+            EntityContent currentContent = (EntityContent)contentEntityList.elementAt(j);
+            whereClause += currentContent.getId();
+            whereClauseSpecial += currentContent.getId();
+
+            setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+
+            first = false;
+          }
+          whereClause += ")";
+          whereClauseSpecial += ")";
+        }
+
+        if(contentEntityList==null && force==true){
+          //hihi, das ist eigentlich boese
+          whereClause="is_published='1' AND to_article_type>=1 AND id IN (0)";
+        }
+
+        fileDesc = currentTopic.getValue("filename");
+
+        // get the startarticle
+        EntityList entityList = contentModule.getContent(whereClauseSpecial,"date desc, webdb_create desc",0,1);
+        SimpleList specialList = HTMLTemplateProcessor.makeSimpleList(entityList);
+        String currentMediaId = null;
+        SimpleHash imageHash = new SimpleHash();
+        EntityContent currentContent;
+        if(entityList != null){
+          for (int k=0; k < entityList.size();k++) {
+            currentContent = (EntityContent)entityList.elementAt(k);
+            currentMediaId = currentContent.getValue("to_media");
+            if (currentMediaId!=null && !currentMediaId.equals("")) {
+              imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+            }
+          }
+          setAdditional("specialimage",imageHash);
+        }
+        setAdditional("special",specialList);
+
+        //set the list of topics
+        setAdditional("topicslist",topicsList);
+
+        handleIt(htmlout,user,force);
+      }
+    }
+       }
+
+       public static void main(String argv[]){
+               try {
+                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+}
\ No newline at end of file
diff --git a/source/mircoders/producer/ProducerWap.java b/source/mircoders/producer/ProducerWap.java
new file mode 100755 (executable)
index 0000000..68ff47f
--- /dev/null
@@ -0,0 +1,106 @@
+package mircoders.producer;
+
+import java.io.*;
+import java.lang.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.misc.*;
+import webdb.storage.*;
+import webdb.module.*;
+import webdb.entity.*;
+
+import mir.module.*;
+import mir.storage.*;
+import mir.entity.*;
+
+
+public class ProducerWap extends Producer {
+
+       static String           wapTemplate;
+       static int              itemsPerPage;
+       static int              newsPerPage;
+
+       // Initialierung
+       static {
+               wapTemplate = Configuration.getProperty("Producer.Wap.Template");
+               itemsPerPage = Integer.parseInt(Configuration.getProperty("Producer.Wap.Items"));
+       }
+
+       public static void main(String argv[]){
+               try {
+                       Configuration.initConfig(argv[0]);
+                       new ProducerWap().handle(new PrintWriter(System.out), null);
+               } catch(Exception e) {
+                       System.err.println(e.toString());
+               }
+       }
+
+       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+               throws StorageObjectException, ModuleException
+       {
+               printHTML(htmlout, "Producer.StartPage: started");
+
+               long                sessionConnectTime = 0;
+               long                startTime = (new java.util.Date()).getTime();
+               String              nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar());
+               String              whereClause;
+               String              orderBy;
+               FileWriter          outputFile;
+               String              xmlFileName;
+               String              wmlFileName;
+               EntityContent       currentContent;
+               EntityList          entityList;
+               SimpleHash          wapPageModel;
+               SimpleList          contentList;
+               String              currentMediaId;
+               SimpleHash          imageHash = new SimpleHash();
+
+
+               // get the breaking news
+               // only the first 5
+               ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
+               entityList = breakingModule.getByWhereClause(null,"webdb_create desc",0,itemsPerPage);
+               SimpleList breakingList = HTMLTemplateProcessor.makeSimpleList(entityList);
+
+
+
+               // Zusaetzlich Informationen
+               wapPageModel = new SimpleHash();
+               wapPageModel.put("breaking", breakingList);
+
+               xmlFileName = producerDocRoot + "/wap/index.xml";
+               wmlFileName = producerDocRoot + "/wap/index.wml";
+
+               produce(wapTemplate, xmlFileName, wapPageModel, new LineFilterWriter(htmlout));
+
+               XmlSaxonStyler styler = XmlSaxonStyler.getInstance();
+               // clear XSL-Cache
+               // XslStyleCache.clear();
+
+               try {
+                       InputStream is = new FileInputStream(producerStorageRoot+xmlFileName);
+                       OutputStream os = new FileOutputStream(producerStorageRoot+wmlFileName);
+                       String contentXsl = Configuration.getProperty("Home") + "templates/" + Configuration.getProperty("Xsl.Wap");
+                       logHTML(htmlout,"using style " + contentXsl);
+                       styler.style(contentXsl,is,os);
+      is.close();
+      os.close();
+                       logHTML(htmlout,"styling done.");
+                       logHTML(htmlout, "html erstellt: <a href=\"" + producerProductionHost+  wmlFileName + "\">" + wmlFileName + "</a>");
+               } catch (FileNotFoundException e) {
+                       System.err.println(e.toString());
+               } catch (IOException e) {
+                       System.err.println(e.toString());
+               } catch (org.xml.sax.SAXException e) {
+                       logHTML(htmlout,e.toString());
+                       System.err.println(e.toString());
+               }
+
+               // Finish
+               sessionConnectTime = new java.util.Date().getTime() - startTime;
+               logHTML(htmlout, "Producer.Startseite finished: " + sessionConnectTime + " ms.");
+       }
+}
+
diff --git a/source/mircoders/servlet/ServletModuleBreaking.java b/source/mircoders/servlet/ServletModuleBreaking.java
new file mode 100755 (executable)
index 0000000..b31c7f0
--- /dev/null
@@ -0,0 +1,75 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.net.*;
+import javax.servlet.http.*;
+import javax.servlet.*;
+import freemarker.template.*;
+import webdb.servlet.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+import webdb.module.*;
+import mir.module.*;
+import mir.storage.*;
+
+/*
+ *  ServletModuleBreaking -
+ *  Authentified Navigation for Breaking News
+ *
+ *
+ */
+
+public class ServletModuleBreaking extends ServletModule
+{
+
+       // Singelton / Kontruktor
+
+       private static ServletModuleBreaking instance = new ServletModuleBreaking();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleBreaking() {
+
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Breaking.Logfile"));
+               templateListString = Configuration.getProperty("ServletModule.Breaking.ListTemplate");
+               templateObjektString = Configuration.getProperty("ServletModule.Breaking.ObjektTemplate");
+               templateConfirmString = Configuration.getProperty("ServletModule.Breaking.ConfirmTemplate");
+               try {
+                       mainModule = new ModuleBreaking(DatabaseBreaking.getInstance());
+               }
+               catch (StorageObjectException e) {
+                       theLog.printDebugInfo("ServletModuleBreaking konnte nicht initialisiert werden");
+               }
+       }
+
+       public void list(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               // fetch and deliver
+               try {
+                       SimpleHash mergeData = new SimpleHash();
+                       String offset = req.getParameter("offset");
+                       if (offset==null || offset.equals("")) offset="0";
+                       mergeData.put("offset",offset);
+                       EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
+                       mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+                       if(theList.getOrder()!=null) {
+                               mergeData.put("order", theList.getOrder());
+                               mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
+                       }
+                       mergeData.put("count", (new Integer(theList.getCount())).toString());
+                       mergeData.put("from", (new Integer(theList.getFrom())).toString());
+                       mergeData.put("to", (new Integer(theList.getTo())).toString());
+                       if (theList.hasNextBatch())
+                               mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+                       if (theList.hasPrevBatch())
+                               mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+
+                       // raus damit
+                       HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
+               }
+               catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+               catch (IOException e) {throw new ServletModuleException(e.toString());}
+               catch (Exception e) {throw new ServletModuleException(e.toString());}
+       }
+}
diff --git a/source/mircoders/servlet/ServletModuleComment.java b/source/mircoders/servlet/ServletModuleComment.java
new file mode 100755 (executable)
index 0000000..3c1c6e4
--- /dev/null
@@ -0,0 +1,126 @@
+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 webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleComment - controls navigation for Comments
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleComment extends ServletModule
+{
+
+       private ModuleContent     moduleContent;
+
+       // Singelton / Kontruktor
+       private static ServletModuleComment instance = new ServletModuleComment();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleComment() {
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Comment.Logfile"));
+               templateListString = Configuration.getProperty("ServletModule.Comment.ListTemplate");
+               templateObjektString = Configuration.getProperty("ServletModule.Comment.ObjektTemplate");
+               templateConfirmString = Configuration.getProperty("ServletModule.Comment.ConfirmTemplate");
+               try {
+                       mainModule = new ModuleComment(DatabaseComment.getInstance());
+                       moduleContent = new ModuleContent(DatabaseContent.getInstance());
+               }
+               catch (StorageObjectException e) {
+                       theLog.printError("servletmodule: comment could not be initialized");
+               }
+       }
+
+
+       public void list(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+                       // Parameter auswerten
+                       SimpleHash mergeData = new SimpleHash();
+                       String query_text = req.getParameter("query_text");
+                       mergeData.put("query_text",query_text);
+                       if (query_text!=null) mergeData.put("query_text_encoded",URLEncoder.encode(query_text));
+                       String query_field = req.getParameter("query_field");
+                       mergeData.put("query_field",query_field);
+                       String query_is_published = req.getParameter("query_is_published");
+                       mergeData.put("query_is_published",query_is_published);
+
+                       String offset = req.getParameter("offset");
+                       if (offset==null || offset.equals("")) offset="0";
+                       mergeData.put("offset",offset);
+
+                       // patching order
+                       String order = req.getParameter("order");
+                       if(order!=null) {
+                               mergeData.put("order", order);
+                               mergeData.put("order_encoded", URLEncoder.encode(order));
+                               if (order.equals("webdb_create")) order="webdb_create desc";
+                       }
+
+                       // sql basteln
+                       String whereClause=""; boolean isFirst=true;
+                       if (query_text!=null && !query_text.equalsIgnoreCase("")) {
+                               whereClause += "lower("+query_field+") like lower('%"+query_text+"%')"; isFirst=false;}
+                       if (query_is_published != null && !query_is_published.equals("")) {
+                               if (isFirst==false) whereClause+=" and ";
+                               whereClause += "is_published='"+query_is_published+"'";
+                               isFirst=false;
+                       }
+
+                       theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
+
+                       // fetch und ausliefern
+                       try {
+
+                               if (query_text!=null || query_is_published!=null ) {
+                                       EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue());
+                                       if (theList!=null) {
+
+                                               //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(moduleContent.getByWhereClause(buf.toString(),-1));
+                                               mergeData.put("articleHash", articleHash);
+
+                                               // get comment
+                                               mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+                                               mergeData.put("count", (new Integer(theList.getCount())).toString());
+                                               mergeData.put("from", (new Integer(theList.getFrom())).toString());
+                                               mergeData.put("to", (new Integer(theList.getTo())).toString());
+                                               if (theList.hasNextBatch())
+                                                       mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+                                               if (theList.hasPrevBatch())
+                                                       mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+                                       }
+                               }
+                               // raus damit
+                               HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
+                       }
+                       catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+                       catch (IOException e) {throw new ServletModuleException(e.toString());}
+                       catch (Exception e) {throw new ServletModuleException(e.toString());}
+       }
+}
diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java
new file mode 100755 (executable)
index 0000000..b70c29c
--- /dev/null
@@ -0,0 +1,416 @@
+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 webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleContent -
+ *  liefert HTML fuer Content
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleContent extends ServletModule
+{
+
+       static ModuleTopics         themenModule;
+       static ModuleSchwerpunkt    schwerpunktModule;
+       static ModuleGruppen        gruppenModule;
+       static ModuleImages         imageModule;
+
+       static String templateOpString;
+
+       // Singelton / Kontruktor
+
+       private static ServletModuleContent instance = new ServletModuleContent();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleContent() {
+               try {
+                       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Content.Logfile"));
+                       templateListString = Configuration.getProperty("ServletModule.Content.ListTemplate");
+                       templateOpString = Configuration.getProperty("ServletModule.Content.OpTemplate");
+                       templateObjektString = Configuration.getProperty("ServletModule.Content.ObjektTemplate");
+                       templateConfirmString = Configuration.getProperty("ServletModule.Content.ConfirmTemplate");
+                       mainModule = new ModuleContent(DatabaseContent.getInstance());
+                       themenModule = new ModuleTopics(DatabaseTopics.getInstance());
+                       schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
+                       gruppenModule = new ModuleGruppen(DatabaseGroups.getInstance());
+                       imageModule = new ModuleImages(DatabaseImages.getInstance());
+               }
+               catch (StorageObjectException e) {
+                               theLog.printDebugInfo("servletmodulecontent konnte nicht initialisiert werden");
+               }
+       }
+
+       // Methoden
+
+       public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               try {
+                       EntityUsers user = _getUser(req);
+                       EntityList   theList;
+                       String       offsetParam = req.getParameter("offset");
+                       int          offset =0;
+
+                       // hier offsetcode bearbeiteb
+                       if (offsetParam != null && !offsetParam.equals(""))
+                                       offset = Integer.parseInt(offsetParam);
+
+                       if (req.getParameter("next") != null)
+                                       offset=Integer.parseInt(req.getParameter("nextoffset"));
+                       else
+                                       if (req.getParameter("prev") != null)
+                                               offset = Integer.parseInt(req.getParameter("prevoffset"));
+
+                       String        whereParam = req.getParameter("where");
+                       String        orderParam = req.getParameter("order");
+
+                       theList = ((ModuleContent)mainModule).getContent(whereParam, orderParam, offset, user);
+                       _list(theList, req, res);
+               }       catch (ModuleException e) {
+                       throw new ServletModuleException(e.toString());
+               }
+       }
+
+       public void listop(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               try {
+                       EntityUsers user = _getUser(req);
+                       EntityList   theList;
+                       String       offsetParam = req.getParameter("offset");
+                       int          offset =0;
+
+                       String whereParam = req.getParameter("where");
+
+                       if (whereParam==null) whereParam = "to_article_type='0'";
+
+                       // hier offsetcode bearbeiteb
+                       if (offsetParam != null && !offsetParam.equals(""))
+                                       offset = Integer.parseInt(offsetParam);
+
+                       if (req.getParameter("next") != null)
+                                       offset=Integer.parseInt(req.getParameter("nextoffset"));
+                       else
+                                       if (req.getParameter("prev") != null)
+                                               offset = Integer.parseInt(req.getParameter("prevoffset"));
+
+                       String orderParam = req.getParameter("order");
+
+                       theList = ((ModuleContent)mainModule).getContent(whereParam, orderParam, offset, user);
+                       _list(theList, req, res);
+               }       catch (ModuleException e) {
+                       throw new ServletModuleException(e.toString());
+               }
+       }
+
+
+       public void search(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException {
+               try {
+                       EntityUsers   user = _getUser(req);
+                       EntityList    theList;
+                       String        fieldParam = req.getParameter("field");
+                       String        fieldValueParam = req.getParameter("fieldvalue");
+                       String        orderParam = req.getParameter("order");
+
+                       theList = ((ModuleContent)mainModule).getContentByField(fieldParam, fieldValueParam, orderParam, 0, user);
+                       _list(theList, req, res);
+               } catch (ModuleException e) {
+                       throw new ServletModuleException(e.toString());
+               }
+       }
+
+       public void add(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException {
+
+               EntityUsers   user = _getUser(req);
+               SimpleHash mergeData = new SimpleHash();
+               mergeData.put("new", "1");
+               mergeData.put("is_published", "1");
+               String now = StringUtil.date2webdbDate(new GregorianCalendar());
+               mergeData.put("date", new SimpleScalar(now));
+               mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+               mergeData.put("gruppenPopupData", gruppenModule.getGruppenAsSimpleList());
+               try {
+                       mergeData.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
+               } catch (Exception e) {theLog.printError("articletype could not be fetched.");}
+               //mergeData.put("gruppenHashData", gruppenModule.getHashData());
+               mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
+               mergeData.put("login_user", HTMLTemplateProcessor.makeSimpleHash(user));
+               deliver(req, res, mergeData, templateObjektString);
+       }
+
+
+       public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               //theLog.printDebugInfo(":: content :: trying to insert");
+               try {
+                       EntityUsers   user = _getUser(req);
+                       HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
+                       //theLog.printDebugInfo(":: content :: got intersecting values");
+                       String now = StringUtil.date2webdbDate(new GregorianCalendar());
+                       withValues.put("date", now);
+                       withValues.put("publish_path", StringUtil.webdbDate2path(now));
+                       withValues.put("to_publisher", user.getId());
+                       withValues.put("is_produced", "0");
+                       if (!withValues.containsKey("is_published"))
+                               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");
+                       String id = mainModule.add(withValues);
+                       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameter("to_topic"));
+                       //theLog.printDebugInfo(":: content :: inserted");
+                       _showObject(id, req, res);
+               }
+               catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
+               catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+       }
+
+       public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+
+               EntityUsers   user = _getUser(req);
+               // hier pruefen ob dem akt. user loeschen erlaubt ist...
+               String idParam = req.getParameter("id");
+               if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+
+               String confirmParam = req.getParameter("confirm");
+               String cancelParam = req.getParameter("cancel");
+
+               if (confirmParam == null && cancelParam == null) {
+                       // HTML Ausgabe zum Confirmen!
+                       SimpleHash mergeData = new SimpleHash();
+                       mergeData.put("module", "Content");
+                       mergeData.put("infoString", "Content: " + idParam);
+                       mergeData.put("id", idParam);
+                       mergeData.put("where", req.getParameter("where"));
+                       mergeData.put("order", req.getParameter("order"));
+                       mergeData.put("offset", req.getParameter("offset"));
+                       deliver(req, res, mergeData, templateConfirmString);
+               }
+               else {
+                       if (confirmParam!= null && !confirmParam.equals("")) {
+                               try {
+                                       mainModule.deleteById(idParam);
+                                       //delete rows in the content_x_topic-table
+                                       DatabaseContentToTopics.getInstance().deleteByContentId(idParam);
+                                       //delete rows in the comment-table
+                                       DatabaseComment.getInstance().deleteByContentId(idParam);
+                               } catch (ModuleException e) {
+                                       throw new ServletModuleException(e.toString());
+                               } catch (StorageObjectException e) {
+                                       throw new ServletModuleException(e.toString());
+                               }
+                               list(req,res);
+                       }
+                       else {
+                               // Datensatz anzeigen
+                               _showObject(idParam, req, res);
+                       }
+               }
+       }
+
+       public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String        idParam = req.getParameter("id");
+               if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+               _showObject(idParam, req, res);
+       }
+
+       // methods for attaching media file
+       public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String  mediaIdParam = req.getParameter("mid");
+               String  idParam = req.getParameter("cid");
+               if (idParam == null||mediaIdParam==null) throw new ServletModuleException("smod content :: attach :: cid/mid missing");
+               try {
+                       EntityContent entContent = (EntityContent)mainModule.getById(idParam);
+                       entContent.attach(mediaIdParam);
+               }
+               catch(ModuleException e) {
+                       theLog.printError("smod content :: attach :: could not get entityContent");
+               }
+               _showObject(idParam, req, res);
+       }
+
+       public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String  idParam = req.getParameter("cid");
+               if (idParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");
+               try {
+                       EntityContent entContent = (EntityContent)mainModule.getById(idParam);
+                       entContent.dettach();
+               }
+               catch(ModuleException e) {
+                       theLog.printError("smod content :: dettach :: could not get entityContent");
+               }
+               _showObject(idParam, req, res);
+       }
+
+       public void newswire(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String  idParam = req.getParameter("id");
+               if (idParam == null) throw new ServletModuleException("smod content :: newswire :: id missing");
+               try {
+                       EntityContent entContent = (EntityContent)mainModule.getById(idParam);
+                       entContent.newswire();
+               }
+               catch(ModuleException e) {
+                       theLog.printError("smod content :: newswire :: could not get entityContent");
+               }
+               list(req, res);
+       }
+
+
+       public void update(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               try {
+
+                       EntityUsers   user = _getUser(req);
+                       if (user==null) theLog.printDebugInfo("user null!");
+                       String idParam = req.getParameter("id");
+                       if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+
+                       HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
+                       String topic_id = req.getParameter("to_topic");
+                       String content_id = req.getParameter("id");
+                       // withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
+                       if(user != null) withValues.put("user_id", user.getId());
+                       withValues.put("is_produced", "0");
+                       if (!withValues.containsKey("is_published"))
+                               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");
+                       //theLog.printDebugInfo("updating. ");
+                       String id = mainModule.set(withValues);
+                       DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),req.getParameter("to_topic"));
+                       //theLog.printDebugInfo("update done. ");
+                       String whereParam = req.getParameter("where");
+                       String orderParam = req.getParameter("order");
+                       if ((whereParam!=null && !whereParam.equals("")) || (orderParam!=null && !orderParam.equals(""))){
+                               //theLog.printDebugInfo("update to list");
+                               list(req,res);
+                       }
+                       else
+                               _showObject(idParam, req, res);
+               }
+               catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
+               catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+       }
+
+       //
+       // Hilfsmethoden
+
+       private void _showObject(String id, HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException {
+
+               try {
+                       EntityContent entContent=(EntityContent)mainModule.getById(id);
+                       SimpleHash mergeData =  HTMLTemplateProcessor.makeSimpleHash(entContent);
+                       EntityList topicToContent = DatabaseContentToTopics.getInstance().getTopics(entContent);
+                       if (topicToContent!=null && topicToContent.size()>0){
+                               Entity topics = (EntityTopics)topicToContent.elementAt(0);
+                               mergeData.put("to_topic",topics.getId());
+                       }
+                       //obsolete, because of psqgl 7.1.x
+      //mergeData.put("content_data", entContent.getContentData());
+                       mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+                       mergeData.put("gruppenPopupData", gruppenModule.getGruppenAsSimpleList());
+                       try {
+                               mergeData.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
+                       } catch (Exception e) {theLog.printError("articletype could not be fetched.");}
+
+                       // get the images
+                       String currentMediaId = entContent.getValue("to_media");
+                       SimpleHash imageHash = new SimpleHash();
+                       if (currentMediaId!=null && !currentMediaId.equals("")) {
+                               imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+                               mergeData.put("images", imageHash);
+                       }
+
+
+                       //mergeData.put("gruppenHashData", gruppenModule.getHashData());
+                       mergeData.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", HTMLTemplateProcessor.makeSimpleHash(_getUser(req)));
+                       deliver(req, res, mergeData, templateObjektString);
+               }
+               catch (Exception e) { throw new ServletModuleException(e.toString());}
+       }
+
+
+       public void _list(EntityList theList, HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException {
+
+               try {
+                       // hier dann htmlcode rausschreiben
+                       if (theList == null || theList.getCount() == 0 || theList.getCount()>1) {
+                               SimpleHash modelRoot = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(theList);
+                               modelRoot.put("themenHashData", themenModule.getHashData());
+                               modelRoot.put("schwerpunktHashData", schwerpunktModule.getHashData());
+                               modelRoot.put("gruppenHashData", gruppenModule.getHashData());
+                               modelRoot.put("articletypeHash", DatabaseArticleType.getInstance().getHashData());
+                               deliver(req, res, modelRoot, templateListString);
+                       } else  { // count = 1
+                               _showObject(theList.elementAt(0).getId(),req,res);
+                       }
+               } catch (StorageObjectException e) {
+                       throw new ServletModuleException(e.toString());
+               }
+       }
+
+       public void _listop(EntityList theList, HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException {
+
+               try {
+                       // hier dann htmlcode rausschreiben
+                       if (theList == null || theList.getCount() == 0 || theList.getCount()>1) {
+                               SimpleHash modelRoot = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(theList);
+                               modelRoot.put("articletypeHash", DatabaseArticleType.getInstance().getHashData());
+                               modelRoot.put("gruppenHashData", gruppenModule.getHashData());
+                               deliver(req, res, modelRoot, templateListString);
+                       } else  { // count = 1
+                               _showObject(theList.elementAt(0).getId(), req, res);
+                       }
+               } catch (StorageObjectException e) {
+                       throw new ServletModuleException(e.toString());
+               }
+       }
+
+       private EntityUsers _getUser(HttpServletRequest req)
+       {
+               HttpSession session=req.getSession(false);
+               return (EntityUsers)session.getAttribute("login.uid");
+       }
+
+
+}
+
diff --git a/source/mircoders/servlet/ServletModuleGroups.java b/source/mircoders/servlet/ServletModuleGroups.java
new file mode 100755 (executable)
index 0000000..ab895cb
--- /dev/null
@@ -0,0 +1,48 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleGruppen -
+ *  liefert HTML fuer Gruppen
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleGroups extends ServletModule
+{
+
+  // Singelton / Kontruktor
+
+  private static ServletModuleGroups instance = new ServletModuleGroups();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleGroups() {
+       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Gruppen.Logfile"));
+       templateListString = Configuration.getProperty("ServletModule.Gruppen.ListTemplate");
+       templateObjektString = Configuration.getProperty("ServletModule.Gruppen.ObjektTemplate");
+       templateConfirmString = Configuration.getProperty("ServletModule.Gruppen.ConfirmTemplate");
+        try {
+          mainModule = new ModuleGruppen(DatabaseGroups.getInstance());
+        }
+        catch (StorageObjectException e) {
+          theLog.printDebugInfo("servletmodulegruppen konnte nicht initialisiert werden");
+        }
+  }
+
+}
diff --git a/source/mircoders/servlet/ServletModuleImages.java b/source/mircoders/servlet/ServletModuleImages.java
new file mode 100755 (executable)
index 0000000..8159cc4
--- /dev/null
@@ -0,0 +1,328 @@
+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 com.oreilly.servlet.multipart.*;
+import com.oreilly.servlet.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleBilder -
+ *  liefert HTML fuer Bilder
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleImages extends webdb.servlet.ServletModule
+{
+
+       private static ModuleMediafolder mediafolderModule;
+       private static DatabaseRights dbRights;
+       private static DatabaseImageFormat dbImageFormat;
+       private static DatabaseImageType dbImageType;
+       private static DatabaseImageColor dbImageColor;
+       private static DatabaseImageLayout dbImageLayout;
+
+       // Singelton / Kontruktor
+       private static ServletModuleImages instance = new ServletModuleImages();
+       public static ServletModule getInstance() { return instance; }
+
+
+       private ServletModuleImages() {
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Bilder.Logfile"));
+               templateListString = Configuration.getProperty("ServletModule.Bilder.ListTemplate");
+               templateObjektString = Configuration.getProperty("ServletModule.Bilder.ObjektTemplate");
+               templateConfirmString = Configuration.getProperty("ServletModule.Bilder.ConfirmTemplate");
+               try {
+                       mainModule = new ModuleImages(DatabaseImages.getInstance());
+                       mediafolderModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
+                       dbRights = DatabaseRights.getInstance();
+                       dbImageFormat = DatabaseImageFormat.getInstance();
+                       dbImageColor = DatabaseImageColor.getInstance();
+                       dbImageType = DatabaseImageType.getInstance();
+                       dbImageLayout = DatabaseImageLayout.getInstance();
+               }
+               catch (StorageObjectException e) {
+                       theLog.printDebugInfo("servletmodulebilder konnte nicht initialisiert werden");
+               }
+       }
+
+
+       public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               try {
+                       WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+                       HashMap parameters = mp.getParameters();
+                       byte[] imageData=mp.getMedia();
+                       String fileName=mp.getFilename();
+
+                       EntityUsers   user = _getUser(req);
+                       parameters.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+                       parameters.put("to_publisher", user.getId());
+                       parameters.put("is_produced", "0");
+                       if (!parameters.containsKey("is_published"))
+                               parameters.put("is_published","0");
+
+                       String id = mainModule.add(parameters);
+                       EntityImage entImage = (EntityImage)mainModule.getById(id);
+
+                       if (imageData!=null && fileName!=null) {
+                               int fileType = -1;
+                               if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
+                               if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
+                               if (fileType>=0)
+                                       entImage.setImage(imageData, fileType);
+                               else
+                                       theLog.printError("Wrong file uploaded!");
+                       }
+                       _edit(id, req, res);
+               }
+               catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+               catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+
+       }
+
+       public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+
+               try {
+                       WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+                       HashMap parameters = mp.getParameters();
+                       byte[] imageData=mp.getMedia();
+                       String fileName=mp.getFilename();
+
+                       EntityUsers   user = _getUser(req);
+                       parameters.put("to_publisher", user.getId());
+                       parameters.put("is_produced", "0");
+                       if (!parameters.containsKey("is_published"))
+                               parameters.put("is_published","0");
+
+                       String id = mainModule.set(parameters);
+                       EntityImage entImage = (EntityImage)mainModule.getById(id);
+
+                       if (imageData!=null && fileName!=null) {
+                               int fileType = -1;
+                               if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
+                               if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
+                               if (fileType>=0)
+                                       entImage.setImage(imageData, fileType);
+                               else
+                                       theLog.printError("Wrong file uploaded!");
+                       }
+                       _edit(id, req, res);
+               }
+               catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+               catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+
+       }
+
+
+       public void showimg(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               String idParam = req.getParameter("id");
+               if (idParam!=null && !idParam.equals("")) {
+                       try {
+                               EntityImage entImage =(EntityImage)mainModule.getById(idParam);
+                               res.setContentType("image/jpeg"); // testweise
+                               ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
+
+                               byte[] outbytes = entImage.getImage();
+                               out.write(outbytes);
+                               out.close();
+                       }
+
+                       catch (IOException e) {throw new ServletModuleException(e.toString());}
+                       catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+                       catch (Exception e) {throw new ServletModuleException(e.toString());}
+               }
+               else theLog.printDebugInfo("id nicht angeben.");
+               // darf keine exception werfen
+       }
+
+       public void showicon(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               String idParam = req.getParameter("id");
+               if (idParam!=null && !idParam.equals("")) {
+                       try {
+                               EntityImage entImage =(EntityImage)mainModule.getById(idParam);
+                               res.setContentType("image/jpeg"); // testweise
+                               ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
+
+                               byte[] outbytes = entImage.getIcon();
+                               out.write(outbytes);
+                               out.close();
+                       }
+
+                       catch (IOException e) {throw new ServletModuleException(e.toString());}
+                       catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+                       catch (Exception e) {throw new ServletModuleException(e.toString());}
+               }
+               else throw new ServletModuleException("id nicht angeben.");
+       }
+
+       public void list(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+                       // Parameter auswerten
+                       SimpleHash mergeData = new SimpleHash();
+                       String query_text = req.getParameter("query_text");
+                       mergeData.put("query_text",query_text);
+                       if (query_text!=null) mergeData.put("query_text_encoded",URLEncoder.encode(query_text));
+                       String query_field = req.getParameter("query_field");
+                       mergeData.put("query_field",query_field);
+                       String query_is_published = req.getParameter("query_is_published");
+                       mergeData.put("query_is_published",query_is_published);
+                       String query_media_folder = req.getParameter("query_media_folder");
+                       mergeData.put("query_media_folder",query_media_folder);
+                       String offset = req.getParameter("offset");
+                       if (offset==null || offset.equals("")) offset="0";
+                       mergeData.put("offset",offset);
+
+                       String order = req.getParameter("order");
+                       if (order==null) order="webdb_lastchange desc";
+
+                       // if in connection mode to content
+                       String cid = req.getParameter("cid");
+                       mergeData.put("cid",cid);
+
+
+                       // sql basteln
+                       String whereClause=""; boolean isFirst=true;
+                       if (query_text!=null && !query_text.equalsIgnoreCase("")) {
+                               whereClause += "lower("+query_field+") like lower('%"+query_text+"%')"; isFirst=false;}
+                       if (query_is_published != null && !query_is_published.equals("")) {
+                               if (isFirst==false) whereClause+=" and ";
+                               whereClause += "is_published='"+query_is_published+"'";
+                               isFirst=false;
+                       }
+                       if (query_media_folder != null && !query_media_folder.equals("")) {
+                               if (isFirst==false) whereClause+=" and ";
+                               whereClause += "to_media_folder='"+query_media_folder+"'";
+                       }
+                       //theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
+
+                       // fetch und ausliefern
+                       try {
+                               mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+                               mergeData.put("mediafolderHashdata", mediafolderModule.getHashData());
+                               if (query_text!=null || query_is_published!=null || query_media_folder!=null) {
+                                       EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue(),10);
+                                       if (theList != null) {
+                                               mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+                                               if(theList.getOrder()!=null) {
+                                                       mergeData.put("order", theList.getOrder());
+                                                       mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
+                                               }
+                                               mergeData.put("count", (new Integer(theList.getCount())).toString());
+                                               mergeData.put("from", (new Integer(theList.getFrom())).toString());
+                                               mergeData.put("to", (new Integer(theList.getTo())).toString());
+                                               if (theList.hasNextBatch())
+                                                       mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+                                               if (theList.hasPrevBatch())
+                                                       mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+                                       }
+                               }
+                               // raus damit
+                               HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
+                       }
+                       catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+                       catch (IOException e) {throw new ServletModuleException(e.toString());}
+                       catch (Exception e) {throw new ServletModuleException(e.toString());}
+       }
+
+
+       public void add(HttpServletRequest req, HttpServletResponse res)
+       throws ServletModuleException
+       {
+               try {
+                       SimpleHash mergeData = new SimpleHash();
+                       mergeData.put("new", "1");
+                       mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+                       deliver(req, res, mergeData, templateObjektString);
+               }
+               catch (Exception e) { throw new ServletModuleException(e.toString());}
+       }
+
+       public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String        idParam = req.getParameter("id");
+               _edit(idParam, req, res);
+       }
+
+       private void _edit(String idParam, HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
+               if (idParam!=null && !idParam.equals("")) {
+                       try {
+                               SimpleHash mergeData =  HTMLTemplateProcessor.makeSimpleHash(mainModule.getById(idParam));
+                               mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+                               mergeData.put("rightsHashdata", dbRights.getHashData());
+                               mergeData.put("imgformatHashdata", dbImageFormat.getHashData());
+                               mergeData.put("imgcolorHashdata", dbImageColor.getHashData());
+                               mergeData.put("imgtypeHashdata", dbImageType.getHashData());
+                               mergeData.put("imglayoutHashdata", dbImageLayout.getHashData());
+                               deliver(req, res, mergeData, templateObjektString);
+                       }
+                       catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+               }
+               else throw new ServletModuleException("ServletmoduleImage :: _edit without id");
+       }
+
+
+       /** @todo should be in ServletModule.java */
+       private EntityUsers _getUser(HttpServletRequest req)
+       {
+               HttpSession session=req.getSession(false);
+               return (EntityUsers)session.getAttribute("login.uid");
+       }
+
+
+       // deprecated
+       public void upload(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               //theLog.printDebugInfo("-- trying to upload");
+               String idParam = req.getParameter("id");
+               if (idParam!=null && !idParam.equals("")) {
+                       try {
+
+                               WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+                               HashMap withValues = mp.getParameters();
+                               byte[] imageData=mp.getMedia();
+                               String fileName=mp.getFilename();
+
+                               int fileType = -1;
+                               if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
+                               if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
+                               if (fileType>=0) {
+                                       EntityImage entImage = (EntityImage)mainModule.getById(idParam);
+                                       entImage.setImage(imageData, fileType);
+                               }
+                               else
+                                       theLog.printError("Wrong file uploaded!");
+                       }
+                       catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+                       catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+               }
+               else // keine id
+                       throw new ServletModuleException("Keine id angegeben");
+               edit(req,res);
+       }
+
+
+}
diff --git a/source/mircoders/servlet/ServletModuleMediafolder.java b/source/mircoders/servlet/ServletModuleMediafolder.java
new file mode 100755 (executable)
index 0000000..711ad3c
--- /dev/null
@@ -0,0 +1,51 @@
+package mircoders.servlet;
+
+/**
+ * Title:        Mir
+ * Description:  liefert Webseiten zur Verwaltung von Mediafoldern aus.
+ * @author       rk
+ * @version      02
+ */
+
+import java.util.*;
+import javax.servlet.http.*;
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.misc.*;
+import webdb.storage.*;
+import mir.storage.*;
+import mir.module.*;
+
+
+public class ServletModuleMediafolder extends ServletModule
+{
+
+       // Singelton / Kontruktor
+       public static ServletModule getInstance() { return instance; }
+       private static ServletModuleMediafolder instance = new ServletModuleMediafolder();
+
+       private ServletModuleMediafolder() {
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Mediafolder.Logfile"));
+               templateListString = Configuration.getProperty("ServletModule.Mediafolder.ListTemplate");
+               templateObjektString = Configuration.getProperty("ServletModule.Mediafolder.ObjektTemplate");
+               templateConfirmString = Configuration.getProperty("ServletModule.Mediafolder.ConfirmTemplate");
+               try {
+                       mainModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
+               }
+               catch (StorageObjectException e) {
+                       theLog.printDebugInfo("ServletModuleMediafolder konnte nicht initialisiert werden");
+               }
+       }
+
+       public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+                       SimpleHash mergeData = new SimpleHash();
+                       mergeData.put("new", "1");
+                       String now = StringUtil.date2webdbDate(new GregorianCalendar());
+                       // date auf now
+                       mergeData.put("date", new SimpleScalar(now));
+                       deliver(req, res, mergeData, templateObjektString);
+       }
+
+}
\ No newline at end of file
diff --git a/source/mircoders/servlet/ServletModuleMessage.java b/source/mircoders/servlet/ServletModuleMessage.java
new file mode 100755 (executable)
index 0000000..b065a91
--- /dev/null
@@ -0,0 +1,80 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.net.*;
+import javax.servlet.http.*;
+import javax.servlet.*;
+import freemarker.template.*;
+import webdb.servlet.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+import webdb.module.*;
+import mir.module.*;
+import mir.storage.*;
+
+/**
+ * Title:    ServletModuleMessage
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+
+public class ServletModuleMessage extends ServletModule
+{
+
+       // Singelton / Kontruktor
+
+       private static ServletModuleMessage instance = new ServletModuleMessage();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleMessage() {
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Messages.Logfile"));
+               templateListString = Configuration.getProperty("ServletModule.Messages.ListTemplate");
+               templateObjektString = Configuration.getProperty("ServletModule.Messages.ObjektTemplate");
+               templateConfirmString = Configuration.getProperty("ServletModule.Messages.ConfirmTemplate");
+               try {
+                       mainModule = new ModuleMessage(DatabaseMessages.getInstance());
+               }
+               catch (StorageObjectException e) {
+                       theLog.printDebugInfo("ServletModuleMessage konnte nicht initialisiert werden");
+               }
+       }
+
+       public void list(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               // fetch and deliver
+               try {
+                       SimpleHash mergeData = new SimpleHash();
+                       String offset = req.getParameter("offset");
+                       if (offset==null || offset.equals("")) offset="0";
+                       mergeData.put("offset",offset);
+                       EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
+                       mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+                       if(theList.getOrder()!=null) {
+                               mergeData.put("order", theList.getOrder());
+                               mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
+                       }
+                       mergeData.put("count", (new Integer(theList.getCount())).toString());
+                       mergeData.put("from", (new Integer(theList.getFrom())).toString());
+                       mergeData.put("to", (new Integer(theList.getTo())).toString());
+                       if (theList.hasNextBatch())
+                               mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+                       if (theList.hasPrevBatch())
+                               mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+
+                       // raus damit
+                       HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
+
+               }
+               catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+               catch (IOException e) {throw new ServletModuleException(e.toString());}
+               catch (Exception e) {throw new ServletModuleException(e.toString());}
+       }
+
+
+}
diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java
new file mode 100755 (executable)
index 0000000..6452a7e
--- /dev/null
@@ -0,0 +1,221 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+import com.oreilly.servlet.multipart.*;
+import com.oreilly.servlet.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+import mir.producer.*;
+
+/*
+ *  ServletModuleOpenIndy -
+ *   is the open-access-servlet, which is responsible for
+ *    adding comments to articles &
+ *    open-postings to the newswire
+ *
+ * @author RK
+ */
+
+public class ServletModuleOpenIndy extends ServletModule
+{
+
+       private String          commentFormTemplate, commentFormDoneTemplate;
+       private String          postingFormTemplate, postingFormDoneTemplate;
+       private ModuleContent   contentModule;
+       private ModuleImages     imageModule;
+
+       // Singelton / Kontruktor
+       private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleOpenIndy() {
+               try {
+                       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.OpenIndy.Logfile"));
+                       commentFormTemplate = Configuration.getProperty("ServletModule.OpenIndy.CommentTemplate");
+                       commentFormDoneTemplate = Configuration.getProperty("ServletModule.OpenIndy.CommentDoneTemplate");
+                       postingFormTemplate = Configuration.getProperty("ServletModule.OpenIndy.PostingTemplate");
+                       postingFormDoneTemplate = Configuration.getProperty("ServletModule.OpenIndy.PostingDoneTemplate");
+
+                       mainModule = new ModuleComment(DatabaseComment.getInstance());
+                       contentModule = new ModuleContent(DatabaseContent.getInstance());
+                       imageModule = new ModuleImages(DatabaseImages.getInstance());
+      defaultAction="addposting";
+               }
+               catch (StorageObjectException e) {
+                               theLog.printError("servletmoduleopenindy could not be initialized");
+               }
+       }
+
+
+       /**
+        *  Method for making a comment
+        */
+
+       public void addcomment(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String aid = req.getParameter("aid"); // the article id the comment will belong to
+               if (aid!=null && !aid.equals(""))
+               {
+                       SimpleHash mergeData = new SimpleHash();
+                       // ok, article
+                       mergeData.put("aid", aid);
+                       deliver(req, res, mergeData, commentFormTemplate);
+               }
+               else throw new ServletModuleException("aid not set!");
+       }
+
+       /**
+        *  Method for inserting a comment into the Database and delivering
+        *  the commentDone Page
+        */
+
+       public void inscomment(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String aid = req.getParameter("to_media"); // the article id the comment will belong to
+               if (aid!=null && !aid.equals(""))
+               {
+                       // ok, collecting data from form
+                       try {
+                               HashMap withValues = getIntersectingValues(req, DatabaseComment.getInstance());
+                               withValues.put("is_published","1");
+
+                               // inserting into database
+                               String id = mainModule.add(withValues);
+
+                               // producing new page
+                               new ProducerContent().handle(null, null, true, false, aid);
+
+                               // sync the server
+                               int exitValue = Helper.rsync();
+
+                               // redirecting to url
+                               // should implement back to article
+                               SimpleHash mergeData = new SimpleHash();
+                               deliver(req, res, mergeData, commentFormDoneTemplate);
+                       }
+                       catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
+                       catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+
+               }
+               else throw new ServletModuleException("aid not set!");
+
+       }
+
+       /**
+        *  Method for delivering the form-Page for open posting
+        */
+
+       public void addposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               SimpleHash mergeData = new SimpleHash();
+               /** @todo popups missing */
+               deliver(req, res, mergeData, postingFormTemplate);
+       }
+
+       /**
+        *  Method for inserting an open posting into the Database and delivering
+        *  the postingDone Page
+        */
+
+       public void insposting(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               SimpleHash mergeData = new SimpleHash();
+
+               try {
+
+                       WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+                       HashMap withValues = mp.getParameters();
+                       byte[] mediaData=mp.getMedia();
+                       String fileName=mp.getFilename();
+
+                       // if op contains imagedata
+                       String mediaId=null;
+                       if (mediaData!=null && fileName!=null) {
+                               HashMap mediaValues = new HashMap();
+                               mediaValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+                               mediaValues.put("to_publisher", "1"); // op user
+                               mediaValues.put("to_media_folder", "7"); // op media_folder
+                               mediaValues.put("is_produced", "0");
+                               mediaValues.put("is_published","1");
+
+                               String mediaTitle=(String)withValues.get("media_title");
+                               if (mediaTitle==null)
+                                       mediaTitle = (String)withValues.get("title");
+                               mediaValues.put("title",mediaTitle);
+
+                               if (fileName.toLowerCase().endsWith("rm")) {
+                                       // this is video !!
+                                       //theLog.printDebugInfo("--GOT VIDEO");
+                                       EntityVideo entVideo = new EntityVideo(DatabaseVideos.getInstance());
+                                       entVideo.setValues(mediaValues);
+                                       mediaId = entVideo.insert();
+                                       entVideo.setVideoData(mediaData);
+                               }
+                               else if (fileName.toLowerCase().endsWith(".jpg") || fileName.toLowerCase().endsWith(".gif")) {
+                                       // this is image !!
+                                       mediaId = imageModule.add(mediaValues);
+                                       EntityImage entImage = (EntityImage)imageModule.getById(mediaId);
+
+                                       int fileType = -1;
+                                       if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
+                                       if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
+                                       if (fileType>=0) {
+                                               entImage.setImage(mediaData, fileType);
+                                               withValues.put("to_media",mediaId);
+                                       }
+                                       else
+                                               theLog.printDebugInfo("Wrong file uploaded!" + fileName);
+                               }
+                       }
+
+                       withValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+                       withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
+                       withValues.put("is_produced", "0");
+                       // op-articles are immediatly published
+                       withValues.put("is_published","1");
+                       // owner is openposting user
+                       withValues.put("to_publisher","1");
+      if (withValues.get("creator").toString().equals(""))
+                               withValues.put("creator","Anonym");
+
+                       // inserting  content into database
+                       String id = contentModule.add(withValues);
+
+
+                       // producing new page
+                       if(mediaId!=null){
+                               new ProducerImages().handle(null, null, false, false, mediaId);
+                       }
+                       // producing openpostinglist
+                       new ProducerOpenPosting().handle(null,null,false,false);
+                       // producing new page
+                       new ProducerContent().handle(null, null, false, false,id);
+
+                       // sync the server
+                       int exitValue = Helper.rsync();
+
+               }
+               catch (IOException e) { throw new ServletModuleException(e.toString());}
+               catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
+               catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+
+               deliver(req, res, mergeData, postingFormDoneTemplate);
+       }
+
+}
+
diff --git a/source/mircoders/servlet/ServletModuleProducer.java b/source/mircoders/servlet/ServletModuleProducer.java
new file mode 100755 (executable)
index 0000000..30957ed
--- /dev/null
@@ -0,0 +1,70 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.misc.*;
+
+import mir.producer.*;
+import mir.entity.*;
+
+/* Verteilerservlet, dass je nach Parameter task die Klasse Producer"TASK"
+ * ueber die Methode handle(); aufruft
+ *
+ * @author RK
+ */
+
+public class ServletModuleProducer extends ServletModule
+{
+
+       private static ServletModuleProducer instance = new ServletModuleProducer();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleProducer() {
+               theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Producer.Logfile"));
+               defaultAction="produce";
+       }
+
+
+       public void produce(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               try {
+                       PrintWriter out = res.getWriter();
+                       String taskParam = req.getParameter("task");
+                       String forcedParam = req.getParameter("forced");
+      String syncParam = req.getParameter("sync");
+                       theLog.printInfo("Starting Task: " + taskParam);
+                       if (taskParam == null) {
+                               throw new ServletModuleException("Kein Task angegeben!");
+                       } else {
+        Class producerModule = Class.forName("mir.producer.Producer" + taskParam);
+        Producer producer = (Producer)producerModule.newInstance();
+        HttpSession session=req.getSession(false);
+                               EntityUsers user = (EntityUsers)session.getAttribute("login.uid");
+
+        if (forcedParam!=null && !forcedParam.equals("")) {
+          if (syncParam!=null && !syncParam.equals("")) {
+            producer.handle(out, user, true, true);
+          } else {
+            producer.handle(out, user, true,false);
+          }
+                               } else {
+                                       producer.handle(out, user, false,false);
+        }
+
+                       }
+               }
+               catch (Exception e) {
+      throw new ServletModuleException(e.toString());
+    }
+       }
+
+
+}
diff --git a/source/mircoders/servlet/ServletModuleSchwerpunkt.java b/source/mircoders/servlet/ServletModuleSchwerpunkt.java
new file mode 100755 (executable)
index 0000000..234be0a
--- /dev/null
@@ -0,0 +1,47 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleSchwerpunkt -
+ *  liefert HTML fuer Schwerpunkt
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleSchwerpunkt extends ServletModule
+{
+   // Singelton / Kontruktor
+  private static ServletModuleSchwerpunkt instance = new ServletModuleSchwerpunkt();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleSchwerpunkt() {
+       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Schwerpunkt.Logfile"));
+       templateListString = Configuration.getProperty("ServletModule.Schwerpunkt.ListTemplate");
+       templateObjektString = Configuration.getProperty("ServletModule.Schwerpunkt.ObjektTemplate");
+       templateConfirmString = Configuration.getProperty("ServletModule.Schwerpunkt.ConfirmTemplate");
+        try {
+          mainModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
+        }
+        catch (StorageObjectException e) {
+          theLog.printDebugInfo("servletmodulethemen konnte nicht initialisiert werden");
+        }
+  }
+}
diff --git a/source/mircoders/servlet/ServletModuleTopics.java b/source/mircoders/servlet/ServletModuleTopics.java
new file mode 100755 (executable)
index 0000000..3df42f0
--- /dev/null
@@ -0,0 +1,45 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleThemen -
+ *  liefert HTML fuer Themen
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleTopics extends ServletModule
+{
+
+  // Singelton / Kontruktor
+  private static ServletModuleTopics instance = new ServletModuleTopics();
+  public static ServletModule getInstance() { return instance; }
+
+  private ServletModuleTopics() {
+         theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Themen.Logfile"));
+    templateListString = Configuration.getProperty("ServletModule.Themen.ListTemplate");
+         templateObjektString = Configuration.getProperty("ServletModule.Themen.ObjektTemplate");
+         templateConfirmString = Configuration.getProperty("ServletModule.Themen.ConfirmTemplate");
+    try {
+      mainModule = new ModuleTopics(DatabaseTopics.getInstance());
+    } catch (StorageObjectException e) {
+      theLog.printDebugInfo("servletmoduletopics konnte nicht initialisiert werden");
+    }
+  }
+}
diff --git a/source/mircoders/servlet/ServletModuleUsers.java b/source/mircoders/servlet/ServletModuleUsers.java
new file mode 100755 (executable)
index 0000000..163f674
--- /dev/null
@@ -0,0 +1,82 @@
+package mircoders.servlet;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import freemarker.template.*;
+
+import webdb.servlet.*;
+import webdb.module.*;
+import webdb.misc.*;
+import webdb.entity.*;
+import webdb.storage.*;
+
+import mir.entity.*;
+import mir.storage.*;
+import mir.module.*;
+
+/*
+ *  ServletModuleUsers -
+ *  liefert HTML fuer Users
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleUsers extends webdb.servlet.ServletModule
+{
+       // Singelton / Kontruktor
+       private static ServletModuleUsers instance = new ServletModuleUsers();
+       public static ServletModule getInstance() { return instance; }
+
+       private ServletModuleUsers() {
+       theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Users.Logfile"));
+       templateListString = Configuration.getProperty("ServletModule.Users.ListTemplate");
+       templateObjektString = Configuration.getProperty("ServletModule.Users.ObjektTemplate");
+       templateConfirmString = Configuration.getProperty("ServletModule.Users.ConfirmTemplate");
+                               try {
+                                       mainModule = new ModuleUsers(DatabaseUsers.getInstance());
+                               }
+                               catch (StorageObjectException e) {
+                                       theLog.printDebugInfo("servletmoduleusers konnte nicht initialisiert werden");
+                               }
+       }
+
+       public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+       {
+               String        idParam = req.getParameter("id");
+               if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+                try {
+                       //theLog.printInfo("Showing User with id: " + idParam);
+                       SimpleHash mergeData =  HTMLTemplateProcessor.makeSimpleHash(mainModule.getById(idParam));
+                       deliver(req, res, mergeData, templateObjektString);
+               }
+               catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+       }
+
+       public void add(HttpServletRequest req, HttpServletResponse res)
+               throws ServletModuleException
+       {
+               try {
+                       SimpleHash mergeData = new SimpleHash();
+                       mergeData.put("new", "1");
+                       deliver(req, res, mergeData, templateObjektString);
+               }
+               catch (Exception e) { throw new ServletModuleException(e.toString());}
+       }
+
+ public void insert(HttpServletRequest req, HttpServletResponse res)
+       throws ServletModuleException
+       {
+               try {
+                       HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
+                       String id = mainModule.add(withValues);
+                       SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(mainModule.getById(id));
+                       deliver(req, res, mergeData, templateObjektString);
+               }
+               catch (Exception e) { throw new ServletModuleException(e.toString());}
+       }
+}
diff --git a/source/mircoders/storage/DatabaseArticleType.java b/source/mircoders/storage/DatabaseArticleType.java
new file mode 100755 (executable)
index 0000000..e7119e7
--- /dev/null
@@ -0,0 +1,50 @@
+package mircoders.storage;
+
+/**
+ * Title:
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+
+public class DatabaseArticleType extends Database implements StorageObject{
+
+       private static DatabaseArticleType instance;
+       private static SimpleList articletypePopupData;
+
+       public static DatabaseArticleType getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseArticleType();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseArticleType() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="article_type";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityArticleType");      }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",false); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseBreaking.java b/source/mircoders/storage/DatabaseBreaking.java
new file mode 100755 (executable)
index 0000000..1a8790a
--- /dev/null
@@ -0,0 +1,44 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseBreaking extends Database implements StorageObject{
+
+       private static DatabaseBreaking instance;
+
+       public static DatabaseBreaking getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseBreaking();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseBreaking() throws StorageObjectException
+       {
+               super();
+               this.cache = new HashMap();
+               this.theTable="breaking";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityBreaking");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseComment.java b/source/mircoders/storage/DatabaseComment.java
new file mode 100755 (executable)
index 0000000..7787a58
--- /dev/null
@@ -0,0 +1,70 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>This class implements the access to the comment-table for the
+ *    media table.
+ *
+ *
+ */
+
+public class DatabaseComment extends Database implements StorageObject{
+
+       private static DatabaseComment instance;
+
+       public static DatabaseComment getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseComment();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseComment() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.cache = new HashMap();
+               this.theTable="comment";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityComment");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("title",true); }
+
+       public boolean deleteByContentId(String id)
+               throws StorageObjectException {
+               Statement   stmt=null;
+               Connection  con=null;
+               String      sql;
+               int         res = 0;
+
+               /** @todo comments and topics should be deleted */
+               sql = "delete from "+ theTable + " where to_media="+id;
+               //theLog.printInfo("DELETE "+ sql);
+
+               try {
+                       con=getPooledCon();
+                       stmt = con.createStatement();
+                       res = stmt.executeUpdate(sql);
+               }       catch (SQLException sqe) {
+                       new StorageObjectException(sqe.toString());
+                       return false;
+               } finally {
+                       freeConnection(con,stmt);
+               }
+               return true;
+       }
+}
diff --git a/source/mircoders/storage/DatabaseContent.java b/source/mircoders/storage/DatabaseContent.java
new file mode 100755 (executable)
index 0000000..7725d97
--- /dev/null
@@ -0,0 +1,107 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+import mir.entity.*;
+
+/**
+ * <b>this class implements the access to the content-table</b>
+ *
+ *
+ */
+
+public class DatabaseContent extends Database implements StorageObject {
+
+       private static DatabaseContent      instance;
+       private static EntityRelation       relationComments;
+       private static EntityRelation       relationFeature;
+
+       // Contructors / Singleton
+
+       public static DatabaseContent getInstance()
+               throws StorageObjectException {
+
+               if (instance == null ) {
+                       instance = new DatabaseContent();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseContent()
+               throws StorageObjectException {
+
+               super();
+               this.theTable="content";
+               this.theCoreTable="media";
+               relationComments = new EntityRelation("id", "to_media", DatabaseComment.getInstance(), EntityRelation.TO_MANY);
+               relationFeature = new EntityRelation("id", "to_feature", DatabaseFeature.getInstance(), EntityRelation.TO_ONE);
+               try {   this.theEntityClass = Class.forName("mir.entity.EntityContent"); }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       // methods
+
+       /**
+        * sets the database flag is_produced to unproduced
+        */
+
+       public void setUnproduced(String where)
+       {
+               Connection con=null;Statement stmt=null;
+               String sql = "update content set is_produced=0 where " + where;
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       executeSql(stmt,sql);
+               }
+               catch (Exception e) {theLog.printDebugInfo("-- set unproduced failed");}
+               finally { freeConnection(con,stmt);}
+       }
+
+       /**
+        * returns the comments that belong to the article (via entityrelation)
+        */
+       public SimpleList getComments(EntityContent entC) {
+               SimpleList comments=null;
+               try {
+                       comments = relationComments.getManyAsSimpleList(entC,"webdb_create");
+               }
+               catch (StorageObjectException e) {
+                       theLog.printError("DatabaseComments :: failed to get comments");
+               }
+               return comments;
+       }
+
+       /**
+        * returns the features that belong to the article (via entityrelation)
+        */
+       public SimpleList getFeature(EntityContent entC) {
+               SimpleList feature=null;
+               try {
+                       feature = relationFeature.getManyAsSimpleList(entC);
+               }
+               catch (StorageObjectException e) {
+                       theLog.printError("DatabaseComments :: failed to get features");
+               }
+               return feature;
+       }
+
+       public boolean delete(String id)
+               throws StorageObjectException {
+               DatabaseComment.getInstance().deleteByContentId(id);
+               super.delete(id);
+               return true;
+       }
+
+}
diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java
new file mode 100755 (executable)
index 0000000..fadadf8
--- /dev/null
@@ -0,0 +1,217 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+import mir.entity.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseContentToTopics extends Database implements StorageObject{
+
+       private static DatabaseContentToTopics instance;
+
+       public static DatabaseContentToTopics getInstance()
+               throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseContentToTopics();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseContentToTopics()
+               throws StorageObjectException {
+
+               super();
+               this.hasTimestamp = false;
+               this.theTable="content_x_topic";
+               try {
+                       // this.theEntityClass = Class.forName("mir.entity.EntityGruppen");
+               } catch (Exception e) {
+                       throw new StorageObjectException(e.toString());
+               }
+       }
+
+
+       public EntityList getTopics(EntityContent content) {
+               EntityList returnList=null;
+               if (content != null) {
+                       // get all to_topic from content_x_topic
+                       String id = content.getId();
+                       String subselect = "id in (select topic_id from " + theTable + " where content_id=" + id+")";
+
+                       try {
+                               returnList = DatabaseTopics.getInstance().selectByWhereClause(subselect,-1);
+                       } catch (Exception e) {
+                               theLog.printDebugInfo("-- get topics failed " + e.toString());
+                       }
+               }
+               return returnList;
+       }
+
+
+       public void setTopics(EntityContent content, ArrayList topicId) {
+               if (content == null && topicId == null) {
+                       return;
+               }
+               String contentId = content.getId();
+               //first delete all row with content_id=contentId
+               String sql = "delete from "+ theTable +" where content_id=" + contentId;
+
+               Connection con=null;Statement stmt=null;
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       ResultSet rs = executeSql(stmt,sql);
+               } catch (Exception e) {
+                       theLog.printDebugInfo("-- set topics failed -- delete");
+               } finally {
+                       freeConnection(con,stmt);
+               }
+
+               //now insert
+               //first delete all row with content_id=contentId
+
+               for (Iterator i = topicId.listIterator(); i.hasNext();) {
+                       sql = "insert into "+ theTable +" (content_id,topic_id) values ("
+                                               + contentId + "," + i.next().toString() + ")";
+                       try {
+                               con = getPooledCon();
+                               // should be a preparedStatement because is faster
+                               stmt = con.createStatement();
+                               ResultSet rs = executeSql(stmt,sql);
+                       } catch (Exception e) {
+                               theLog.printDebugInfo("-- set topics failed -- insert");
+                       } finally {
+                               freeConnection(con,stmt);
+                       }
+               }
+       }
+
+
+       public void setTopics(String contentId, String topicId) {
+               if (contentId == null && topicId == null) {
+                       return;
+               }
+               //first delete all row with content_id=contentId
+               String sql = "delete from "+ theTable +" where content_id=" + contentId;
+
+               Connection con=null;Statement stmt=null;
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       int rs = executeUpdate(stmt,sql);
+               } catch (Exception e) {
+                       theLog.printDebugInfo("-- set topics failed -- delete");
+               } finally {
+                       freeConnection(con,stmt);
+               }
+
+               //now insert
+               //first delete all row with content_id=contentId
+
+               sql = "insert into "+ theTable +" (content_id,topic_id) values ("
+                                       + contentId + "," + topicId + ")";
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       int rs = executeUpdate(stmt,sql);
+               } catch (Exception e) {
+                       theLog.printDebugInfo("-- set topics failed -- insert");
+               } finally {
+                       freeConnection(con,stmt);
+               }
+       }
+
+       public void deleteByContentId(String contentId) {
+               if (contentId == null) {
+                       //theLog.printDebugInfo("-- delete topics failed -- no content id");
+                       return;
+               }
+               //delete all row with content_id=contentId
+               String sql = "delete from "+ theTable +" where content_id=" + contentId;
+
+               Connection con=null;Statement stmt=null;
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       ResultSet rs = executeSql(stmt,sql);
+               } catch (Exception e) {
+                       //theLog.printDebugInfo("-- delete topics failed  ");
+               } finally {
+                       freeConnection(con,stmt);
+               }
+       }
+
+       public void deleteByTopicId(String topicId) {
+               if (topicId == null) {
+                       //theLog.printDebugInfo("-- delete topics failed -- no topic id");
+                       return;
+               }
+               //delete all row with content_id=contentId
+               String sql = "delete from "+ theTable +" where topic_id=" + topicId;
+
+               Connection con=null;Statement stmt=null;
+               try {
+                       con = getPooledCon();
+                       // should be a preparedStatement because is faster
+                       stmt = con.createStatement();
+                       ResultSet rs = executeSql(stmt,sql);
+               } catch (Exception e) {
+                       theLog.printDebugInfo("-- delete topics failed ");
+               } finally {
+                       freeConnection(con,stmt);
+               }
+       }
+
+
+       public EntityList getContent(EntityTopics topic) {
+               EntityList returnList=null;
+               if (topic != null) {
+                       String id = topic.getId();
+                       String select = "select content_id from " + theTable + " where topic_id=" + id;
+
+                       // execute select statement
+                       Connection con=null;Statement stmt=null;
+                       try {
+                               con = getPooledCon();
+                               // should be a preparedStatement because is faster
+                               stmt = con.createStatement();
+                               ResultSet rs = executeSql(stmt,select);
+                               if (rs!=null) {
+                                       String topicSelect= "id IN (";
+                                       boolean first=true;
+                                       while (rs.next()) {
+                                               if (first==false) topicSelect+=",";
+                                               topicSelect += rs.getString(1);
+                                               first=false;
+                                       }
+                                       topicSelect+=")";
+                                       if (first==false)
+                                               returnList = DatabaseContent.getInstance().selectByWhereClause(topicSelect,-1);
+                               }
+                       }
+                       catch (Exception e) {theLog.printDebugInfo("-- get contetn failed");}
+                       finally { freeConnection(con,stmt);}
+               }
+               return returnList;
+       }
+
+}
diff --git a/source/mircoders/storage/DatabaseFeature.java b/source/mircoders/storage/DatabaseFeature.java
new file mode 100755 (executable)
index 0000000..e51bbf7
--- /dev/null
@@ -0,0 +1,51 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseFeature extends Database implements StorageObject{
+
+       private static DatabaseFeature instance;
+
+       public static DatabaseFeature getInstance() throws StorageObjectException {
+                       if (instance == null) {
+               instance = new DatabaseFeature();
+               instance.myselfDatabase = instance;
+                       }
+               return instance;
+       }
+
+       private DatabaseFeature() throws StorageObjectException
+       {
+               super();
+               this.cache = new HashMap();
+               this.hasTimestamp = false;
+               this.theTable="feature";
+
+               try {
+                               this.theEntityClass = Class.forName("mir.entity.EntityFeature");
+               }
+               catch (Exception e) {
+                               throw new StorageObjectException(e.toString());
+               }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("title",true);
+       }
+
+}
diff --git a/source/mircoders/storage/DatabaseGroups.java b/source/mircoders/storage/DatabaseGroups.java
new file mode 100755 (executable)
index 0000000..666fcd2
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseGroups extends Database implements StorageObject{
+
+       private static DatabaseGroups instance;
+
+       public static DatabaseGroups getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseGroups();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseGroups() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.cache = new HashMap();
+               this.theTable="creator";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityGruppen");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+}
diff --git a/source/mircoders/storage/DatabaseImageColor.java b/source/mircoders/storage/DatabaseImageColor.java
new file mode 100755 (executable)
index 0000000..15200f8
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageColor extends Database implements StorageObject{
+
+       private static DatabaseImageColor instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImageColor getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImageColor();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImageColor() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="img_color";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityImageColor");       }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseImageFormat.java b/source/mircoders/storage/DatabaseImageFormat.java
new file mode 100755 (executable)
index 0000000..0616549
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageFormat extends Database implements StorageObject{
+
+       private static DatabaseImageFormat instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImageFormat getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImageFormat();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImageFormat() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="img_format";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityImageFormat");      }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseImageLayout.java b/source/mircoders/storage/DatabaseImageLayout.java
new file mode 100755 (executable)
index 0000000..3151bcc
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageLayout extends Database implements StorageObject{
+
+       private static DatabaseImageLayout instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImageLayout getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImageLayout();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImageLayout() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="img_layout";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityImageLayout");      }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseImageType.java b/source/mircoders/storage/DatabaseImageType.java
new file mode 100755 (executable)
index 0000000..b74df24
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImageType extends Database implements StorageObject{
+
+       private static DatabaseImageType instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImageType getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImageType();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImageType() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="img_type";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityImageType");        }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseImages.java b/source/mircoders/storage/DatabaseImages.java
new file mode 100755 (executable)
index 0000000..8890c0d
--- /dev/null
@@ -0,0 +1,76 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImages extends Database implements StorageObject{
+
+       private static DatabaseImages instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImages getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImages();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImages() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = true;
+               this.theTable="images";
+               this.theCoreTable="media";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityImage");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("title",true);
+       }
+
+       public void update(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","1");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+
+               super.update(theEntity);
+       }
+
+
+       public String insert(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","1");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+               return super.insert(theEntity);
+       }
+
+       // initialisierungen aus den statischen Tabellen
+
+}
diff --git a/source/mircoders/storage/DatabaseLanguage.java b/source/mircoders/storage/DatabaseLanguage.java
new file mode 100755 (executable)
index 0000000..221ffff
--- /dev/null
@@ -0,0 +1,50 @@
+package mircoders.storage;
+
+/**
+ * Title: DatabaseLanguage
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+
+public class DatabaseLanguage extends Database implements StorageObject{
+
+       private static DatabaseLanguage instance;
+       private static SimpleList languagePopupData;
+
+       public static DatabaseLanguage getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseLanguage();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseLanguage() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="language";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityLanguage"); }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",false); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseMediafolder.java b/source/mircoders/storage/DatabaseMediafolder.java
new file mode 100755 (executable)
index 0000000..e6377ea
--- /dev/null
@@ -0,0 +1,54 @@
+package mircoders.storage;
+
+/**
+ * Title:        Mir
+ * Description:  Ihre Beschreibung
+ * Copyright:    Copyright (c) 1999
+ * Company:
+ * @author
+ * @version
+ */
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+
+
+public class DatabaseMediafolder extends Database implements StorageObject{
+
+       private static DatabaseMediafolder instance;
+
+       public static DatabaseMediafolder getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseMediafolder();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseMediafolder() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.cache = new HashMap();
+               this.theTable="media_folder";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityMediafolder");
+               }
+               catch (Exception e) {   throw new StorageObjectException(e.toString());
+               }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("name",true);
+       }
+
+}
diff --git a/source/mircoders/storage/DatabaseMessages.java b/source/mircoders/storage/DatabaseMessages.java
new file mode 100755 (executable)
index 0000000..0950f90
--- /dev/null
@@ -0,0 +1,49 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+
+/**
+ * Title:
+ * Description:
+ * Copyright:    Copyright (c) 2001
+ * Company:      Indymedia
+ * @author
+ * @version 1.0
+ */
+
+
+public class DatabaseMessages extends Database implements StorageObject{
+
+       private static DatabaseMessages instance;
+
+       public static DatabaseMessages getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseMessages();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseMessages() throws StorageObjectException
+       {
+               super();
+               this.cache = new HashMap();
+               this.theTable="messages";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityMessage");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseRights.java b/source/mircoders/storage/DatabaseRights.java
new file mode 100755 (executable)
index 0000000..39906fc
--- /dev/null
@@ -0,0 +1,46 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseRights extends Database implements StorageObject{
+
+       private static DatabaseRights instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseRights getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseRights();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseRights() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="rights";
+               try { this.theEntityClass = Class.forName("mir.entity.EntityRights");   }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() { return getPopupData("name",true); }
+
+
+}
diff --git a/source/mircoders/storage/DatabaseTopics.java b/source/mircoders/storage/DatabaseTopics.java
new file mode 100755 (executable)
index 0000000..55731a5
--- /dev/null
@@ -0,0 +1,53 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseTopics extends Database implements StorageObject{
+
+       private static DatabaseTopics instance;
+
+       public static DatabaseTopics getInstance() throws StorageObjectException {
+                       if (instance == null) {
+               instance = new DatabaseTopics();
+               instance.myselfDatabase = instance;
+                       }
+               return instance;
+       }
+
+       private DatabaseTopics() throws StorageObjectException
+       {
+          super();
+                       this.cache = new HashMap();
+                       this.hasTimestamp = false;
+                       this.theTable="topic";
+                       try {
+               this.theEntityClass = Class.forName("mir.entity.EntityTopics");
+                       }
+                       catch (Exception e) {
+               throw new StorageObjectException(e.toString());
+                       }
+
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("title",true);
+       }
+
+
+
+}
diff --git a/source/mircoders/storage/DatabaseUsers.java b/source/mircoders/storage/DatabaseUsers.java
new file mode 100755 (executable)
index 0000000..03e38d7
--- /dev/null
@@ -0,0 +1,48 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseUsers extends Database implements StorageObject{
+
+       private static DatabaseUsers instance;
+
+       public static DatabaseUsers getInstance() throws StorageObjectException {
+               if (instance == null) {
+                       instance = new DatabaseUsers();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseUsers() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = false;
+               this.theTable="webdb_users";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityUsers");
+               }
+               catch (Exception e) {
+                       throw new StorageObjectException(e.toString());
+               }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("login",true);
+       }
+}
diff --git a/source/mircoders/storage/DatabaseVideos.java b/source/mircoders/storage/DatabaseVideos.java
new file mode 100755 (executable)
index 0000000..2cfa8e5
--- /dev/null
@@ -0,0 +1,74 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseVideos extends Database implements StorageObject{
+
+       private static DatabaseVideos instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseVideos getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseVideos();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseVideos() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = true;
+               this.theTable="videos";
+               this.theCoreTable="media";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityVideo");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("title",true);
+       }
+
+       public void update(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","3");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+
+               super.update(theEntity);
+       }
+
+
+       public String insert(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","3");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+               return super.insert(theEntity);
+       }
+
+}