String mediaIdParam = req.getParameter("mid");
String idParam = req.getParameter("cid");
if (idParam == null||mediaIdParam==null) throw new ServletModuleException("smod content :: attach :: cid/mid missing");
+
try {
EntityContent entContent = (EntityContent)mainModule.getById(idParam);
entContent.attach(mediaIdParam);
public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
- String idParam = req.getParameter("cid");
- if (idParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");
+ String cidParam = req.getParameter("cid");
+ String midParam = req.getParameter("mid");
+ if (cidParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");
+ if (midParam == null) throw new ServletModuleException("smod content :: dettach :: mid missing");
+
try {
- EntityContent entContent = (EntityContent)mainModule.getById(idParam);
- entContent.dettach();
+ EntityContent entContent = (EntityContent)mainModule.getById(cidParam);
+ entContent.dettach(cidParam,midParam);
}
catch(ModuleException e) {
theLog.printError("smod content :: dettach :: could not get entityContent");
}
- _showObject(idParam, req, res);
+ _showObject(cidParam, req, res);
}
public void newswire(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
theLog.printError("language-popup could not be fetched.");
}
// get the images
- String currentMediaId = entContent.getValue("to_media");
- SimpleHash imageHash = new SimpleHash();
- if (currentMediaId!=null && !currentMediaId.equals("")) {
- imageHash.put(currentMediaId, HTMLTemplateProcessor.makeSimpleHash(imageModule.getById(currentMediaId)));
- mergeData.put("images", imageHash);
+ EntityList currentMedia = DatabaseContentToMedia.getInstance().getMedia(entContent);
+ if (currentMedia!=null && currentMedia.getCount()>=1) {
+ SimpleList mediaList = HTMLTemplateProcessor.makeSimpleList(currentMedia);
+ mergeData.put("to_media", mediaList);
}