source/mir/media/MirMedia.java
authormh <mh>
Wed, 27 Mar 2002 13:21:43 +0000 (13:21 +0000)
committermh <mh>
Wed, 27 Mar 2002 13:21:43 +0000 (13:21 +0000)
12 files changed:
source/mir/misc/StringUtil.java
source/mircoders/entity/EntityUploadedMedia.java
source/mircoders/media/MediaHandlerAudio.java
source/mircoders/media/MediaHandlerGeneric.java
source/mircoders/media/MediaHandlerImages.java
source/mircoders/media/MediaHandlerMp3.java
source/mircoders/media/MediaHandlerRealAudio.java
source/mircoders/media/MediaHandlerRealVideo.java
templates-dist/producer/content.template
templates-dist/producer/openposting.template
templates-dist/producer/startpage.template
templates-dist/producer/topiclist.template

index 24de3ab..a9a9a36 100755 (executable)
@@ -980,38 +980,6 @@ public final class StringUtil {
                return createURLLinks(haystack, title, imageRoot, extImage);
        }
 
-       /**
-        * this routine takes text in url format and makes
-        * an image link removing any "illegal" html tags
-        * @param haystack, the url
-        * @param title, the image alt text, can be null
-        * @param height, height of the image
-        * @param width, width of the image
-        * @return a String containing the url
-        */
-       public static String createIMGLinks(String haystack, String title,
-                                        String height,String width) {
-        String wh="";
-        if ( (height != null) && (width != null) ) 
-        {
-            wh = "width=\""+width+"\" height=\""+height+"\""; 
-        }
-               if (title != null) {
-                       title = removeHTMLTags(title);
-                       return re_url.substituteAll(haystack,
-                                        "<img hspace=\"10\" vspace=\"6\" "+
-                                        "align=\"left\" src=\"$0\" "+wh+
-                                        " alt=\""+title+"\"/>&#160;<br><i>"+
-                                        title+"</i>");
-               } else {
-                       return re_url.substituteAll(haystack,
-                                        "<img hspace=\"10\" vspace=\"6\" "+
-                                        "align=\"left\" src=\"$0\" "+wh+
-                                        " alt=\"\"/>&#160;");
-               }
-       }
-
-
         /**
         *  deleteForbiddenTags
         *  this method deletes all <script>, <body> and <head>-tags
index 7e67826..7a1ee12 100755 (executable)
@@ -67,8 +67,8 @@ public class EntityUploadedMedia extends Entity
     if (key!=null) {
       if (key.equals("big_icon"))
         returnValue=getBigIcon();
-      else if (key.equals("list"))
-        returnValue=getListView();
+      else if (key.equals("descr"))
+        returnValue=getDescr();
       else
         returnValue=super.getValue(key);
     }
@@ -83,6 +83,8 @@ public class EntityUploadedMedia extends Entity
     return new SimpleScalar(getValue(key));
   }
 
+  // @todo  all these methods should be merged into 1
+  // and the MediaHandler should be cached somehow.
   private String getBigIcon()
   {
     MirMedia            mediaHandler=null;
@@ -115,7 +117,7 @@ public class EntityUploadedMedia extends Entity
     return null;
   }
 
-  private String getListView()
+  private String getDescr()
   {
     MirMedia            mediaHandler=null;
     Entity              mediaType=null;
@@ -123,13 +125,12 @@ public class EntityUploadedMedia extends Entity
     try {
       mediaType = getMediaType();
       mediaHandler = MediaHelper.getHandler( mediaType );
-      return mediaHandler.getListView(this, mediaType);
+      return mediaHandler.getDescr();
     } catch (Exception ex) {
-      theLog.printWarning("-- getUrl: could not fetch data "
+      theLog.printWarning("-- getDescr: could not fetch data "
                          + this.getClass().toString()+" "+ ex.toString());
     }
     return null;
   }
 
-
 }
index d32ff50..351878c 100755 (executable)
@@ -48,4 +48,5 @@ public class MediaHandlerAudio extends MediaHandlerGeneric implements MirMedia
   {
     return true;
   }
+
 }
index e3d2124..9b80523 100755 (executable)
@@ -146,27 +146,24 @@ public class MediaHandlerGeneric implements MirMedia
       return theList;
     }
 
-    public String getListView(Entity ent, Entity mediaTypeEnt)
-    {
-      //String title = ent.getValue("title")+
-      //  " - "+mediaTypeEnt.getValue("name")+" "+
-      //  ent.getValue("size")+" Bytes";
-      return getBigIcon();
-    }
-
     public boolean isVideo()
     {
-        return false;
+      return false;
     }
 
     public boolean isAudio()
     {
-        return false;
+      return false;
     }
 
     public boolean isImage()
     {
-        return false;
+      return false;
+    }
+
+    public String getDescr()
+    {
+      return "";
     }
 
 }
index b72ca18..a49f351 100755 (executable)
@@ -118,14 +118,6 @@ public class MediaHandlerImages implements MirMedia
     return icon_data;
   }
 
-  public String getListView(Entity ent, Entity mediaTypeEnt)
-  {
-    //String title = ent.getValue("title");
-    return StringUtil.createIMGLinks(
-      MirConfig.getProp("Producer.ProductionHost")+ent.getValue("icon_path"),
-      null, ent.getValue("icon_height"), ent.getValue("icon_width"));
-  }
-
   public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
   {
     SimpleList theList = new SimpleList();
@@ -178,4 +170,9 @@ public class MediaHandlerImages implements MirMedia
     return true;
   } 
 
+  public String getDescr()
+  {
+    return "";
+  }
+
 }
index 26484fd..bc8e19c 100755 (executable)
@@ -102,6 +102,11 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
 
   }
 
+  public String getDescr()
+  {
+    return "Mp3 audio";
+  }
+
 }
         
         
index 1b08664..0aad13c 100755 (executable)
@@ -61,6 +61,11 @@ public class MediaHandlerRealAudio extends MediaHandlerAudio implements
       return MirConfig.getProp("Producer.RealMedia.Path");
     }
 
+    public String getDescr()
+    {
+      return "RealMedia Audio";
+    }
+
 }
         
         
index 91e888e..d41cfef 100755 (executable)
@@ -61,6 +61,11 @@ public class MediaHandlerRealVideo extends MediaHandlerVideo implements
       return MirConfig.getProp("Producer.RealMedia.Path");
     }
 
+    public String getDescr()
+    {
+      return "RealMedia Video";
+    }
+
 }
         
         
index 632a013..9eb620d 100755 (executable)
@@ -73,7 +73,7 @@
               <p>
                 <img src="/img/${media["big_icon"]}" border="0" alt="">
                 <a href="${audio["publish_server"]}${audio["publish_path"]}">
-                ${audio["title"]}</a>
+                ${audio["title"]} - ${media["descr"]}</a>
               </p>
             </list>
           </list>
@@ -82,7 +82,7 @@
               <p>
                 <img src="/img/${media["big_icon"]}" border="0" alt="">
                 <a href="${video["publish_server"]}${video["publish_path"]}">
-                ${video["title"]}</a>
+                ${video["title"]} - ${media["descr"]}</a>
               </p>
             </list>
           </list>
@@ -91,7 +91,7 @@
               <p>
                 <img src="/img/${media["big_icon"]}" border="0" alt="">
                 <a href="${other["publish_server"]}${other["publish_path"]}">
-                ${other["title"]}</a>
+                ${other["title"]} - ${media["descr"]}</a>
               </p>
             </list>
           </list>
index dbc2b35..9a5b9b8 100755 (executable)
               <tr> 
                 <td width="100%" valign="top"> 
                   <!--- articles ---> 
-                  <list contentlist as i> 
+                  <list data.contentlist 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 i.to_media_audio > 
-                          ${i.to_media_audio[0]["list"]}
-                      </if> 
-                                 <if i.to_media_video > 
-                          ${i.to_media_video[0]["list"]}
-                      </if> 
-                                 <if i.to_media_other > 
-                          ${i.to_media_other[0]["list"]}
-                      </if> 
-                      <p>
-                                 <if i.to_media_images >
-                          ${i.to_media_images[0]["list"]}
-                      </if> 
+                        <if i.to_media_audio > 
+                          <img src="/img/${i.to_media_audio[0]["big_icon"]}">
+                        </if> 
+                        <if i.to_media_video > 
+                          <img src="/img/${i.to_media_video[0]["big_icon"]}">
+                        </if> 
+                        <if i.to_media_other > 
+                          <img src="/img/${i.to_media_other[0]["big_icon"]}">
+                        </if> 
+                        <p>
+                        <if i.to_media_images >
+                          <img src="${i.to_media_images[0]["icon_path"]}"
+                            width="${i.to_media_images[0]["icon_width"]}"
+                            height="${i.to_media_images[0]["icon_height"]}"
+                            border=0 alt="${i.to_media_images[0]["title"]}">
+                        </if> 
                          ${i.description}</p>
                         <p align="right">[<a href="${config.producerDocRoot}${i.publish_path}${i.id}.shtml">read</a>]</p>
                       </td>
index b213238..0284dea 100755 (executable)
                         <h3>${s.title}</h3>
                         <h4><i>${s.creator}, ${s.webdb_create_formatted}</i></h4>
                         <p>                     
-                        <if s.to_media_audio && s.to_media_audio[0]["is_published"]=="1"
-                          ${s.to_media_audio[0]["list"]}
+                        <if s.to_media_audio > 
+                          <img src="/img/${s.to_media_audio[0]["big_icon"]}">
                         </if> 
-                        <if s.to_media_video && s.to_media_video[0]["is_published"]=="1"
-                          ${s.to_media_video[0]["list"]}
+                        <if s.to_media_video > 
+                          <img src="/img/${s.to_media_video[0]["big_icon"]}">
                         </if> 
-                        <if s.to_media_other && s.to_media_other[0]["is_published"]=="1"
-                          ${s.to_media_other[0]["list"]}
+                        <if s.to_media_other > 
+                          <img src="/img/${s.to_media_other[0]["big_icon"]}">
                         </if> 
                         <p>
-                        <if s.to_media_images && s.to_media_images[0]["is_published"]=="1"> 
-                          ${s.to_media_images[0]["list"]}
+                        <if s.to_media_images >
+                          <img src="${s.to_media_images[0]["icon_path"]}"
+                            width="${s.to_media_images[0]["icon_width"]}"
+                            height="${s.to_media_images[0]["icon_height"]}"
+                            border=0 alt="${s.to_media_images[0]["title"]}">
                         </if> 
                        ${s.description_parsed} </p>
                         <p align="right">[<a href="${config.producerDocRoot}${s.publish_path}${s.id}.shtml">read</a>]</p>
                         <h3>${i.title}</h3>
                         <h4><i>${i.creator}, ${i.webdb_create_formatted}</i></h4>
                         <p>                     
-                        <if i.to_media_audio && i.to_media_audio[0]["is_published"]=="1"
-                          ${i.to_media_audio[0]["list"]}
+                        <if i.to_media_audio > 
+                          <img src="/img/${i.to_media_audio[0]["big_icon"]}">
                         </if> 
-                        <if i.to_media_video && i.to_media_video[0]["is_published"]=="1"
-                          ${i.to_media_video[0]["list"]}
+                        <if i.to_media_video > 
+                          <img src="/img/${i.to_media_video[0]["big_icon"]}">
                         </if> 
-                        <if i.to_media_other && i.to_media_other[0]["is_published"]=="1"
-                          ${i.to_media_other[0]["list"]}
+                        <if i.to_media_other > 
+                          <img src="/img/${i.to_media_other[0]["big_icon"]}">
                         </if> 
                         <p>
-                        <if i.to_media_images && i.to_media_images[0]["is_published"]=="1"> 
-                          ${i.to_media_images[0]["list"]}
+                        <if i.to_media_images >
+                          <img src="${i.to_media_images[0]["icon_path"]}"
+                            width="${i.to_media_images[0]["icon_width"]}"
+                            height="${i.to_media_images[0]["icon_height"]}"
+                            border=0 alt="${i.to_media_images[0]["title"]}">
                         </if> 
                           ${i.description_parsed} </p>
                         <p align="right">[<a href="${config.producerDocRoot}${i.publish_path}${i.id}.shtml">read</a>]</p>
index 769bea2..a089b52 100755 (executable)
                         <h3>${data.special.title}</h3>
                         <h4><i>${data.special.creator}, ${data.special.webdb_create_formatted}</i></h4>
                         <p> 
-                <if special.to_media_audio && special.to_media_audio[0]["is_published"]=="1"> 
-                  ${data.special.to_media_audio[0]["list"]}
-                </if> 
-                <if special.to_media_video && special.to_media_video[0]["is_published"]=="1"> 
-                  ${data.special.to_media_video[0]["list"]}
-                </if> 
-                <if special.to_media_other && special.to_media_other[0]["is_published"]=="1"> 
-                  ${data.special.to_media_other[0]["list"]}
-                </if> 
-                <p>
-                <if special.to_media_images && special.to_media_images[0]["is_published"]=="1"> 
-                  ${data.special.to_media_images[0]["list"]}
-                </if> 
+                        <if data.special.to_media_audio > 
+                          <img src="/img/${data.special.to_media_audio[0]["big_icon"]}">
+                        </if> 
+                        <if data.special.to_media_video > 
+                          <img src="/img/${data.special.to_media_video[0]["big_icon"]}">
+                        </if> 
+                        <if data.special.to_media_other > 
+                          <img src="/img/${data.special.to_media_other[0]["big_icon"]}">
+                        </if> 
+                        <p>
+                        <if data.special.to_media_images >
+                          <img src="${data.special.to_media_images[0]["icon_path"]}"
+                            width="${data.special.to_media_images[0]["icon_width"]}"
+                            height="${data.special.to_media_images[0]["icon_height"]}"
+                            border=0 alt="${data.special.to_media_images[0]["title"]}">
+                        </if> 
                           ${data.special.description_parsed} </p>
                         <p align="right">[<a href="${config.producerDocroot}${data.special.publish_path}${data.special.id}.shtml">read</a>]</p>
                       </td>
                         <h3>${i.title}</h3>
                         <h4><i>${i.creator}, ${i.webdb_create_formatted}</i></h4>
                         <p>                     
-                <if i.to_media_audio && i.to_media_audio[0]["is_published"]=="1"> 
-                  ${i.to_media_audio[0]["list"]}
-                </if> 
-                                 <if i.to_media_video && i.to_media_video[0]["is_published"]=="1"> 
-                  ${i.to_media_video[0]["list"]}
-                </if> 
-                                 <if i.to_media_other && i.to_media_other[0]["is_published"]=="1"> 
-                  ${i.to_media_other[0]["list"]}
-                </if> 
-                <p>
-                                 <if i.to_media_images && i.to_media_images[0]["is_published"]=="1"> 
-                  ${i.to_media_images[0]["list"]}
-                </if> 
+                        <if i.to_media_audio > 
+                          <img src="/img/${i.to_media_audio[0]["big_icon"]}">
+                        </if> 
+                        <if i.to_media_video > 
+                          <img src="/img/${i.to_media_video[0]["big_icon"]}">
+                        </if> 
+                        <if i.to_media_other > 
+                          <img src="/img/${i.to_media_other[0]["big_icon"]}">
+                        </if> 
+                        <p>
+                        <if i.to_media_images >
+                          <img src="${i.to_media_images[0]["icon_path"]}"
+                            width="${i.to_media_images[0]["icon_width"]}"
+                            height="${i.to_media_images[0]["icon_height"]}"
+                            border=0 alt="${i.to_media_images[0]["title"]}">
+                        </if> 
                          ${i.description_parsed}</p>
                         <p align="right">[<a href="${config.producerDocroot}${i.publish_path}${i.id}.shtml">read</a>]</p>
                       </td>