some indy.nl related updates
authorzapata <zapata>
Sat, 15 Jun 2002 14:19:38 +0000 (14:19 +0000)
committerzapata <zapata>
Sat, 15 Jun 2002 14:19:38 +0000 (14:19 +0000)
source/Mir.java
source/mir/producer/EntityBatchingProducerNode.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mirlocal/indymedia.nl/IndyNLLocalizer.java
source/mirlocal/indymedia.nl/IndyNLProducerAssistantLocalizer.java [new file with mode: 0755]
source/mirlocal/indymedia.nl/IndyNLProducerLocalizer.java

index c70f42a..dd8f373 100755 (executable)
@@ -75,6 +75,10 @@ public class Mir extends AbstractServlet {
         /** @todo for cleanup and readability this should be moved to
          *  method loginIfNecessary() */
 
         /** @todo for cleanup and readability this should be moved to
          *  method loginIfNecessary() */
 
+        if (moduleName!=null && moduleName.equals("direct")) {
+          //...
+        }
+
         // Authentifizierung
         if (moduleName != null && moduleName.equals("login")) {
             String user = req.getParameter("login");
         // Authentifizierung
         if (moduleName != null && moduleName.equals("login")) {
             String user = req.getParameter("login");
index a57a751..19df0f1 100755 (executable)
@@ -126,6 +126,7 @@ public class EntityBatchingProducerNode implements ProducerNode {
       batchData.put("all", batchesData);
       batchData.put("first", batchesData.get(0));
       batchData.put("last", batchesData.get(batchesData.size()-1));
       batchData.put("all", batchesData);
       batchData.put("first", batchesData.get(0));
       batchData.put("last", batchesData.get(batchesData.size()-1));
+      batchData.put("count", Integer.toString(batchesData.size()));
 
       if (batchListSubNode!=null) {
         batchListSubNode.produce(aValueMap, aVerb, aLogger);
 
       if (batchListSubNode!=null) {
         batchListSubNode.produce(aValueMap, aVerb, aLogger);
index ddc4d7e..7f5cb12 100755 (executable)
@@ -188,8 +188,12 @@ public class ServletModuleContent extends ServletModule
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
-      if (withValues.get("creator").toString().equals(""))
-        withValues.put("creator","Anonym");
+
+//      ML: this is not multi-language friendly and this can be done in a template
+//      if (withValues.get("creator").toString().equals(""))
+//        withValues.put("creator","Anonym");
+
+
       String id = mainModule.add(withValues);
       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
       //theLog.printDebugInfo(":: content :: inserted");
       String id = mainModule.add(withValues);
       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
       //theLog.printDebugInfo(":: content :: inserted");
@@ -339,8 +343,11 @@ public class ServletModuleContent extends ServletModule
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
         withValues.put("is_published","0");
       if (!withValues.containsKey("is_html"))
         withValues.put("is_html","0");
-      if (withValues.get("creator").toString().equals(""))
-        withValues.put("creator","Anonym");
+
+//      ML: this is not multi-language friendly and this can be done in a template
+//      if (withValues.get("creator").toString().equals(""))
+//        withValues.put("creator","Anonym");
+
       //theLog.printDebugInfo("updating. ");
       String id = mainModule.set(withValues);
       DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
       //theLog.printDebugInfo("updating. ");
       String id = mainModule.set(withValues);
       DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
index e967f89..1c7ed36 100755 (executable)
@@ -286,10 +286,12 @@ public class ServletModuleOpenIndy extends ServletModule
       // if op direct article-type == newswire
       if (directOp.equals("yes")) withValues.put("to_article_type","1");
 
       // if op direct article-type == newswire
       if (directOp.equals("yes")) withValues.put("to_article_type","1");
 
-      // owner is openposting user
       withValues.put("to_publisher","1");
       withValues.put("to_publisher","1");
-      if (withValues.get("creator").toString().equals(""))
-        withValues.put("creator","Anonym");
+
+      // owner is openposting user
+//      ML: this is not multi-language friendly and this can be done in a template
+//      if (withValues.get("creator").toString().equals(""))
+//        withValues.put("creator","Anonym");
 
       // inserting  content into database
       String cid = contentModule.add(withValues);
 
       // inserting  content into database
       String cid = contentModule.add(withValues);
index 464e4ed..56286b8 100755 (executable)
@@ -15,7 +15,7 @@ public class IndyNLLocalizer extends MirBasicLocalizer {
   }
 
   public MirProducerToolLocalizer producerTool() {
   }
 
   public MirProducerToolLocalizer producerTool() {
-    return new MirBasicProducerToolLocalizer();
+    return new IndyNLProducerAssistantLocalizer();
   }
 
 }
\ No newline at end of file
   }
 
 }
\ No newline at end of file
diff --git a/source/mirlocal/indymedia.nl/IndyNLProducerAssistantLocalizer.java b/source/mirlocal/indymedia.nl/IndyNLProducerAssistantLocalizer.java
new file mode 100755 (executable)
index 0000000..4812af5
--- /dev/null
@@ -0,0 +1,15 @@
+package mircoders.localizer.basic;
+
+import java.util.*;
+import mircoders.localizer.basic.*;
+
+public class IndyNLProducerAssistantLocalizer extends MirBasicProducerToolLocalizer {
+  public void initializeGenerationValueSet(Map aValueSet) {
+    super.initializeGenerationValueSet(aValueSet);
+
+    Map articleTypeMap = (Map) aValueSet.get("articletype");
+    articleTypeMap.put("static", "5");
+    articleTypeMap.put("promotednewswire", "6");
+    articleTypeMap.put("trashed", "7");
+  };
+}
index 80f6d0f..5ce5355 100755 (executable)
@@ -43,8 +43,8 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
       logger.printError("IndyNLProducerLocalizer.setupContentFactory: Exception "+t.getMessage());
     }
 
       logger.printError("IndyNLProducerLocalizer.setupContentFactory: Exception "+t.getMessage());
     }
 
-    contentNode.addVerb( "all", "is_published='1'", "" );
-    contentNode.addVerb( "new", "is_published='1' and is_produced='f'", "" );
+    contentNode.addVerb( "all", "is_published='1' and article_type<>${articletype.trashed} and article_type<>${articletype.static}", "" );
+    contentNode.addVerb( "new", "is_published='1' and is_produced='f' and article_type<>${articletype.trashed} and article_type<>${articletype.static}", "" );
 
     aProducerNode.addSubNode( contentNode );
   }
 
     aProducerNode.addSubNode( contentNode );
   }
