-/*
- * put your module comment here
- */
-
-
package mir.misc;
import java.net.*;
*
*/
public class Configuration {
-
- private static int instances=0;
-
+
private static HashMap confs = new HashMap(); // key: conffilename, confHash
private String confFilename;
}
protected static Enumeration getResourceKeys() {
- return conf.getKeys();
+ return conf.getKeys();
}
}
/**
- * Liefert Hashtabel mit den Konfigurationen
+ * Liefert Hashtable mit den Konfigurationen
* @return
*/
public static HashMap getConfs(){
return confs;
}
-
- /**
- * Finalize Methode
- */
- protected void finalize(){
- instances --;
- try {
- super.finalize();
- } catch (Throwable t) {}
- }
-
} //end of class
-/*
- * put your module comment here
- */
-
-
package mir.misc;
import javax.servlet.http.*;
/**
* Title: Mir
- * Description: Class that allows access to all Mir
+ * Description: Class that allows access to all Mir
* config values
* Copyright: Copyright (c) 2001
* Company: Indymedia
/**
* This class is a layer above the Configuration
- * It manages access to config variables that are
+ * It manages access to config variables that are
* both generated on the fly and found in the config file.
*/
private static HashMap configHash = new HashMap();
private static HashMap brokerHash = new HashMap();
-
private static int instances=0;
/**
* Initializes Configuration hash that contains all values.
- * loads the config.properties file and any other values
- * @param Uri, the root Uri of the install
- * @param Home, The absolute path if the install root.
- * @param Name, The name of the servlet (usually "Mir")
+ * loads the properties-file and any other values
+ * @param uri, the root Uri of the install
+ * @param home, The absolute path if the install root.
+ * @param name, The name of the servlet (usually "Mir")
* @param confName, the name of the config file to load.
*/
- public static void initConfig(String Home, String Uri, String Name, String confName) {
+ public static void initConfig(String home, String uri, String name, String confName) {
initConfResource(confName);
- configHash.put("Home", Home);
- configHash.put("RootUri", Uri);
- configHash.put("ServletName", Name);
+ configHash.put("Home", home);
+ configHash.put("RootUri", uri);
+ configHash.put("ServletName", name);
- Enumeration ResKeys = getResourceKeys();
- while(ResKeys.hasMoreElements()) {
- String keyNm = (String)ResKeys.nextElement();
+ Enumeration resKeys = getResourceKeys();
+ while(resKeys.hasMoreElements()) {
+ String keyNm = (String)resKeys.nextElement();
configHash.put(keyNm, getProperty(keyNm));
}
}
} catch (Throwable t) {}
}
-
}
--- /dev/null
+ /**
+ * Datamodel of a MulitpartRequest
+ * (inner class)
+ */
+
+package mir.misc;
+
+
+public class MpRequest{
+ byte[] uploadData=null;
+ String fileName=null;
+ String fileContentType=null;
+
+ public MpRequest(byte[] i_uploadData, String i_fileName, String i_contentType){
+ setFilename(i_fileName);
+ setContentType(i_contentType);
+ setMedia(i_uploadData);
+ }
+
+ public byte[] getMedia() {
+ return uploadData;
+ }
+
+ public String getFilename() {
+ return fileName;
+ }
+
+ public String getContentType() {
+ return fileContentType;
+ }
+
+ public void setMedia(byte[] i_uploadData) {
+ uploadData=i_uploadData;
+ }
+
+ public void setFilename(String i_fileName) {
+ fileName=i_fileName;
+ }
+
+ public void setContentType(String i_contentType) {
+ fileContentType=i_contentType;
+ }
+}
HttpServletRequest req=null;
HashMap parameters = new HashMap();
MultipartParser mp=null;
- byte[] uploadData=null;
- String fileName=null;
- String fileContentType=null;
+ public static ArrayList requestList;
public WebdbMultipartRequest(HttpServletRequest theReq) throws IOException
{
req=theReq;
mp = new MultipartParser(req, 1024*8192); // maximum eight megabyte
+ requestList = new ArrayList();
_evaluateRequest();
}
return parameters;
}
- public byte[] getMedia() {
- return uploadData;
- }
-
- public String getFilename() {
- return fileName;
- }
-
- public String getContentType() {
- return fileContentType;
- }
private void _evaluateRequest() throws IOException{
Part part;
+ int i = 0;
while ((part = mp.readNextPart()) != null) {
String name = part.getName();
if (part.isParam()) {
else if (part.isFile()) {
// nur das erste uploadfile beruecksichtigen
FilePart filePart = (FilePart) part;
- fileName = filePart.getFileName();
- fileContentType = filePart.getContentType();
- if (fileName != null) {
+ String fn = filePart.getFileName();
+ if (filePart.getFileName() != null) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
filePart.writeTo(byteStream);
- uploadData=byteStream.toByteArray();
+ requestList.add(i,new MpRequest(byteStream.toByteArray(),filePart.getFileName(),filePart.getContentType()));
+ i++;
}
}
} // while */
}
+
}
*/
public final class ServletModuleDispatch {
- static Logfile theLog;
+ static Logfile theLog;
- static {
- theLog = Logfile.getInstance("/tmp/smod.dispatch");
- }
+ static {
+ theLog = Logfile.getInstance("/tmp/smod.dispatch");
+ }
- /**
- * privater Konstruktor, um versehentliche Instantiierung zu verhindern
- */
- private ServletModuleDispatch () {
- }
+ /**
+ * privater Konstruktor, um versehentliche Instantiierung zu verhindern
+ */
+ private ServletModuleDispatch () {
+ }
- /**
- * Die Dispatch-Routine ruft das von dem Hauptservlet kommende ServletModule
- * mit dem per HttpServletRequest angegebenen Paramter <code>do</code> auf.
- * Ist kein Parameter angegeben, so wird versucht, in die <code>defaultAction</code>
- * des ServletModules zu springen.
- *
- * @param req Http-Request, das vom Dispatcher an die Methode des
- * ServletModules durchgereicht wird
- * @param res Http-Response, die vom Dispatcher an die Methode des
- * ServletModules durchgereicht wird
- * @param sMod ServletModule, an das dispatched wird.
- * @param mod Name des Modules als String (für Logfile)
- */
+ /**
+ * Die Dispatch-Routine ruft das von dem Hauptservlet kommende ServletModule
+ * mit dem per HttpServletRequest angegebenen Paramter <code>do</code> auf.
+ * Ist kein Parameter angegeben, so wird versucht, in die <code>defaultAction</code>
+ * des ServletModules zu springen.
+ *
+ * @param req Http-Request, das vom Dispatcher an die Methode des
+ * ServletModules durchgereicht wird
+ * @param res Http-Response, die vom Dispatcher an die Methode des
+ * ServletModules durchgereicht wird
+ * @param sMod ServletModule, an das dispatched wird.
+ * @param mod Name des Modules als String (für Logfile)
+ */
- public static void dispatch(ServletModule sMod, HttpServletRequest req,
- HttpServletResponse res) throws ServletModuleException
- {
- //sMod.predeliver(req,res);
+ public static void dispatch(ServletModule sMod, HttpServletRequest req,
+ HttpServletResponse res) throws ServletModuleException
+ {
+ //sMod.predeliver(req,res);
- String doParam = req.getParameter("do");
- theLog.printInfo("SerletModuleDispatch: " + sMod.toString() + " with method " + doParam);
- if (doParam == null) {
- if (sMod.defaultAction() != null) doParam = sMod.defaultAction();
- else throw new ServletModuleException("no parameter do supplied!");
- }
+ String doParam = req.getParameter("do");
+ theLog.printInfo("SerletModuleDispatch: " + sMod.toString() + " with method " + doParam);
+ if (doParam == null) {
+ if (sMod.defaultAction() != null) doParam = sMod.defaultAction();
+ else throw new ServletModuleException("no parameter do supplied!");
+ }
- Class[] params= { HttpServletRequest.class, HttpServletResponse.class};
+ Class[] params= { HttpServletRequest.class, HttpServletResponse.class};
- try {
- Method method = sMod.getClass().getMethod(doParam,params);
- if (method != null) {
- method.invoke(sMod,new Object[] {req,res} );
- return;
- }
- else theLog.printDebugInfo("method lookup unsuccesful");
- }
- catch ( NoSuchMethodException e) { throw new ServletModuleException("no such method!" + e.toString());}
- catch ( SecurityException e) { throw new ServletModuleException("method not allowed!" + e.toString());}
- catch ( InvocationTargetException e) {throw new ServletModuleException("target method exception!" + e.getTargetException().toString());}
- catch ( IllegalAccessException e) { throw new ServletModuleException("illegal method not allowed!" + e.toString());}
-// catch ( Exception e ) { throw new ServletModuleException(e.toString()); }
+ try {
+ Method method = sMod.getClass().getMethod(doParam,params);
+ if (method != null) {
+ method.invoke(sMod,new Object[] {req,res} );
+ return;
+ }
+ else theLog.printDebugInfo("method lookup unsuccesful");
+ }
+ catch ( NoSuchMethodException e) { throw new ServletModuleException("no such method!" + e.toString());}
+ catch ( SecurityException e) { throw new ServletModuleException("method not allowed!" + e.toString());}
+ catch ( InvocationTargetException e) {e.printStackTrace();throw new ServletModuleException("target method exception!" + e.getTargetException().toString());}
+ catch ( IllegalAccessException e) { throw new ServletModuleException("illegal method not allowed!" + e.toString());}
+// catch ( Exception e ) { throw new ServletModuleException(e.toString()); }
- throw new ServletModuleException("delivery failed! -- ");
- }
-}
\ No newline at end of file
+ throw new ServletModuleException("delivery failed! -- ");
+ }
+}
SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);
// get the images
- EntityList currentMedia = DatabaseContentToMedia.getInstance().getMedia(currentContent);
- if (currentMedia!=null && currentMedia.getCount()>=1) {
- SimpleList mediaList = HTMLTemplateProcessor.makeSimpleList(currentMedia);
- mergeData.put("to_media", mediaList);
- }
- /**
+ EntityList currentMedia = DatabaseContentToMedia.getInstance().getImages(currentContent);
+ if (currentMedia!=null && currentMedia.getCount()>=1) {
+ SimpleList mediaList = HTMLTemplateProcessor.makeSimpleList(currentMedia);
+ mergeData.put("to_media", mediaList);
+ }
+ /**
currentMediaId = currentContent.getValue("to_media");
if (currentMediaId!=null && !currentMediaId.equals("")) {
imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
}
mergeData.put("images", imageHash);
- */
+ */
// get the comments for the article
mergeData.put("comments", currentContent.getComments());
public class ServletModuleImages extends mir.servlet.ServletModule
{
- private static ModuleMediafolder mediafolderModule;
- private static DatabaseRights dbRights;
- private static DatabaseImageFormat dbImageFormat;
- private static DatabaseImageType dbImageType;
- private static DatabaseImageColor dbImageColor;
- private static DatabaseImageLayout dbImageLayout;
-
- // Singelton / Kontruktor
- private static ServletModuleImages instance = new ServletModuleImages();
- public static ServletModule getInstance() { return instance; }
-
-
- private ServletModuleImages() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Bilder.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Bilder.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Bilder.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Bilder.ConfirmTemplate");
- try {
- mainModule = new ModuleImages(DatabaseImages.getInstance());
- mediafolderModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
- dbRights = DatabaseRights.getInstance();
- dbImageFormat = DatabaseImageFormat.getInstance();
- dbImageColor = DatabaseImageColor.getInstance();
- dbImageType = DatabaseImageType.getInstance();
- dbImageLayout = DatabaseImageLayout.getInstance();
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodulebilder konnte nicht initialisiert werden");
- }
- }
-
-
- public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
- try {
- WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
- HashMap parameters = mp.getParameters();
- byte[] imageData=mp.getMedia();
- String fileName=mp.getFilename();
-
- EntityUsers user = _getUser(req);
- parameters.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
- parameters.put("to_publisher", user.getId());
- parameters.put("is_produced", "0");
- if (!parameters.containsKey("is_published"))
- parameters.put("is_published","0");
-
- String id = mainModule.add(parameters);
- EntityImage entImage = (EntityImage)mainModule.getById(id);
-
- if (imageData!=null && fileName!=null) {
- int fileType = -1;
- if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
- if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
- if (fileType>=0)
- entImage.setImage(imageData, fileType);
- else
- theLog.printError("Wrong file uploaded!");
- }
- _edit(id, req, res);
- }
- catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
- catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
-
- }
-
- public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
-
- try {
- WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
- HashMap parameters = mp.getParameters();
- byte[] imageData=mp.getMedia();
- String fileName=mp.getFilename();
-
- EntityUsers user = _getUser(req);
- parameters.put("to_publisher", user.getId());
- parameters.put("is_produced", "0");
- if (!parameters.containsKey("is_published"))
- parameters.put("is_published","0");
-
- String id = mainModule.set(parameters);
- EntityImage entImage = (EntityImage)mainModule.getById(id);
-
- if (imageData!=null && fileName!=null) {
- int fileType = -1;
- if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
- if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
- if (fileType>=0)
- entImage.setImage(imageData, fileType);
- else
- theLog.printError("Wrong file uploaded!");
- }
- _edit(id, req, res);
- }
- catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
- catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
-
- }
-
-
- public void showimg(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- String idParam = req.getParameter("id");
- if (idParam!=null && !idParam.equals("")) {
- try {
- EntityImage entImage =(EntityImage)mainModule.getById(idParam);
- res.setContentType("image/jpeg"); // testweise
- ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
-
- byte[] outbytes = entImage.getImage();
- 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 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 {
- EntityImage entImage =(EntityImage)mainModule.getById(idParam);
- res.setContentType("image/jpeg"); // testweise
- ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
-
- byte[] outbytes = entImage.getIcon();
- 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.");
- }
-
- public void list(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- // Parameter auswerten
- SimpleHash mergeData = new SimpleHash();
- String query_text = req.getParameter("query_text");
- mergeData.put("query_text",query_text);
- if (query_text!=null) mergeData.put("query_text_encoded",URLEncoder.encode(query_text));
- String query_field = req.getParameter("query_field");
- mergeData.put("query_field",query_field);
- String query_is_published = req.getParameter("query_is_published");
- mergeData.put("query_is_published",query_is_published);
- String query_media_folder = req.getParameter("query_media_folder");
- mergeData.put("query_media_folder",query_media_folder);
- String offset = req.getParameter("offset");
- if (offset==null || offset.equals("")) offset="0";
- mergeData.put("offset",offset);
-
- String order = req.getParameter("order");
- if (order==null) order="webdb_lastchange desc";
-
- // if in connection mode to content
- String cid = req.getParameter("cid");
- mergeData.put("cid",cid);
-
-
- // sql basteln
- String whereClause=""; boolean isFirst=true;
- if (query_text!=null && !query_text.equalsIgnoreCase("")) {
- whereClause += "lower("+query_field+") like lower('%"+query_text+"%')"; isFirst=false;}
- if (query_is_published != null && !query_is_published.equals("")) {
- if (isFirst==false) whereClause+=" and ";
- whereClause += "is_published='"+query_is_published+"'";
- isFirst=false;
- }
- if (query_media_folder != null && !query_media_folder.equals("")) {
- if (isFirst==false) whereClause+=" and ";
- whereClause += "to_media_folder='"+query_media_folder+"'";
- }
- //theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
-
- // fetch und ausliefern
- try {
- mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
- mergeData.put("mediafolderHashdata", mediafolderModule.getHashData());
- if (query_text!=null || query_is_published!=null || query_media_folder!=null) {
- EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue(),10);
- if (theList != null) {
- mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
- if(theList.getOrder()!=null) {
- mergeData.put("order", theList.getOrder());
- mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
- }
- mergeData.put("count", (new Integer(theList.getCount())).toString());
- mergeData.put("from", (new Integer(theList.getFrom())).toString());
- mergeData.put("to", (new Integer(theList.getTo())).toString());
- if (theList.hasNextBatch())
- mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
- if (theList.hasPrevBatch())
- mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
- }
- }
- // raus damit
- HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
- }
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
-
-
- public void add(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- try {
- SimpleHash mergeData = new SimpleHash();
- mergeData.put("new", "1");
- mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
- deliver(req, res, mergeData, templateObjektString);
- }
- catch (Exception e) { throw new ServletModuleException(e.toString());}
- }
-
- public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
- String idParam = req.getParameter("id");
- _edit(idParam, req, res);
- }
-
- private void _edit(String idParam, HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
- if (idParam!=null && !idParam.equals("")) {
- try {
- SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(mainModule.getById(idParam));
- mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
- mergeData.put("rightsHashdata", dbRights.getHashData());
- mergeData.put("imgformatHashdata", dbImageFormat.getHashData());
- mergeData.put("imgcolorHashdata", dbImageColor.getHashData());
- mergeData.put("imgtypeHashdata", dbImageType.getHashData());
- mergeData.put("imglayoutHashdata", dbImageLayout.getHashData());
- deliver(req, res, mergeData, templateObjektString);
- }
- catch (ModuleException e) { throw new ServletModuleException(e.toString());}
- }
- else throw new ServletModuleException("ServletmoduleImage :: _edit without id");
- }
-
-
- /** @todo should be in ServletModule.java */
- private EntityUsers _getUser(HttpServletRequest req)
- {
- HttpSession session=req.getSession(false);
- return (EntityUsers)session.getAttribute("login.uid");
- }
-
-
- // deprecated
- public void upload(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
- //theLog.printDebugInfo("-- trying to upload");
- String idParam = req.getParameter("id");
- if (idParam!=null && !idParam.equals("")) {
- try {
-
- WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
- HashMap withValues = mp.getParameters();
- byte[] imageData=mp.getMedia();
- String fileName=mp.getFilename();
-
- int fileType = -1;
- if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
- if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
- if (fileType>=0) {
- EntityImage entImage = (EntityImage)mainModule.getById(idParam);
- entImage.setImage(imageData, fileType);
- }
- else
- theLog.printError("Wrong file uploaded!");
- }
- catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
- catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
- }
- else // keine id
- throw new ServletModuleException("Keine id angegeben");
- edit(req,res);
- }
+ private static ModuleMediafolder mediafolderModule;
+ private static DatabaseRights dbRights;
+ private static DatabaseImageFormat dbImageFormat;
+ private static DatabaseImageType dbImageType;
+ private static DatabaseImageColor dbImageColor;
+ private static DatabaseImageLayout dbImageLayout;
+
+ // Singelton / Kontruktor
+ private static ServletModuleImages instance = new ServletModuleImages();
+ public static ServletModule getInstance() { return instance; }
+
+
+ private ServletModuleImages() {
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Bilder.Logfile"));
+ templateListString = MirConfig.getProp("ServletModule.Bilder.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Bilder.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Bilder.ConfirmTemplate");
+ try {
+ mainModule = new ModuleImages(DatabaseImages.getInstance());
+ mediafolderModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
+ dbRights = DatabaseRights.getInstance();
+ dbImageFormat = DatabaseImageFormat.getInstance();
+ dbImageColor = DatabaseImageColor.getInstance();
+ dbImageType = DatabaseImageType.getInstance();
+ dbImageLayout = DatabaseImageLayout.getInstance();
+ }
+ catch (StorageObjectException e) {
+ theLog.printDebugInfo("servletmodulebilder konnte nicht initialisiert werden");
+ }
+ }
+
+
+ public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+ try {
+ WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+ HashMap parameters = mp.getParameters();
+ MpRequest mpReq = (MpRequest)mp.requestList.get(0);
+ byte[] imageData=mpReq.getMedia();
+ String fileName=mpReq.getFilename();
+ String contentType= mpReq.getContentType();
+
+ EntityUsers user = _getUser(req);
+ parameters.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+ parameters.put("to_publisher", user.getId());
+ parameters.put("is_produced", "0");
+ if (!parameters.containsKey("is_published"))
+ parameters.put("is_published","0");
+
+ String id = mainModule.add(parameters);
+ EntityImage entImage = (EntityImage)mainModule.getById(id);
+
+ if (imageData!=null && fileName!=null) {
+ int fileType = -1;
+ if (contentType.equals("image/jpeg")) fileType=0;
+ if (contentType.equals("image/gif")) fileType=1;
+ if (fileType>=0)
+ entImage.setImage(imageData, fileType);
+ else
+ theLog.printError("Wrong file uploaded!");
+ }
+ _edit(id, req, res);
+ }
+ catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+ catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+
+ }
+
+ public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+
+ try {
+ WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+ HashMap parameters = mp.getParameters();
+ MpRequest mpReq = (MpRequest)mp.requestList.get(0);
+ byte[] imageData=mpReq.getMedia();
+ String fileName=mpReq.getFilename();
+ String contentType=mpReq.getContentType();
+
+ EntityUsers user = _getUser(req);
+ parameters.put("to_publisher", user.getId());
+ parameters.put("is_produced", "0");
+ if (!parameters.containsKey("is_published"))
+ parameters.put("is_published","0");
+
+ String id = mainModule.set(parameters);
+ EntityImage entImage = (EntityImage)mainModule.getById(id);
+
+ if (imageData!=null && fileName!=null) {
+ int fileType = -1;
+ if (contentType.equals("image/jpeg")) fileType=0;
+ if (contentType.equals("image/gif")) fileType=1;
+ if (fileType>=0)
+ entImage.setImage(imageData, fileType);
+ else
+ theLog.printError("Wrong file uploaded!");
+ }
+ _edit(id, req, res);
+ }
+ catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+ catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+
+ }
+
+
+ public void showimg(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ String idParam = req.getParameter("id");
+ if (idParam!=null && !idParam.equals("")) {
+ try {
+ EntityImage entImage =(EntityImage)mainModule.getById(idParam);
+ res.setContentType("image/jpeg"); // testweise
+ ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
+
+ byte[] outbytes = entImage.getImage();
+ 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 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 {
+ EntityImage entImage =(EntityImage)mainModule.getById(idParam);
+ res.setContentType("image/jpeg"); // testweise
+ ServletOutputStream out = res.getOutputStream(); // wichtig, dass vorher kein res.getwriter() gelaufen ist
+
+ byte[] outbytes = entImage.getIcon();
+ 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.");
+ }
+
+ public void list(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ // Parameter auswerten
+ SimpleHash mergeData = new SimpleHash();
+ String query_text = req.getParameter("query_text");
+ mergeData.put("query_text",query_text);
+ if (query_text!=null) mergeData.put("query_text_encoded",URLEncoder.encode(query_text));
+ String query_field = req.getParameter("query_field");
+ mergeData.put("query_field",query_field);
+ String query_is_published = req.getParameter("query_is_published");
+ mergeData.put("query_is_published",query_is_published);
+ String query_media_folder = req.getParameter("query_media_folder");
+ mergeData.put("query_media_folder",query_media_folder);
+ String offset = req.getParameter("offset");
+ if (offset==null || offset.equals("")) offset="0";
+ mergeData.put("offset",offset);
+
+ String order = req.getParameter("order");
+ if (order==null) order="webdb_lastchange desc";
+
+ // if in connection mode to content
+ String cid = req.getParameter("cid");
+ mergeData.put("cid",cid);
+
+
+ // sql basteln
+ String whereClause=""; boolean isFirst=true;
+ if (query_text!=null && !query_text.equalsIgnoreCase("")) {
+ whereClause += "lower("+query_field+") like lower('%"+query_text+"%')"; isFirst=false;}
+ if (query_is_published != null && !query_is_published.equals("")) {
+ if (isFirst==false) whereClause+=" and ";
+ whereClause += "is_published='"+query_is_published+"'";
+ isFirst=false;
+ }
+ if (query_media_folder != null && !query_media_folder.equals("")) {
+ if (isFirst==false) whereClause+=" and ";
+ whereClause += "to_media_folder='"+query_media_folder+"'";
+ }
+ //theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
+
+ // fetch und ausliefern
+ try {
+ mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+ mergeData.put("mediafolderHashdata", mediafolderModule.getHashData());
+ if (query_text!=null || query_is_published!=null || query_media_folder!=null) {
+ EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue(),10);
+ if (theList != null) {
+ mergeData.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
+ if(theList.getOrder()!=null) {
+ mergeData.put("order", theList.getOrder());
+ mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
+ }
+ mergeData.put("count", (new Integer(theList.getCount())).toString());
+ mergeData.put("from", (new Integer(theList.getFrom())).toString());
+ mergeData.put("to", (new Integer(theList.getTo())).toString());
+ if (theList.hasNextBatch())
+ mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+ if (theList.hasPrevBatch())
+ mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+ }
+ }
+ // raus damit
+ HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateListString, mergeData, res.getWriter());
+ }
+ catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+ catch (IOException e) {throw new ServletModuleException(e.toString());}
+ catch (Exception e) {throw new ServletModuleException(e.toString());}
+ }
+
+
+ public void add(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ mergeData.put("new", "1");
+ mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+ deliver(req, res, mergeData, templateObjektString);
+ }
+ catch (Exception e) { throw new ServletModuleException(e.toString());}
+ }
+
+ public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+ String idParam = req.getParameter("id");
+ _edit(idParam, req, res);
+ }
+
+ private void _edit(String idParam, HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
+ if (idParam!=null && !idParam.equals("")) {
+ try {
+ SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(mainModule.getById(idParam));
+ mergeData.put("mediafolderPopupData", mediafolderModule.getPopupData());
+ mergeData.put("rightsHashdata", dbRights.getHashData());
+ mergeData.put("imgformatHashdata", dbImageFormat.getHashData());
+ mergeData.put("imgcolorHashdata", dbImageColor.getHashData());
+ mergeData.put("imgtypeHashdata", dbImageType.getHashData());
+ mergeData.put("imglayoutHashdata", dbImageLayout.getHashData());
+ deliver(req, res, mergeData, templateObjektString);
+ }
+ catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+ }
+ else throw new ServletModuleException("ServletmoduleImage :: _edit without id");
+ }
+
+
+ /** @todo should be in ServletModule.java */
+ private EntityUsers _getUser(HttpServletRequest req)
+ {
+ HttpSession session=req.getSession(false);
+ return (EntityUsers)session.getAttribute("login.uid");
+ }
+
+
+ // deprecated
+ public void upload(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+ //theLog.printDebugInfo("-- trying to upload");
+ String idParam = req.getParameter("id");
+ if (idParam!=null && !idParam.equals("")) {
+ try {
+
+ WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+ HashMap withValues = mp.getParameters();
+ MpRequest mpReq = (MpRequest)mp.requestList.get(0);
+ byte[] imageData=mpReq.getMedia();
+ String fileName=mpReq.getFilename();
+ String contentType=mpReq.getContentType();
+
+ int fileType = -1;
+ if (contentType.equals("image/jpeg")) fileType=0;
+ if (contentType.equals("image/gif")) fileType=1;
+ if (fileType>=0) {
+ EntityImage entImage = (EntityImage)mainModule.getById(idParam);
+ entImage.setImage(imageData, fileType);
+ }
+ else
+ theLog.printError("Wrong file uploaded!");
+ }
+ catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
+ catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+ }
+ else // keine id
+ throw new ServletModuleException("Keine id angegeben");
+ edit(req,res);
+ }
}
postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
- //directOp="yes";
mainModule = new ModuleComment(DatabaseComment.getInstance());
contentModule = new ModuleContent(DatabaseContent.getInstance());
imageModule = new ModuleImages(DatabaseImages.getInstance());
// sync the server
int exitValue = Helper.rsync();
- theLog.printDebugInfo("rsync:"+exitValue);
+ theLog.printDebugInfo("rsync:"+exitValue);
// redirecting to url
// should implement back to article
public void addposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
SimpleHash mergeData = new SimpleHash();
+ String numOfMedia = req.getParameter("medianum");
+ if(numOfMedia==null||numOfMedia.equals("")){
+ numOfMedia="1";
+ }
+
+ int mediaNum = Integer.parseInt(numOfMedia);
+ SimpleList mediaFields = new SimpleList();
+ for(int i =0; i<mediaNum;i++){
+ Integer mNum = new Integer(i+1);
+ mediaFields.add(mNum.toString());
+ }
+ mergeData.put("medianum",numOfMedia);
+ mergeData.put("mediafields",mediaFields);
+
+
/** @todo popups missing */
try{
mergeData.put("languagePopUpData",DatabaseLanguage.getInstance().getPopupData());
boolean setMedia=false;
try {
-
WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
+
HashMap withValues = mp.getParameters();
- byte[] mediaData=mp.getMedia();
- String fileName=mp.getFilename();
-
- theLog.printDebugInfo("ContentType: "+mp.getContentType());
-
- // if op contains imagedata
- String mediaId=null;
- if (mediaData!=null && fileName!=null) {
- HashMap mediaValues = new HashMap();
- mediaValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
- mediaValues.put("to_publisher", "1"); // op user
- mediaValues.put("to_media_folder", "7"); // op media_folder
- mediaValues.put("is_produced", "0");
- mediaValues.put("is_published","1");
-
- String mediaTitle=(String)withValues.get("media_title");
- if (mediaTitle==null)
- mediaTitle = (String)withValues.get("title");
- mediaValues.put("title",mediaTitle);
-
- if (fileName.toLowerCase().endsWith("rm")) {
- // this is video !!
- //theLog.printDebugInfo("--GOT VIDEO");
- EntityVideo entVideo = new EntityVideo(DatabaseVideos.getInstance());
- entVideo.setValues(mediaValues);
- mediaId = entVideo.insert();
- entVideo.setVideoData(mediaData);
- }
- else if (fileName.toLowerCase().endsWith(".jpg") || fileName.toLowerCase().endsWith(".gif")) {
- // this is image !!
- mediaId = imageModule.add(mediaValues);
- EntityImage entImage = (EntityImage)imageModule.getById(mediaId);
-
- int fileType = -1;
- if (fileName.toLowerCase().endsWith(".jpg")) fileType=0;
- if (fileName.toLowerCase().endsWith(".gif")) fileType=1;
- if (fileType>=0) {
- entImage.setImage(mediaData, fileType);
- setMedia=true;
- }
- else
- theLog.printDebugInfo("Wrong file uploaded!" + fileName);
- }
- }
-
withValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
withValues.put("is_produced", "0");
withValues.put("is_published","1");
// if op direct article-type == newswire
if (directOp.equals("yes")) withValues.put("to_article_type","1");
- theLog.printDebugInfo("direct op: "+directOp);
// owner is openposting user
withValues.put("to_publisher","1");
withValues.put("creator","Anonym");
// inserting content into database
- String id = contentModule.add(withValues);
+ String cid = contentModule.add(withValues);
- // inserting content and media id in table content_x_media
- try{
- DatabaseContentToMedia.getInstance().setMedia(id,mediaId);
- theLog.printError("setting content_x_topic success");
- } catch (Exception e) {
- theLog.printError("setting content_x_topic failed");
+ // if op contains uploaddata
+ String mediaId=null;
+ int i=1;
+ for(Iterator it = mp.requestList.iterator(); it.hasNext();){
+ MpRequest mpReq = (MpRequest)it.next();
+ byte[] mediaData=mpReq.getMedia();
+ String fileName=mpReq.getFilename();
+ String contentType=mpReq.getContentType();
+ if (mediaData!=null && fileName!=null) {
+ HashMap mediaValues = new HashMap();
+ mediaValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+ mediaValues.put("to_publisher", "1"); // op user
+ mediaValues.put("to_media_folder", "7"); // op media_folder
+ mediaValues.put("is_produced", "0");
+ mediaValues.put("is_published","1");
+
+ String mediaTitle=(String)withValues.get("media_title"+i);
+ i++;
+ if (mediaTitle==null)
+ mediaTitle = (String)withValues.get("title");
+ mediaValues.put("title",mediaTitle);
+
+ if (fileName.toLowerCase().endsWith("rm")) {
+ // this is video !!
+ //theLog.printDebugInfo("--GOT VIDEO");
+ EntityVideo entVideo = new EntityVideo(DatabaseVideos.getInstance());
+ entVideo.setValues(mediaValues);
+ mediaId = entVideo.insert();
+ entVideo.setVideoData(mediaData);
+ }
+ else if (contentType.equals("image/jpeg") || contentType.equals("image/gif")) {
+ // this is image !!
+ mediaId = imageModule.add(mediaValues);
+ EntityImage entImage = (EntityImage)imageModule.getById(mediaId);
+
+ int fileType = -1;
+ if (contentType.equals("image/jpeg")) fileType=0;
+ if (contentType.equals("image/gif")) fileType=1;
+ if (fileType>=0) {
+ entImage.setImage(mediaData, fileType);
+ // inserting content and media id in table content_x_media
+ try{
+ DatabaseContentToMedia.getInstance().addMedia(cid,mediaId);
+ theLog.printError("setting content_x_topic success");
+ } catch (Exception e) {
+ theLog.printError("setting content_x_topic failed");
+ }
+
+ // producing new page
+ if(mediaId!=null){
+ new ProducerImages().handle(null, null, false, false, mediaId);
+ }
+ } else {
+ theLog.printDebugInfo("Wrong file uploaded!" + fileName);
+ }
+ }
+ }
}
-
- // producing new page
- if(mediaId!=null){
- new ProducerImages().handle(null, null, false, false, mediaId);
- }
// producing openpostinglist
new ProducerOpenPosting().handle(null,null,false,false);
// producing new page
- new ProducerContent().handle(null, null, false, false,id);
+ new ProducerContent().handle(null, null, false, false,cid);
//if direct op producing startpage
if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
// sync the server
//should be configureable
int exitValue = Helper.rsync();
- theLog.printDebugInfo("rsync: "+exitValue);
+ theLog.printDebugInfo("rsync: "+exitValue);
}
- catch (IOException e) { throw new ServletModuleException(e.toString());}
- catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
- catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+ catch (IOException e) { throw new ServletModuleException("IOException: "+ e.toString());}
+ catch (StorageObjectException e) { throw new ServletModuleException("StorageObjectException" + e.toString());}
+ catch (ModuleException e) { throw new ServletModuleException("ModuleException"+e.toString());}
deliver(req, res, mergeData, postingFormDoneTemplate);
}
this.hasTimestamp = false;
this.theTable="content_x_media";
}
-
-
+
+ /**
+ * get all the media-files belonging to a content entity
+ *
+ */
public EntityList getMedia(EntityContent content) {
EntityList returnList=null;
if (content != null) {
}
return returnList;
}
+
+ /**
+ * get all the images belonging to a content entity
+ *
+ */
+ public EntityList getImages(EntityContent content) {
+ EntityList returnList=null;
+ if (content != null) {
+ // get all to_topic from media_x_topic
+ String id = content.getId();
+ //this is not supported by mysql
+ String subselect = "id in (select media_id from " + theTable + " where content_id=" + id+")";
+
+ try {
+ returnList = DatabaseImages.getInstance().selectByWhereClause(subselect,-1);
+ } catch (Exception e) {
+ theLog.printDebugInfo("-- get images failed " + e.toString());
+ }
+ }
+ return returnList;
+ }
public void setMedia(String contentId, String[] mediaId) {
freeConnection(con,stmt);
}
}
-
+
public void setMedia(String contentId, String mediaId) {
if (contentId == null && mediaId == null) {
return;
freeConnection(con,stmt);
}
}
-
- public void delete(String contentId, String mediaId) {
+
+ public void delete(String contentId, String mediaId) {
if (mediaId == null || contentId==null) {
theLog.printDebugInfo("-- delete media failed -- missing parameter");
return;
}
return returnList;
}
-
+
/**
* Returns a EntityList with all content-objects having a relation to a media
*/
-
+
public EntityList getContent() {
EntityList returnList=null;
String select = "select distinct content_id from " + theTable;
- // execute select statement
- Connection con=null;Statement stmt=null;
- try {
- con = getPooledCon();
- // should be a preparedStatement because is faster
- stmt = con.createStatement();
- ResultSet rs = executeSql(stmt,select);
- if (rs!=null) {
- String mediaSelect= "id IN (";
- boolean first=true;
- while (rs.next()) {
- if (first==false) mediaSelect+=",";
- mediaSelect += rs.getString(1);
- first=false;
- }
- mediaSelect+=")";
- if (first==false)
- returnList = DatabaseContent.getInstance().selectByWhereClause(mediaSelect,"webdb_lastchange desc");
- }
- }
- catch (Exception e) {theLog.printDebugInfo("-- get content failed");}
- finally { freeConnection(con,stmt);}
+ // execute select statement
+ Connection con=null;Statement stmt=null;
+ try {
+ con = getPooledCon();
+ // should be a preparedStatement because is faster
+ stmt = con.createStatement();
+ ResultSet rs = executeSql(stmt,select);
+ if (rs!=null) {
+ String mediaSelect= "id IN (";
+ boolean first=true;
+ while (rs.next()) {
+ if (first==false) mediaSelect+=",";
+ mediaSelect += rs.getString(1);
+ first=false;
+ }
+ mediaSelect+=")";
+ if (first==false)
+ returnList = DatabaseContent.getInstance().selectByWhereClause(mediaSelect,"webdb_lastchange desc");
+ }
+ }
+ catch (Exception e) {theLog.printDebugInfo("-- get content failed");}
+ finally { freeConnection(con,stmt);}
- return returnList;
+ return returnList;
}
}
</ul>
</td>
</tr>
+<form action="${openAction}?do=addposting" method="post">
+ <tr>
+ <td>Anzahl der Medien</td>
+ <td colspan="2"><input type="text" name="medianum" value="${medianum}"> <input type="submit">
+ </tr>
+</form>
<a name="form"></a>
<form enctype="multipart/form-data" action="${openAction}?do=insposting" method="post">
-
<tr>
<td bgcolor="#663399" colspan="3">
<center><font size="+2" face="Helvetica, Arial" color="white"><b>Veröffentlichungsformular</b></font></center>
</td>
<td colspan="2">
Hier kannst Du ein Medien zu Deinem Artikel hochladen (bislang nur jpg-Bilder)<br>
- <INPUT TYPE="file" NAME="mptest"> <font size="-1">(<i>optional</i>)</font>
+ </td>
+ </tr>
+<list mediafields as m>
+ <tr>
+ <td>Bild ${m}</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media${m}"> <font size="-1">(<i>optional</i>)</font>
</td>
</tr>
<tr>
<td>
- Medienunterschrift:
+ Medienunterschrift ${m}:
</td>
<td colspan="2">
- <input type="text" name="media_title" size="40" maxlength="80" value=""> <font size="-1">(<i>optional</i>)</font>
+ <input type="text" name="media_title${m}" size="40" maxlength="80" value=""> <font size="-1">(<i>optional</i>)</font>
</td>
- </tr>
-
-
+ </tr>
+</list>
<tr>
<td><b </td>
<td bgcolor="#663399" valign="top" align="center"><br>
</ul>
</td>
</tr>
+<form action="${openAction}?do=addposting" method="post">
+ <tr>
+ <td>Anzahl der Medien</td>
+ <td colspan="2"><input type="text" name="medianum" value="${medianum}"> <input type="submit">
+ </tr>
+</form>
<a name="form"></a>
<form enctype="multipart/form-data" action="${openAction}?do=insposting" method="post">
-
<tr>
<td bgcolor="#663399" colspan="3">
<center><font size="+2" face="Helvetica, Arial" color="white"><b>Veröffentlichungsformular</b></font></center>
</td>
<td colspan="2">
Hier kannst Du ein Medien zu Deinem Artikel hochladen (bislang nur jpg-Bilder)<br>
- <INPUT TYPE="file" NAME="mptest"> <font size="-1">(<i>optional</i>)</font>
+ </td>
+ </tr>
+<list mediafields as m>
+ <tr>
+ <td>Bild ${m}</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media${m}"> <font size="-1">(<i>optional</i>)</font>
</td>
</tr>
<tr>
<td>
- Medienunterschrift:
+ Medienunterschrift ${m}:
</td>
<td colspan="2">
- <input type="text" name="media_title" size="40" maxlength="80" value=""> <font size="-1">(<i>optional</i>)</font>
+ <input type="text" name="media_title${m}" size="40" maxlength="80" value=""> <font size="-1">(<i>optional</i>)</font>
</td>
- </tr>
-
-
+ </tr>
+</list>
<tr>
<td><b </td>
<td bgcolor="#663399" valign="top" align="center"><br>
<td>
<h2>${title}</h2>
<h4><i>${creator}, ${webdb_create_formatted}</i></h4>
- <p><b>${description}</b></p>
- <p> <if images[to_media] && images[to_media]["is_published"]=="1">
- <img src="${imageHost}${images[to_media]["id"]}.jpg" width="${images[to_media]["img_width"]}" height="${images[to_media]["img_height"]}" alt="" align="left" vspace="8" hspace="8">
- </if> ${s.description} </p>
+ <p><b>${description}</b>
+ <!-- images -->
+ <list to_media as images>
+ <p>
+ <if images && images["is_published"]=="1">
+ <img src="${imageHost}/${images["id"]}.jpg" width="${images["img_width"]}" height="${images["img_height"]}" alt="${images["title"]}">
+ </if><br><i>${images["title"]}</i>
+ </p>
+ </list>
+ <!-- images -->
<p>${content_data}</p>
<if creator_main_url || creator_email>
<table width="100%" bgcolor="#FFFFFF">
</td>
</tr>
</table>
- </list> <!--- start-special ---> <br>
+ </list>
+ <!--- start-special ---> <br>
<!--- features ---> <list items as i>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
<br>
- </list> <!--- features ---> </td>
+ </list>
+ <!--- features --->
+ </td>
</tr>
</table>
</td>
<table width="150" border="0" cellspacing="2" cellpadding="0">
<tr>
<td> <!-- newswire -->
- <p> <list newswire as n> <img alt="[Text]" border="0" height="10" src="/images/text_small.gif" width="12">
+ <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>
<font size="-2"><b></b>${n.webdb_create_formatted}</font><br>
<br>
- </list> <!-- newswire --> </p>
+ </list>
+ <!-- newswire -->
+ </p>
</td>
</tr>
</table>