multiple file-editable directories
authorzapata <zapata>
Mon, 28 Apr 2003 00:44:05 +0000 (00:44 +0000)
committerzapata <zapata>
Mon, 28 Apr 2003 00:44:05 +0000 (00:44 +0000)
deletions can be turned off
small bugfixes

24 files changed:
bundles/admin_de.properties
bundles/admin_en.properties
bundles/admin_es.properties
bundles/admin_eu.properties
bundles/admin_fr.properties
bundles/admin_nl.properties
bundles/admin_tr.properties
source/Mir.java
source/default.properties
source/mir/storage/Database.java
source/mir/util/FileFunctions.java
source/mircoders/servlet/ServletModuleComment.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleFileEdit.java
templates/admin/breakinglist.template
templates/admin/commentlist.template
templates/admin/confirm.template
templates/admin/contentlist.template
templates/admin/fileedit.template
templates/admin/fileeditlist.template
templates/admin/hiddenlist.template
templates/admin/imagelist.template
templates/admin/mediafolderlist.template
templates/admin/start_admin.template

index fda0df0..b92a927 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: deutsch / german
-# $Id: admin_de.properties,v 1.28 2003/04/26 23:20:24 zapata Exp $
+# $Id: admin_de.properties,v 1.29 2003/04/28 00:44:05 zapata Exp $
 
 languagename=Deutsch
 
@@ -322,7 +322,7 @@ start.breaking.title=breaking news
 start.content.title=ARTIKEL
 start.administer.title=AUFR&Auml;UMEN
 start.list.title=LIST
-start.fileedit.title=Includes editieren
+start.fileedit.includes.title=Includes editieren
 start.addandedit.title=NEU / &Auml;NDERN
 start.extra.title=EXTRA
 start.search.title=SUCHEN
index caa631c..ad25f77 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.45 2003/04/26 23:20:24 zapata Exp $
+# $Id: admin_en.properties,v 1.46 2003/04/28 00:44:05 zapata Exp $
 
 languagename=English
 
@@ -308,7 +308,7 @@ start.breaking.title=breaking news
 start.content.title=ARTICLES
 start.administer.title=ADMINISTER
 start.list.title=LIST
-start.fileedit.title=edit include files
+start.fileedit.includes.title=edit include files
 start.addandedit.title=ADD / EDIT
 start.extra.title=EXTRA
 start.search.title=SEARCH
index e383232..569eab0 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: spanish
-# $Id: admin_es.properties,v 1.26 2003/04/26 23:20:24 zapata Exp $
+# $Id: admin_es.properties,v 1.27 2003/04/28 00:44:05 zapata Exp $
 
 languagename = Castellano
 
@@ -326,7 +326,7 @@ start.breaking.title = \u00faltimas noticias
 start.content.title = ART\u00cdCULOS
 start.administer.title = ADMINISTRAR
 start.list.title = LISTA
-start.fileedit.title = editar ficheros
+start.fileedit.includes.title = editar ficheros
 start.addandedit.title = A\u00d1ADIR / EDITAR
 start.extra.title = EXTRA
 start.search.title = BUSCAR
index b8011bd..0c31674 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: euskera / basque
-# $Id: admin_eu.properties,v 1.10 2003/04/26 23:20:24 zapata Exp $
+# $Id: admin_eu.properties,v 1.11 2003/04/28 00:44:05 zapata Exp $
 
 languagename = Euskera
 
@@ -392,7 +392,7 @@ start.administer.title =
 # missing (master value = "LIST")
 start.list.title = 
 # missing (master value = "edit include files")
-start.fileedit.title = 
+start.fileedit.includes.title = 
 # missing (master value = "ADD / EDIT")
 start.addandedit.title = 
 # missing (master value = "EXTRA")
index 1e24d62..fd8d54f 100755 (executable)
@@ -320,7 +320,7 @@ start.breaking.title = DERNI\u00c8RES NOUVELLES
 start.content.title = ARTICLES
 start.administer.title = ADMINISTRER
 start.list.title = LISTES
-start.fileedit.title = \u00c9diter les fichiers include (.inc)
+start.fileedit.includes.title = \u00c9diter les fichiers include (.inc)
 start.addandedit.title = AJOUTER / EDITER
 start.extra.title = EXTRA
 start.search.title = CHERCHER
