add in advanced query parameters used by media and comment search to mergeData so...
authormh <mh>
Tue, 10 Dec 2002 09:55:13 +0000 (09:55 +0000)
committermh <mh>
Tue, 10 Dec 2002 09:55:13 +0000 (09:55 +0000)
source/mir/servlet/ServletModule.java

index 2f91ce8..ca09663 100755 (executable)
@@ -83,6 +83,13 @@ public abstract class ServletModule {
     }
 
     /**
+     * get the module name to be used for generic operations like delete.
+     */
+    protected String getOperationModuleName() {
+      return getClass().getName().substring((new String("mircoders.servlet.ServletModule")).length());
+    }
+
+    /**
      * get the session binded language
      */
     public String getLanguage(HttpServletRequest req) {
@@ -127,6 +134,7 @@ public abstract class ServletModule {
      */
     public void list(HttpServletRequest req, HttpServletResponse res)
             throws ServletModuleException {
+
         try {
             EntityList theList;
             String offsetParam = req.getParameter("offset");
@@ -145,6 +153,7 @@ public abstract class ServletModule {
                     offset = Integer.parseInt(req.getParameter("prevoffset"));
                 }
             }
+
             theList = mainModule.getByWhereClause(null, offset);
             //theList = mainModule.getByWhereClause((String)null, offset);
             if (theList == null || theList.getCount() == 0 || theList.getCount() > 1) {
@@ -215,22 +224,26 @@ public abstract class ServletModule {
             throws ServletModuleException {
         try {
             String idParam = req.getParameter("id");
-            if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+            if (idParam == null) throw new ServletModuleException("Invalid call to delete: no id supplied");
             // Hier code zum Loeschen
             String confirmParam = req.getParameter("confirm");
             String cancelParam = req.getParameter("cancel");
             if (confirmParam == null && cancelParam == null) {
                 // HTML Ausgabe zum Confirmen!
                 SimpleHash mergeData = new SimpleHash();
-                String moduleClassName = mainModule.getClass().getName();
-                int i = moduleClassName.indexOf(".Module");
-                String moduleName = moduleClassName.substring(i + 7);
+                String moduleName = getOperationModuleName();
                 mergeData.put("module", moduleName);
                 mergeData.put("infoString", moduleName + ": " + idParam);
                 mergeData.put("id", idParam);
                 mergeData.put("where", req.getParameter("where"));
                 mergeData.put("order", req.getParameter("order"));
                 mergeData.put("offset", req.getParameter("offset"));
+                // this stuff is to be compatible with the other more advanced
+                // search method used for media and comments
+                mergeData.put("query_media_folder", req.getParameter("query_media_folder"));
+                mergeData.put("query_is_published", req.getParameter("query_is_published"));
+                mergeData.put("query_text", req.getParameter("query_text"));
+                mergeData.put("query_field", req.getParameter("query_field"));
                 deliver(req, res, mergeData, templateConfirmString);
             }
             else {