+ try {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ URLBuilder urlBuilder = new URLBuilder();
+
+ urlBuilder.setValue("module", "Content");
+ urlBuilder.setValue("do", "setparent");
+ urlBuilder.setValue("childid", requestParser.getParameter("id"));
+ urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));
+
+ returnList(aRequest, aResponse, "", "", 0, urlBuilder.getQuery());
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void listchildren(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+ {
+ try {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ String articleId = requestParser.getParameter("article_id");
+
+ if (articleId == null)
+ throw new ServletModuleExc("ServletModuleContent.listchildren: article_id not set!");
+
+ returnList(aRequest, aResponse, "to_content = " + articleId, "", 0, null);
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void setparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+ {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ String articleId = aRequest.getParameter("childid");
+ String parentId = aRequest.getParameter("id");
+ String returnUrl = aRequest.getParameter("returnurl");
+
+ try {
+ EntityContent article = (EntityContent) mainModule.getById(articleId);
+ article.setValueForProperty("to_content", parentId);
+ article.setProduced(false);
+ article.update();
+ logAdminUsage(aRequest, articleId, "parent set to " + parentId);
+ }
+ catch(Throwable e) {
+ logger.error("ServletModuleContent.setparent: " + e.getMessage());
+ throw new ServletModuleFailure(e);
+ }
+
+ redirect(aResponse, returnUrl);
+ }
+
+ public void clearparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+ {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ String articleId = requestParser.getParameter("id");
+ String returnUrl = requestParser.getParameter("returnurl");
+
+ try {
+ EntityContent article = (EntityContent) mainModule.getById(articleId);
+ article.setValueForProperty("to_content", "");
+ article.setProduced(false);
+ article.update();
+ logAdminUsage(aRequest, articleId, "parent cleared");
+ }
+ catch(Throwable e) {
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+ logger.error("ServletModuleContent.clearparent: " + e.getMessage());
+
+ throw new ServletModuleFailure("ServletModuleContent.clearparent: " + e.getMessage(), e);
+ }
+
+ redirect(aResponse, returnUrl);