X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmircoders%2Fservlet%2FServletModuleContent.java;h=9a24af2ef3d9225903e98cd5a7826c785f42686d;hb=86b6f499b413c722acc895346ac5186405b0c44c;hp=e01d76f5c75751fb077a61bc2d8d9b2efae49f8b;hpb=d285cdbb4b307fa5bc47e87b62ab269d5fb10e24;p=mir.git diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index e01d76f5..9a24af2e 100755 --- a/source/mircoders/servlet/ServletModuleContent.java +++ b/source/mircoders/servlet/ServletModuleContent.java @@ -46,11 +46,11 @@ public class ServletModuleContent extends ServletModule private ServletModuleContent() { try { - theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.Content.Logfile")); - templateListString = Configuration.getProperty("ServletModule.Content.ListTemplate"); - templateOpString = Configuration.getProperty("ServletModule.Content.OpTemplate"); - templateObjektString = Configuration.getProperty("ServletModule.Content.ObjektTemplate"); - templateConfirmString = Configuration.getProperty("ServletModule.Content.ConfirmTemplate"); + theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile")); + templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate"); + templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate"); + templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate"); + templateConfirmString = MirConfig.getProp("ServletModule.Content.ConfirmTemplate"); mainModule = new ModuleContent(DatabaseContent.getInstance()); themenModule = new ModuleTopics(DatabaseTopics.getInstance()); schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance()); @@ -254,6 +254,7 @@ public class ServletModuleContent extends ServletModule 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); @@ -266,16 +267,19 @@ public class ServletModuleContent extends ServletModule 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 @@ -372,11 +376,10 @@ public class ServletModuleContent extends ServletModule 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); }