From c144ff544fcae88787144d7f370108de1a941a41 Mon Sep 17 00:00:00 2001 From: grok Date: Sun, 7 Aug 2005 17:02:15 +0000 Subject: [PATCH 1/1] adding a form on the edit article pages that allows you to add an image attachment by directly typing in it's id --- ChangeLog | 5 +++++ source/mircoders/servlet/ServletModuleContent.java | 13 +++++++++++-- templates/admin/FUNCTIONS.template | 10 +++++++++- templates/admin/content.template | 9 +++++---- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fb0ecef..daf68e2e 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-7 Grok + * templates/admin/FUNCTIONS.template: + adding a form on the edit article pages that allows you + to add an image attachment by directly typing in its id + 2005-07-26 Grok * source/mir/media/image/ImageMagickImageProcessor.java: diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index 6955e26c..afba80cd 100755 --- a/source/mircoders/servlet/ServletModuleContent.java +++ b/source/mircoders/servlet/ServletModuleContent.java @@ -176,10 +176,19 @@ public class ServletModuleContent extends ServletModule { public void attach(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc { String mediaIdParam = aRequest.getParameter("mid"); String articleId = aRequest.getParameter("articleid"); - if (articleId == null || mediaIdParam==null) throw new ServletModuleExc("smod content :: attach :: articleid/mid missing"); - + // check if mediaIdParam and articleid are correct integers + try + { + Integer.parseInt(mediaIdParam); + Integer.parseInt(articleId); + } + catch(NumberFormatException e) + { + throw new ServletModuleExc("smod content :: attach :: invalid articleid/mid"); + } + if (!MirGlobal.accessControl().article().mayEditArticle(ServletHelper.getUser(aRequest), articleId)) throw new ServletModuleExc("Article has been locked"); diff --git a/templates/admin/FUNCTIONS.template b/templates/admin/FUNCTIONS.template index 6c08aa3c..0a0e8823 100755 --- a/templates/admin/FUNCTIONS.template +++ b/templates/admin/FUNCTIONS.template @@ -443,7 +443,15 @@ [+] ${lang("content.addimage")} | - ${lang("content.uploadimage")} + ${lang("content.uploadimage")} | +
+ id: + + + + + +
diff --git a/templates/admin/content.template b/templates/admin/content.template index dfe72e56..e0f620f5 100755 --- a/templates/admin/content.template +++ b/templates/admin/content.template @@ -218,7 +218,11 @@ - + + + + + @@ -265,9 +269,6 @@
- - - -- 2.11.0