fixes:
authorzapata <zapata>
Tue, 4 Mar 2003 22:00:51 +0000 (22:00 +0000)
committerzapata <zapata>
Tue, 4 Mar 2003 22:00:51 +0000 (22:00 +0000)
- only published media are now generated into articles
- HashMap -> Map for variable defintions
- cos library upgraded
added
- upload media from the article page

34 files changed:
bundles/admin_en.properties
lib/cos.jar
source/Mir.java
source/mir/entity/Entity.java
source/mir/misc/FileHandler.java
source/mir/misc/HTMLTemplateProcessor.java
source/mir/misc/WebdbMultipartRequest.java
source/mir/module/AbstractModule.java
source/mir/servlet/ServletModule.java
source/mir/storage/Database.java
source/mir/storage/store/ObjectStore.java
source/mir/storage/store/StoreContainerType.java
source/mircoders/entity/EntityAudio.java
source/mircoders/entity/EntityComment.java
source/mircoders/entity/EntityContent.java
source/mircoders/entity/EntityOther.java
source/mircoders/entity/EntityUploadedMedia.java
source/mircoders/entity/EntityVideo.java
source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java
source/mircoders/media/MediaRequest.java
source/mircoders/module/ModuleComment.java
source/mircoders/module/ModuleContent.java
source/mircoders/module/ModuleTopics.java
source/mircoders/producer/PDFPreFormattingProducerNode.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mircoders/servlet/ServletModuleUploadedMedia.java
source/mircoders/servlet/ServletModuleUsers.java
source/mircoders/storage/DatabaseLinksImcs.java
templates/admin/audio.template
templates/admin/content.template
templates/admin/image.template
templates/admin/media.template
templates/admin/video.template

index 9ffef87..61dc5a1 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.35 2003/02/21 05:38:36 zapata Exp $
+# $Id: admin_en.properties,v 1.36 2003/03/04 22:00:51 zapata Exp $
 
 languagename=English
 
@@ -152,9 +152,13 @@ content.video=Video
 content.other=Other media
 content.media=Media
 content.addimage=add image
+content.uploadimage=upload image
 content.addaudio=add audio
+content.uploadaudio=upload audio
 content.addvideo=add video
+content.uploadvideo=upload video
 content.addother=add other media
+content.uploadother=upload other media
 content.creationdate=date
 content.modificationdate=last change
 content.status=Status
