X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmircoders%2Fservlet%2FServletModuleContent.java;h=9a24af2ef3d9225903e98cd5a7826c785f42686d;hb=86b6f499b413c722acc895346ac5186405b0c44c;hp=6797d1536ab6d924dc0d9b20deeb05afb9517a3c;hpb=35404b2e50dc83add87eeed6aafe2d858447a7b0;p=mir.git diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index 6797d153..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()); @@ -262,37 +262,24 @@ public class ServletModuleContent extends ServletModule catch(ModuleException e) { theLog.printError("smod content :: attach :: could not get entityContent"); } - - try{ - DatabaseContentToMedia.getInstance().setMedia(idParam,mediaIdParam); - } catch(Exception e){ - theLog.printError("set media failed"); - } _showObject(idParam, req, res); } 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"); - //1-1-relation - //schould be deleted soon 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"); } - - //1-n-relation - try{ - DatabaseContentToMedia.getInstance().deleteByContentId(idParam); - } catch(Exception e){ - theLog.printError("remove media failed"); - } - _showObject(idParam, req, res); + _showObject(cidParam, req, res); } public void newswire(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException @@ -389,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); }