moving breaking / imclist to modules
authorrk <rk>
Tue, 5 Feb 2002 13:17:11 +0000 (13:17 +0000)
committerrk <rk>
Tue, 5 Feb 2002 13:17:11 +0000 (13:17 +0000)
source/mircoders/module/ModuleBreaking.java
source/mircoders/producer/ProducerStartPage.java

index e00d295..edb8aba 100755 (executable)
@@ -34,11 +34,21 @@ public class ModuleBreaking extends AbstractModule
 
        public ModuleBreaking (StorageObject theStorage)
        {
-               if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+               if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Breaking.Logfile"));
                if (theStorage == null) theLog.printWarning("ModuleBreaking -- StorageObject was null!");
                this.theStorage = theStorage;
        }
 
        // Methoden
-
+  public SimpleList getBreakingNews() {
+    SimpleList returnList = null;
+    try {
+      EntityList entityList = getByWhereClause(null,"webdb_create desc",0,5);
+      returnList = HTMLTemplateProcessor.makeSimpleList(entityList);
+    }
+    catch (Exception ex) {
+      theLog.printWarning("--getBreakingNews(): could not fetch Breaking News" + ex.toString());
+    }
+    return returnList;
+  }
 }
index 3ea6e41..e9423e4 100755 (executable)
@@ -82,13 +82,6 @@ public class ProducerStartPage extends Producer {
     SimpleList mediaList;
     SimpleHash contentHash;
 
-    // get the imclinks
-    /** @todo don't we want to preproduce and include the imcs? */
-    entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
-    SimpleList imcList = HTMLTemplateProcessor.makeSimpleList(entityList);
-    EntityList theParentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
-    SimpleList parentList = HTMLTemplateProcessor.makeSimpleList(theParentList);
-
     // get the newswire
     /** @todo same with newswire, should be fetched via moduleContent.getNewswire() */
     whereClause="is_published=true AND to_article_type = 1";
@@ -226,13 +219,7 @@ public class ProducerStartPage extends Producer {
 
     theLog.printDebugInfo("############### got startitems");
 
-    // get the breaking news
-    // only the first 5
-    // todo: the number of breaking_news items have to be configurable
-    ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
-    entityList = breakingModule.getByWhereClause(null,"webdb_create desc",0,5);
-    SimpleList breakingList = HTMLTemplateProcessor.makeSimpleList(entityList);
-    theLog.printDebugInfo("############### got breaking");
+
 
     // get the articles
     /** @todo moduleContent.getArticles() */
@@ -309,10 +296,12 @@ public class ProducerStartPage extends Producer {
 
     // Additional Information
     startPageModel = new SimpleHash();
-    startPageModel.put("breakingnews", breakingList);
+
+    // breaking news
+    ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
+    startPageModel.put("breakingnews", breakingModule.getBreakingNews());
+
     startPageModel.put("topics", topicsModule.getTopicsList());
-    startPageModel.put("imclist", imcList);
-    startPageModel.put("parentlist", parentList);
     startPageModel.put("newswire", newsWireList);
     startPageModel.put("startspecial", startItemList);
     startPageModel.put("features", featureList);