debug info
[mir.git] / source / mircoders / producer / ProducerStartPage.java
index 6092df1..8030959 100755 (executable)
@@ -77,7 +77,7 @@ public class ProducerStartPage extends Producer {
     Database            mediaStorage=null;
     String              tinyIcon;
     String              iconAlt;
-    Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
+    Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + "/" +MirConfig.getProp("Producer.Logfile"));
 
     SimpleList mediaList;
     SimpleHash contentHash;
@@ -99,7 +99,7 @@ public class ProducerStartPage extends Producer {
     SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int i=0; i < entityList.size();i++) {
       currentContent = (EntityContent)entityList.elementAt(i);
-      try {  
+      try {
           //fetching/setting the images
           upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
           if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
@@ -154,6 +154,7 @@ public class ProducerStartPage extends Producer {
         theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
       }
     }
+    theLog.printDebugInfo("############### got newswire");
 
     // get the startarticle and the related images
     whereClause="is_published=true AND to_article_type=4";
@@ -169,7 +170,8 @@ public class ProducerStartPage extends Producer {
       try {
           //media to content
           currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-          if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+          contentHash = (SimpleHash)startItemList.get(k);
+                                       if (currentMediaList!=null && currentMediaList.getCount()>=1) {
             SimpleList mediaListAudio = new SimpleList();
             SimpleList mediaListImages = new SimpleList();
             SimpleList mediaListVideo = new SimpleList();
@@ -203,24 +205,34 @@ public class ProducerStartPage extends Producer {
                 } //end if is_published
               } //end if media_type != null
             } //end for
-            contentHash = (SimpleHash)startItemList.get(k);
             contentHash.put("to_media_audio", mediaListAudio);
             contentHash.put("to_media_images", mediaListImages);
             contentHash.put("to_media_video", mediaListVideo);
             contentHash.put("to_media_other", mediaListOther);
           } //end if currentMediaList != null
-      } catch (Exception e) {
+                                       //convert to html
+                                       if ( ((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ) {
+                                               SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+                                               String temp = StringUtil.createHTML(tempScalar.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName);
+                                               temp = StringUtil.decodeHTMLinTags(temp);
+                                               contentHash.put("description",temp);
+                                       }
+
+                       } catch (Exception e) {
         logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
         theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
       }
     } //enf for featurueList.size..
 
+    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
     whereClause="is_published=true AND to_article_type=2";
@@ -232,7 +244,8 @@ public class ProducerStartPage extends Producer {
       try {
           //media to content
           currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
-          if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+          contentHash = (SimpleHash)featureList.get(k);
+                                       if (currentMediaList!=null && currentMediaList.getCount()>=1) {
             SimpleList mediaListAudio = new SimpleList();
             SimpleList mediaListImages = new SimpleList();
             SimpleList mediaListVideo = new SimpleList();
@@ -266,17 +279,26 @@ public class ProducerStartPage extends Producer {
                 } //end if is_published
               } //end if media_type != null
             } //end for
-            contentHash = (SimpleHash)featureList.get(k);
             contentHash.put("to_media_audio", mediaListAudio);
             contentHash.put("to_media_images", mediaListImages);
             contentHash.put("to_media_video", mediaListVideo);
             contentHash.put("to_media_other", mediaListOther);
           } //end if currentMediaList != null
-      } catch (Exception e) {
+
+                                       //convert to html
+                                       if ( ((SimpleScalar)contentHash.get("is_html")).getAsString().equals("0") ) {
+                                               SimpleScalar tempScalar = (SimpleScalar)contentHash.get("description");
+                                               String temp = StringUtil.createHTML(tempScalar.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName);
+                                               temp = StringUtil.decodeHTMLinTags(temp);
+                                               contentHash.put("description",temp);
+                                       }
+
+                       } catch (Exception e) {
         logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
         theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
       }
     } //enf for featurueList.size..
+    theLog.printDebugInfo("############### got featurelist");
 
     // Zusaetzlich Informationen
     startPageModel = new SimpleHash();