index 924b220..d4ec235 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: dutch
-# $Id: admin_nl.properties,v 1.6 2003/04/26 23:20:24 zapata Exp $
+# $Id: admin_nl.properties,v 1.7 2003/04/28 00:44:05 zapata Exp $
 
 languagename = Nederlands
 
@@ -324,7 +324,7 @@ start.breaking.title = Breaking news
 start.content.title = Artikelen
 start.administer.title = OPRUIMEN
 start.list.title = LIJST
-start.fileedit.title = Include bestanden bewerken
+start.fileedit.includes.title = Include bestanden bewerken
 start.addandedit.title = VOEG TOE / BEWERK
 start.extra.title = EXTRA
 start.search.title = ZOEKEN
index a2ca84a..57b228b 100755 (executable)
@@ -1,5 +1,5 @@
 ########## admin ##########
-# $Id: admin_tr.properties,v 1.10 2003/04/09 02:06:06 zapata Exp $
+# $Id: admin_tr.properties,v 1.11 2003/04/28 00:44:05 zapata Exp $
 
 languagename = T\u00fcrk\u00e7e
 
@@ -409,7 +409,7 @@ start.administer.title =
 # missing (master value = "LIST")
 start.list.title = 
 # missing (master value = "edit include files")
-start.fileedit.title = 
+start.fileedit.includes.title = 
 # missing (master value = "ADD / EDIT")
 start.addandedit.title = 
 # missing (master value = "EXTRA")
index 4f90445..01af8f3 100755 (executable)
  * 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  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.  
+ * the code of this program with  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.
  */
 
@@ -63,7 +63,7 @@ import mircoders.entity.EntityUsers;
 import mircoders.global.MirGlobal;
 import mircoders.module.ModuleMessage;
 import mircoders.module.ModuleUsers;
-import mircoders.servlet.ServletHelper;
+import mircoders.servlet.*;
 import mircoders.storage.DatabaseUsers;
 
 import org.apache.struts.util.MessageResources;
@@ -79,8 +79,8 @@ import freemarker.template.TemplateModel;
 /**
  * Mir.java - main servlet, that dispatches to servletmodules
  *
- * @author $Author: idfx $
- * @version $Id: Mir.java,v 1.45 2003/04/21 12:42:46 idfx Exp $
+ * @author $Author: zapata $
+ * @version $Id: Mir.java,v 1.46 2003/04/28 00:44:05 zapata Exp $
  *
  */
 public class Mir extends AbstractServlet {
@@ -462,6 +462,9 @@ public class Mir extends AbstractServlet {
              new CachingRewindableIterator(
                new EntityIteratorAdapter( "", "webdb_create desc", 10,
                  MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0)));
+
+      mergeData.put("fileeditentries", ((ServletModuleFileEdit) ServletModuleFileEdit.getInstance()).getEntries());
+
       mergeData.put("searchvalue", null);
       mergeData.put("searchfield", null);
       mergeData.put("searchispublished", null);
index e4d232c..c488215 100755 (executable)
@@ -103,6 +103,10 @@ Mir.Localizer.Admin.TopicListColumns=3
 # In which order should the topic appear?
 Mir.Localizer.Admin.TopicListOrder=title
 
+# enable deletion of comments/articles?
+Mir.Localizer.Admin.AllowDeleteComment=1
+Mir.Localizer.Admin.AllowDeleteArticle=1
+
 # Which producers need to be called after an article (resp. a comment) is posted
 Mir.Localizer.OpenPosting.ContentProducers= media.new;articles.changed;startpage.generate;synchronization.run
 Mir.Localizer.OpenPosting.CommentProducers= articles.changed;synchronization.run
@@ -143,12 +147,13 @@ Producer.ProductionHost=http://indy.code-fu.de
 # the generated HTML pages will be stored
 Producer.StorageRoot=/pub/Dokumente/Indymedia/de-tech/Mir/produced
 
-# for FileEdit module
-#
-# where do we find the files? absolute path
-ServletModule.FileEdit.FileDirectory=/pub/Dokumente/Indymedia/de-tech/Mir/produced
-ServletModule.FileEdit.ExtFilter=.*\.inc$
-ServletModule.FileEdit.Recursive=0
+# FileEdit module
+#   a list of directories to edit
+#   format: 
+#      <name>:<path>:<file filter>:<0|1 (recursion off or on)> [, ....]
+
+ServletModule.FileEdit.Configuration= \
+  includes:/pub/Dokumente/Indymedia/de-tech/Mir/produced:.*\\.inc:1
 
 #
 #
index 594ba23..0a09ffb 100755 (executable)
  * 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  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.  
+ * the code of this program with  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 mir.storage;
@@ -76,7 +76,7 @@ import freemarker.template.SimpleList;
  * Treiber, Host, User und Passwort, ueber den der Zugriff auf die
  * Datenbank erfolgt.
  *
- * @version $Id: Database.java,v 1.39 2003/04/21 12:42:47 idfx Exp $
+ * @version $Id: Database.java,v 1.40 2003/04/28 00:44:06 zapata Exp $
  * @author rk
  *
  */
@@ -1280,7 +1280,7 @@ public class Database implements StorageObject {
       logger.debug((System.currentTimeMillis() - startTime) + "ms. for: " + sql);
     }
     catch (SQLException e) {
-      logger.debug("Failed: " + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);
+      logger.error("Failed: " + (System.currentTimeMillis() - startTime) + "ms. for: " + sql);
       throw e;
     }
 
index 862145d..4df8058 100755 (executable)
  * 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  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.  
+ * the code of this program with  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 mir.util;
 
-import gnu.regexp.RE;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+
+import gnu.regexp.RE;
 
 public class FileFunctions {
   protected static final int FILE_COPY_BUFFER_SIZE = 65536;
@@ -135,4 +138,13 @@ public class FileFunctions {
 
   }
 
+  public static List getDirectoryContentsAsList(File aDirectory, FilenameFilter aFilter) {
+    Object[] contents = aDirectory.list(aFilter);
+    if (contents==null)
+      return new Vector();
+    else
+      return Arrays.asList(contents);
+  }
+
+
 }
\ No newline at end of file
index 89ad6ae..c9c288f 100755 (executable)
  * 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  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.  
+ * the code of this program with  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.
  */
 
@@ -35,7 +35,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -46,6 +45,7 @@ import mir.log.LoggerWrapper;
 import mir.servlet.ServletModule;
 import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
+import mir.servlet.ServletModuleUserExc;
 import mir.util.CachingRewindableIterator;
 import mir.util.HTTPRequestParser;
 import mir.util.JDBCStringRoutines;
@@ -88,6 +88,13 @@ public class ServletModuleComment extends ServletModule
     }
   }
 
