/**
* Diese Klasse enthält die Daten eines MetaObjekts
*
- * @author RK
- * @version 29.6.1999
+ * @author mh, mir-coders group
+ * @version $Id: EntityUploadedMedia.java,v 1.12 2002/11/27 08:57:31 mh Exp $
*/
if (key != null) {
if (key.equals("big_icon"))
returnValue = getBigIconName();
- else if (key.equals("descr"))
+ else if (key.equals("descr") || key.equals("description"))
returnValue = getDescr();
else if (key.equals("mediatype"))
returnValue = getMediaTypeString();
*
* @see mir.media.MirMedia
* @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerGeneric.java,v 1.10 2002/11/04 04:35:22 mh Exp $
+ * @version $Id: MediaHandlerGeneric.java,v 1.11 2002/11/27 08:57:32 mh Exp $
*/
public class MediaHandlerGeneric implements MirMedia
protected static String imageHost = MirConfig.getProp("Producer.Image.Host");
protected static String imageRoot = MirConfig.getProp("Producer.ImageRoot");
protected static Logfile theLog = Logfile.getInstance(
- MirConfig.getProp("Home")+
+ MirConfig.getProp("Home")+
"log/media.log");
private final String sepChar = File.separator;
-
+
public void set (InputStream in, Entity ent, Entity mediaTypeEnt )
throws MirMediaException {
try {
long size = FileUtil.write(getStoragePath()+sepChar+datePath+
sepChar+mediaFname, in);
- ent.setValueForProperty("publish_path",datePath+sepChar+mediaFname);
+ ent.setValueForProperty("publish_path",datePath+mediaFname);
ent.setValueForProperty("size", new Long(size).toString());
ent.update();
} catch (Exception e) {
public InputStream getMedia (Entity ent, Entity mediaTypeEnt)
throws MirMediaException {
- String publishPath = mediaTypeEnt.getValue("publish_path");
+ String publishPath = ent.getValue("publish_path");
String fname = getStoragePath()+publishPath;
File f = new File(fname);
if(! f.exists())
throw new MirMediaException("error in MirMedia.getMedia(): "+fname+
- "does not exist!");
+ " does not exist!");
FileInputStream in;
try {
in = new FileInputStream(f);
public String getPublishHost()
{
- return MirConfig.getProp("Producer.Media.Host");
+ return StringUtil.removeSlash(MirConfig.getProp("Producer.Media.Host"));
}
public String getTinyIconName()
*
* @see mir.media.MirMedia
* @author mh
- * @version $Date: 2002/11/04 04:35:22 $ $Revision: 1.11 $
+ * @version $Id: MediaHandlerImages.java,v 1.12 2002/11/27 08:57:32 mh Exp $
*/
public String getPublishHost()
{
- return MirConfig.getProp("Producer.Image.Host");
+ return StringUtil.removeSlash(MirConfig.getProp("Producer.Image.Host"));
}
public String getTinyIconName()
public String getDescr(Entity mediaType)
{
- return "";
+ return "image/jpeg";
}
}
package mircoders.media;
-//import java.lang.*;
-//import java.io.*;
-//import java.util.*;
-//import java.lang.reflect.*;
-
-//import freemarker.template.SimpleList;
-
import mir.media.*;
-//import mir.misc.*;
+import mir.entity.Entity;
/**
* This class handles saving, fetching creating representations
*
* @see mir.media.MirMedia
* @see mircoders.media.MediaHandlerImages
- * @author mh
- * @version 24.09.2001
+ * @author mh, mir-coders group
+ * @version $Id: MediaHandlerImagesJpeg.java,v 1.3 2002/11/27 08:57:32 mh Exp $
*/
return JPEG;
}
+ public String getDescr(Entity mediaType)
+ {
+ return "image/jpeg";
+ }
+
}
package mircoders.media;
-//import java.lang.*;
-//import java.io.*;
-//import java.util.*;
-//import java.lang.reflect.*;
-
-//import freemarker.template.SimpleList;
-
import mir.media.*;
-//import mir.misc.*;
+import mir.entity.Entity;
/**
* This class handles saving, fetching creating representations
*
* @see mir.media.MirMedia
* @see mircoders.media.MediaHandlerImages
- * @author mh
- * @version 24.09.2001
+ * @author mh ,mir-coders
+ * @version $Id: MediaHandlerImagesPng.java,v 1.3 2002/11/27 08:57:32 mh Exp $
*/
return PNG;
}
+ public String getDescr(Entity mediaType)
+ {
+ return "image/png";
+ }
+
}
public String getPublishHost()
{
- return MirConfig.getProp("Producer.RealMedia.Host");
+ return StringUtil.removeSlash(MirConfig.getProp("Producer.RealMedia.Host"));
}
}
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version 11.10.2001
+ * @version $Id: MediaHandlerRealVideo.java,v 1.12 2002/11/27 08:57:32 mh Exp $
*/
public String getPublishHost()
{
- return MirConfig.getProp("Producer.RealMedia.Host");
+ return StringUtil.removeSlash(MirConfig.getProp("Producer.RealMedia.Host"));
}
}
* ServletModuleImages -
* liefert HTML fuer Images
*
- *
- * @author RK
+ * @version $Id: ServletModuleImages.java,v 1.23 2002/11/27 08:57:32 mh Exp $
+ * @author RK, the mir-coders group
*/
public class ServletModuleImages extends ServletModuleUploadedMedia
}
}
- public void showimg(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- String idParam = req.getParameter("id");
- if (idParam!=null && !idParam.equals("")) {
- try {
- EntityImages entImage =(EntityImages)mainModule.getById(idParam);
- ServletContext ctx =
- (ServletContext)MirConfig.getPropAsObject("ServletContext");
- String fName = entImage.getId()+"."
- +entImage.getMediaType().getValue("name");
- res.setContentType(ctx.getMimeType(fName));
- ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
-
- InputStream in = entImage.getImage();
- int read;
- byte[] buf = new byte[8 * 1024];
- while((read = in.read(buf)) != -1) {
- out.write(buf, 0, read);
- }
- in.close();
- out.close();
- }
-
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
- else theLog.printDebugInfo("id nicht angeben.");
- // darf keine exception werfen
- }
-
- public void showicon(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- String idParam = req.getParameter("id");
- if (idParam!=null && !idParam.equals("")) {
- try {
- EntityImages entImage =(EntityImages)mainModule.getById(idParam);
- ServletContext ctx =
- (ServletContext)MirConfig.getPropAsObject("ServletContext");
- String fName = entImage.getId()+"."
- +entImage.getMediaType().getValue("name");
- res.setContentType(ctx.getMimeType(fName));
- ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
-
- InputStream in = entImage.getIcon();
- int read;
- byte[] buf = new byte[8 * 1024];
- while((read = in.read(buf)) != -1) {
- out.write(buf, 0, read);
- }
- in.close();
- //out.write(outbytes);
- out.close();
- }
-
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
- else throw new ServletModuleException("id nicht angeben.");
- }
}
import mir.storage.Database;
import mir.storage.StorageObjectException;
import mircoders.entity.EntityUsers;
+import mircoders.entity.EntityUploadedMedia;
import mircoders.storage.DatabaseMediaType;
import mircoders.storage.DatabaseMediafolder;
import mircoders.media.MediaRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
+import javax.servlet.ServletOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URLEncoder;
import java.util.GregorianCalendar;
import java.util.HashMap;
* ServletModuleBilder -
* liefert HTML fuer Bilder
*
- *
- * @author RK
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.11 2002/11/27 08:57:32 mh Exp $
+ * @author RK, the mir-coders group
*/
public abstract class ServletModuleUploadedMedia
return (EntityUsers) session.getAttribute("login.uid");
}
+ public void getMedia(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ String idParam = req.getParameter("id");
+ if (idParam!=null && !idParam.equals("")) {
+ try {
+ EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);
+ Entity mediaType = ent.getMediaType();
+ MirMedia mediaHandler;
+
+ ServletContext ctx =
+ (ServletContext)MirConfig.getPropAsObject("ServletContext");
+ String fName = ent.getId()+"."+mediaType.getValue("name");
+
+ mediaHandler = MediaHelper.getHandler(mediaType);
+ InputStream in = mediaHandler.getMedia(ent, mediaType);
+
+ res.setContentType(ctx.getMimeType(fName));
+ //important that before calling this res.getWriter was not called first
+ ServletOutputStream out = res.getOutputStream();
+
+ int read ;
+ byte[] buf = new byte[8 * 1024];
+ while((read = in.read(buf)) != -1) {
+ out.write(buf, 0, read);
+ }
+ in.close();
+ out.close();
+ }
+
+ catch (IOException e) {
+ throw new ServletModuleException(e.toString());
+ }
+ catch (ModuleException e) {
+ throw new ServletModuleException(e.toString());
+ }
+ catch (Exception e) {
+ throw new ServletModuleException(e.toString());
+ }
+ }
+ else theLog.printDebugInfo("id nicht angeben.");
+ // darf keine exception werfen
+ }
+
+ public void getIcon(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ String idParam = req.getParameter("id");
+ if (idParam!=null && !idParam.equals("")) {
+ try {
+ EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);
+ Entity mediaType = ent.getMediaType();
+ MirMedia mediaHandler;
+
+ ServletContext ctx =
+ (ServletContext)MirConfig.getPropAsObject("ServletContext");
+ String fName = ent.getId()+"."+mediaType.getValue("name");
+
+ mediaHandler = MediaHelper.getHandler(mediaType);
+ InputStream in = mediaHandler.getIcon(ent);
+
+ res.setContentType(ctx.getMimeType(fName));
+ //important that before calling this res.getWriter was not called first
+ ServletOutputStream out = res.getOutputStream();
+
+ int read ;
+ byte[] buf = new byte[8 * 1024];
+ while((read = in.read(buf)) != -1) {
+ out.write(buf, 0, read);
+ }
+ in.close();
+ out.close();
+ }
+
+ catch (IOException e) {
+ throw new ServletModuleException(e.toString());
+ }
+ catch (ModuleException e) {
+ throw new ServletModuleException(e.toString());
+ }
+ catch (Exception e) {
+ throw new ServletModuleException(e.toString());
+ }
+ }
+ else theLog.printDebugInfo("id nicht angeben.");
+ // darf keine exception werfen
+ }
+
}
<tr>
<td align="right" class="darkgrey">
<span class="witesmall">
- <img src="${config.docRoot}/img/${data.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=Audio&do=getMedia&id=${data.id}">
+ <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
<td valign="bottom"><span class="spezialtext">
${lang("media.created")}: ${data.webdb_create}
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<list data.contentlist as entry>
<tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
<td>
- <img src="${config.docRoot}/img/${entry.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=Audio&do=getMedia&id=${entry.id}">
+ <img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
<td>${entry.title}
- <if entry.decription><br>${entry.description}</if></td>
+ <if entry.description><br>${entry.description}</if></td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
<td align="right" class="darkgrey">
<if (data.icon_data!="" && data.icon_data!="0") && !new>
<span class="witesmall">
- <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=showimg&id=${data.id}')">
- <img src="${config.actionRoot}?module=Images&do=showicon&id=${data.id}" border=0></a></span></td>
+ <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${data.id}')">
+ <img src="${config.actionRoot}?module=Images&do=getIcon&id=${data.id}" border=0></a></span></td>
</if>
<td valign="bottom"><span class="spezialtext">
${lang("media.created")}: ${data.webdb_create} <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"> </if>>
<td>
<if entry.icon_data!="" && entry.icon_data!="0">
- <a href="${config.actionRoot}?module=Images&do=showimg&id=${entry.id}" target="new">
- <img src="${config.actionRoot}?module=Images&do=showicon&id=${entry.id}" border=0></a></span></td>
+ <a href="${config.actionRoot}?module=Images&do=getMedia&id=${entry.id}" target="new">
+ <img src="${config.actionRoot}?module=Images&do=getIcon&id=${entry.id}" border=0></a></span></td>
</if>
<td>${entry.title}
- <if entry.decription><br>${entry.description}</if></td>
+ <if entry.description><br>${entry.description}</if></td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
<tr>
<td align="right" class="darkgrey">
<span class="witesmall">
- <img src="${config.docRoot}/img/${data.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=OtherMedia&do=getMedia&id=${data.id}">
+ <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
<td valign="bottom"><span class="spezialtext">
${lang("media.created")}: ${data.webdb_create}
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
</tr>
<if data.contentlist>
<list data.contentlist as entry>
- <tr <if grey=="1"><assign grey="0">bgcolor="#dddddd"<else><assign grey="1"></if>
+ <tr <if grey=="1"><assign grey="0">class="list1"<else>class="list2"<assign grey="1"></if>>
<td>
- <img src="${config.docRoot}/img/${entry.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=OtherMedia&do=getMedia&id=${entry.id}">
+ <img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
<td>${entry.title}
- <if entry.decription><br>${entry.description}</if></td>
+ <if entry.description><br>${entry.description}</if></td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
<tr>
<td align="right" class="darkgrey">
<span class="witesmall">
- <img src="${config.docRoot}/img/${data.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=Video&do=getMedia&id=${data.id}">
+ <img src="${config.docRoot}/img/${data.big_icon}" border=0></a></span></td>
<td valign="bottom"><span class="spezialtext">
${lang("media.created")}: ${data.webdb_create}
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<list data.contentlist as entry>
<tr <if grey=="1"><assign grey="0">class="list1"<else>class="list1"<assign grey="1"> </if>>
<td>
- <img src="${config.docRoot}/img/${entry.big_icon}" border=0></span></td>
+ <a href="${config.actionRoot}?module=Video&do=getMedia&id=${entry.id}">
+ <img src="${config.docRoot}/img/${entry.big_icon}" border=1></a></span></td>
<td>${entry.title}
- <if entry.decription><br>${entry.description}</if></td>
+ <if entry.description><br>${entry.description}</if></td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">