Ok, big merge. here's the new xml-config stuff in action. There's a few
[mir.git] / source / mircoders / servlet / ServletModuleOpenIndy.java
index 8efa6d1..ff29354 100755 (executable)
@@ -36,28 +36,40 @@ import mircoders.producer.*;
 
 public class ServletModuleOpenIndy extends ServletModule
 {
-
-  private String          commentFormTemplate, commentFormDoneTemplate, commentFormDupeTemplate;
-  private String          postingFormTemplate, postingFormDoneTemplate, postingFormDupeTemplate;
   private ModuleContent   contentModule;
   private ModuleImages    imageModule;
   private ModuleTopics    themenModule;
-  private String          directOp ="yes";
+
+  //config values
+  private static String commentFormTemplate = "open/comment.template";
+  private static String commentFormDoneTemplate = "open/comment_done.template";
+  private static String commentFormDupeTemplate = "open/comment_dupe.template";
+  private static String postingFormTemplate = "open/posting.template";
+  private static String postingFormDoneTemplate = "open/posting_done.template";
+  private static String postingFormDupeTemplate = "open/posting_dupe.template";
+  private static boolean  directOp = true;
 
   // Singelton / Kontruktor
   private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();
   public static ServletModule getInstance() { return instance; }
 
+  public static void setDirectOp(boolean v) {
+    directOp=v;
+  }
+
+//  public static setCommentFormTemplate(String template) throws  {
+   // if
+
   private ServletModuleOpenIndy() {
     try {
-      theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.OpenIndy.Logfile"));
-      commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
-      commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
-      commentFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDupeTemplate");
-      postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
-      postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
-      postingFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDupeTemplate");
-      directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
+      theLog = Logfile.getInstance(this.getClass().getName());
+      //commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
+      //commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
+      //commentFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDupeTemplate");
+      //postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
+      //postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
+      //postingFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDupeTemplate");
+      //directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
       mainModule = new ModuleComment(DatabaseComment.getInstance());
       contentModule = new ModuleContent(DatabaseContent.getInstance());
       themenModule = new ModuleTopics(DatabaseTopics.getInstance());
@@ -208,7 +220,7 @@ public class ServletModuleOpenIndy extends ServletModule
       // op-articles are immediatly published
       withValues.put("is_published","1");
       // if op direct article-type == newswire
-      if (directOp.equals("yes")) withValues.put("to_article_type","1");
+      if (directOp) withValues.put("to_article_type","1");
       
       // owner is openposting user
       withValues.put("to_publisher","1");
@@ -272,6 +284,7 @@ public class ServletModuleOpenIndy extends ServletModule
              * sure that it is in this file -mh
              */
             contentType = FileUtil.guessContentTypeFromName(fileName);
+            theLog.printError("tYPE: "+contentType);
             if (contentType==null)
                 contentType = "text/plain"; // rfc1867 says this is the default
         }
@@ -368,7 +381,7 @@ public class ServletModuleOpenIndy extends ServletModule
       // producing new page
       new ProducerContent().handle(null, null, false, false,cid);
       //if direct op producing startpage
-      if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
+      if (directOp) new ProducerStartPage().handle(null,null);
       
       // sync the server
       //should be configureable