some fixes: images, producerdocroot, ...
authoridfx <idfx>
Mon, 24 Sep 2001 13:39:01 +0000 (13:39 +0000)
committeridfx <idfx>
Mon, 24 Sep 2001 13:39:01 +0000 (13:39 +0000)
source/mircoders/producer/ProducerStartPage.java
templates-dist/producer/content.template
templates-dist/producer/navigation.template
templates-dist/producer/openposting.template
templates-dist/producer/startpage.template
templates-dist/producer/topiclist.template

index fdae520..5b478b7 100755 (executable)
@@ -56,7 +56,9 @@ public class ProducerStartPage extends Producer {
     SimpleHash          startPageModel;
     SimpleList          contentList;
     String              currentMediaId;
-    SimpleHash          imageHash = new SimpleHash();
+    EntityList          imageEntityList;
+    SimpleList mediaList;
+    SimpleHash contentHash;
 
     // get the topiclist
     entityList = topicsModule.getByWhereClause("","title",-1);
@@ -78,14 +80,20 @@ public class ProducerStartPage extends Producer {
     SimpleList startItemList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int i=0; i < entityList.size();i++) {
       currentContent = (EntityContent)entityList.elementAt(i);
-      currentMediaId = currentContent.getValue("to_media");
-      if (currentMediaId!=null && !currentMediaId.equals("")) {
-        imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+      //fetching/setting the images
+      imageEntityList = DatabaseContentToMedia.getInstance().getImages(currentContent);
+      if (imageEntityList!=null && imageEntityList.getCount()>=1) {
+        try{
+          mediaList = HTMLTemplateProcessor.makeSimpleList(imageEntityList);
+          contentHash = (SimpleHash)startItemList.get(i);
+          contentHash.put("to_media", mediaList);
+        } catch (Exception e){}
       }
     }
 
     // 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);
@@ -94,29 +102,27 @@ public class ProducerStartPage extends Producer {
     whereClause="is_published=true AND to_article_type=2";
     orderBy="date desc, webdb_create desc";
     entityList = contentModule.getContent(whereClause, orderBy, 0, itemsPerPage);
+    SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(entityList);
     for (int i=0; i < entityList.size();i++) {
       currentContent = (EntityContent)entityList.elementAt(i);
-      /**
-      if (currentContent.get("is_html").equals("0")) {
-        currentContent.put("content_data",StringUtil.createHTML((String)currentContent.get("content_data"),imageRoot,mailLinkName,extLinkName,intLinkName));
-        currentContent.put("description",StringUtil.createHTML((String)currentContent.get("description"),imageRoot,mailLinkName,extLinkName,intLinkName));
-      }
-      */
-      currentMediaId = currentContent.getValue("to_media");
-      if (currentMediaId!=null && !currentMediaId.equals("")) {
-        imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
+      //fetching/setting the images
+      imageEntityList = DatabaseContentToMedia.getInstance().getImages(currentContent);
+      if (imageEntityList!=null && imageEntityList.getCount()>=1) {
+        try{
+          mediaList = HTMLTemplateProcessor.makeSimpleList(imageEntityList);
+          contentHash = (SimpleHash)featureList.get(i);
+          contentHash.put("to_media", mediaList);
+        } catch (Exception e){}
       }
     }
-    SimpleList itemList = HTMLTemplateProcessor.makeSimpleList(entityList);
 
     // Zusaetzlich Informationen
     startPageModel = new SimpleHash();
-    startPageModel.put("breaking", breakingList);
+    startPageModel.put("breakingnews", breakingList);
     startPageModel.put("topics", topicList);
     startPageModel.put("newswire", newsWireList);
-    startPageModel.put("start", startItemList);
-    startPageModel.put("items", itemList);
-    startPageModel.put("images", imageHash);
+    startPageModel.put("startspecial", startItemList);
+    startPageModel.put("features", featureList);
 
     htmlFileName = producerDocRoot + "/index.shtml";
     
index 13583dc..ee37be1 100755 (executable)
@@ -12,7 +12,7 @@
       <table width="150" border="0" cellspacing="0" cellpadding="0">
         <tr> 
           <td width="140">
-            <a href="/">
+            <a href="/${config.docroot}">
              <img src="/images/mirlogo.jpg" width="150" height="205" border="0">
             </a>
           </td>
index ae44de7..af58891 100755 (executable)
@@ -2,7 +2,7 @@
                     <!-- topiclist --> 
                     <list topics as t> 
                     <br>
-                    <a href="/${t.filename}.shtml"><b>${t.title}</b></a> 
+                    <a href="${config.docroot}/${t.filename}.shtml"><b>${t.title}</b></a> 
                     </list> 
                     <!-- topiclist --> 
                   </p>
@@ -18,4 +18,4 @@
 <!-- imclist --> 
 <include "producer/cities.inc"> 
 <!-- imclist --> 
-                  </p>
\ No newline at end of file
+                  </p>
index f22dc2c..1e5312a 100755 (executable)
@@ -12,7 +12,7 @@
       <table width="150" border="0" cellspacing="0" cellpadding="0">
         <tr> 
           <td width="140">
-             <a href="/">
+             <a href="/${config.docroot}">
              <img src="images/mirlogo.jpg" width="150" height="205" border="0">
              </a>
           </td>
index 7501769..242811c 100755 (executable)
           <td align="left" valign="top"> 
             <table width="457" border="0" cellpadding="0" cellspacing="2" height="100%">
               <tr> 
-                <td width="457" valign="top"> <!--- start-special ---> <list start as s> 
+                <td width="457" valign="top"> 
+               <!--- start-special ---> 
+               <list startspecial as s> 
                   <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr> 
                       <td> 
                         <h3>${s.title}</h3>
                         <h4><i>${s.creator}, ${s.webdb_create_formatted}</i></h4>
-                        <p> <if images[s.to_media] && images[s.to_media]["is_published"]=="1"> 
-                          <img src="${images[s.to_media]["icon_path"]}" width="${images[s.to_media]["icon_width"]}" height="${images[s.to_media]["icon_height"]}" alt="" align="left" vspace="8" hspace="8"> 
-                          </if> ${s.description} </p>
-                        <p align="right">[<a href="${producerDocRoot}${s.publish_path}${s.id}.shtml">read</a>]</p>
+                        <p> <if s.to_media && s.to_media[0]["is_published"]=="1"> 
+                          <img src="${s.to_media[0]["icon_path"]}" width="${s.to_media[0]["icon_width"]}" height="${s.to_media[0]["icon_height"]}" alt="${s.to_media[0]["title"]}" align="left" vspace="8" hspace="8"> 
+                          </if> 
+                       ${s.description} </p>
+                        <p align="right">[<a href="${config.docroot}${s.publish_path}${s.id}.shtml">read</a>]</p>
                       </td>
                     </tr>
                   </table>
                   </list> 
-                 <!--- start-special ---> <br>
-                  <!--- features ---> <list items as i> 
+                 <!--- start-special ---> 
+                 <br>
+                  <!--- features ---> 
+                 <list features as i> 
                   <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr> 
                       <td> 
                         <h3>${i.title}</h3>
                         <h4><i>${i.creator}, ${i.webdb_create_formatted}</i></h4>
-                        <p> <if images[i.to_media] && images[i.to_media]["is_published"]=="1"> 
-                          <img src="${images[i.to_media]["icon_path"]}" width="${images[i.to_media]["icon_width"]}" height="${images[i.to_media]["icon_height"]}" alt="" align="left" vspace="8" hspace="8"> 
+                        <p> <if i.to_media && i.to_media[0]["is_published"]=="1"> 
+                          <img src="${i.to_media[0]["icon_path"]}" width="${i.to_media[0]["icon_width"]}" height="${i.to_media[0]["icon_height"]}" alt="${i.to_media[0]["title"]}" align="left" vspace="8" hspace="8"> 
                           </if> ${i.description} </p>
-                        <p align="right">[<a href="${producerDocRoot}${i.publish_path}${i.id}.shtml">read</a>]</p>
+                        <p align="right">[<a href="${config.docroot}${i.publish_path}${i.id}.shtml">read</a>]</p>
                       </td>
                     </tr>
                   </table>
               </tr>
             </table>
           </td>
-                 <td width=1 bgcolor="#000000"><img src="images/1pixel.gif" width="1" height="1"></td>
+          <td width=1 bgcolor="#000000">
+            <img src="images/1pixel.gif" width="1" height="1">
+         </td>
           <td width="150" bgcolor="#666666" valign="top" align="left"> 
             <table width="150" border="0" cellspacing="2" cellpadding="0">
               <tr> 
-                <td> <!-- newswire --> 
+                <td> 
+                 <!-- newswire --> 
                   <p> 
                    <list newswire as n>
                    <img alt="[Text]" border="0" height="10" src="/images/text_small.gif" width="12"> 
-                    <a href="${producerDocRoot}${n.publish_path}${n.id}.shtml"><b>${n.title}</b></a><br>
+                    <a href="${config.docroot}${n.publish_path}${n.id}.shtml"><b>${n.title}</b></a><br>
                     <font size="-2"><b></b>${n.webdb_create_formatted}</font><br>
                     <br>
                     </list> 
     </td>
   </tr>
 </table>
-<p>&nbsp;</p>
 </body>
 </html>
index 2879668..9dd28bf 100755 (executable)
@@ -12,7 +12,7 @@
       <table width="150" border="0" cellspacing="0" cellpadding="0">
         <tr> 
           <td width="140">
-             <a href="/">
+             <a href="/${config.docroot}">
              <img src="images/mirlogo.jpg" width="150" height="205" border="0">
              </a>
           </td>