########## admin ##########
# language: deutsch / german
-# $Id: admin_de.properties,v 1.15 2002/10/08 14:03:29 bruno Exp $
+# $Id: admin_de.properties,v 1.16 2002/11/28 07:28:24 mh Exp $
# general
yes=ja
media.type=Typ
media.mediafolder=Mediafolder
media.title=Titel
+media.size=Grösser
media.description=Beschreibung
media.date=Datum/Zusatz
media.location=Ort
########## admin ##########
# language: english
-# $Id: admin_en.properties,v 1.23 2002/11/20 17:47:39 zapata Exp $
+# $Id: admin_en.properties,v 1.24 2002/11/28 07:28:24 mh Exp $
# general
yes=yes
media.type=type
media.mediafolder=Media folder
media.title=title
+media.size=size
media.description=description
media.date=date
media.location=location
########## admin ##########
# language: espanol / spanish
-# $Id: admin_es.properties,v 1.7 2002/11/20 17:47:39 zapata Exp $
+# $Id: admin_es.properties,v 1.8 2002/11/28 07:28:24 mh Exp $
# general
yes=sí
media.type=Tipo
media.mediafolder=Carpeta de recursos mediáticos
media.title=Título
+media.size=Tamaño
media.description=Descripción
media.date=Fecha
media.location=Lugar de origen
media.format=Formato
media.rights=Copyright
media.type=Tipo
+media.size=Tamaño
media.mediafolder=Carpeta de recursos mediáticos
media.title=Título
media.description=Descripción
media.type=Tipo
media.mediafolder=Carpeta de recursos mediáticos
media.title=Título
+media.size=Tamaño
media.description=Descripción
media.date=Fecha
media.location=Lugar de origen
<list article.to_media_audio as media>
<p>
<a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["descr"]}
+ ${media["title"]} - ${media["descr"]} ${media["size"]}
</a>
</p>
</list>
<p>
<img src="../../../img/${media["big_icon"]}" border="0" alt="">
<a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["descr"]}</a>
+ ${media["title"]} - ${media["descr"]} ${media["size"]}</a>
</p>
</list>
<list article.to_media_other as media>
<p>
<img src="../../../img/${media["big_icon"]}" border="0" alt="">
<a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["descr"]}</a>
+ ${media["title"]} - ${media["descr"]} ${media["size"]}</a>
</p>
</list>
--- /dev/null
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two. You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries. If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so. If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.misc;
+
+import freemarker.template.*;
+
+import java.text.NumberFormat;
+import java.util.List;
+
+/**
+ * Help methods for number handling.
+ *
+ * @version $Id: NumberUtils.java,v 1.2 2002/11/28 07:28:24 mh Exp $
+ * @author mh, Mir-coders group
+ *
+ */
+
+public final class NumberUtils {
+
+ /*
+ * Uses a suffix indicating multiples of 1024 (K),
+ * 1024*1024 (M), and 1024*1024*1024 (G). For example,
+ * 8500 would be converted to 8.3K, 133456345 to
+ * 127M, 56990456345 to 53G, and so on. Numbers
+ * smaller than 1024 aren't modified.
+ *
+ * @param bytes The number of bytes.
+ * @return A text representation of the number of bytes,
+ * abbreviated for larger quantities.
+ */
+ public static String humanReadableSize(double bytes)
+ {
+ String suffix;
+
+ if( bytes >= 1024 * 1024 * 1024 )
+ {
+ bytes /= (1024 * 1024 * 1024);
+ suffix = "G";
+ }
+ else if( bytes >= 1024 * 1024 )
+ {
+ bytes /= (1024 * 1024);
+ suffix = "M";
+ }
+ else if( bytes >= 1024 )
+ {
+ bytes /= 1024;
+ suffix = "K";
+ }
+ else
+ {
+ suffix = "";
+ }
+ int frac = (bytes >= 10 || bytes == 0) ? 0 : 1;
+ NumberFormat nf = NumberFormat.getInstance();
+ nf.setMinimumFractionDigits(frac);
+ nf.setMaximumFractionDigits(frac);
+ System.out.println(nf.getMinimumIntegerDigits());
+ nf.setGroupingUsed(false);
+ return nf.format(bytes) + suffix;
+ }
+
+}
+
import mir.media.MirMedia;
import mir.storage.StorageObject;
import mir.storage.StorageObjectException;
+import mir.misc.NumberUtils;
import mircoders.storage.DatabaseUploadedMedia;
import java.util.HashMap;
* Diese Klasse enthält die Daten eines MetaObjekts
*
* @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.12 2002/11/27 08:57:31 mh Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.13 2002/11/28 07:28:24 mh Exp $
*/
returnValue = getMediaTypeString();
else if (key.equals("mimetype"))
returnValue = getMimeType();
+ else if (key.equals("size")) {
+ String size = super.getValue(key);
+ if (size != null)
+ returnValue = NumberUtils.humanReadableSize(Double.parseDouble(size));
+ }
else
returnValue = super.getValue(key);
}
*
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
- * @author mh <heckmann@hbe.ca>
- * @version 24.09.2001
+ * @author mh <mh@nadir.org>
+ * @version $Id: MediaHandlerAudio.java,v 1.6 2002/11/28 07:28:24 mh Exp $
*/
public class MediaHandlerAudio extends MediaHandlerGeneric implements MirMedia
*
* @see mir.media.MirMedia
* @author mh
- * @version $Id: MediaHandlerImages.java,v 1.12 2002/11/27 08:57:32 mh Exp $
+ * @version $Id: MediaHandlerImages.java,v 1.13 2002/11/28 07:28:24 mh Exp $
*/
* @see mir.media.MirMedia
* @see mircoders.media.MediaHandlerImages
* @author mh ,mir-coders
- * @version $Id: MediaHandlerImagesPng.java,v 1.3 2002/11/27 08:57:32 mh Exp $
+ * @version $Id: MediaHandlerImagesPng.java,v 1.4 2002/11/28 07:28:24 mh Exp $
*/
* If the web server is not apache, then your on your own.
*
* @see mir.media.MirMedia
- * @author mh <heckmann@hbe.ca>
- * @version 01.12.2001
+ * @author mh <mh@nadir.org>
+ * @version $Id: MediaHandlerMp3.java,v 1.9 2002/11/28 07:28:24 mh Exp $
*/
public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
public String getDescr(Entity mediaType)
{
- return "Mp3 audio";
+ return "mp3";
}
}
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version 11.10.2001
+ * @version $Id: MediaHandlerRealAudio.java,v 1.13 2002/11/28 07:28:24 mh Exp $
*/
public String getDescr(Entity mediaType)
{
- return "RealMedia Audio";
+ return "RealMedia";
}
public String getPublishHost()
*
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
- * @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version $Id: MediaHandlerRealVideo.java,v 1.12 2002/11/27 08:57:32 mh Exp $
+ * @author john <john@manifestor.org>, mh <mh@nadir.org>
+ * @version $Id: MediaHandlerRealVideo.java,v 1.13 2002/11/28 07:28:24 mh Exp $
*/
public String getDescr(Entity mediaType)
{
- return "RealMedia Video";
+ return "RealMedia";
}
public String getPublishHost()
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>
- * @version 11.10.2001
+ * @version $Id: MediaHandlerVideo.java,v 1.5 2002/11/28 07:28:24 mh Exp $
*/
public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia
* appropriate media objects are set.
*
* @author mh
- * @version $Id: MediaRequest.java,v 1.6 2002/11/27 08:06:54 mh Exp $
+ * @version $Id: MediaRequest.java,v 1.7 2002/11/28 07:28:24 mh Exp $
*
*/
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
${lang("media.format")}: ${data.mimetype} / ${data.descr}<br>
+ ${lang("media.size")}: ${data.size}<br>
${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
</td>
</tr>
<td><span class="witesmall">
<b>${lang("media.title")}</b></span></td>
<td><span class="witesmall">
+ <b>${lang("media.size")}</b></span></td>
+ <td><span class="witesmall">
<b>${lang("media.mediafolder")}</b></span></td>
<td><span class="witesmall">
<b>${lang("media.creator")}</b></span></td>
<img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
<td>${entry.title}
<if entry.description><br>${entry.description}</if></td>
+ <td>${entry.size} </td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
${lang("media.created")}: ${data.webdb_create} <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
${lang("media.format")}: ${data.img_width}x${data.img_height} / ${data.imgformatHashdata[to_img_format]["name"]} / ${data.imglayoutHashdata[to_img_layout]["name"]} / ${data.imgcolorHashdata[to_img_color]["name"]}<br>
+ ${lang("media.size")}: ${data.size}<br>
${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
${lang("media.type")}: <b>${data.imgtypeHashdata[to_img_type]["name"]}</b><br>
</span>
<td><span class="witesmall">
<b>${lang("media.title")}</b></span></td>
<td><span class="witesmall">
+ <b>${lang("media.size")}</b></span></td>
+ <td><span class="witesmall">
<b>${lang("media.mediafolder")}</b></span></td>
<td><span class="witesmall">
<b>${lang("media.creator")}</b></span></td>
</if>
<td>${entry.title}
<if entry.description><br>${entry.description}</if></td>
+ <td>${entry.size} </td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
${lang("media.format")}: ${data.mimetype} / ${data.descr}<br>
+ ${lang("media.size")}: ${data.size}<br>
${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
</td>
</tr>
<td><span class="witesmall">
<b>${lang("media.title")}</b></span></td>
<td><span class="witesmall">
+ <b>${lang("media.size")}</b></span></td>
+ <td><span class="witesmall">
<b>${lang("media.mediafolder")}</b></span></td>
<td><span class="witesmall">
<b>${lang("media.creator")}</b></span></td>
<img src="${config.docRoot}/img/${entry.big_icon}" border=0></a></span></td>
<td>${entry.title}
<if entry.description><br>${entry.description}</if></td>
+ <td>${entry.size} </td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">
<if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
<if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
${lang("media.format")}: ${data.mimetype} / ${data.descr}<br>
+ ${lang("media.size")}: ${data.size}<br>
${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
</td>
</tr>
<td><span class="witesmall">
<b>${lang("media.title")}</b></span></td>
<td><span class="witesmall">
+ <b>${lang("media.size")}</b></span></td>
+ <td><span class="witesmall">
<b>${lang("media.mediafolder")}</b></span></td>
<td><span class="witesmall">
<b>${lang("media.creator")}</b></span></td>
<img src="${config.docRoot}/img/${entry.big_icon}" border=1></a></span></td>
<td>${entry.title}
<if entry.description><br>${entry.description}</if></td>
+ <td>${entry.size} </td>
<td>${data.mediafolderHashdata[entry.to_media_folder]["name"]} </td>
<td>${entry.creator} </td>
<td><span class="text">