@@ -53,7 +53,7 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
     try {
       aProducerNode.addSubNode(
             new EntityListProducerNode("newswire", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
     try {
       aProducerNode.addSubNode(
             new EntityListProducerNode("newswire", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
-                    "is_published='1' and to_article_type = 1", "date desc, webdb_create desc", 40, 0,
+                    "is_published='1' and to_article_type in (${articletype.newswire, articletype.promotednewswire})", "date desc, webdb_create desc", 40, 0,
               new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
                             "", "code", 10, 0,
                     new CompositeProducerNode( new ProducerNode[] {
               new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
                             "", "code", 10, 0,
                     new CompositeProducerNode( new ProducerNode[] {
@@ -66,7 +66,7 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
                           )
                         ),
                         new EntityListProducerNode("features", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
                           )
                         ),
                         new EntityListProducerNode("features", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
-                                "is_published='1' and to_article_type = 2", "date desc, webdb_create desc", 10, 0,
+                                "is_published='1' and to_article_type in ( ${articletype.feature}, ${articletype.promotednewswire})", "date desc, webdb_create desc", 10, 0,
                           new EntityListProducerNode("breaking", DatabaseBreaking.getInstance(), BreakingAdapterDefinition.getInstance(),
                                     "", "webdb_create desc", 5, 0,
                             new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "code='nl'", "",
                           new EntityListProducerNode("breaking", DatabaseBreaking.getInstance(), BreakingAdapterDefinition.getInstance(),
                                     "", "webdb_create desc", 5, 0,
                             new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "code='nl'", "",
@@ -103,7 +103,7 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
     try {
       topicPageNode =
         new EntityBatchingProducerNode( "articles", "batch", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
     try {
       topicPageNode =
         new EntityBatchingProducerNode( "articles", "batch", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
-              "is_published='1' and to_article_type = ${articletype.newswire} and id in (select content_id from content_x_topic where topic_id = ${topic.id})", "date asc, webdb_create asc", 6, 5, 0,
+              "is_published='1' and to_article_type in (${articletype.newswire, articletype.promotednewswire}) and id in (select content_id from content_x_topic where topic_id = ${topic.id})", "date asc, webdb_create asc", 6, 5, 0,
           new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
                   "", "code", 10, 0,
             new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
           new EntityListProducerNode("languages", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(),
                   "", "code", 10, 0,
             new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
@@ -221,6 +221,7 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
 
     ProducerNode node = null;
     EntityBatchingProducerNode batchingNode = null;
 
     ProducerNode node = null;
     EntityBatchingProducerNode batchingNode = null;
+    EntityEnumeratingProducerNode enumeratingNode = null;
 
     try {
       node =
 
     try {
       node =
@@ -241,12 +242,12 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
               )
             )
           );
               )
             )
           );
+      aFactoriesMap.put("features", new NodedProducerFactory( node ) );
     }
     catch (Throwable t) {
       logger.printError("IndyNLProducerLocalizer.setupFactories Exception "+t.getMessage());
     }
 
     }
     catch (Throwable t) {
       logger.printError("IndyNLProducerLocalizer.setupFactories Exception "+t.getMessage());
     }
 
-    aFactoriesMap.put("features", new NodedProducerFactory( node ) );
 
     try {
       node =
 
     try {
       node =
@@ -267,12 +268,12 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
               )
             )
           );
               )
             )
           );
+      aFactoriesMap.put("featurestest", new NodedProducerFactory( node ) );
     }
     catch (Throwable t) {
       logger.printError("IndyNLProducerLocalizer.setupFactories Exception "+t.getMessage());
     }
 
     }
     catch (Throwable t) {
       logger.printError("IndyNLProducerLocalizer.setupFactories Exception "+t.getMessage());
     }
 
-    aFactoriesMap.put("featurestest", new NodedProducerFactory( node ) );
     try {
       batchingNode =
           new EntityBatchingProducerNode( "comments", "batch", DatabaseComment.getInstance(), CommentAdapterDefinition.getInstance(),
     try {
       batchingNode =
           new EntityBatchingProducerNode( "comments", "batch", DatabaseComment.getInstance(), CommentAdapterDefinition.getInstance(),
@@ -309,5 +310,28 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer {
       logger.printError("IndyNLProducerLocalizer.setupFactories: Exception "+t.getMessage());
     }
 
       logger.printError("IndyNLProducerLocalizer.setupFactories: Exception "+t.getMessage());
     }
 
+    try {
+      enumeratingNode =
+              new EntityEnumeratingProducerNode( "content", DatabaseContent.getInstance(), ContentAdapterDefinition.getInstance(),
+                  new GeneratingProducerNode(
+                      "/producer/indymedia.nl/static.template",
+                      "${config.storageRoot}/${language.code}/static/${content.edittitle}.shtml"
+                  )
+                );
+
+      enumeratingNode.addVerb( "all", "is_published='1' and to_article_type=${articletype.static} and to_language=${language.id} and edittitle<>'' and not edittitle is null", "" );
+      enumeratingNode.addVerb( "new", "is_published='1' and is_produced='f' and to_article_type=${articletype.static} and to_language=${language.id} and edittitle<>'' and not edittitle is null", "" );
+
+      aFactoriesMap.put("staticarticles", new NodedProducerFactory(
+          new EntityEnumeratingProducerNode( "language", DatabaseLanguage.getInstance(), LanguageAdapterDefinition.getInstance(), "", "",
+            new ResourceBundleProducerNode("lang", "bundles.producer_${language.code}",
+              enumeratingNode
+            )
+          )
+      ));
+    }
+    catch (Throwable t) {
+      logger.printError("IndyNLProducerLocalizer.setupFactories: Exception "+t.getMessage());
+    }
   }
 }
   }
 }