Modified config system:
[mir.git] / source / mircoders / servlet / ServletModuleOpenIndy.java
index a2ccc2e..be5d5a9 100755 (executable)
@@ -36,7 +36,8 @@ public class ServletModuleOpenIndy extends ServletModule
   private String          commentFormTemplate, commentFormDoneTemplate;
   private String          postingFormTemplate, postingFormDoneTemplate;
   private ModuleContent   contentModule;
-  private ModuleImages     imageModule;
+  private ModuleImages    imageModule;
+  private String          directOp ="yes";
 
   // Singelton / Kontruktor
   private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();
@@ -44,12 +45,13 @@ public class ServletModuleOpenIndy extends ServletModule
 
   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");
-
+      theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.OpenIndy.Logfile"));
+      commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
+      commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
+      postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
+      postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
+      directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
+      //directOp="yes";
       mainModule = new ModuleComment(DatabaseComment.getInstance());
       contentModule = new ModuleContent(DatabaseContent.getInstance());
       imageModule = new ModuleImages(DatabaseImages.getInstance());
@@ -101,6 +103,7 @@ public class ServletModuleOpenIndy extends ServletModule
 
         // sync the server
         int exitValue = Helper.rsync();
+                               theLog.printDebugInfo("rsync:"+exitValue);
 
         // redirecting to url
         // should implement back to article
@@ -196,6 +199,10 @@ public class ServletModuleOpenIndy extends ServletModule
       withValues.put("is_produced", "0");
       // 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");
+      theLog.printDebugInfo("direct op: "+directOp);
+      
       // owner is openposting user
       withValues.put("to_publisher","1");
       if (withValues.get("creator").toString().equals(""))
@@ -221,10 +228,14 @@ public class ServletModuleOpenIndy extends ServletModule
       new ProducerOpenPosting().handle(null,null,false,false);
       // producing new page
       new ProducerContent().handle(null, null, false, false,id);
+      //if direct op producing startpage
+      if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
+      
 
       // sync the server
       //should be configureable
       int exitValue = Helper.rsync();
+                       theLog.printDebugInfo("rsync: "+exitValue);
 
     }
     catch (IOException e) { throw new ServletModuleException(e.toString());}