+  public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
+    if (!configuration.getString("Mir.Localizer.Admin.AllowDeleteArticle", "0").equals("1"))
+      throw new ServletModuleExc("Operation not permitted");
+
+    super.delete(req, res);
+  }
+
   public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
   {
     String idParam = req.getParameter("id");
index cfc02e7..01e6abe 100755 (executable)
  * 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  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.  
+ * the code of this program with  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.
  */
 
@@ -71,7 +71,7 @@ import freemarker.template.SimpleHash;
  *  ServletModuleContent -
  *  deliver html for the article admin form.
  *
- * @version $Id: ServletModuleContent.java,v 1.50 2003/04/21 12:42:51 idfx Exp $
+ * @version $Id: ServletModuleContent.java,v 1.51 2003/04/28 00:44:06 zapata Exp $
  * @author rk, mir-coders
  *
  */
@@ -202,6 +202,9 @@ public class ServletModuleContent extends ServletModule
 
   public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
   {
+    if (!configuration.getString("Mir.Localizer.Admin.AllowDeleteArticle", "0").equals("1"))
+      throw new ServletModuleExc("Operation not permitted");
+
     EntityUsers   user = _getUser(req);
 
     String idParam = req.getParameter("id");
index 2fef2b9..63218ed 100755 (executable)
  * 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  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.  
+ * the code of this program with  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.
  */
 
@@ -36,12 +36,11 @@ import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Vector;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -51,6 +50,7 @@ import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
 import mir.util.FileFunctions;
 import mir.util.HTTPRequestParser;
+import mir.util.StringRoutines;
 import mir.util.URLBuilder;
 
 /*
@@ -58,8 +58,8 @@ import mir.util.URLBuilder;
  *  Allows one to do a basic edit of a file in a directory specified
  *  in the config file.
  *
- * @author $Author: idfx $
- * @version $Revision: 1.10 $ $Date: 2003/04/21 12:42:51 $
+ * @author $Author: zapata $
+ * @version $Revision: 1.11 $ $Date: 2003/04/28 00:44:06 $
  *
  */
 
@@ -68,20 +68,79 @@ public class ServletModuleFileEdit extends ServletModule
   private static ServletModuleFileEdit instance = new ServletModuleFileEdit();
   public static ServletModule getInstance() { return instance; }
 
-  private File rootDirectory;
-  private FilenameFilter filter;
+  private Map directories;
+  private List directoryNames;
+
   private FilenameFilter dirFilter;
-  private boolean recurse;
+
+  private class FileEditDirectory {
+    private String name;
+    private FileFunctions.RegExpFileFilter filter;
+    private File rootDirectory;
+    private boolean recursive;
+
+    public FileEditDirectory(String aName, String aRootDirectory, String aFilter, boolean aRecursive) {
+      name = aName;
+      rootDirectory = new File(aRootDirectory);
+      filter = new FileFunctions.RegExpFileFilter(aFilter);
+      recursive = aRecursive;
+    }
+
+    public String getName() {
+      return name;
+    }
+
+    public FileFunctions.RegExpFileFilter getFilter() {
+      return filter;
+    }
+
+    public File getRootDirectory() {
+      return rootDirectory;
+    }
+
+    public boolean getRecursive() {
+      return recursive;
+    }
+  }
 
   private ServletModuleFileEdit() {
     super();
 
     logger = new LoggerWrapper("ServletModule.FileEdit");
 
-    rootDirectory = new File(configuration.getString("ServletModule.FileEdit.FileDirectory"));
-    recurse = configuration.getString("ServletModule.FileEdit.Recursive", "").equals("1");
+    directories = new HashMap();
+    directoryNames = new Vector();
+
+    String settings[] = configuration.getStringArray("ServletModule.FileEdit.Configuration");
+/*
+ServletModule.FileEdit.FileDirectory=/pub/Dokumente/Indymedia/de-tech/Mir/produced
+ServletModule.FileEdit.ExtFilter=.*\.inc$
+ServletModule.FileEdit.Recursive=0
+*/
+
+    if (settings!=null) {
+      for (int i = 0; i < settings.length; i++) {
+        String setting = settings[i].trim();
+
+        if (setting.length() > 0) {
+          List parts = StringRoutines.splitString(setting, ":");
+          if (parts.size() != 4) {
+            logger.error("config error: " + settings[i] + ", 4 parts expected");
+          }
+          else {
+            String name = (String) parts.get(0);
+            String directory = (String) parts.get(1);
+            String filter = (String) parts.get(2);
+            String recursive = (String) parts.get(3);
+
+            directories.put(name, new FileEditDirectory(name, directory, filter,
+                recursive.equals("1") || recursive.toLowerCase().equals("y")));
+            directoryNames.add(name);
+          }
+        }
+      }
+    }
 
-    filter = new FileFunctions.RegExpFileFilter(configuration.getString("ServletModule.FileEdit.ExtFilter"));
     dirFilter = new FileFunctions.DirectoryFilter();
 
     templateListString =configuration.getString("ServletModule.FileEdit.ListTemplate");
@@ -89,22 +148,35 @@ public class ServletModuleFileEdit extends ServletModule
     templateConfirmString =configuration.getString("ServletModule.FileEdit.ConfirmTemplate");
   }
 
+  public List getEntries() {
+    return directoryNames;
+  }
+
+  public FileEditDirectory getDirectory(HttpServletRequest aRequest) throws ServletModuleExc {
+    FileEditDirectory result = (FileEditDirectory) directories.get(aRequest.getParameter("entry"));
+    if (result == null)
+      throw new ServletModuleExc("Unknown entry: " + aRequest.getParameter("entry"));
+
+    return result;
+  }
+
   public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
   {
-    listSubDirectory("/", aRequest, aResponse);
+    listSubDirectory(getDirectory(aRequest), "/", aRequest, aResponse);
   }
 
   public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
   {
     try {
       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
       String filename = requestParser.getParameter("filename");
       String subDirectory = requestParser.getParameterWithDefault("subdirectory", "");
 
       if (filename == null)
         throw new ServletModuleExc("No filename  specified");
 
-      editFile(filename, subDirectory, aRequest, aResponse);
+      editFile(getDirectory(aRequest), filename, subDirectory, aRequest, aResponse);
     }
     catch (Throwable e) {
       throw new ServletModuleFailure(e);
@@ -115,28 +187,32 @@ public class ServletModuleFileEdit extends ServletModule
   {
     try {
       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
       String directoryName = requestParser.getParameter("directory");
       String subDirectoryName = requestParser.getParameter("subdirectory");
 
       if (directoryName==null | subDirectoryName==null)
         throw new ServletModuleExc("No directory/subDirectory specified");
 
-      listSubDirectory(subDirectoryName+File.separator+directoryName, aRequest, aResponse);
+      listSubDirectory(getDirectory(aRequest), subDirectoryName+File.separator+directoryName, aRequest, aResponse);
     }
     catch (Throwable e) {
       throw new ServletModuleFailure(e);
     }
   }
+
   public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
   {
-    String filename = aRequest.getParameter("filename");
-    String subDirectory = aRequest.getParameter("subdirectory");
-    String text = aRequest.getParameter("text");
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+    String filename = requestParser.getParameter("filename");
+    String subDirectory = requestParser.getParameter("subdirectory");
+    String text = requestParser.getParameter("text");
+    FileEditDirectory directory = getDirectory(aRequest);
 
     try {
-      File f = new File(new File(rootDirectory, subDirectory), filename);
+      File f = new File(new File(directory.getRootDirectory(), subDirectory), filename);
 
-      if (validateDirectory(f)) {
+      if (validateDirectory(directory, f)) {
         StringReader in = new StringReader(text);
         FileWriter out = new FileWriter(f);
 
@@ -146,7 +222,7 @@ public class ServletModuleFileEdit extends ServletModule
         in.close();
         out.close();
 
-        editFile(filename, subDirectory, aRequest, aResponse);
+        editFile(directory, filename, subDirectory, aRequest, aResponse);
       }
     }
     catch (Throwable e) {
@@ -154,25 +230,25 @@ public class ServletModuleFileEdit extends ServletModule
     }
   }
 
-  public void listSubDirectory(String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  public void listSubDirectory(FileEditDirectory aDirectory, String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
   {
     try {
       Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
-      File dir = new File(rootDirectory, aSubDirectory);
+      File dir = new File(aDirectory.getRootDirectory(), aSubDirectory);
 
-      if (!validateDirectory(dir) || !dir.isDirectory()) {
-        dir = rootDirectory;
+      if (!validateDirectory(aDirectory, dir) || !dir.isDirectory()) {
+        dir = aDirectory.getRootDirectory();
         aSubDirectory = "";
       }
 
-      responseData.put("filelist", Arrays.asList(dir.list(filter)));
+      responseData.put("filelist", FileFunctions.getDirectoryContentsAsList(dir, aDirectory.getFilter()));
 
-      if (recurse) {
+      if (aDirectory.getRecursive()) {
         List dirs = new Vector();
-        if (!dir.getCanonicalPath().equals(rootDirectory.getCanonicalPath()))
+        if (!dir.getCanonicalPath().equals(aDirectory.getRootDirectory().getCanonicalPath()))
           responseData.put("updir", new File(aSubDirectory).getParent());
 
-        dirs.addAll(Arrays.asList(dir.list(dirFilter)));
+        dirs.addAll(FileFunctions.getDirectoryContentsAsList(dir, dirFilter));
 
         responseData.put("dirlist", dirs);
       }
@@ -182,6 +258,7 @@ public class ServletModuleFileEdit extends ServletModule
       }
 
       responseData.put("subdirectory", aSubDirectory);
+      responseData.put("entry", aDirectory.getName());
 
       ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateListString);
     }
@@ -190,13 +267,13 @@ public class ServletModuleFileEdit extends ServletModule
     }
   }
 
-  public void editFile(String aFileName, String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+  public void editFile(FileEditDirectory aDirectory, String aFileName, String aSubDirectory, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
   {
     try {
-      File f = new File(new File(rootDirectory, aSubDirectory), aFileName);
+      File f = new File(new File(aDirectory.getRootDirectory(), aSubDirectory), aFileName);
 
-      if (!validateDirectory(f) || f.isDirectory() || !validateFile(f)) {
-        listSubDirectory("", aRequest, aResponse);
+      if (!validateDirectory(aDirectory, f) || f.isDirectory() || !validateFile(aDirectory, f)) {
+        listSubDirectory(aDirectory, "", aRequest, aResponse);
       }
       else {
         Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
@@ -204,6 +281,7 @@ public class ServletModuleFileEdit extends ServletModule
 
         urlBuilder.setValue("module", "FileEdit");
         urlBuilder.setValue("do", "enter");
+        urlBuilder.setValue("entry", aDirectory.getName());
         urlBuilder.setValue("directory", "");
         urlBuilder.setValue("subdirectory", aSubDirectory);
 
@@ -216,6 +294,7 @@ public class ServletModuleFileEdit extends ServletModule
         in.close();
         out.close();
 
+        responseData.put("entry", aDirectory.getName());
         responseData.put("text", out.toString());
         responseData.put("filename", aFileName);
         responseData.put("subdirectory", aSubDirectory);
@@ -229,18 +308,18 @@ public class ServletModuleFileEdit extends ServletModule
     }
   }
 
-  protected boolean validateDirectory(File aFile) {
+  protected boolean validateDirectory(FileEditDirectory aDirectory, File aFile) {
     try {
-      return (aFile.getCanonicalPath().startsWith(rootDirectory.getCanonicalPath()));
+      return (aFile.getCanonicalPath().startsWith(aDirectory.getRootDirectory().getCanonicalPath()));
     }
     catch (Throwable t) {
       return false;
     }
   }
 
-  protected boolean validateFile(File aFile) {
+  protected boolean validateFile(FileEditDirectory aDirectory, File aFile) {
     try {
-      return filter.accept(aFile.getParentFile(), aFile.getName());
+      return aDirectory.getFilter().accept(aFile.getParentFile(), aFile.getName());
     }
     catch (Throwable t) {
       return false;
index fa9764b..2c07468 100755 (executable)
@@ -34,7 +34,7 @@
                <call ListTable(contentlist, data_keys, column_head_texts, column_head_CSS, listrow1CSS, listrow2CSS, footer_css, module_name)>   
                <call PrevNextPage(module_name)>          
    <else>
-               <P align="center" class="box">${lang("no-matches_found")}</p>
+               <P align="center" class="box">${lang("no_matches_found")}</p>
     </if>
     
         <p>
index 33b73de..3cba7fa 100755 (executable)
                        [
                        <a href="${config.actionRoot}?module=Content&do=edit&id=${entry.to_content.id}">
                                        ${lang("edit")}
-                               </a> |
+            </a> |
                        <a href="${entry.publicurl}">
                                ${lang("start.show")}
                        </a> |
                        ${utility.encodeHTML(entry.description)}
                        
                        <if entry.main_url><br>URL: ${entry.main_url}</if>
-                       <div class="bg-neutral small">
+                       <br>
+<!--                   <div class="bg-neutral small">-->
                        <if config["Mir.Localizer.Admin.ListOperationsFlavor"]=="0">
                                <list entry.operations as op>
                                        [ <a href="${config.actionRoot}?module=Localizer&do=commentoperation&operation=${op}&id=${entry.id}&returnurl=${utility.encodeURI(thisurl + "#" + entry.id)}">${lang("comment.operation."+op)}</a> ]
                        </if>
                        <if entry.operations>&nbsp;|&nbsp;</if>
                        <a href="${config.actionRoot}?module=Comment&do=edit&id=${entry.id}">${lang("edit")}</a>                
-                       </div>
+<!--                   </div>-->
                </td>
       
                <td valign="top">
                        &nbsp;
-                       <a class="small" href="${config.actionRoot}?module=Comment&do=delete&id=${entry.id}&searchtext=${utility.encodeHTML(searchtext)}&searchfield=${utility.encodeHTML(searchfield)}&searchispublished=${searchispublished}&searchorder=${searchorder}&offset=${offset}">[${lang("delete")}]</a>
+      <if config["Mir.Localizer.Admin.AllowDeleteComment"]=="1">
+        <a class="small" href="${config.actionRoot}?module=Comment&do=delete&id=${entry.id}&searchtext=${utility.encodeHTML(searchtext)}&searchfield=${utility.encodeHTML(searchfield)}&searchispublished=${searchispublished}&searchorder=${searchorder}&offset=${offset}">[${lang("delete")}]</a>
+      </if>
                </td>    
        </tr>
 </list>
 </if>  
   
 <else>
-<P align="center" class="box">${lang("no-matches_found")}</p>
+<P align="center" class="box">${lang("no_matches_found")}</p>
 </if>
 
 <include "foot.template">
index 946cf26..4411e3c 100755 (executable)
@@ -9,7 +9,7 @@
   <include "head_nonavi.template">
       <form method="post" action="${config.actionRoot}">
       <table><tr><td>
-         <p class="box-head" align="center"><b>${lang("confirm.really-delete")}</b></p>
+         <p class="box-head" align="center"><b>${lang("confirm.really_delete")}</b></p>
         <p class="box" align="center">
           <input type="hidden" name="module" value="${data.module}">
           <input type="hidden" name="do" value="delete">
index fb34ef0..52d2271 100755 (executable)
                        </td>
                        <td valign="top" class="listcommand">
                                <if showactions=="1">
-                                       <a href="${config.actionRoot}?module=Content&do=delete&id=${entry.id}&where=${utility.encodeURI(where)}&order=${utility.encodeURI(order)}&offset=${utility.encodeURI(offset)}">[${lang("delete")}]</a>
+          <if config["Mir.Localizer.Admin.AllowDeleteArticle"]=="1">
+            <a href="${config.actionRoot}?module=Content&do=delete&id=${entry.id}&where=${utility.encodeURI(where)}&order=${utility.encodeURI(order)}&offset=${utility.encodeURI(offset)}">[${lang("delete")}]</a>
+          </if>
                                </if>
                        </td>
        </tr>
 
 
 <else>
-<p align="center" class="box">${lang("no-matches_found")}</p>
+<p align="center" class="box">${lang("no_matches_found")}</p>
 </if>
 
 <include "foot.template">
index 97cfada..6317856 100755 (executable)
@@ -18,6 +18,7 @@
 <form action="${config.actionRoot}" method="post">
        <input type="hidden" name="module" value="FileEdit">
        <input type="hidden" name="filename" value="${filename}">
+       <input type="hidden" name="entry" value="${entry}">
        <input type="hidden" name="subdirectory" value="${subdirectory}">
        <input type="hidden" name="do" value="update">
        <input type="submit" name="save" value="${lang("save")}"> &nbsp;
index 3cd22d4..cfbac44 100755 (executable)
@@ -8,82 +8,83 @@
 
 <include "head.template">
 
-<table cellpadding="16"><tr><td valign="top">
-
-
-<if dirlist || updir>
-<table border="0" cellpadding="2" cellspacing="2">
-
-       <tr>
-               <td class="table-head"><b>${lang("fileeditlist.dirname")}</b></td>
-               <td class="table-head">&nbsp;</td>
-       </tr>
-       <assign grey="0">
-
-<if updir>
-       <tr class="list1">
-               <td>&nbsp;..&nbsp;</td>
-               <td><a class="tablecommand" href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(updir)}&directory=">${lang("edit")}</a></td>
-       </tr>
-</if>
-
-<if dirlist>
-       <list dirlist as entry>
-               <if grey=="1">
-                       <assign grey="0">
-                       <tr class="listrow1">
-               <else>
-                       <tr class="listrow2">
-                       <assign grey="1"> 
-               </if>
-                               <td> ${entry}&nbsp;</td>
-                               <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=enter&subdirectory=${utility.encodeURI(subdirectory)}&directory=${utility.encodeURI(entry)}">${lang("edit")}</a></td>
-                       </tr>
-       </list>
-       </if>
-
-</table>
-</if>
-
-
-</td>
-<td valign="top">
-
-
-<if filelist || updir || dirlist>
-
-</if>
-
-<if filelist>
-
-<table border="0" cellpadding="2" cellspacing="2">
-
-       <tr>
-               <td class="table-head"><b>${lang("fileeditlist.filename")}</b></td>
-               <td class="table-head">&nbsp;</td>
-       </tr>
-<assign grey="0">
-<list filelist as entry>
-       <if grey=="1">
-               <assign grey="0"><tr class="listrow1">
-       <else><tr class="listrow2">
-               <assign grey="1">
-       </if>
-                       <td>${entry}&nbsp;</td>
-                       <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=edit&subdirectory=${utility.encodeURI(subdirectory)}&filename=${utility.encodeURI(entry)}">${lang("edit")}</a></td>
-               </tr>
-</list>
-</table>
-
-</td></tr></table>
-
-
-<P>
-<else>
-       <P align="center" class="box">${lang("no-matches_found")}</p>
-</if>
-<include "foot.template">
-</body>
+    <table cellpadding="16">
+      <tr>
+        <td valign="top">
+        
+        
+        <if dirlist || updir>
+          <table border="0" cellpadding="2" cellspacing="2">
+          
+               <tr>
+                       <td class="table-head"><b>${lang("fileeditlist.dirname")}</b></td>
+                       <td class="table-head">&nbsp;</td>
+               </tr>
+               <assign grey="0">
+          
+            <if updir>
+               <tr class="list1">
+                       <td>&nbsp;..&nbsp;</td>
+                       <td><a class="tablecommand" href="${config.actionRoot}?module=FileEdit&do=enter&entry=${entry}&subdirectory=${utility.encodeURI(updir)}&directory=">${lang("edit")}</a></td>
+               </tr>
+            </if>
+            
+            <if dirlist>
+               <list dirlist as item>
+                       <if grey=="1">
+                               <assign grey="0">
+                               <tr class="listrow1">
+                       <else>
+                               <tr class="listrow2">
+                               <assign grey="1"> 
+                       </if>
+                                       <td> ${item}&nbsp;</td>
+                                       <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=enter&entry=${entry}&subdirectory=${utility.encodeURI(subdirectory)}&directory=${utility.encodeURI(item)}">${lang("edit")}</a></td>
+                               </tr>
+               </list>
+            </if>
+          
+          </table>
+        </if>
+        
+        
+        </td>
+        <td valign="top">
+          
+          <table border="0" cellpadding="2" cellspacing="2">
+          
+               <tr>
+                       <td class="table-head"><b>${lang("fileeditlist.filename")}</b></td>
+                       <td class="table-head">&nbsp;</td>
+               </tr>
+            <if filelist>
+              <assign grey="0">
+              <list filelist as item>
+               <if grey=="1">
+                       <assign grey="0">
+                       <tr class="listrow1">
+               <else>
+                 <tr class="listrow2">
+                       <assign grey="1">
+               </if>
+                    <td>${item}&nbsp;</td>
+                    <td class="tablecommand"><a href="${config.actionRoot}?module=FileEdit&do=edit&entry=${entry}&subdirectory=${utility.encodeURI(subdirectory)}&filename=${utility.encodeURI(item)}">${lang("edit")}</a></td>
+                  </tr>
+              </list>
+            <else>
+              <tr><td colspan="2">
+               <P align="center" class="box">${lang("no_matches_found")}</p>
+               </tr></tr>
+            </if>
+          </table>
+        </td>
+      </tr>
+    </table>
+  
+    <P>
+  
+    <include "foot.template">
+  </body>
 </html>
 
 
index da57255..537e0c3 100755 (executable)
 </list>
 
 <else>
-       <tr><td><div class="box" align="center"><b>${lang("no-matches_found")}</b></div></td></tr>
+       <tr><td><div class="box" align="center"><b>${lang("no_matches_found")}</b></div></td></tr>
 </if>
 
 
index 8b1c66f..08e9970 100755 (executable)
@@ -94,7 +94,7 @@ function openWin(url) {
        </tr>
 
 <else>
-  <tr><td align="center" class="box" colspan="7">${lang("no-matches_found")}</td></tr>
+  <tr><td align="center" class="box" colspan="7">${lang("no_matches_found")}</td></tr>
 </if>
 </table>
 
index 7cbe8bd..e5e7efd 100755 (executable)
@@ -43,7 +43,7 @@
        <a href="${config.actionRoot}?module=Mediafolder&do=list&where=${data.where}&nextoffset=${data.next}&next=weiter">${lang("list.next")}</a>
        </if>
 <else>
-  <P align="center" class="box">${lang("no-matches_found")}</p>
+  <P align="center" class="box">${lang("no_matches_found")}</p>
 </if>
 
     <p>
index c285cbd..3cd1c90 100755 (executable)
 
                <p class="box-head"><b>${lang("start.extra.title")}</b></p>             
                <p class="box"> 
-                       <a href="${config.actionRoot}?module=Hidden&do=list">&gt; ${lang("start.content.hidden")}</a><br>
-                       <a href="${config.actionRoot}?module=FileEdit&do=list">&gt; ${lang("start.fileedit.title")}</a>
+                       <a href="${config.actionRoot}?module=Hidden&do=list">&gt; ${lang("start.content.hidden")}</a>
+                       <list fileeditentries as e>
+                         <br>
+          <a href="${config.actionRoot}?module=FileEdit&do=list&entry=${e}">&gt; ${lang("start.fileedit."+e+".title")}</a>
+      </list>
                </p>
 </td>