index bcb822a..6a4a1ff 100755 (executable)
Binary files a/lib/cos.jar and b/lib/cos.jar differ
index ed6825c..b61308b 100755 (executable)
@@ -81,14 +81,14 @@ import mircoders.storage.DatabaseUsers;
 /**\r
  * Mir.java - main servlet, that dispatches to servletmodules\r
  *\r
- * @author $Author: idfx $\r
- * @version $Id: Mir.java,v 1.30 2003/02/28 18:27:07 idfx Exp $\r
+ * @author $Author: zapata $\r
+ * @version $Id: Mir.java,v 1.31 2003/03/04 22:00:51 zapata Exp $\r
  *\r
  */\r
 public class Mir extends AbstractServlet {\r
   private static ModuleUsers usersModule = null;\r
   private static ModuleMessage messageModule = null;\r
-  private final static HashMap servletModuleInstanceHash = new HashMap();\r
+  private final static Map servletModuleInstanceHash = new HashMap();\r
 \r
   //I don't know about making this static cause it removes the\r
   //possibility to change the config on the fly.. -mh\r
index 0ea0386..85ae712 100755 (executable)
@@ -37,6 +37,7 @@
 package  mir.entity;\r
 \r
 import java.util.List;\r
+import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.Set;\r
@@ -59,7 +60,7 @@ import mir.storage.StorageObjectFailure;
  * Base Class of Entities\r
  * Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant\r
  *\r
- * @version $Id: Entity.java,v 1.16 2003/02/28 18:27:07 idfx Exp $\r
+ * @version $Id: Entity.java,v 1.17 2003/03/04 22:00:51 zapata Exp $\r
  * @author rk\r
  *\r
  */\r
@@ -69,7 +70,7 @@ public class Entity implements TemplateHashModel, TemplateModelRoot
   protected static MirPropertiesConfiguration configuration;\r
 \r
   private boolean changed;\r
-  protected HashMap theValuesHash; // tablekey / value\r
+  protected Map theValuesHash; // tablekey / value\r
   protected StorageObject theStorageObject;\r
   protected List streamedInput = null;\r
   protected LoggerWrapper logger;\r
@@ -107,24 +108,17 @@ public class Entity implements TemplateHashModel, TemplateModelRoot
 \r
   /**\r
    * Sets the values of the Entity.\r
-   * @param theStringValues HashMap containing the new values of the Entity\r
+   * @param theStringValues Map containing the new values of the Entity\r
    */\r
 \r
-  public void setValues(HashMap theStringValues) {\r
+  public void setValues(Map theStringValues) {\r
     /** @todo should be synchronized */\r
     if (theStringValues != null) {\r
       theValuesHash = new HashMap();\r
-      String aKey;\r
-      Set set = theStringValues.keySet();\r
-      Iterator it = set.iterator();\r
-      int size = set.size();\r
-      for (int i = 0; i < size; i++) {\r
-        aKey = (String) it.next();\r
-        theValuesHash.put(aKey, (String) theStringValues.get(aKey));\r
-      }\r
+      theValuesHash.putAll(theStringValues);\r
     }\r
     else\r
-      logger.warn("Entity.setValues called with null HashMap");\r
+      logger.warn("Entity.setValues called with null Map");\r
   }\r
 \r
   /**\r
@@ -248,14 +242,14 @@ public class Entity implements TemplateHashModel, TemplateModelRoot
   }\r
 \r
   /**\r
-   * Returns a Hashmap with all values of the Entity.\r
-   * @return HashMap with field name as key and the corresponding values\r
+   * Returns a Map with all values of the Entity.\r
+   * @return Map with field name as key and the corresponding values\r
    *\r
        * @deprecated This method is deprecated and will be deleted in the next release.\r
    *  Entity interfaces freemarker.template.TemplateHashModel now and can\r
    *  be used in the same way as SimpleHash.\r
    */\r
-  public HashMap getValues() {\r
+  public Map getValues() {\r
     logger.warn("using deprecated Entity.getValues() - a waste of resources");\r
     return theValuesHash;\r
   }\r
index 7d9b01e..790d5c3 100755 (executable)
@@ -31,7 +31,7 @@
 
 package  mir.misc;
 
-import java.util.HashMap;
+import java.util.Map;
 
 import com.oreilly.servlet.multipart.FilePart;
 
@@ -39,16 +39,16 @@ import com.oreilly.servlet.multipart.FilePart;
 /**
  * Interface that classes wishing to be used as a callback on FileParts for the
  * WebdbMultipartRequest class should implement this interface.
- * 
+ *
  * @author mh <mh@nadir.org>
- * @version $Id: FileHandler.java,v 1.3 2003/01/25 17:45:17 idfx Exp $
+ * @version $Id: FileHandler.java,v 1.4 2003/03/04 22:00:52 zapata Exp $
  * @see mir.misc.WebdbMultipartRequest
- * 
+ *
  */
 
 public interface  FileHandler {
 
-  public void setFile (FilePart filePart, int fileNum, HashMap Params)
+  public void setFile (FilePart filePart, int fileNum, Map Params)
     throws FileHandlerException, FileHandlerUserException;
 
 }
index 346d3d2..46775f2 100755 (executable)
@@ -352,11 +352,11 @@ public final class HTMLTemplateProcessor {
   /**\r
    *  Konvertiert ein Hashtable mit den keys und values als String\r
    *  in ein freemarker.template.SimpleHash-Modell\r
-   *  @param mergeData der HashMap mit den String / String Daten\r
+   *  @param mergeData der Map mit den String / String Daten\r
    *  @return SimpleHash mit den entsprechenden freemarker Daten\r
    *\r
    */\r
-  public static SimpleHash makeSimpleHash(HashMap mergeData) {\r
+  public static SimpleHash makeSimpleHash(Map mergeData) {\r
     SimpleHash modelRoot = new SimpleHash();\r
     String aField;\r
     if (mergeData != null) {\r
index 42e9082..d421d12 100755 (executable)
@@ -34,6 +34,7 @@ package mir.misc;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Hashtable;
 import java.util.Vector;
 
@@ -82,20 +83,20 @@ public class WebdbMultipartRequest
 
 
   /**
-   * The following comment and some code was adapted from the Oreilley cos.jar 
+   * The following comment and some code was adapted from the Oreilley cos.jar
    * package. -mh 2001.09.20
    *
-   * Returns all the parameters as a HashMap of Strings, any parameter 
-   * that sent without a value will be null.  A value 
-   * is guaranteed to be in its normal, decoded form.  If A parameter 
-   * has multiple values, only the last one is returned (for backward 
+   * Returns all the parameters as a Map of Strings, any parameter
+   * that sent without a value will be null.  A value
+   * is guaranteed to be in its normal, decoded form.  If A parameter
+   * has multiple values, only the last one is returned (for backward
    * compatibility).  For parameters with multiple values, it's possible
    * the last "value" may be null.
    *
-   * @return A HashMap of String representations of the  parameter values.
+   * @return A Map of String representations of the  parameter values.
    */
-  public HashMap getParameters(){
-    HashMap pHash = new HashMap();
+  public Map getParameters(){
+    Map pHash = new HashMap();
     String value = new String();
 
     Enumeration Keys = parameters.keys();
@@ -116,10 +117,10 @@ public class WebdbMultipartRequest
    * The following code and comment stolen from oreilley cos.jar.
    * -mh. 2001.09.20
    *
-   * Returns the values of the named parameter as a String array, or null if 
-   * the parameter was not sent.  The array has one entry for each parameter 
-   * field sent.  If any field was sent without a value that entry is stored 
-   * in the array as a null.  The values are guaranteed to be in their 
+   * Returns the values of the named parameter as a String array, or null if
+   * the parameter was not sent.  The array has one entry for each parameter
+   * field sent.  If any field was sent without a value that entry is stored
+   * in the array as a null.  The values are guaranteed to be in their
    * normal, decoded form.  A single value is returned as a one-element array.
    *
    * @param name the parameter name.
index a010a85..2324e19 100755 (executable)
@@ -32,7 +32,7 @@
 package  mir.module;
 
 import java.sql.SQLException;
-import java.util.HashMap;
+import java.util.Map;
 
 import freemarker.template.SimpleHash;
 
@@ -163,7 +163,7 @@ public class AbstractModule {
    * @return Id des eingef?gten Objekts
    * @exception ModuleException
    */
-  public String add (HashMap theValues) throws ModuleException {
+  public String add (Map theValues) throws ModuleException {
     try {
       Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();
       theEntity.setStorage(theStorage);
@@ -180,7 +180,7 @@ public class AbstractModule {
    * @return Id des eingef?gten Objekts
    * @exception ModuleException
    */
-  public String set (HashMap theValues) throws ModuleException {
+  public String set (Map theValues) throws ModuleException {
     try {
       Entity theEntity = theStorage.selectById((String)theValues.get("id"));
       if (theEntity == null)
index eb95f61..3d67860 100755 (executable)
@@ -34,6 +34,7 @@ package mir.servlet;
 import java.io.IOException;\r
 import java.io.PrintWriter;\r
 import java.util.List;\r
+import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.Locale;\r
 \r
@@ -216,7 +217,7 @@ public abstract class ServletModule {
   public void insert(HttpServletRequest req, HttpServletResponse res)\r
       throws ServletModuleException, ServletModuleUserException {\r
     try {\r
-      HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
+      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
       logger.debug("--trying to add...");\r
       String id = mainModule.add(withValues);\r
       logger.debug("--trying to deliver..." + id);\r
@@ -310,7 +311,7 @@ public abstract class ServletModule {
       throws ServletModuleException {\r
     try {\r
       String idParam = req.getParameter("id");\r
-      HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
+      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
 \r
       String id = mainModule.set(withValues);\r
       String whereParam = req.getParameter("where");\r
@@ -446,12 +447,12 @@ public abstract class ServletModule {
   }\r
 \r
   /**\r
-   * Holt die Felder aus der Metadatenfelderliste des StorageObjects, die\r
-   * im HttpRequest vorkommen und liefert sie als HashMap zurueck\r
+   * Gets the fields from a httprequest and matches them with the metadata from\r
+   * the storage object. Returns the keys that match, with their values.\r
    *\r
-   * @return HashMap mit den Werten\r
+   * @return Map with the values\r
    */\r
-  public HashMap getIntersectingValues(HttpServletRequest req, StorageObject theStorage)\r
+  public Map getIntersectingValues(HttpServletRequest req, StorageObject theStorage)\r
       throws ServletModuleException {\r
 \r
     try {\r
@@ -471,7 +472,7 @@ public abstract class ServletModule {
 \r
       theFieldList = theStorage.getFields();\r
 \r
-      HashMap withValues = new HashMap();\r
+      Map withValues = new HashMap();\r
       String aField, aValue;\r
 \r
       for (int i = 0; i < theFieldList.size(); i++) {\r
index a22714c..2482ba1 100755 (executable)
@@ -49,6 +49,7 @@ import java.util.List;
 import java.util.Calendar;\r
 import java.util.GregorianCalendar;\r
 import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 import com.codestudio.util.SQLManager;\r
 \r
@@ -85,7 +86,7 @@ import mir.util.JDBCStringRoutines;
  * Treiber, Host, User und Passwort, ueber den der Zugriff auf die\r
  * Datenbank erfolgt.\r
  *\r
- * @version $Id: Database.java,v 1.34 2003/02/23 05:00:12 zapata Exp $\r
+ * @version $Id: Database.java,v 1.35 2003/03/04 22:00:52 zapata Exp $\r
  * @author rk\r
  *\r
  */\r
@@ -695,7 +696,7 @@ public class Database implements StorageObject {
   private Entity makeEntityFromResultSet(ResultSet rs)\r
     throws StorageObjectFailure {\r
     /** @todo OS: get Pkey from ResultSet and consult ObjectStore */\r
-    HashMap theResultHash = new HashMap();\r
+    Map theResultHash = new HashMap();\r
     String theResult = null;\r
     int theType;\r
     Entity returnEntity = null;\r
index b50f0a8..e117bcf 100755 (executable)
@@ -63,6 +63,7 @@ package mir.storage.store;
 \r
 import java.io.BufferedInputStream;\r
 import java.io.FileInputStream;\r
+import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.MissingResourceException;\r
@@ -76,7 +77,7 @@ import mir.log.LoggerWrapper;
 public class ObjectStore {\r
 \r
   private final static ObjectStore INSTANCE = new ObjectStore();\r
-  private final static HashMap containerMap = new HashMap(); // StoreContainerType/StoreContainer\r
+  private final static Map containerMap = new HashMap(); // StoreContainerType/StoreContainer\r
   private static long storeHit = 0, storeMiss = 0;\r
   private Properties ostoreConf;\r
   private LoggerWrapper logger;\r
index fe8b149..dde90a6 100755 (executable)
@@ -47,6 +47,7 @@ package mir.storage.store;
  */\r
 \r
 import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 import mir.misc.StringUtil;\r
 \r
@@ -57,7 +58,7 @@ public class StoreContainerType {
   public final static int STOC_TYPE_ENTITYLIST = 1;\r
   public final static int STOC_TYPE_MAX = STOC_TYPE_ENTITYLIST;\r
 \r
-  private static HashMap[] uniqueTypes = new HashMap[STOC_TYPE_MAX + 1];\r
+  private static Map[] uniqueTypes = new HashMap[STOC_TYPE_MAX + 1];\r
   private static ObjectStore o_store = ObjectStore.getInstance();\r
   private Class stocClass = null;\r
   private int stocType = STOC_TYPE_UNKNOWN;\r
@@ -77,7 +78,7 @@ public class StoreContainerType {
   public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {\r
     StoreContainerType returnStocType = null;\r
     if (stoc_type >= 0 && stoc_type <= STOC_TYPE_MAX) {\r
-      HashMap current = uniqueTypes[stoc_type];\r
+      Map current = uniqueTypes[stoc_type];\r
       if (current.containsKey(stoc_class))\r
         returnStocType = (StoreContainerType) current.get(stoc_class);\r
       else {\r
index 6de0502..10ddfa0 100755 (executable)
@@ -32,7 +32,7 @@
 package mircoders.entity;\r
 \r
 import java.sql.SQLException;\r
-import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 import mir.storage.StorageObject;\r
 import mir.storage.StorageObjectFailure;\r
@@ -41,7 +41,7 @@ import mir.storage.StorageObjectFailure;
  * This class handles storage of audio data and meta data\r
  *\r
  * @author mh\r
- * @version $Id: EntityAudio.java,v 1.6 2003/02/23 05:00:13 zapata Exp $\r
+ * @version $Id: EntityAudio.java,v 1.7 2003/03/04 22:00:52 zapata Exp $\r
  */\r
 \r
 \r
@@ -66,7 +66,7 @@ public class EntityAudio extends EntityUploadedMedia
     }\r
   }\r
 \r
-  public void setValues(HashMap theStringValues) {\r
+  public void setValues(Map theStringValues) {\r
     if (theStringValues != null) {\r
       if (!theStringValues.containsKey("is_published"))\r
         theStringValues.put("is_published", "0");\r
index 0a8659b..cfec128 100755 (executable)
@@ -31,7 +31,7 @@
 
 package mircoders.entity;
 
-import java.util.HashMap;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.storage.StorageObject;
@@ -39,8 +39,8 @@ import mir.storage.StorageObject;
 /**
  * This class maps one line of the comment-table to a java-object.
  *
- * @author $Author: idfx $
- * @version $Revision: 1.13 $ $Date: 2003/01/25 17:50:34 $
+ * @author $Author: zapata $
+ * @version $Revision: 1.14 $ $Date: 2003/03/04 22:00:52 $
  */
 
 
@@ -61,7 +61,7 @@ public class EntityComment extends Entity
   /**
    * overridden method setValues to patch creator_main_url
    */
-  public void setValues(HashMap theStringValues)
+  public void setValues(Map theStringValues)
   {
     if (theStringValues != null) {
       if (!theStringValues.containsKey("is_published")) {
index 87f6397..5c4f6da 100755 (executable)
@@ -34,6 +34,7 @@ package mircoders.entity;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Map;
 import java.util.HashMap;
 
 import freemarker.template.SimpleScalar;
@@ -54,7 +55,7 @@ import mircoders.storage.DatabaseContentToTopics;
  * this class implements mapping of one line of the database table content
  * to a java object
  *
- * @version $Id: EntityContent.java,v 1.15 2003/02/23 05:00:13 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.16 2003/03/04 22:00:53 zapata Exp $
  * @author mir-coders group
  *
  */
@@ -71,7 +72,7 @@ public class EntityContent extends Entity
   //this should always be transient i.e it can never be stored in the db
   //or ObjectStore. (so the ObjectStore should only be caching what comes
   //directly out of the DB. @todo confirm this with rk. -mh
-  HashMap _entCache = new HashMap();
+  Map _entCache = new HashMap();
   Boolean _hasMedia = null;
 
   // constructors
@@ -260,7 +261,7 @@ public class EntityContent extends Entity
   /**
    * overridden method setValues to patch creator_main_url
    */
-  public void setValues(HashMap theStringValues) {
+  public void setValues(Map theStringValues) {
     if (theStringValues != null) {
       if (theStringValues.containsKey("creator_main_url")){
         if (((String)theStringValues.get("creator_main_url")).equalsIgnoreCase("http://")){
index ba293d0..0ec4ad0 100755 (executable)
@@ -1,78 +1,78 @@
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.entity;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-
-import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
-
-/**
- * This class handles storage of other data and meta data
- *
- * @author mh
- * @version 11.11.2000
- */
-
-
-public class EntityOther extends EntityUploadedMedia
-{
-       public EntityOther()
-       {
-               super();
-       }
-
-       public EntityOther(StorageObject theStorage) {
-               this();
-               setStorage(theStorage);
-       }
-
-       public void update() throws StorageObjectFailure {
-               super.update();
-               try {
-                       theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
-               } catch (SQLException e) {
-                       throwStorageObjectFailure(e, "EntityOther :: update :: failed!! ");
-               }
-       }
-
-       public void setValues(HashMap theStringValues)
-       {
-               if (theStringValues != null) {
-                       if (!theStringValues.containsKey("is_published"))
-                        theStringValues.put("is_published","0");
-               }
-               super.setValues(theStringValues);
-       }
-
-}
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.entity;\r
+\r
+import java.sql.SQLException;\r
+import java.util.Map;\r
+\r
+import mir.storage.StorageObject;\r
+import mir.storage.StorageObjectFailure;\r
+\r
+/**\r
+ * This class handles storage of other data and meta data\r
+ *\r
+ * @author mh\r
+ * @version 11.11.2000\r
+ */\r
+\r
+\r
+public class EntityOther extends EntityUploadedMedia\r
+{\r
+  public EntityOther() {\r
+    super();\r
+  }\r
+\r
+  public EntityOther(StorageObject theStorage) {\r
+    this();\r
+    setStorage(theStorage);\r
+  }\r
+\r
+  public void update() throws StorageObjectFailure {\r
+    super.update();\r
+    try {\r
+      theStorageObject.executeUpdate(\r
+          "update content set is_produced='0' where to_media=" + getId());\r
+    }\r
+    catch (SQLException e) {\r
+      throwStorageObjectFailure(e, "EntityOther :: update :: failed!! ");\r
+    }\r
+  }\r
+\r
+  public void setValues(Map theStringValues) {\r
+    if (theStringValues != null) {\r
+      if (!theStringValues.containsKey("is_published"))\r
+        theStringValues.put("is_published", "0");\r
+    }\r
+    super.setValues(theStringValues);\r
+  }\r
+\r
+}\r
index 35da22b..0ef98fb 100755 (executable)
@@ -31,7 +31,7 @@
 
 package mircoders.entity;
 
-import java.util.HashMap;
+import java.util.Map;
 
 import freemarker.template.SimpleList;
 import freemarker.template.SimpleScalar;
@@ -53,7 +53,7 @@ import mircoders.storage.DatabaseUploadedMedia;
 /**
  *
  * @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.20 2003/02/28 18:27:08 idfx Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.21 2003/03/04 22:00:53 zapata Exp $
  */
 
 
@@ -82,7 +82,7 @@ public class EntityUploadedMedia extends Entity {
     }
   }
 
-  public void setValues(HashMap theStringValues) {
+  public void setValues(Map theStringValues) {
     if (theStringValues != null) {
       if (!theStringValues.containsKey("is_published"))
         theStringValues.put("is_published", "0");
index c97b37e..97cb75a 100755 (executable)
@@ -32,7 +32,7 @@
 package mircoders.entity;\r
 \r
 import java.sql.SQLException;\r
-import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 import mir.storage.StorageObject;\r
 import mir.storage.StorageObjectFailure;\r
@@ -73,7 +73,7 @@ public class EntityVideo extends EntityUploadedMedia
     }\r
   }\r
 \r
-  public void setValues(HashMap theStringValues) {\r
+  public void setValues(Map theStringValues) {\r
     if (theStringValues != null) {\r
       if (!theStringValues.containsKey("is_published"))\r
         theStringValues.put("is_published", "0");\r
index 8f246ce..fe7b59e 100755 (executable)
@@ -353,7 +353,7 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
     public Object getValue(EntityAdapter anEntityAdapter) {\r
       try {\r
         return anEntityAdapter.getRelation(\r
-          "exists (select * from content_x_media where content_id="+anEntityAdapter.get("id")+" and media_id=id)",\r
+          "is_published='t' and exists (select * from content_x_media where content_id="+anEntityAdapter.get("id")+" and media_id=id)",\r
           "id",\r
           definition);\r
       }\r
index 2ae108b..3142ca0 100755 (executable)
@@ -32,7 +32,7 @@
 package mircoders.media;
 
 import java.util.GregorianCalendar;
-import java.util.HashMap;
+import java.util.Map;
 import java.util.Iterator;
 
 import javax.servlet.ServletContext;
@@ -64,7 +64,7 @@ import mircoders.storage.DatabaseMediaType;
  *    appropriate media objects are set.
  *
  * @author mh
- * @version $Id: MediaRequest.java,v 1.14 2003/02/28 18:27:08 idfx Exp $
+ * @version $Id: MediaRequest.java,v 1.15 2003/03/04 22:00:53 zapata Exp $
  *
  */
 
@@ -92,7 +92,7 @@ public class MediaRequest implements FileHandler
    * is_published parameter (from the upload form) is supplied. (for backwards
    * compatibility.)
    */
-  public void setFile(FilePart filePart, int fileNum, HashMap mediaValues)
+  public void setFile(FilePart filePart, int fileNum, Map mediaValues)
     throws FileHandlerException, FileHandlerUserException {
 
     String mediaId=null;
index c9a6e4a..c57a920 100755 (executable)
@@ -32,7 +32,7 @@
 package mircoders.module;
 
 import java.io.PrintWriter;
-import java.util.HashMap;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.log.LoggerToWriterAdapter;
@@ -92,7 +92,7 @@ public class ModuleComment extends AbstractModule
   /**
    * setValues in the Entity and updates them on the StorageObject
    */
-  public String set(HashMap theValues) throws ModuleException {
+  public String set(Map theValues) throws ModuleException {
     try {
       Entity theEntity = theStorage.selectById((String)theValues.get("id"));
       if (theEntity == null)
index 0e5c305..9c14525 100755 (executable)
@@ -31,7 +31,7 @@
 
 package mircoders.module;
 
-import java.util.HashMap;
+import java.util.Map;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -49,7 +49,7 @@ import mircoders.storage.DatabaseContentToMedia;
 /*
  *  ContentObjekt -
  *
- * @version $Id: ModuleContent.java,v 1.14 2003/01/25 17:50:35 idfx Exp $
+ * @version $Id: ModuleContent.java,v 1.15 2003/03/04 22:00:53 zapata Exp $
  *
  * @author RK, mir-coders
  *
@@ -94,7 +94,7 @@ public class ModuleContent extends AbstractModule
     return returnList;
   }
 
-  public EntityList getContent(HashMap searchValues, boolean concat, int offset, EntityUsers user)
+  public EntityList getContent(Map searchValues, boolean concat, int offset, EntityUsers user)
       throws ModuleException {
 
     try {
index 6629c4c..2f30f64 100755 (executable)
@@ -31,7 +31,7 @@
 
 package mircoders.module;
 
-import java.util.HashMap;
+import java.util.Map;
 
 import freemarker.template.SimpleList;
 
@@ -86,7 +86,7 @@ public class ModuleTopics extends AbstractModule {
       returnList = getByWhereClause("", "title", -1);
     }
     catch (Exception e) {
-      logger.warn("--getTopicsList: topics could not be fetched: " + e.getMessage());
+      logger.warn("ModuleTopics.getTopicsList: topics could not be fetched: " + e.getMessage());
     }
     return returnList;
   }
@@ -98,22 +98,15 @@ public class ModuleTopics extends AbstractModule {
    * @return Id des eingef?gten Objekts
    * @exception ModuleException
    */
-  public String set(HashMap theValues) throws ModuleException {
+  public String set(Map theValues) throws ModuleException {
     try {
       Entity theEntity = theStorage.selectById((String) theValues.get("id"));
       if (theEntity == null) {
-        throw new ModuleException("Kein Objekt mit id in Datenbank id: " + theValues.get("id"));
+        throw new ModuleException("No topic with id  " + theValues.get("id") + " found");
       }
       theEntity.setValues(theValues);
-      DatabaseContentToTopics db = DatabaseContentToTopics.getInstance();
-      DatabaseContent dbc = DatabaseContent.getInstance();
-      EntityList contentList = db.getContent((EntityTopics) theEntity);
-      if (contentList!=null) {
-        for (int i = 0; i < contentList.size(); i++) {
-          dbc.setUnproduced("id=" + ((EntityContent) contentList.elementAt(i)).getId());
-        }
-      }
       theEntity.update();
+
       return theEntity.getId();
     }
     catch (StorageObjectFailure e) {
index 1ae82e3..7dd8d80 100755 (executable)
@@ -115,14 +115,14 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
       theContent = StringUtil.convertNewline2Break(theContent);
 
       if (images == null){
-          HashMap row = new HashMap();
+          Map row = new HashMap();
           row.put("text",theContent);
           row.put("hasImage","0");
           brokenUpContent.add(row);
       }
       if (images != null){
           //need to add checks for out of content!
-          HashMap row0 = new HashMap();
+          Map row0 = new HashMap();
           if (numCharsInAnImagelessRow>(theContent).length()){
               row0.put("text",theContent);
               outOfText = true;
@@ -137,8 +137,8 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
           brokenUpContent.add(row0);
           aLogger.debug("CP1 is "+ currentPosition);
           while(images.hasNext()){
-              HashMap row1 = new HashMap();
-              HashMap row2 = new HashMap();
+              Map row1 = new HashMap();
+              Map row2 = new HashMap();
               EntityImages currentImage=(EntityImages) images.next();
               float img_width=(new Float(currentImage.getValue("img_width"))).floatValue();
               float img_height=(new Float(currentImage.getValue("img_height"))).floatValue();
@@ -198,7 +198,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
 
               aLogger.debug("CP3 is "+ currentPosition);
           }
-          HashMap row3 = new HashMap();
+          Map row3 = new HashMap();
           if (! outOfText){
               row3.put("text",theContent.substring(currentPosition));
               row3.put("hasImage","0");
index c44df63..478376a 100755 (executable)
@@ -33,6 +33,7 @@ package mircoders.servlet;
 \r
 import java.io.IOException;\r
 import java.util.GregorianCalendar;\r
+import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.List;\r
@@ -72,7 +73,7 @@ import freemarker.template.SimpleHash;
  *  ServletModuleContent -\r
  *  deliver html for the article admin form.\r
  *\r
- * @version $Id: ServletModuleContent.java,v 1.37 2003/03/04 02:04:35 zapata Exp $\r
+ * @version $Id: ServletModuleContent.java,v 1.38 2003/03/04 22:00:54 zapata Exp $\r
  * @author rk, mir-coders\r
  *\r
  */\r
@@ -174,7 +175,7 @@ public class ServletModuleContent extends ServletModule
 //theLog.printDebugInfo(":: content :: trying to insert");\r
     try {\r
       EntityUsers   user = _getUser(req);\r
-      HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());\r
+      Map withValues = getIntersectingValues(req, DatabaseContent.getInstance());\r
 \r
       String now = StringUtil.date2webdbDate(new GregorianCalendar());\r
       withValues.put("date", now);\r
@@ -320,7 +321,7 @@ public class ServletModuleContent extends ServletModule
       String idParam = aRequest.getParameter("id");\r
       if (idParam == null) throw new ServletModuleException("Wrong call: (id) is missing");\r
 \r
-      HashMap withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());\r
+      Map withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());\r
       String[] topic_id = aRequest.getParameterValues("to_topic");\r
       String content_id = aRequest.getParameter("id");\r
 \r
@@ -353,7 +354,7 @@ public class ServletModuleContent extends ServletModule
   * if the "id" parameter is null, it means show an empty form to add a new\r
   * article.\r
 */\r
-  private void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)\r
+  public void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)\r
       throws ServletModuleException {\r
 \r
     try {\r
index 0828b22..e720bb9 100755 (executable)
@@ -42,6 +42,7 @@ import java.util.ArrayList;
 import java.util.Collections;\r
 import java.util.Enumeration;\r
 import java.util.GregorianCalendar;\r
+import java.util.Map;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.ListIterator;\r
@@ -120,7 +121,7 @@ import freemarker.template.TemplateModelRoot;
  *    open-postings to the newswire\r
  *\r
  * @author mir-coders group\r
- * @version $Id: ServletModuleOpenIndy.java,v 1.60 2003/02/28 18:27:08 idfx Exp $\r
+ * @version $Id: ServletModuleOpenIndy.java,v 1.61 2003/03/04 22:00:54 zapata Exp $\r
  *\r
  */\r
 \r
@@ -226,7 +227,7 @@ public class ServletModuleOpenIndy extends ServletModule
       {\r
         // ok, collecting data from form\r
         try {\r
-          HashMap withValues = getIntersectingValues(req, DatabaseComment.getInstance());\r
+          Map withValues = getIntersectingValues(req, DatabaseComment.getInstance());\r
 \r
           //no html in comments(for now)\r
           for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){\r
@@ -366,7 +367,7 @@ public class ServletModuleOpenIndy extends ServletModule
         throw new ServletModuleUserException(e.getMessage());\r
       }\r
 \r
-      HashMap withValues = mp.getParameters();\r
+      Map withValues = mp.getParameters();\r
 \r
       //checking the onetimepasswd\r
       if(passwdProtection.equals("yes")){\r
@@ -755,7 +756,7 @@ public class ServletModuleOpenIndy extends ServletModule
               }\r
               else{\r
                 // then we'll sort by date!\r
-                HashMap dateToPosition = new HashMap(end,1.0F); //we know how big it will be\r
+                Map dateToPosition = new HashMap(end,1.0F); //we know how big it will be\r
                 for(int i = start; i < end; i++) {\r
                   String creationDate=(hits.doc(i)).get("creationDate");\r
                   // do a little dance in case two contents created at the same second!\r
index ed4549d..7d20647 100755 (executable)
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.servlet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLEncoder;
-import java.util.HashMap;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
-import mir.entity.Entity;
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.media.MediaHelper;
-import mir.media.MirMedia;
-import mir.misc.FileHandler;
-import mir.misc.FileHandlerException;
-import mir.misc.FileHandlerUserException;
-import mir.misc.WebdbMultipartRequest;
-import mir.module.ModuleException;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleException;
-import mir.servlet.ServletModuleUserException;
-import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityUploadedMedia;
-import mircoders.entity.EntityUsers;
-import mircoders.media.MediaRequest;
-import mircoders.storage.DatabaseMediafolder;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-
-/*
- *  ServletModuleBilder -
- *  liefert HTML fuer Bilder
- *
- * @version $Id: ServletModuleUploadedMedia.java,v 1.16 2003/02/23 05:00:15 zapata Exp $
- * @author RK, the mir-coders group
- */
-
-public abstract class ServletModuleUploadedMedia
-        extends mir.servlet.ServletModule {
-
-  //private static DatabaseRights dbRights;
-
-  public static ServletModule getInstance() {
-    return null;
-  }
-
-  public ServletModuleUploadedMedia() {
-    super();
-    logger = new LoggerWrapper("ServletModule.UploadedMedia");
-  }
-
-  public void insert(HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleException, ServletModuleUserException {
-    try {
-      EntityUsers user = _getUser(req);
-      MediaRequest mediaReq =  new MediaRequest(user.getId(), false);
-      WebdbMultipartRequest mp = new WebdbMultipartRequest(req, (FileHandler)mediaReq);
-      EntityList mediaList = mediaReq.getEntityList();
-
-      SimpleHash mergeData = new SimpleHash();
-      SimpleHash popups = new SimpleHash();
-      mergeData.put("contentlist", mediaList);
-      if (mediaList.getOrder() != null) {
-        mergeData.put("order", mediaList.getOrder());
-        mergeData.put("order_encoded", URLEncoder.encode(mediaList.getOrder()));
-      }
-      mergeData.put("count", (new Integer(mediaList.getCount())).toString());
-      mergeData.put("from", (new Integer(mediaList.getFrom())).toString());
-      mergeData.put("to", (new Integer(mediaList.getTo())).toString());
-      if (mediaList.hasNextBatch())
-        mergeData.put("next", (new Integer(mediaList.getNextBatch())).toString());
-      if (mediaList.hasPrevBatch())
-          mergeData.put("prev", (new Integer(mediaList.getPrevBatch())).toString());
-      //fetch the popups
-      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());
-      // raus damit
-      deliver(req, res, mergeData, popups, templateListString);
-    } catch (FileHandlerUserException e) {
-      logger.error("ServletModuleUploadedMedia.insert: " + e.getMessage());
-      throw new ServletModuleUserException(e.getMessage());
-    } catch (FileHandlerException e) {
-      throw new ServletModuleException(
-              "upload -- media handling exception " + e.toString());
-    } catch (StorageObjectFailure e) {
-      throw new ServletModuleException("upload -- storageobjectexception "
-                                      + e.toString());
-    } catch (IOException e) {
-      throw new ServletModuleException("upload -- ioexception " + e.toString());
-    } catch (PropertiesConfigExc e) {
-      throw new ServletModuleException("upload -- configexception " + e.toString());
-    }
-  }
-
-  public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
-
-    try {
-      EntityUsers user = _getUser(req);
-      WebdbMultipartRequest mp = new WebdbMultipartRequest(req, null);
-      HashMap parameters = mp.getParameters();
-
-      parameters.put("to_publisher", user.getId());
-      parameters.put("is_produced", "0");
-      if (!parameters.containsKey("is_published"))
-        parameters.put("is_published", "0");
-
-      String id = mainModule.set(parameters);
-      logger.debug("update: media ID = " + id);
-      _edit(id, req, res);
-    }
-    catch (IOException e) {
-      throw new ServletModuleException("upload -- ioexception " + e.toString());
-    }
-    catch (ModuleException e) {
-      throw new ServletModuleException("upload -- moduleexception " + e.toString());
-    }
-    catch (Exception e) {
-      throw new ServletModuleException("upload -- exception " + e.toString());
-    }
-
-  }
-
-
-  public void list(HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleException {
-    // Parameter auswerten
-    SimpleHash mergeData = new SimpleHash();
-    SimpleHash popups = new SimpleHash();
-
-    String query_text = req.getParameter("query_text");
-    mergeData.put("query_text", query_text);
-    if (query_text != null) mergeData.put("query_text_encoded", URLEncoder.encode(query_text));
-    String query_field = req.getParameter("query_field");
-    mergeData.put("query_field", query_field);
-    String query_is_published = req.getParameter("query_is_published");
-    mergeData.put("query_is_published", query_is_published);
-    String query_media_folder = req.getParameter("query_media_folder");
-    mergeData.put("query_media_folder", query_media_folder);
-    String offset = req.getParameter("offset");
-    if (offset == null || offset.equals("")) offset = "0";
-    mergeData.put("offset", offset);
-
-    String order = req.getParameter("order");
-    if (order == null || order.equals("")) order = "webdb_lastchange desc";
-
-    // if in connection mode to content
-    String cid = req.getParameter("cid");
-    mergeData.put("cid", cid);
-
-
-    // sql basteln
-    String whereClause = "";
-    boolean isFirst = true;
-    if (query_text != null && !query_text.equalsIgnoreCase("")) {
-      whereClause += "lower(" + query_field + ") like lower('%" + query_text + "%')";
-      isFirst = false;
-    }
-    if (query_is_published != null && !query_is_published.equals("")) {
-      if (isFirst == false) whereClause += " and ";
-      whereClause += "is_published='" + query_is_published + "'";
-      isFirst = false;
-    }
-    if (query_media_folder != null && !query_media_folder.equals("")) {
-      if (isFirst == false) whereClause += " and ";
-      whereClause += "to_media_folder='" + query_media_folder + "'";
-    }
-    //theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
-
-    // fetch and deliver
-    try {
-      if (query_text != null || query_is_published != null || query_media_folder != null) {
-        EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue(), 10);
-        if (theList != null) {
-          mergeData.put("contentlist", theList);
-          if (theList.getOrder() != null) {
-            mergeData.put("order", theList.getOrder());
-            mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
-          }
-          mergeData.put("count", (new Integer(theList.getCount())).toString());
-          mergeData.put("from", (new Integer(theList.getFrom())).toString());
-          mergeData.put("to", (new Integer(theList.getTo())).toString());
-          if (theList.hasNextBatch())
-            mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
-          if (theList.hasPrevBatch())
-            mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
-        }
-      }
-      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());
-
-      deliver(req, res, mergeData, popups, templateListString);
-    }
-    catch (ModuleException e) {
-      throw new ServletModuleException(e.toString());
-    }
-    catch (Exception e) {
-      throw new ServletModuleException(e.toString());
-    }
-  }
-
-
-  public void add(HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleException {
-    try {
-      SimpleHash mergeData = new SimpleHash();
-      mergeData.put("new", "1");
-      SimpleHash popups = new SimpleHash();
-      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());
-      String maxMedia = MirPropertiesConfiguration.instance().getString("ServletModule.OpenIndy.MaxMediaUploadItems");
-      String numOfMedia = req.getParameter("medianum");
-      if(numOfMedia==null||numOfMedia.equals("")){
-        numOfMedia="1";
-      } else if(Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) {
-        numOfMedia = maxMedia;
-      }
-
-      int mediaNum = Integer.parseInt(numOfMedia);
-      SimpleList mediaFields = new SimpleList();
-      for(int i =0; i<mediaNum;i++){
-        Integer mNum = new Integer(i+1);
-        mediaFields.add(mNum.toString());
-      }
-      mergeData.put("medianum",numOfMedia);
-      mergeData.put("mediafields",mediaFields);
-      deliver(req, res, mergeData, popups, templateObjektString);
-    } catch (Exception e) {
-      throw new ServletModuleException(e.toString());
-    }
-  }
-
-  public void edit(HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleException {
-    String idParam = req.getParameter("id");
-    _edit(idParam, req, res);
-  }
-
-  private void _edit(String idParam, HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleException {
-    if (idParam != null && !idParam.equals("")) {
-      try {
-        SimpleHash popups = new SimpleHash();
-        popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());
-        deliver(req, res, mainModule.getById(idParam), popups,
-                templateObjektString);
-      }
-      catch (ModuleException e) {
-        throw new ServletModuleException(e.toString());
-      }
-      catch (StorageObjectFailure e) {
-        throw new ServletModuleException(e.toString());
-      }
-    }
-    else {
-      throw new ServletModuleException("ServletmoduleUploadedMedia :: _edit without id");
-    }
-  }
-
-
-  /** @todo should be in ServletModule.java */
-  private EntityUsers _getUser(HttpServletRequest req) {
-    HttpSession session = req.getSession(false);
-    return (EntityUsers) session.getAttribute("login.uid");
-  }
-
-  public void getMedia(HttpServletRequest req, HttpServletResponse res)
-    throws ServletModuleException
-  {
-    String idParam = req.getParameter("id");
-    if (idParam!=null && !idParam.equals("")) {
-      try {
-        EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);
-        Entity mediaType = ent.getMediaType();
-        MirMedia mediaHandler;
-
-        ServletContext ctx = MirPropertiesConfiguration.getContext();
-        String fName = ent.getId()+"."+mediaType.getValue("name");
-
-        mediaHandler = MediaHelper.getHandler(mediaType);
-        InputStream in = mediaHandler.getMedia(ent, mediaType);
-
-        res.setContentType(ctx.getMimeType(fName));
-        //important that before calling this res.getWriter was not called first
-        ServletOutputStream out = res.getOutputStream();
-
-        int read ;
-        byte[] buf = new byte[8 * 1024];
-        while((read = in.read(buf)) != -1) {
-          out.write(buf, 0, read);
-        }
-        in.close();
-        out.close();
-      }
-
-      catch (IOException e) {
-        throw new ServletModuleException(e.toString());
-      }
-      catch (ModuleException e) {
-        throw new ServletModuleException(e.toString());
-      }
-      catch (Exception e) {
-        throw new ServletModuleException(e.toString());
-      }
-    }
-    else logger.error("id not specified.");
-    // no exception allowed
-  }
-
-  public void getIcon(HttpServletRequest req, HttpServletResponse res)
-    throws ServletModuleException
-  {
-    String idParam = req.getParameter("id");
-    if (idParam!=null && !idParam.equals("")) {
-      try {
-        EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);
-        Entity mediaType = ent.getMediaType();
-        MirMedia mediaHandler;
-
-        ServletContext ctx = MirPropertiesConfiguration.getContext();
-        String fName = ent.getId()+"."+mediaType.getValue("name");
-
-        mediaHandler = MediaHelper.getHandler(mediaType);
-        InputStream in = mediaHandler.getIcon(ent);
-
-        res.setContentType(ctx.getMimeType(fName));
-        //important that before calling this res.getWriter was not called first
-        ServletOutputStream out = res.getOutputStream();
-
-        int read ;
-        byte[] buf = new byte[8 * 1024];
-        while((read = in.read(buf)) != -1) {
-          out.write(buf, 0, read);
-        }
-        in.close();
-        out.close();
-      }
-
-      catch (IOException e) {
-        throw new ServletModuleException(e.toString());
-      }
-      catch (ModuleException e) {
-        throw new ServletModuleException(e.toString());
-      }
-      catch (Exception e) {
-        throw new ServletModuleException(e.toString());
-      }
-    }
-    else logger.error("getIcon: id not specified.");
-    // no exception allowed
-  }
-
-}
-
-
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.servlet;\r
+\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.net.URLEncoder;\r
+import java.util.Map;\r
+\r
+import javax.servlet.ServletContext;\r
+import javax.servlet.ServletOutputStream;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+import javax.servlet.http.HttpSession;\r
+\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
+import mir.entity.Entity;\r
+import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
+import mir.media.MediaHelper;\r
+import mir.media.MirMedia;\r
+import mir.misc.FileHandler;\r
+import mir.misc.FileHandlerException;\r
+import mir.misc.FileHandlerUserException;\r
+import mir.misc.WebdbMultipartRequest;\r
+import mir.module.ModuleException;\r
+import mir.servlet.ServletModule;\r
+import mir.servlet.ServletModuleException;\r
+import mir.servlet.ServletModuleUserException;\r
+import mir.storage.StorageObjectFailure;\r
+import mircoders.entity.EntityUploadedMedia;\r
+import mircoders.entity.EntityUsers;\r
+import mircoders.entity.EntityContent;\r
+import mircoders.media.MediaRequest;\r
+import mircoders.storage.DatabaseMediafolder;\r
+import mircoders.storage.DatabaseContent;\r
+import freemarker.template.SimpleHash;\r
+import freemarker.template.SimpleList;\r
+\r
+/*\r
+ *  ServletModuleBilder -\r
+ *  liefert HTML fuer Bilder\r
+ *\r
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.17 2003/03/04 22:00:54 zapata Exp $\r
+ * @author RK, the mir-coders group\r
+ */\r
+\r
+public abstract class ServletModuleUploadedMedia\r
+        extends mir.servlet.ServletModule {\r
+\r
+  //private static DatabaseRights dbRights;\r
+\r
+  public static ServletModule getInstance() {\r
+    return null;\r
+  }\r
+\r
+  public ServletModuleUploadedMedia() {\r
+    super();\r
+    logger = new LoggerWrapper("ServletModule.UploadedMedia");\r
+  }\r
+\r
+  public void insert(HttpServletRequest req, HttpServletResponse res)\r
+          throws ServletModuleException, ServletModuleUserException {\r
+    try {\r
+      EntityUsers user = _getUser(req);\r
+      MediaRequest mediaReq =  new MediaRequest(user.getId(), false);\r
+      WebdbMultipartRequest mp = new WebdbMultipartRequest(req, (FileHandler)mediaReq);\r
+      EntityList mediaList = mediaReq.getEntityList();\r
+      String articleid = (String) mp.getParameters().get("articleid");\r
+\r
+      if (articleid!=null) {\r
+        EntityContent entContent = (EntityContent) DatabaseContent.getInstance().selectById(articleid);\r
+\r
+        mediaList.rewind();\r
+\r
+        while (mediaList.hasNext()) {\r
+          entContent.attach( ( (EntityUploadedMedia) mediaList.next()).getId());\r
+        }\r
+        mediaList.rewind();\r
+\r
+        ((ServletModuleContent) ServletModuleContent.getInstance())._showObject(articleid, req, res);\r
+\r
+        return;\r
+      }\r
+\r
+      SimpleHash mergeData = new SimpleHash();\r
+      SimpleHash popups = new SimpleHash();\r
+      mergeData.put("contentlist", mediaList);\r
+      if (mediaList.getOrder() != null) {\r
+        mergeData.put("order", mediaList.getOrder());\r
+        mergeData.put("order_encoded", URLEncoder.encode(mediaList.getOrder()));\r
+      }\r
+      mergeData.put("count", (new Integer(mediaList.getCount())).toString());\r
+      mergeData.put("from", (new Integer(mediaList.getFrom())).toString());\r
+      mergeData.put("to", (new Integer(mediaList.getTo())).toString());\r
+      if (mediaList.hasNextBatch())\r
+        mergeData.put("next", (new Integer(mediaList.getNextBatch())).toString());\r
+      if (mediaList.hasPrevBatch())\r
+        mergeData.put("prev", (new Integer(mediaList.getPrevBatch())).toString());\r
+      //fetch the popups\r
+      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());\r
+      // raus damit\r
+      deliver(req, res, mergeData, popups, templateListString);\r
+    }\r
+    catch (FileHandlerUserException e) {\r
+      logger.error("ServletModuleUploadedMedia.insert: " + e.getMessage());\r
+      throw new ServletModuleUserException(e.getMessage());\r
+    }\r
+    catch (FileHandlerException e) {\r
+      throw new ServletModuleException(\r
+              "upload -- media handling exception " + e.toString());\r
+    }\r
+    catch (StorageObjectFailure e) {\r
+      throw new ServletModuleException("upload -- storageobjectexception "\r
+                                      + e.toString());\r
+    }\r
+    catch (IOException e) {\r
+      throw new ServletModuleException("upload -- ioexception " + e.toString());\r
+    }\r
+    catch (PropertiesConfigExc e) {\r
+      throw new ServletModuleException("upload -- configexception " + e.toString());\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ServletModuleException("upload -- exception " + t.toString());\r
+    }\r
+  }\r
+\r
+  public void update(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {\r
+\r
+    try {\r
+      EntityUsers user = _getUser(req);\r
+      WebdbMultipartRequest mp = new WebdbMultipartRequest(req, null);\r
+      Map parameters = mp.getParameters();\r
+\r
+      parameters.put("to_publisher", user.getId());\r
+      parameters.put("is_produced", "0");\r
+      if (!parameters.containsKey("is_published"))\r
+        parameters.put("is_published", "0");\r
+\r
+      String id = mainModule.set(parameters);\r
+      logger.debug("update: media ID = " + id);\r
+      _edit(id, req, res);\r
+    }\r
+    catch (IOException e) {\r
+      throw new ServletModuleException("upload -- ioexception " + e.toString());\r
+    }\r
+    catch (ModuleException e) {\r
+      throw new ServletModuleException("upload -- moduleexception " + e.toString());\r
+    }\r
+    catch (Exception e) {\r
+      throw new ServletModuleException("upload -- exception " + e.toString());\r
+    }\r
+\r
+  }\r
+\r
+\r
+  public void list(HttpServletRequest req, HttpServletResponse res)\r
+          throws ServletModuleException {\r
+    // Parameter auswerten\r
+    SimpleHash mergeData = new SimpleHash();\r
+    SimpleHash popups = new SimpleHash();\r
+\r
+    String query_text = req.getParameter("query_text");\r
+    mergeData.put("query_text", query_text);\r
+    if (query_text != null) mergeData.put("query_text_encoded", URLEncoder.encode(query_text));\r
+    String query_field = req.getParameter("query_field");\r
+    mergeData.put("query_field", query_field);\r
+    String query_is_published = req.getParameter("query_is_published");\r
+    mergeData.put("query_is_published", query_is_published);\r
+    String query_media_folder = req.getParameter("query_media_folder");\r
+    mergeData.put("query_media_folder", query_media_folder);\r
+    String offset = req.getParameter("offset");\r
+    if (offset == null || offset.equals("")) offset = "0";\r
+    mergeData.put("offset", offset);\r
+\r
+    String order = req.getParameter("order");\r
+    if (order == null || order.equals("")) order = "webdb_lastchange desc";\r
+\r
+    // if in connection mode to content\r
+    String cid = req.getParameter("cid");\r
+    mergeData.put("cid", cid);\r
+\r
+\r
+    // sql basteln\r
+    String whereClause = "";\r
+    boolean isFirst = true;\r
+    if (query_text != null && !query_text.equalsIgnoreCase("")) {\r
+      whereClause += "lower(" + query_field + ") like lower('%" + query_text + "%')";\r
+      isFirst = false;\r
+    }\r
+    if (query_is_published != null && !query_is_published.equals("")) {\r
+      if (isFirst == false) whereClause += " and ";\r
+      whereClause += "is_published='" + query_is_published + "'";\r
+      isFirst = false;\r
+    }\r
+    if (query_media_folder != null && !query_media_folder.equals("")) {\r
+      if (isFirst == false) whereClause += " and ";\r
+      whereClause += "to_media_folder='" + query_media_folder + "'";\r
+    }\r
+    //theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);\r
+\r
+    // fetch and deliver\r
+    try {\r
+      if (query_text != null || query_is_published != null || query_media_folder != null) {\r
+        EntityList theList = mainModule.getByWhereClause(whereClause, order, (new Integer(offset)).intValue(), 10);\r
+        if (theList != null) {\r
+          mergeData.put("contentlist", theList);\r
+          if (theList.getOrder() != null) {\r
+            mergeData.put("order", theList.getOrder());\r
+            mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));\r
+          }\r
+          mergeData.put("count", (new Integer(theList.getCount())).toString());\r
+          mergeData.put("from", (new Integer(theList.getFrom())).toString());\r
+          mergeData.put("to", (new Integer(theList.getTo())).toString());\r
+          if (theList.hasNextBatch())\r
+            mergeData.put("next", (new Integer(theList.getNextBatch())).toString());\r
+          if (theList.hasPrevBatch())\r
+            mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());\r
+        }\r
+      }\r
+      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());\r
+\r
+      deliver(req, res, mergeData, popups, templateListString);\r
+    }\r
+    catch (ModuleException e) {\r
+      throw new ServletModuleException(e.toString());\r
+    }\r
+    catch (Exception e) {\r
+      throw new ServletModuleException(e.toString());\r
+    }\r
+  }\r
+\r
+\r
+  public void add(HttpServletRequest req, HttpServletResponse res)\r
+          throws ServletModuleException {\r
+    try {\r
+      SimpleHash mergeData = new SimpleHash();\r
+      SimpleHash popups = new SimpleHash();\r
+      String maxMedia = MirPropertiesConfiguration.instance().getString("ServletModule.OpenIndy.MaxMediaUploadItems");\r
+      String numOfMedia = req.getParameter("medianum");\r
+\r
+      mergeData.put("new", "1");\r
+      mergeData.put("articleid", req.getParameter("articleid"));\r
+\r
+      popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());\r
+\r
+      if (numOfMedia==null || numOfMedia.equals("")) {\r
+        numOfMedia="1";\r
+      }\r
+      else if(Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) {\r
+        numOfMedia = maxMedia;\r
+      }\r
+\r
+      int mediaNum = Integer.parseInt(numOfMedia);\r
+      SimpleList mediaFields = new SimpleList();\r
+      for(int i =0; i<mediaNum;i++){\r
+        Integer mNum = new Integer(i+1);\r
+        mediaFields.add(mNum.toString());\r
+      }\r
+      mergeData.put("medianum",numOfMedia);\r
+      mergeData.put("mediafields",mediaFields);\r
+      deliver(req, res, mergeData, popups, templateObjektString);\r
+    } catch (Exception e) {\r
+      throw new ServletModuleException(e.toString());\r
+    }\r
+  }\r
+\r
+  public void edit(HttpServletRequest req, HttpServletResponse res)\r
+          throws ServletModuleException {\r
+    String idParam = req.getParameter("id");\r
+    _edit(idParam, req, res);\r
+  }\r
+\r
+  private void _edit(String idParam, HttpServletRequest req, HttpServletResponse res)\r
+          throws ServletModuleException {\r
+    if (idParam != null && !idParam.equals("")) {\r
+      try {\r
+        SimpleHash popups = new SimpleHash();\r
+        popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());\r
+        deliver(req, res, mainModule.getById(idParam), popups,\r
+                templateObjektString);\r
+      }\r
+      catch (ModuleException e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+      catch (StorageObjectFailure e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+    }\r
+    else {\r
+      throw new ServletModuleException("ServletmoduleUploadedMedia :: _edit without id");\r
+    }\r
+  }\r
+\r
+\r
+  /** @todo should be in ServletModule.java */\r
+  private EntityUsers _getUser(HttpServletRequest req) {\r
+    HttpSession session = req.getSession(false);\r
+    return (EntityUsers) session.getAttribute("login.uid");\r
+  }\r
+\r
+  public void getMedia(HttpServletRequest req, HttpServletResponse res)\r
+    throws ServletModuleException\r
+  {\r
+    String idParam = req.getParameter("id");\r
+    if (idParam!=null && !idParam.equals("")) {\r
+      try {\r
+        EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);\r
+        Entity mediaType = ent.getMediaType();\r
+        MirMedia mediaHandler;\r
+\r
+        ServletContext ctx = MirPropertiesConfiguration.getContext();\r
+        String fName = ent.getId()+"."+mediaType.getValue("name");\r
+\r
+        mediaHandler = MediaHelper.getHandler(mediaType);\r
+        InputStream in = mediaHandler.getMedia(ent, mediaType);\r
+\r
+        res.setContentType(ctx.getMimeType(fName));\r
+        //important that before calling this res.getWriter was not called first\r
+        ServletOutputStream out = res.getOutputStream();\r
+\r
+        int read ;\r
+        byte[] buf = new byte[8 * 1024];\r
+        while((read = in.read(buf)) != -1) {\r
+          out.write(buf, 0, read);\r
+        }\r
+        in.close();\r
+        out.close();\r
+      }\r
+\r
+      catch (IOException e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+      catch (ModuleException e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+      catch (Exception e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+    }\r
+    else logger.error("id not specified.");\r
+    // no exception allowed\r
+  }\r
+\r
+  public void getIcon(HttpServletRequest req, HttpServletResponse res)\r
+    throws ServletModuleException\r
+  {\r
+    String idParam = req.getParameter("id");\r
+    if (idParam!=null && !idParam.equals("")) {\r
+      try {\r
+        EntityUploadedMedia ent = (EntityUploadedMedia)mainModule.getById(idParam);\r
+        Entity mediaType = ent.getMediaType();\r
+        MirMedia mediaHandler;\r
+\r
+        ServletContext ctx = MirPropertiesConfiguration.getContext();\r
+        String fName = ent.getId()+"."+mediaType.getValue("name");\r
+\r
+        mediaHandler = MediaHelper.getHandler(mediaType);\r
+        InputStream in = mediaHandler.getIcon(ent);\r
+\r
+        res.setContentType(ctx.getMimeType(fName));\r
+        //important that before calling this res.getWriter was not called first\r
+        ServletOutputStream out = res.getOutputStream();\r
+\r
+        int read ;\r
+        byte[] buf = new byte[8 * 1024];\r
+        while((read = in.read(buf)) != -1) {\r
+          out.write(buf, 0, read);\r
+        }\r
+        in.close();\r
+        out.close();\r
+      }\r
+\r
+      catch (IOException e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+      catch (ModuleException e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+      catch (Exception e) {\r
+        throw new ServletModuleException(e.toString());\r
+      }\r
+    }\r
+    else logger.error("getIcon: id not specified.");\r
+    // no exception allowed\r
+  }\r
+\r
+}\r
+\r
+\r
index 2b39c57..15b455f 100755 (executable)
@@ -31,7 +31,7 @@
 
 package mircoders.servlet;
 
-import java.util.HashMap;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -104,7 +104,7 @@ public class ServletModuleUsers extends mir.servlet.ServletModule
       throws ServletModuleException
   {
     try {
-      HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
+      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());
       String id = mainModule.add(withValues);
       deliver(req, res, mainModule.getById(id), templateObjektString);
     }
index 306b248..cf4a810 100755 (executable)
@@ -36,7 +36,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;\r
 import java.sql.SQLException;\r
 import java.util.List;\r
-import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 import mir.log.LoggerWrapper;\r
 import mir.entity.Entity;\r
@@ -90,7 +90,7 @@ public class DatabaseLinksImcs extends Database implements StorageObject {
     //cache\r
     invalidatePopupCache();\r
     try {\r
-      HashMap theEntityValues = theEntity.getValues();\r
+      Map theEntityValues = theEntity.getValues();\r
       List streamedInput = theEntity.streamedInput();\r
       StringBuffer f = new StringBuffer();\r
       StringBuffer v = new StringBuffer();\r
@@ -177,7 +177,7 @@ public class DatabaseLinksImcs extends Database implements StorageObject {
     Connection con = null;\r
     PreparedStatement pstmt = null;\r
     List streamedInput = theEntity.streamedInput();\r
-    HashMap theEntityValues = theEntity.getValues();\r
+    Map theEntityValues = theEntity.getValues();\r
     String id = theEntity.getId();\r
     String aField;\r
     StringBuffer fv = new StringBuffer();\r
index 6f62f6d..d8198ef 100755 (executable)
@@ -15,6 +15,9 @@ function openWin(url) {
 
 <if data.new>
 <form action="${config.actionRoot}?module=Audio&do=add" method="post">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <table border="0">
        <tr>
        <td align="right" class="darkgrey">
@@ -30,6 +33,9 @@ function openWin(url) {
 </form>
 </if>
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Audio&do=<if data.new>insert<else>update</if>&id=${data.id}">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">
index 78c9494..7921f69 100755 (executable)
                 ${lang("content.images")}:
             </td>
             <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Images&do=list&cid=${article.id}">${lang("content.addimage")}</a>
+                <a href="${config.actionRoot}?module=Images&do=list&cid=${article.id}">${lang("content.addimage")}</a> |
+                <a href="${config.actionRoot}?module=Images&do=add&articleid=${article.id}">${lang("content.uploadimage")}</a>
             </td>
           </tr>
 
               ${lang("content.audio")}:
             </td>
             <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Audio&do=list&cid=${article.id}">${lang("content.addaudio")}</a>
+                <a href="${config.actionRoot}?module=Audio&do=list&cid=${article.id}">${lang("content.addaudio")}</a> |
+                <a href="${config.actionRoot}?module=Audio&do=add&articleid=${article.id}">${lang("content.uploadaudio")}</a>
             </td>
           </tr>
 
                 ${lang("content.video")}:
             </td>
             <td colspan="4" align="left" valign="top">
-                <a href="${config.actionRoot}?module=Video&do=list&cid=${article.id}">${lang("content.addvideo")}</a>
+                <a href="${config.actionRoot}?module=Video&do=list&cid=${article.id}">${lang("content.addvideo")}</a> |
+                <a href="${config.actionRoot}?module=Video&do=add&articleid=${article.id}">${lang("content.uploadvideo")}</a>
             </td>
           </tr>
           <list article.to_media_other as m>
                 ${lang("content.other")}:
             </td>
             <td colspan="4" align="left" valign="top">
-              <a href="${config.actionRoot}?module=OtherMedia&do=list&cid=${article.id}">${lang("content.addother")}</a>
+              <a href="${config.actionRoot}?module=OtherMedia&do=list&cid=${article.id}">${lang("content.addother")}</a> |
+              <a href="${config.actionRoot}?module=OtherMedia&do=add&articleid=${article.id}">${lang("content.uploadother")}</a>
             </td>
           </tr>
           
index 1e1baf6..efc0d0a 100755 (executable)
 <html>
-<head>
-        <title>${config["Mir.Name"]} | ${lang("image.htmltitle")}</title>
-        <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-<head>
-<SCRIPT LANGUAGE="JavaScript">
-function openWin(url) {
-   window.open(url,"vc","scrollbars=0,height=${data.img_height},width=${data.img_width}");
-}
-</SCRIPT>
-
-<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
-
-<include "templates/admin/head.template">
-
-
-<if data.new>
-<form action="${config.actionRoot}?module=Images&do=add" method="post">
-       <table border="0">
-       <tr>
-       <td align="right" class="darkgrey">
-       <span class="witesmall">
-       <b>${lang("media.nr_of_media")}</b> <br>
-       </span>
-       </td>
-       <td>
-       <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
-       </td>
-       </tr>
-       </table>
-</form>
-</if>
-<form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Images&do=<if data.new>insert<else>update</if>&id=${data.id}">
-       <table border="0">
-
-       <input type="hidden" name="where" value="${data.where}">
-       <input type="hidden" name="offset" value="${data.offset}">
-       <input type="hidden" name="order" value="${data.order}">
-       <input type="hidden" name="id" value="${data.id}">
-
-       <if !data.new>
-       <tr>
-    <td align="right" class="darkgrey">
-               <if (data.icon_data!="" && data.icon_data!="0") && !new>
-               <span class="witesmall">
-               <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${data.id}')">
-               <img src="${config.actionRoot}?module=Images&do=getIcon&id=${data.id}" border=0></a></span></td>
-               </if>
-    <td valign="bottom"><span class="spezialtext">
-               ${lang("media.created")}: ${data.webdb_create} <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
-               <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
-               ${lang("media.format")}: ${data.media_descr} / ${data.img_width}x${data.img_height} / ${data.imgformatHashdata[to_img_format]["name"]} / ${data.imglayoutHashdata[to_img_layout]["name"]} /  ${data.imgcolorHashdata[to_img_color]["name"]}<br>
-               ${lang("media.size")}: ${data.human_readable_size}<br>
-               ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
-               ${lang("media.type")}: <b>${data.imgtypeHashdata[to_img_type]["name"]}</b><br>
-      </span>
-       </td>
-       </tr>
-       </if>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-         <B>${lang("media.mediafolder")}:</B></span></td>
-    <td>
-               <select name="to_media_folder">
-               <list extra.mediafolderPopupData as m>
-               <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
-               </list>
-           </select>
-       </td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.description")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
-       </tr>
-
-       <tr>
-   <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.date")}:</B></span></td>
-    <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
-               <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.location")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.creator")}:</B></span></td>
-    <td>
-               <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.keywords")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.comment")}:</B></span></td>
-    <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
-       </tr>
-
-       <tr>
-    <td align="right" class="darkgrey"><span class="witesmall">
-        <B>${lang("media.source")}:</B></span></td>
-    <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
-       </tr>
-       <if data.new>
-       <tr>
-       <td>
-               ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-       </td>
-       </tr>
-       <list data.mediafields as m>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
-
-                       <B>${lang("media.title")}:<B>
-               </font> </td>
-               <td>
-                       <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
-               </td>
-               </tr>
-               <tr>
-               <td align="right" class="darkgrey"></td>
-               <td>
-                               <INPUT TYPE="file" NAME="mpfile${m}"><br>
-               </td>
-               </tr>
-       </list>
-       <else>
-               <tr>
-               <td align="right" class="darkgrey"><span class="witesmall">
-                       <B>${lang("media.title")}:<B>
-               </td>
-               <td>
-                       <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
-               </td>
-               </tr>
-       </if>
-
-       <tr>
-    <td colspan="2" align="right"> <span class="text">
-       <if data.new>
-      <input type="submit" name="save" value="${lang("insert")}">
-    <else>
-       ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
-    <input type="submit" name="save" value="${lang("save")}">
-    </if> </span></form></font>
-    </td>
-</table>
-<include "templates/admin/foot.template">
-</body>
+  <head>
+    <title>${config["Mir.Name"]} | ${lang("image.htmltitle")}</title>
+    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+  <head>
+
+  <SCRIPT LANGUAGE="JavaScript">
+    function openWin(url) {
+       window.open(url,"vc","scrollbars=0,height=${data.img_height},width=${data.img_width}");
+    }
+  </SCRIPT>
+
+  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+  
+    <include "templates/admin/head.template">
+
+    <if data.new>
+      <form action="${config.actionRoot}?module=Images&do=add" method="post">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
+        <table border="0">
+          <tr>
+            <td align="right" class="darkgrey">
+              <span class="witesmall">
+                <b>${lang("media.nr_of_media")}</b> <br>
+              </span>
+            </td>
+            <td>
+              <input type="text" size="3" name="medianum" value="${medianum}">&nbsp;<input type="submit" value="${lang("media.nr_of_media.submit")}">
+            </td>
+          </tr>
+        </table>
+      </form>
+    </if>
+    <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Images&do=<if data.new>insert<else>update</if>&id=${data.id}">
+      <input type="hidden" name="where" value="${data.where}">
+      <input type="hidden" name="offset" value="${data.offset}">
+      <input type="hidden" name="order" value="${data.order}">
+      <input type="hidden" name="id" value="${data.id}">
+      
+      <if data.articleid>
+        <input type="hidden" name="articleid" value="${data.articleid}">
+      </if>
+
+      <table border="0">
+        <if !data.new>
+        <tr>
+          <td align="right" class="darkgrey">
+          <if (data.icon_data!="" && data.icon_data!="0") && !new>
+          <span class="witesmall">
+            <a href="JavaScript:openWin('${config.actionRoot}?module=Images&do=getMedia&id=${data.id}')">
+            <img src="${config.actionRoot}?module=Images&do=getIcon&id=${data.id}" border=0></a></span></td>
+          </if>
+          <td valign="bottom"><span class="spezialtext">
+            ${lang("media.created")}: ${data.webdb_create} <if data.webdb_lastchange>/ ${lang("media.changed")} ${data.webdb_lastchange}</if><br>
+            <if data.is_published=="1">${lang("media.published")}: ${data.publish_date} / ${data.publish_server}${data.publish_path}<br></if>
+            ${lang("media.format")}: ${data.media_descr} / ${data.img_width}x${data.img_height} / ${data.imgformatHashdata[to_img_format]["name"]} / ${data.imglayoutHashdata[to_img_layout]["name"]} /  ${data.imgcolorHashdata[to_img_color]["name"]}<br>
+            ${lang("media.size")}: ${data.human_readable_size}<br>
+            ${lang("media.rights")}: <b>${data.rightsHashdata[to_rights]["name"]}</b><br>
+            ${lang("media.type")}: <b>${data.imgtypeHashdata[to_img_type]["name"]}</b><br>
+            </span>
+        </td>
+          </tr>
+        </if>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+          <B>${lang("media.mediafolder")}:</B></span></td>
+          <td>
+          <select name="to_media_folder">
+          <list extra.mediafolderPopupData as m>
+          <option value="${m.key}" <if m.key == data.to_media_folder>selected</if>>${m.value}</option>
+            </list>
+            </select>
+          </td>
+        </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.description")}:</B></span></td>
+          <td><input type="text" size="40" maxlength="255" name="description" value="${data.description}"></td>
+          </tr>
+      
+        <tr>
+         <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.date")}:</B></span></td>
+          <td><input type="text" size="8" maxlength="8" name="date" value="${data.date}">
+          <input type="text" size="20" maxlength="40" name="year" value="${data.year}"></td>
+          </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.location")}:</B></span></td>
+          <td><input type="text" size="40" maxlength="80" name="place" value="${data.place}"></td>
+          </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.creator")}:</B></span></td>
+          <td>
+          <input type="text" size="40" maxlength="80" name="creator" value="${data.creator}">
+          </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.keywords")}:</B></span></td>
+          <td><textarea cols="40" rows="2" name="keywords">${data.keywords}</textarea></td>
+          </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.comment")}:</B></span></td>
+          <td><textarea cols="40" rows="2" name="comment">${data.comment}</textarea></td>
+          </tr>
+      
+        <tr>
+          <td align="right" class="darkgrey"><span class="witesmall">
+         <B>${lang("media.source")}:</B></span></td>
+          <td><input type="text" size="40" maxlength="80" name="source" value="${data.source}"></td>
+          </tr>
+        <if data.new>
+          <tr>
+            <td>
+              ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
+            </td>
+          </tr>
+          <list data.mediafields as m>
+            <tr>
+              <td align="right" class="darkgrey">
+                <span class="witesmall">
+                  <b>${lang("media.title")}:<b>
+                </span>
+              </td>
+              <td>
+                <input type="text" name="media_title${m}" size="40" maxlength="80" value="">
+              </td>
+            </tr>
+            <tr>
+              <td align="right" class="darkgrey"></td>
+              <td>
+                <input type="file" name="mpfile${m}"><br>
+              </td>
+            </tr>
+          </list>
+        <else>
+          <tr>
+            <td align="right" class="darkgrey"><span class="witesmall">
+              <b>${lang("media.title")}:<b>
+            </td>
+            <td>
+              <input type="text" name="title" size="40" maxlength="80" value="${data.title}">
+            </td>
+          </tr>
+        </if>
+        <tr>
+          <td colspan="2" align="right">
+            <span class="text">
+              <if data.new>
+                <input type="submit" name="save" value="${lang("insert")}">
+              <else>
+                ${lang("media.is_published")} <input type="checkbox" name="is_published" value="1"<if data.is_published!="0" && data.is_published!=""> checked</if>>
+                <input type="submit" name="save" value="${lang("save")}">
+              </if> 
+            </span>
+          </td>
+        </tr>
+      </form>
+    </table>
+
+    <include "templates/admin/foot.template">
+  </body>
 </html>
index 987998d..d6ecab9 100755 (executable)
@@ -15,6 +15,9 @@ function openWin(url) {
 
 <if data.new>
 <form action="${config.actionRoot}?module=OtherMedia&do=add" method="post">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <table border="0">
        <tr>
        <td align="right" class="darkgrey">
@@ -30,6 +33,9 @@ function openWin(url) {
 </form>
 </if>
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=OtherMedia&do=<if data.new>insert<else>update</if>&id=${data.id}">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">
index f89994a..45f12d5 100755 (executable)
@@ -15,6 +15,9 @@ function openWin(url) {
 
 <if data.new>
 <form action="${config.actionRoot}?module=Video&do=add" method="post">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <table border="0">
        <tr>
        <td align="right" class="darkgrey">
@@ -30,6 +33,9 @@ function openWin(url) {
 </form>
 </if>
 <form enctype="multipart/form-data" method="post" action="${config.actionRoot}?module=Video&do=<if data.new>insert<else>update</if>&id=${data.id}">
+        <if data.articleid>
+          <input type="hidden" name="articleid" value="${data.articleid}">
+        </if>
        <input type="hidden" name="where" value="${data.where}">
        <input type="hidden" name="offset" value="${data.offset}">
        <input type="hidden" name="order" value="${data.order}">