*/
public class AbstractModule {
- protected StorageObject theStorage;
+ protected StorageObject theStorage;
public void setStorage(StorageObject storage) {
- this.theStorage = storage;
- }
-
- /**
- * Liefert das Standard-StorageObject zurück, mit dem das Module assoziiert ist.
- * @return Standard-StorageObject
- */
- public StorageObject getStorageObject () {
- return theStorage;
- }
-
- /**
- * Holt eine Entity anhand der Id via StorageObject
- * @param String der Entity
- * @return Entity
- */
- public Entity getById (String id) throws ModuleException {
- try {
- if (theStorage == null)
- throw new ModuleException("No StorageObject set!");
- Entity entity = (Entity)theStorage.selectById(id);
- if (entity == null)
- throw new ModuleException("No object for id = " + id);
- else return entity;
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
+ this.theStorage = storage;
+ }
+
+ /**
+ * Liefert das Standard-StorageObject zurück, mit dem das Module assoziiert ist.
+ * @return Standard-StorageObject
+ */
+ public StorageObject getStorageObject () {
+ return theStorage;
+ }
+
+ /**
+ * Holt eine Entity anhand der Id via StorageObject
+ * @param String der Entity
+ * @return Entity
+ */
+ public Entity getById (String id) throws ModuleException {
+ try {
+ if (theStorage == null)
+ throw new ModuleException("No StorageObject set!");
+ Entity entity = (Entity)theStorage.selectById(id);
+ if (entity == null)
+ throw new ModuleException("No object for id = " + id);
+ else return entity;
+ }
+ catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ /**
+ * Holt eine EntityListe anhand des WhereClause via StorageObject
+ * @param String whereclause
+ * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+ * @return EntityList Liste der gematchten Datensätze
+ */
+ public EntityList getByWhereClause (String whereClause, int offset) throws ModuleException {
+ try {
+ if (theStorage == null)
+ throw new ModuleException("Kein StorageObject gesetzt");
+ return theStorage.selectByWhereClause(whereClause, offset);
+ }
+ catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ /**
+ * Holt eine EntityListe anhand des WhereClause aus dem StorageObject
+ * @param String where WhereClause
+ * @param String order Sortierreihenfolge
+ * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+ * @return EntityList Liste der gematchten Datensätze
+ */
+ public EntityList getByWhereClause (String where, String order, int offset) throws ModuleException {
+ try {
+ if (theStorage==null) throw new ModuleException("Kein StorageObject gesetzt");
+ return theStorage.selectByWhereClause(where, order, offset);
+ }
+ catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+ /**
+ * Executes a where clause on the StorageObject with order criteria
+ * fetching from offset the number of limit objects
+ *
+ * @param String where
+ * @param String order
+ * @param int offset
+ * @param int limit
+ * @return EntityList
+ */
+
+ public EntityList getByWhereClause(String where, String order, int offset, int limit) throws ModuleException
+ {
+ try {
+ if (theStorage==null) throw new ModuleException("StorageObject not set!");
+ return theStorage.selectByWhereClause(where, order, offset, limit);
+ }
+ catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ /**
+ * Holt eine EntityListe anhand des Wertes aValue von Feld aField aus dem StorageObject
+ * @param String aField - Feldname im StorageObject
+ * @param String aValue - Wert in Feld im StorageObject
+ * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+ * @return EntityList Liste der gematchten Datensätze
+ */
+ public EntityList getByFieldValue (String aField, String aValue, int offset) throws ModuleException {
+ String whereClause;
+ whereClause = aField + " like '%" + aValue + "%'";
+ return getByWhereClause(whereClause, offset);
+ }
+
+ /**
+ * Standardfunktion, um einen Datensatz via StorageObject einzufügen
+ * @param theValues Hash mit Spalte/Wert-Paaren
+ * @return Id des eingefügten Objekts
+ * @exception ModuleException
+ */
+ public String add (HashMap theValues) throws ModuleException {
+ try {
+ Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();
+ theEntity.setStorage(theStorage);
+ theEntity.setValues(theValues);
+ return theEntity.insert();
+ } catch (Exception e) {
+ throw new ModuleException(e.toString());
+ }
+ }
/**
- * Holt eine EntityListe anhand des WhereClause via StorageObject
- * @param String whereclause
- * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
- * @return EntityList Liste der gematchten Datensätze
- */
- public EntityList getByWhereClause (String whereClause, int offset) throws ModuleException {
- try {
- if (theStorage == null)
- throw new ModuleException("Kein StorageObject gesetzt");
- return theStorage.selectByWhereClause(whereClause, offset);
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
-
- /**
- * Holt eine EntityListe anhand des WhereClause aus dem StorageObject
- * @param String where WhereClause
- * @param String order Sortierreihenfolge
- * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
- * @return EntityList Liste der gematchten Datensätze
- */
- public EntityList getByWhereClause (String where, String order, int offset) throws ModuleException {
- try {
- if (theStorage==null) throw new ModuleException("Kein StorageObject gesetzt");
- return theStorage.selectByWhereClause(where, order, offset);
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
- /**
- * Executes a where clause on the StorageObject with order criteria
- * fetching from offset the number of limit objects
- *
- * @param String where
- * @param String order
- * @param int offset
- * @param int limit
- * @return EntityList
- */
-
- public EntityList getByWhereClause(String where, String order, int offset, int limit) throws ModuleException
- {
- try {
- if (theStorage==null) throw new ModuleException("StorageObject not set!");
- return theStorage.selectByWhereClause(where, order, offset, limit);
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
-
- /**
- * Holt eine EntityListe anhand des Wertes aValue von Feld aField aus dem StorageObject
- * @param String aField - Feldname im StorageObject
- * @param String aValue - Wert in Feld im StorageObject
- * @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
- * @return EntityList Liste der gematchten Datensätze
- */
- public EntityList getByFieldValue (String aField, String aValue, int offset) throws ModuleException {
- String whereClause;
- whereClause = aField + " like '%" + aValue + "%'";
- return getByWhereClause(whereClause, offset);
- }
-
- /**
- * Standardfunktion, um einen Datensatz via StorageObject einzufügen
- * @param theValues Hash mit Spalte/Wert-Paaren
- * @return Id des eingefügten Objekts
- * @exception ModuleException
- */
- public String add (HashMap theValues) throws ModuleException {
- try {
- Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();
- theEntity.setStorage(theStorage);
- theEntity.setValues(theValues);
- return theEntity.insert();
- } catch (Exception e) {
- throw new ModuleException(e.toString());
- }
- }
-
- /**
- * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren
- * @param theValues Hash mit Spalte/Wert-Paaren
- * @return Id des eingefügten Objekts
- * @exception ModuleException
- */
- public String set (HashMap 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"));
- theEntity.setValues(theValues);
- theEntity.update();
- return theEntity.getId();
- }
- catch (StorageObjectException e){
- e.printStackTrace(System.err);
- throw new ModuleException(e.toString());
- }
- }
-
- /**
- * Löscht einen Datensatz anhand seiner Id
- * @param idParam
- * @exception ModuleException
- */
- public void deleteById (String idParam) throws ModuleException {
+ * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren
+ * @param theValues Hash mit Spalte/Wert-Paaren
+ * @return Id des eingefügten Objekts
+ * @exception ModuleException
+ */
+ public String set (HashMap theValues) throws ModuleException {
try {
- theStorage.delete(idParam);
+ Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+ if (theEntity == null)
+ throw new ModuleException("Kein Objekt mit id in Datenbank id: " + theValues.get("id"));
+ theEntity.setValues(theValues);
+ theEntity.update();
+ return theEntity.getId();
+ }
+ catch (StorageObjectException e){
+ e.printStackTrace(System.err);
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ /**
+ * Deletes a record using an id
+ * @param idParam
+ * @exception ModuleException
+ */
+ public void deleteById (String idParam) throws ModuleException {
+ try {
+ theStorage.delete(idParam);
} catch (StorageObjectException e){
throw new ModuleException(e.toString());
}
}
- /**
- * Liefert den Lookuptable aller Objekte des StorageObjects
- * @return freemarker.template.SimpleHash
- */
- public SimpleHash getHashData() {
- return theStorage.getHashData();
- }
+ /**
+ * Liefert den Lookuptable aller Objekte des StorageObjects
+ * @return freemarker.template.SimpleHash
+ */
+ public SimpleHash getHashData() {
+ return theStorage.getHashData();
+ }
/**
* returns the number of rows
*/
public int getSize(String where)
- throws SQLException,StorageObjectException {
+ throws SQLException,StorageObjectException {
return theStorage.getSize(where);
}
import freemarker.template.TemplateModel;
import mir.entity.EntityList;
+import mir.log.*;
import mir.misc.*;
import mir.module.AbstractModule;
import mir.module.ModuleException;
public abstract class ServletModule {
public String defaultAction;
- protected Logfile theLog;
+ protected LoggerWrapper logger;
+
protected AbstractModule mainModule;
protected String templateListString;
protected String templateObjektString;
public void process(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
}
+ public void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleException {
+ try {
+ aResponse.sendRedirect(MirConfig.getProp("RootUri") + "/Mir?"+aQuery);
+ }
+ catch (Throwable t) {
+ throw new ServletModuleException(t.getMessage());
+ }
+ }
/**
* list(req,res) - generische Listmethode. Wennn die Funktionalitaet
throws ServletModuleException, ServletModuleUserException {
try {
HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
- theLog.printDebugInfo("--trying to add...");
+ logger.debug("--trying to add...");
String id = mainModule.add(withValues);
- theLog.printDebugInfo("--trying to deliver..." + id);
+ logger.debug("--trying to deliver..." + id);
list(req, res);
}
catch (Exception e) {
* Dispatcher, calls the method passed to ServletModule Class, through the "do"
* Parameter (via POST or GET)
*
- * @version $Id: ServletModuleDispatch.java,v 1.8 2002/10/25 03:25:15 zapata Exp $
+ * @version $Id: ServletModuleDispatch.java,v 1.9 2002/11/29 13:43:41 zapata Exp $
*
* @Author rk
*
*/
public final class ServletModuleDispatch {
- private static LoggerWrapper logger;
+ private static LoggerWrapper logger = new LoggerWrapper("servlet.dispatch");
private static final Class[] SIGNATURE = { HttpServletRequest.class, HttpServletResponse.class };
- static {
- logger = new LoggerWrapper("servlet.dispatch");
- }
-
/**
* private constructor to prevent unwanted instantiation;
*/
package mir.util;
import java.util.*;
-import java.net.*;
import mir.misc.*;
import mir.generator.*;
if (!(aParameters.get(0) instanceof String))
throw new GeneratorExc("encodeURIGeneratorFunction: parameter must be a string (not a "+aParameters.get(0).getClass().getName()+")");
- return URLEncoder.encode((String) aParameters.get(0));
+ return HTMLRoutines.encodeURL((String) aParameters.get(0));
};
}
package mir.util;
+import java.net.*;
+
public class HTMLRoutines {
+
+ public static String encodeURL(String aString) {
+ return URLEncoder.encode(aString);
+ }
+
public static String encodeHTML(String aText) {
final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"', '\'' };
final String[] ESCAPE_CODES = { "&", "<", ">", """, "'" };
anEntityAdapterDefinition.addCalculatedField("to_media_other", new ContentToMediaField( "otherMedia" ));\r
anEntityAdapterDefinition.addCalculatedField("to_media_icon", new ContentToIconField());\r
\r
+ anEntityAdapterDefinition.addCalculatedField("article_type", new ContentToArticleTypeField());\r
+\r
anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));\r
anEntityAdapterDefinition.addCalculatedField("content_data_parsed", new FilteredField("content_data"));\r
}\r
}\r
}\r
\r
+ protected class ContentToArticleTypeField implements EntityAdapterDefinition.CalculatedField {\r
+ public Object getValue(EntityAdapter anEntityAdapter) {\r
+ try {\r
+ return anEntityAdapter.getToOneRelation(\r
+ "id="+anEntityAdapter.get("to_article_type"),\r
+ "id",\r
+ "articleType" );\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.getMessage());\r
+ }\r
+ }\r
+ }\r
+\r
protected class ContentToCommentsField implements EntityAdapterDefinition.CalculatedField {\r
public Object getValue(EntityAdapter anEntityAdapter) {\r
try {\r
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
-import mir.entity.*;
-import mir.storage.*;
/*
- * ContentObjekt -
+ *
*
*
* @author RK
public class ModuleBreaking extends AbstractModule
{
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Breaking");
- // Kontruktor
-
- public ModuleBreaking (StorageObject theStorage)
- {
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Breaking.Logfile"));
- if (theStorage == null) theLog.printWarning("ModuleBreaking -- StorageObject was null!");
- this.theStorage = theStorage;
- }
+ public ModuleBreaking (StorageObject theStorage)
+ {
+ if (theStorage == null) logger.warn("ModuleBreaking -- StorageObject was null!");
+ this.theStorage = theStorage;
+ }
- // Methoden
+// Methoden
public EntityList getBreakingNews() {
EntityList returnList = null;
try {
returnList = getByWhereClause(null,"webdb_create desc",0,5);
}
catch (Exception ex) {
- theLog.printWarning("--getBreakingNews(): could not fetch Breaking News" + ex.toString());
+ logger.error("--getBreakingNews(): could not fetch Breaking News" + ex.toString());
}
return returnList;
}
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
public class ModuleComment extends AbstractModule
{
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Comment");
// Contructor
public ModuleComment(StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
- if (theStorage == null) theLog.printWarning("StorageObject was null!");
+ if (theStorage == null) logger.warn("StorageObject was null!");
this.theStorage = theStorage;
}
public SimpleList getCommentAsSimpleList() throws ModuleException {
try {
return ((DatabaseComment)theStorage).getPopupData();
- } catch (StorageObjectException e) {
+ }
+ catch (StorageObjectException e) {
throw new ModuleException(e.toString());
}
}
-
+
/**
* setValues in the Entity and updates them on the StorageObject
*/
theEntity.setValues(theValues);
theEntity.update();
return theEntity.getId();
- } catch (StorageObjectException e){
- e.printStackTrace(System.err);
+ }
+ catch (StorageObjectException e){
+ logger.error("ModuleComment.set: " + e.getMessage());
+ e.printStackTrace(new PrintWriter(new LoggerToWriterAdapter(logger, LoggerWrapper.DEBUG_MESSAGE)));
+
throw new ModuleException(e.toString());
}
}
import java.io.*;
import java.util.*;
import java.sql.*;
+
import javax.servlet.*;
import javax.servlet.http.*;
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
/*
* ContentObjekt -
*
- * @version $Id: ModuleContent.java,v 1.10 2002/11/27 07:48:02 mh Exp $
+ * @version $Id: ModuleContent.java,v 1.11 2002/11/29 13:43:42 zapata Exp $
*
* @author RK, mir-coders
*
public class ModuleContent extends AbstractModule
{
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Content");
- public ModuleContent() {
- super();
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile"));
- }
+ public ModuleContent() {
+ super();
+ }
- public ModuleContent(StorageObject theStorage) {
- this.theStorage = theStorage;
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile"));
- }
+ public ModuleContent(StorageObject theStorage) {
+ this.theStorage = theStorage;
+ }
- //
- // methoden, um an ContentEntities zu kommen
+//
+// various methods to retrieve content entities
public EntityList getFeatures(int offset, int limit) throws ModuleException
{
public EntityList getNewsWire(int offset, int limit) throws ModuleException
{
return getContent("is_published=true AND to_article_type = 1",
- "webdb_create desc",offset,limit);
+ "webdb_create desc",offset,limit);
}
public EntityList getStartArticle() throws ModuleException
{
EntityList returnList = getContent("is_published=true AND to_article_type=4",
- "webdb_create desc",0,1);
- //if no startspecial exists
+ "webdb_create desc",0,1);
+//if no startspecial exists
if (returnList==null || returnList.size()==0)
returnList = getContent("is_published=true AND to_article_type=3",
"webdb_create desc",0,1);
return returnList;
}
- public EntityList getContent(HashMap searchValues, boolean concat, int offset, EntityUsers user)
- throws ModuleException {
-
- try {
-
- String whereClause ="", aField, aValue;
- boolean first = true;
-
- Set set = searchValues.keySet();
- Iterator it = set.iterator();
- for (int i=0;i<set.size();i++) {
- aField = (String)it.next();
- aValue = (String)searchValues.get(aField);
-
- if (first == false)
- whereClause += (concat) ? " and " : " or ";
- else
- first = false;
-
- whereClause += "(";
-
- // default: hier splitten der eintraege und verknupfung mit AND OR NOT
- StringTokenizer st = new StringTokenizer(aValue);
- boolean firstToken = true;
- while(st.hasMoreTokens()) {
- String notString = "";
- String tokenConcat = " OR ";
- String nextToken = st.nextToken();
-
- if (nextToken.startsWith("+")) {
- nextToken = nextToken.substring(1);
- tokenConcat = " AND ";
- }
- if (nextToken.startsWith("-")) {
- nextToken = nextToken.substring(1);
- tokenConcat = " AND ";
- notString = " NOT ";
- }
- if (firstToken == true) {
- tokenConcat = "";
- firstToken = false;
- }
-
-
- whereClause += tokenConcat + aField + notString + " like '";
- whereClause += nextToken + "%'";
- }
- whereClause += ") ";
- }
- return theStorage.selectByWhereClause(whereClause, offset);
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
-
- }
-
- public EntityList getContentByField(String aField, String aValue, String orderBy, int offset,
- EntityUsers user) throws ModuleException
- {
- String whereClause = "lower("+aField + ") like lower('%" + StringUtil.quote(aValue) + "%')";
- return getContent(whereClause, orderBy, offset, user);
- }
-
- public EntityList getContent(String whereClause, String orderBy, int offset,
- int limit, EntityUsers user) throws ModuleException {
-
- try {
- if (user!=null){
- if (!user.isAdmin())
- whereClause += " and to_publisher='" + user.getId()+"'";
- }
- return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
- }
- catch (StorageObjectException e){ throw new ModuleException(e.toString()); }
- }
-
- public EntityList getContent(String whereClause, String orderBy,int offset, int limit)
- throws ModuleException {
- try {
- return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
- } catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
-
- public EntityList getContent(String whereClause, String orderBy, int offset, EntityUsers user)
- throws ModuleException
- {
- try {
- if (whereClause !=null) {
-
- // for the different article_types
- if(whereClause.equals("newswire")) {
- whereClause="is_published='1' and to_article_type='1'";
- orderBy = "webdb_create desc";
- }
- if(whereClause.equals("feature")) {
- whereClause="is_published='1' and to_article_type='2'";
- orderBy = "webdb_create desc";
- }
- if(whereClause.equals("themenspecial")) {
- whereClause="is_published='1' and to_article_type='3'";
- orderBy = "webdb_create desc";
- }
- if(whereClause.equals("special")) {
- whereClause="is_published='1' and to_article_type='4'";
- orderBy = "webdb_create desc";
- }
-
- if(whereClause.equals("comments")) {
- whereClause="not (comment is null or comment like '')";
- orderBy = "webdb_lastchange desc";
- }
-
- if(whereClause.equals("nfrei")) {
- whereClause="is_published='0'"; orderBy="webdb_create desc";
- }
-
- if(whereClause.equals("lastchange")) {
- whereClause=""; orderBy="webdb_lastchange desc";
- }
-
- if(whereClause.equals("media")) {
- return DatabaseContentToMedia.getInstance().getContent();
- }
- }
- return theStorage.selectByWhereClause(whereClause, orderBy, offset);
- }
- catch (StorageObjectException e){ throw new ModuleException(e.toString()); }
- }
+ public EntityList getContent(HashMap searchValues, boolean concat, int offset, EntityUsers user)
+ throws ModuleException {
+
+ try {
+
+ String whereClause ="", aField, aValue;
+ boolean first = true;
+
+ Set set = searchValues.keySet();
+ Iterator it = set.iterator();
+ for (int i=0;i<set.size();i++) {
+ aField = (String)it.next();
+ aValue = (String)searchValues.get(aField);
+
+ if (first == false)
+ whereClause += (concat) ? " and " : " or ";
+ else
+ first = false;
+
+ whereClause += "(";
+
+// default: hier splitten der eintraege und verknupfung mit AND OR NOT
+ StringTokenizer st = new StringTokenizer(aValue);
+ boolean firstToken = true;
+ while(st.hasMoreTokens()) {
+ String notString = "";
+ String tokenConcat = " OR ";
+ String nextToken = st.nextToken();
+
+ if (nextToken.startsWith("+")) {
+ nextToken = nextToken.substring(1);
+ tokenConcat = " AND ";
+ }
+ if (nextToken.startsWith("-")) {
+ nextToken = nextToken.substring(1);
+ tokenConcat = " AND ";
+ notString = " NOT ";
+ }
+ if (firstToken == true) {
+ tokenConcat = "";
+ firstToken = false;
+ }
+
+
+ whereClause += tokenConcat + aField + notString + " like '";
+ whereClause += nextToken + "%'";
+ }
+ whereClause += ") ";
+ }
+ return theStorage.selectByWhereClause(whereClause, offset);
+ }
+ catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ public EntityList getContentByField(String aField, String aValue, String orderBy, int offset,
+ EntityUsers user) throws ModuleException
+ {
+ String whereClause = "lower("+aField + ") like lower('%" + StringUtil.quote(aValue) + "%')";
+ return getContent(whereClause, orderBy, offset, user);
+ }
+ public EntityList getContent(String whereClause, String orderBy, int offset,
+ int limit, EntityUsers user) throws ModuleException {
+
+ try {
+ if (user!=null){
+ if (!user.isAdmin())
+ whereClause += " and to_publisher='" + user.getId()+"'";
+ }
+ return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
+ }
+ catch (StorageObjectException e){ throw new ModuleException(e.toString()); }
+ }
+
+ public EntityList getContent(String whereClause, String orderBy,int offset, int limit)
+ throws ModuleException {
+ try {
+ return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit);
+ } catch (StorageObjectException e){
+ throw new ModuleException(e.toString());
+ }
+ }
+
+ public EntityList getContent(String whereClause, String orderBy, int offset, EntityUsers user)
+ throws ModuleException
+ {
+ try {
+ if (whereClause !=null) {
+
+// for the different article_types
+ if(whereClause.equals("newswire")) {
+ whereClause="is_published='1' and to_article_type='1'";
+ orderBy = "webdb_create desc";
+ }
+ if(whereClause.equals("feature")) {
+ whereClause="is_published='1' and to_article_type='2'";
+ orderBy = "webdb_create desc";
+ }
+ if(whereClause.equals("themenspecial")) {
+ whereClause="is_published='1' and to_article_type='3'";
+ orderBy = "webdb_create desc";
+ }
+ if(whereClause.equals("special")) {
+ whereClause="is_published='1' and to_article_type='4'";
+ orderBy = "webdb_create desc";
+ }
+
+ if(whereClause.equals("comments")) {
+ whereClause="not (comment is null or comment like '')";
+ orderBy = "webdb_lastchange desc";
+ }
+
+ if(whereClause.equals("nfrei")) {
+ whereClause="is_published='0'"; orderBy="webdb_create desc";
+ }
+
+ if(whereClause.equals("lastchange")) {
+ whereClause=""; orderBy="webdb_lastchange desc";
+ }
+
+ if(whereClause.equals("media")) {
+ return DatabaseContentToMedia.getInstance().getContent();
+ }
+ }
+ return theStorage.selectByWhereClause(whereClause, orderBy, offset);
+ }
+ catch (StorageObjectException e){ throw new ModuleException(e.toString()); }
+ }
}
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
/*
public class ModuleFeature extends AbstractModule
{
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Feature");
- public ModuleFeature(StorageObject theStorage) {
+ public ModuleFeature(StorageObject theStorage) {
- this.theStorage = theStorage;
+ this.theStorage = theStorage;
+ }
- if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Feature.Logfile"));
-
- }
-
- public SimpleList getSchwerpunktAsSimpleList()
- throws ModuleException {
- try {
- return ((DatabaseFeature)theStorage).getPopupData();
- } catch (StorageObjectException e) {
- throw new ModuleException(e.toString());
- }
- }
+ public SimpleList getSchwerpunktAsSimpleList() throws ModuleException {
+ try {
+ return ((DatabaseFeature)theStorage).getPopupData();
+ }
+ catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
+ }
}
-
import java.lang.*;
import java.util.*;
import java.sql.*;
+
import javax.servlet.*;
import javax.servlet.http.*;
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
public class ModuleImages extends AbstractModule {
- static Logfile theLog;
-
- // Kontruktor
-
- public ModuleImages(StorageObject theStorage) {
+ static LoggerWrapper logger = new LoggerWrapper("Module.Images");
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home")+MirConfig.getProp("Module.Images.Logfile"));
- if (theStorage == null) theLog.printWarning("StorageObject was null!");
- this.theStorage = theStorage;
+ public ModuleImages(StorageObject theStorage) {
+ if (theStorage == null)
+ logger.warn("ModuleImages: StorageObject was null!");
+ this.theStorage = theStorage;
- }
+ }
- // Methoden
+// Methoden
- public SimpleList getBilderAsSimpleList()
+ public SimpleList getBilderAsSimpleList()
throws ModuleException {
- // String sql = "select id, name from Bilder order by name";
- try {
- return ((DatabaseImages)theStorage).getPopupData();
- } catch (StorageObjectException e) {
- throw new ModuleException(e.toString());
- }
- }
+// String sql = "select id, name from Bilder order by name";
+ try {
+ return ((DatabaseImages)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
+ }
}
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
-
import mir.entity.*;
import mir.storage.*;
+import mir.log.*;
/**
* Title: mir - another content management system
*/
public class ModuleLanguage extends AbstractModule {
+ static LoggerWrapper logger = new LoggerWrapper("Module.Language");
- static Logfile theLog;
-
- // Kontruktor
- public ModuleLanguage (StorageObject theStorage) {
-
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Language.Logfile"));
- if (theStorage == null) theLog.printWarning("ModuleLanguage -- StorageObject was null!");
+ public ModuleLanguage (StorageObject theStorage) {
- this.theStorage = theStorage;
- }
+ if (theStorage == null)
+ logger.warn("ModuleLanguage -- StorageObject was null!");
- // Methoden
+ this.theStorage = theStorage;
+ }
}
\ No newline at end of file
import java.lang.*;
import java.util.*;
import java.sql.*;
+
import javax.servlet.*;
import javax.servlet.http.*;
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
public class ModuleLinksImcs extends AbstractModule
{
+ static LoggerWrapper logger = new LoggerWrapper("Module.LinksImcs");
- static Logfile theLog;
-
- public ModuleLinksImcs(StorageObject theStorage) {
- this.theStorage = theStorage;
- if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.LinksImcs.Logfile"));
- }
-
- public SimpleHash getLinksImcsAsSimpleHash() {
- return ((DatabaseLinksImcs)theStorage).getHashData();
- }
+ public ModuleLinksImcs(StorageObject theStorage) {
+ this.theStorage = theStorage;
+ }
-}
+ public SimpleHash getLinksImcsAsSimpleHash() {
+ return ((DatabaseLinksImcs)theStorage).getHashData();
+ }
+}
\ No newline at end of file
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
public class ModuleMediafolder extends AbstractModule
{
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Mediafolder");
- // Kontruktor
+// Kontruktor
- public ModuleMediafolder(StorageObject theStorage)
- {
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Mediafolder.Logfile"));
- if (theStorage == null) theLog.printWarning("StorageObject was null!");
- this.theStorage = theStorage;
- }
+ public ModuleMediafolder(StorageObject theStorage)
+ {
+ if (theStorage == null) logger.warn("ModuleMediafolder: StorageObject was null!");
+ this.theStorage = theStorage;
+ }
- // Methoden
+// Methoden
- public SimpleList getPopupData() throws ModuleException {
- try {
- return ((DatabaseMediafolder)theStorage).getPopupData();
- } catch (Exception e) {
- throw new ModuleException(e.toString());
- }
- }
+ public SimpleList getPopupData() throws ModuleException {
+ try {
+ return ((DatabaseMediafolder)theStorage).getPopupData();
+ } catch (Exception e) {
+ throw new ModuleException(e.toString());
+ }
+ }
}
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
-
-import mir.entity.*;
-import mir.storage.*;
+import mir.log.*;
/**
* Title: ModuleMessage
public class ModuleMessage extends AbstractModule
{
- static Logfile theLog;
-
- // Kontruktor
-
- public ModuleMessage (StorageObject theStorage)
- {
-
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Messages.Logfile"));
- if (theStorage == null) theLog.printWarning("ModuleMessage -- StorageObject was null!");
-
- this.theStorage = theStorage;
-
- }
+ static LoggerWrapper logger = new LoggerWrapper("Module.Message");
- // Methoden
+ public ModuleMessage (StorageObject theStorage)
+ {
+ if (theStorage == null) logger.warn("ModuleMessage -- StorageObject was null!");
-}
+ this.theStorage = theStorage;
+ }
+}
\ No newline at end of file
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
-import mir.entity.*;
import mircoders.storage.*;
+
/*
* Feature -
*
public class ModuleSchwerpunkt extends AbstractModule
{
- static Logfile theLog;
-
- public ModuleSchwerpunkt(StorageObject theStorage) {
+ static LoggerWrapper logger = new LoggerWrapper("Module.Feature");
- this.theStorage = theStorage;
+ public ModuleSchwerpunkt(StorageObject theStorage) {
- if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Schwerpunkt.Logfile"));
+ this.theStorage = theStorage;
+ }
- }
-
- public SimpleList getSchwerpunktAsSimpleList()
- throws ModuleException {
- try {
- return ((DatabaseFeature)theStorage).getPopupData();
- } catch (StorageObjectException e) {
- throw new ModuleException(e.toString());
- }
- }
+ public SimpleList getSchwerpunktAsSimpleList() throws ModuleException {
+ try {
+ return ((DatabaseFeature)theStorage).getPopupData();
+ }
+ catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
+ }
}
-
package mircoders.module;
+import java.util.HashMap;
+
import freemarker.template.SimpleList;
+
import mir.entity.Entity;
import mir.entity.EntityList;
-import mir.misc.Logfile;
import mir.misc.MirConfig;
import mir.module.AbstractModule;
import mir.module.ModuleException;
import mir.storage.StorageObject;
import mir.storage.StorageObjectException;
+import mir.log.*;
+
import mircoders.entity.EntityContent;
import mircoders.entity.EntityTopics;
import mircoders.storage.DatabaseContent;
import mircoders.storage.DatabaseContentToTopics;
import mircoders.storage.DatabaseTopics;
-import java.util.HashMap;
-
/*
* ThemenModule -
*
public class ModuleTopics extends AbstractModule {
- static Logfile theLog;
+ static LoggerWrapper logger = new LoggerWrapper("Module.Topics");
public ModuleTopics(StorageObject theStorage) {
this.theStorage = theStorage;
- if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
}
public SimpleList getTopicsAsSimpleList() throws ModuleException {
}
}
-
/**
* Method getTopicList
*
returnList = getByWhereClause("", "title", -1);
}
catch (Exception e) {
- theLog.printWarning("--getTopicsList: topics could not be fetched");
+ logger.warn("--getTopicsList: topics could not be fetched: " + e.getMessage());
}
return returnList;
}
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.storage.*;
public class ModuleUploadedMedia extends AbstractModule
{
+ static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia");
- static Logfile theLog;
-
- public ModuleUploadedMedia(StorageObject theStorage) {
- this.theStorage = theStorage;
- if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home")
- + MirConfig.getProp("Module.UploadedMedia.Logfile"));
- }
-}
+ public ModuleUploadedMedia(StorageObject theStorage) {
+ this.theStorage = theStorage;
+ }
+}
\ No newline at end of file
import java.lang.*;
import java.util.*;
import java.sql.*;
+
import javax.servlet.*;
import javax.servlet.http.*;
import mir.entity.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
public class ModuleUsers extends AbstractModule
{
- static Logfile theLog;
-
- // Kontruktor
-
- public ModuleUsers(StorageObject theStorage)
- {
-
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Users.Logfile"));
- if (theStorage == null) theLog.printWarning("StorageObject was null!");
- this.theStorage = theStorage;
-
- }
-
- /**
- * login method
- */
-
- public EntityUsers getUserForLogin(String user, String password) throws ModuleException
- {
- String whereString = "login='" +user + "' and password='"+ password + "' and is_admin='1'";
- EntityList userList = getByWhereClause(whereString, -1);
- if (userList != null && userList.getCount()==1)
- return (EntityUsers)userList.elementAt(0);
- else return null;
- }
-
-
-
- public EntityList getUsers(String whereClause, int offset, int limit)
- throws ModuleException
- {
- try {
- return theStorage.selectByWhereClause(whereClause, null, offset, limit);
- }
- catch (StorageObjectException e){
- throw new ModuleException(e.toString());
- }
- }
-
- public SimpleList getUsersAsSimpleList() throws ModuleException {
- // String sql = "select id, name from Users order by name";
+ static LoggerWrapper logger = new LoggerWrapper("Module.Users");
+
+ public ModuleUsers(StorageObject theStorage)
+ {
+ if (theStorage == null)
+ logger.warn("StorageObject was null!");
+
+ this.theStorage = theStorage;
+ }
+
+ /**
+ * login method
+ */
+
+ public EntityUsers getUserForLogin(String user, String password) throws ModuleException
+ {
+ String whereString = "login='" +user + "' and password='"+ password + "' and is_admin='1'";
+ EntityList userList = getByWhereClause(whereString, -1);
+ if (userList != null && userList.getCount()==1)
+ return (EntityUsers)userList.elementAt(0);
+ else
+ return null;
+ }
+
+ public EntityList getUsers(String whereClause, int offset, int limit) throws ModuleException
+ {
try {
- return ((DatabaseUsers)theStorage).getPopupData();
- } catch(StorageObjectException e) {
+ return theStorage.selectByWhereClause(whereClause, null, offset, limit);
+ }
+ catch (StorageObjectException e){
throw new ModuleException(e.toString());
}
- }
+ }
-}
+ public SimpleList getUsersAsSimpleList() throws ModuleException {
+ try {
+ return ((DatabaseUsers)theStorage).getPopupData();
+ }
+ catch(StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package mircoders.servlet;
+
+import java.util.*;
+import java.io.*;
+
+import org.apache.struts.util.MessageResources;
+
+import mir.entity.*;
+import mir.entity.adapter.*;
+import mir.generator.*;
+import mir.servlet.*;
+import mir.util.*;
+
+import mircoders.global.*;
+
+
+
+public class ServletHelper {
+// ML: add logging!
+
+ static Map makeGenerationData(Locale aLocale) throws ServletModuleException {
+ try {
+ MessageResources messages;
+ Map result = new HashMap();
+
+ MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result);
+ messages = MessageResources.getMessageResources("bundles.admin");
+
+ result.put( "lang", new ResourceBundleGeneratorFunction( aLocale, messages));
+
+ return result;
+ }
+ catch (Throwable t) {
+ throw new ServletModuleException(t.getMessage());
+ }
+ }
+
+ static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleException {
+
+ Generator generator;
+
+ try {
+ generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);
+
+ generator.generate(aWriter, aGenerationData, new PrintWriter(new NullWriter()));
+ }
+ catch (Throwable t) {
+ throw new ServletModuleException(t.getMessage());
+ }
+ }
+}
\ No newline at end of file
package mircoders.servlet;
-import mir.misc.Logfile;
import mir.misc.MirConfig;
import mir.servlet.ServletModule;
import mir.storage.StorageObjectException;
+import mir.log.*;
+
import mircoders.module.ModuleUploadedMedia;
import mircoders.storage.DatabaseAudio;
return instance;
}
-
private ServletModuleAudio() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Audio.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Audio");
templateListString = MirConfig.getProp("ServletModule.Audio.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Audio.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Audio.ConfirmTemplate");
//dbRights = DatabaseRights.getInstance();
}
catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodule audio could not be initialized");
+ logger.error("servletmodule audio could not be initialized: " + e.getMessage());
}
}
}
import javax.servlet.http.*;
import javax.servlet.*;
import freemarker.template.*;
+
import mir.servlet.*;
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
import mir.module.*;
+import mir.log.*;
+
import mircoders.module.*;
import mircoders.storage.*;
public class ServletModuleBreaking extends ServletModule
{
- // Singelton / Kontruktor
-
- private static ServletModuleBreaking instance = new ServletModuleBreaking();
- public static ServletModule getInstance() { return instance; }
+// Singelton / Kontruktor
- private ServletModuleBreaking() {
+ private static ServletModuleBreaking instance = new ServletModuleBreaking();
+ public static ServletModule getInstance() { return instance; }
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Breaking.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Breaking.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Breaking.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Breaking.ConfirmTemplate");
- try {
+ private ServletModuleBreaking() {
+ logger = new LoggerWrapper("ServletModule.Breaking");
+ templateListString = MirConfig.getProp("ServletModule.Breaking.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Breaking.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Breaking.ConfirmTemplate");
+ try {
DatabaseBreaking dbb = DatabaseBreaking.getInstance();
- mainModule = new ModuleBreaking(dbb);
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("ServletModuleBreaking konnte nicht initialisiert werden");
- }
- }
+ mainModule = new ModuleBreaking(dbb);
+ }
+ catch (StorageObjectException e) {
+ logger.error("Initializatoin of ServletModuleBreaking failed!: " + e.getMessage());
+ }
+ }
- public void list(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- theLog.printDebugInfo("-- breaking: list");
- // fetch and deliver
- try {
- SimpleHash mergeData = new SimpleHash();
- String offset = req.getParameter("offset");
- if (offset==null || offset.equals("")) offset="0";
- mergeData.put("offset",offset);
- EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
- 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());
+ public void list(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ logger.debug("-- breaking: list");
+// fetch and deliver
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ String offset = req.getParameter("offset");
+ if (offset==null || offset.equals("")) offset="0";
+ mergeData.put("offset",offset);
+ EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
+ 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());
- // raus damit
- HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
- }
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
+// raus damit
+ HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+ }
+ catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+ catch (IOException e) {throw new ServletModuleException(e.toString());}
+ catch (Exception e) {throw new ServletModuleException(e.toString());}
+ }
}
import java.sql.*;
import java.util.*;
import java.net.*;
+
import javax.servlet.*;
import javax.servlet.http.*;
+
import org.apache.struts.util.MessageResources;
import freemarker.template.*;
import mir.entity.*;
import mir.entity.adapter.*;
import mir.util.*;
+import mir.log.*;
import mircoders.storage.*;
import mircoders.global.*;
public static ServletModule getInstance() { return instance; }
private ServletModuleComment() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Comment.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Comment");
templateListString = MirConfig.getProp("ServletModule.Comment.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Comment.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Comment.ConfirmTemplate");
moduleContent = new ModuleContent(DatabaseContent.getInstance());
}
catch (StorageObjectException e) {
- theLog.printError("servletmodule: comment could not be initialized");
+ logger.error("servletmodule comment could not be initialized:" + e.getMessage());
}
}
isFirst=false;
}
- theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
+ logger.debug("list comments: whereclause = " + whereClause + ", order = " + order + ", offset = " + offset);
// fetch und ausliefern
try {
import javax.servlet.*;
import javax.servlet.http.*;
+import org.apache.struts.util.MessageResources;
import freemarker.template.*;
import mir.misc.*;
import mir.storage.*;
import mir.entity.*;
+import mir.util.*;
+import mir.entity.adapter.*;
+import mir.log.*;
+import mircoders.global.*;
import mircoders.storage.*;
import mircoders.module.*;
import mircoders.entity.*;
-
/*
* ServletModuleContent -
* deliver html for the article admin form.
*
- * @version $Id: ServletModuleContent.java,v 1.22 2002/11/04 04:35:22 mh Exp $
+ * @version $Id: ServletModuleContent.java,v 1.23 2002/11/29 13:43:42 zapata Exp $
* @author rk, mir-coders
*
*/
static String templateOpString;
- // Singelton / Kontruktor
+// Singelton / Kontruktor
private static ServletModuleContent instance = new ServletModuleContent();
public static ServletModule getInstance() { return instance; }
private ServletModuleContent() {
+ logger = new LoggerWrapper("ServletModule.Content");
try {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile"));
templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
- //templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
+//templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Content.ConfirmTemplate");
mainModule = new ModuleContent(DatabaseContent.getInstance());
themenModule = new ModuleTopics(DatabaseTopics.getInstance());
schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
imageModule = new ModuleImages(DatabaseImages.getInstance());
- } catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodulecontent konnte nicht initialisiert werden");
+ }
+ catch (StorageObjectException e) {
+ logger.error("servletmodulecontent konnte nicht initialisiert werden");
}
}
- // Methoden
+// Methoden
public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
- try {
- EntityUsers user = _getUser(req);
- EntityList theList;
- String offsetParam = req.getParameter("offset");
- int offset =0;
+ EntityUsers user = _getUser(req);
+ String offsetParam = req.getParameter("offset");
+ String whereParam = req.getParameter("where");
+ String orderParam = req.getParameter("order");
- // hier offsetcode bearbeiteb
- if (offsetParam != null && !offsetParam.equals(""))
- offset = Integer.parseInt(offsetParam);
+ int offset =0;
- if (req.getParameter("next") != null)
- offset=Integer.parseInt(req.getParameter("nextoffset"));
- else
- if (req.getParameter("prev") != null)
- offset = Integer.parseInt(req.getParameter("prevoffset"));
+ if (offsetParam != null && !offsetParam.equals(""))
+ offset = Integer.parseInt(offsetParam);
- String whereParam = req.getParameter("where");
- String orderParam = req.getParameter("order");
+ if (req.getParameter("next") != null)
+ offset=Integer.parseInt(req.getParameter("nextoffset"));
+ else
+ if (req.getParameter("prev") != null)
+ offset = Integer.parseInt(req.getParameter("prevoffset"));
- theList = ((ModuleContent)mainModule).getContent(whereParam, orderParam, offset, user);
- _list(theList, req, res);
- } catch (ModuleException e) {
- throw new ServletModuleException(e.toString());
- }
+
+
+ returnArticleList(req, res, whereParam, orderParam, offset);
}
public void listop(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
- try {
- EntityUsers user = _getUser(req);
- EntityList theList;
- String offsetParam = req.getParameter("offset");
- int offset =0;
+ EntityUsers user = _getUser(req);
+ String offsetParam = req.getParameter("offset");
+ int offset =0;
- String whereParam = req.getParameter("where");
+ String whereParam = req.getParameter("where");
- if (whereParam==null) whereParam = "to_article_type='0'";
+ if (whereParam==null) whereParam = "to_article_type='0'";
- // hier offsetcode bearbeiteb
- if (offsetParam != null && !offsetParam.equals(""))
- offset = Integer.parseInt(offsetParam);
+// hier offsetcode bearbeiteb
+ if (offsetParam != null && !offsetParam.equals(""))
+ offset = Integer.parseInt(offsetParam);
- if (req.getParameter("next") != null)
- offset=Integer.parseInt(req.getParameter("nextoffset"));
- else
- if (req.getParameter("prev") != null)
- offset = Integer.parseInt(req.getParameter("prevoffset"));
+ if (req.getParameter("next") != null)
+ offset=Integer.parseInt(req.getParameter("nextoffset"));
+ else
+ if (req.getParameter("prev") != null)
+ offset = Integer.parseInt(req.getParameter("prevoffset"));
- String orderParam = req.getParameter("order");
+ String orderParam = req.getParameter("order");
- theList = ((ModuleContent)mainModule).getContent(whereParam, orderParam, offset, user);
- _list(theList, req, res);
- } catch (ModuleException e) {
- throw new ServletModuleException(e.toString());
- }
+ returnArticleList(req, res, whereParam, orderParam, offset);
}
public void search(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException {
+ throws ServletModuleException {
try {
EntityUsers user = _getUser(req);
EntityList theList;
String orderParam = req.getParameter("order");
theList = ((ModuleContent)mainModule).getContentByField(fieldParam, fieldValueParam, orderParam, 0, user);
- _list(theList, req, res);
+ returnArticleList(req, res, "lower("+ fieldParam + ") like lower('%" + StringUtil.quote(fieldValueParam) + "%')", orderParam, 0);
} catch (ModuleException e) {
throw new ServletModuleException(e.toString());
}
}
public void add(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException {
+ throws ServletModuleException {
_showObject(null, req, res);
}
public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
- //theLog.printDebugInfo(":: content :: trying to insert");
+//theLog.printDebugInfo(":: content :: trying to insert");
try {
EntityUsers user = _getUser(req);
HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
- //theLog.printDebugInfo(":: content :: got intersecting values");
+//theLog.printDebugInfo(":: content :: got intersecting values");
String now = StringUtil.date2webdbDate(new GregorianCalendar());
withValues.put("date", now);
withValues.put("publish_path", StringUtil.webdbDate2path(now));
String id = mainModule.add(withValues);
DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));
- //theLog.printDebugInfo(":: content :: inserted");
+//theLog.printDebugInfo(":: content :: inserted");
_showObject(id, req, res);
}
catch (StorageObjectException e) {
public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
-
EntityUsers user = _getUser(req);
- // hier pruefen ob dem akt. user loeschen erlaubt ist...
+// hier pruefen ob dem akt. user loeschen erlaubt ist...
String idParam = req.getParameter("id");
- if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
+ if (idParam == null) throw new ServletModuleException("Invalid call: id missing");
String confirmParam = req.getParameter("confirm");
String cancelParam = req.getParameter("cancel");
+ logger.info("where = " + req.getParameter("where"));
+
if (confirmParam == null && cancelParam == null) {
- // HTML Ausgabe zum Confirmen!
+// HTML Ausgabe zum Confirmen!
SimpleHash mergeData = new SimpleHash();
mergeData.put("module", "Content");
mergeData.put("infoString", "Content: " + idParam);
_showObject(idParam, req, res);
}
- // methods for attaching media file
+// methods for attaching media file
public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
String mediaIdParam = req.getParameter("mid");
entContent.attach(mediaIdParam);
}
catch(ModuleException e) {
- theLog.printError("smod content :: attach :: could not get entityContent");
+ logger.error("smod content :: attach :: could not get entityContent");
}
catch(StorageObjectException e) {
- theLog.printError("smod content :: attach :: could not get entityContent");
+ logger.error("smod content :: attach :: could not get entityContent");
}
_showObject(idParam, req, res);
public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
{
String cidParam = req.getParameter("cid");
- String midParam = req.getParameter("mid");
+ String midParam = req.getParameter("mid");
if (cidParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");
if (midParam == null) throw new ServletModuleException("smod content :: dettach :: mid missing");
entContent.dettach(cidParam,midParam);
}
catch(ModuleException e) {
- theLog.printError("smod content :: dettach :: could not get entityContent");
+ logger.error("smod content :: dettach :: could not get entityContent");
}
catch(StorageObjectException e) {
- theLog.printError("smod content :: dettach :: could not get entityContent");
+ logger.error("smod content :: dettach :: could not get entityContent");
}
_showObject(cidParam, req, res);
entContent.newswire();
}
catch(ModuleException e) {
- theLog.printError("smod content :: newswire :: could not get entityContent");
+ logger.error("smod content :: newswire :: could not get entityContent");
}
catch(StorageObjectException e) {
- theLog.printError("smod content :: dettach :: could not get entityContent");
+ logger.error("smod content :: dettach :: could not get entityContent");
}
list(req, res);
public void update(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
+ throws ServletModuleException
{
try {
EntityUsers user = _getUser(req);
- if (user==null) theLog.printDebugInfo("user null!");
+ if (user==null) logger.debug("user null!");
String idParam = req.getParameter("id");
if (idParam == null) throw new ServletModuleException("Wrong call: (id) is missing");
HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());
String[] topic_id = req.getParameterValues("to_topic");
String content_id = req.getParameter("id");
- // withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
+// withValues.put("publish_path", StringUtil.webdbDate2path((String)withValues.get("date")));
if(user != null) withValues.put("user_id", user.getId());
withValues.put("is_produced", "0");
if (!withValues.containsKey("is_published"))
// if (withValues.get("creator").toString().equals(""))
// withValues.put("creator","Anonym");
- //theLog.printDebugInfo("updating. ");
+//theLog.printDebugInfo("updating. ");
String id = mainModule.set(withValues);
DatabaseContentToTopics.getInstance().setTopics(req.getParameter("id"),topic_id);
- //theLog.printDebugInfo("update done. ");
+//theLog.printDebugInfo("update done. ");
String whereParam = req.getParameter("where");
String orderParam = req.getParameter("order");
if ((whereParam!=null && !whereParam.equals("")) || (orderParam!=null && !orderParam.equals(""))){
}
}
- /*
- * HelperMethod shows the basic article editing form.
- *
- * if the "id" parameter is null, it means show an empty form to add a new
- * article.
- */
+/*
+ * HelperMethod shows the basic article editing form.
+ *
+ * if the "id" parameter is null, it means show an empty form to add a new
+ * article.
+*/
private void _showObject(String id, HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException {
+ throws ServletModuleException {
SimpleHash extraInfo = new SimpleHash();
try {
withValues.put("login_user", user);
entContent = withValues;
}
-
+
extraInfo.put("themenPopupData", themenModule.getTopicsAsSimpleList());
try {
- extraInfo.put("articletypePopupData",
- DatabaseArticleType.getInstance().getPopupData());
- } catch (Exception e) {
- theLog.printError("articletype could not be fetched.");
+ extraInfo.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
+ }
+ catch (Exception e) {
+ logger.error("articletype could not be fetched.");
}
try {
extraInfo.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
- } catch (Exception e) {
- theLog.printError("language-popup could not be fetched.");
+ }
+ catch (Exception e) {
+ logger.error("language-popup could not be fetched.");
}
extraInfo.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
- // hier code um zur liste zurueckzukommen
+// hier code um zur liste zurueckzukommen
String offsetParam, whereParam, orderParam;
if ((offsetParam = req.getParameter("offset"))!=null) extraInfo.put("offset", offsetParam);
if ((whereParam = req.getParameter("where"))!=null) extraInfo.put("where", whereParam);
}
}
+ public void returnArticleList(HttpServletRequest aRequest, HttpServletResponse aResponse,
+ String aWhereClause, String anOrderByClause, int anOffset) throws ServletModuleException {
+ // ML: experiment in using the producer's generation system instead of the
+ // old one...
- public void _list(EntityList theList, HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException {
+ EntityAdapterModel model;
+ int nrArticlesPerPage = 30;
+ int count;
try {
- // hier dann htmlcode rausschreiben
- if (theList == null || theList.getCount() == 0 || theList.getCount()>1) {
- SimpleHash modelRoot = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(theList);
- modelRoot.put("themenHashData", themenModule.getHashData());
- modelRoot.put("schwerpunktHashData", schwerpunktModule.getHashData());
- modelRoot.put("articletypeHash", DatabaseArticleType.getInstance().getHashData());
- deliver(req, res, modelRoot, templateListString);
- } else { // count = 1
- _showObject(theList.elementAt(0).getId(),req,res);
- }
- } catch (StorageObjectException e) {
- throw new ServletModuleException(e.toString());
- }
- }
+ Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));
+ model = MirGlobal.localizer().dataModel().adapterModel();
- public void _listop(EntityList theList, HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException {
+ Object contentList =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( aWhereClause, anOrderByClause, 20,
+ MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)
+ );
- try {
- // delivering html
- if (theList == null || theList.getCount() == 0 || theList.getCount()>1) {
- SimpleHash modelRoot = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(theList);
- modelRoot.put("articletypeHash", DatabaseArticleType.getInstance().getHashData());
-
- EntityContent currentContent;
- EntityList upMediaEntityList;
- EntityList imageEntityList;
- EntityList currentMediaList;
- Entity mediaType;
- EntityMedia uploadedMedia;
- SimpleList opList;
- String imageRoot = MirConfig.getProp("Producer.ImageRoot");
-
- SimpleHash contentHash;
- Class mediaHandlerClass=null;
- MirMedia mediaHandler=null;
- String mediaHandlerName=null;
- Database mediaStorage=null;
- String tinyIcon;
- String iconAlt;
-
- for (int i=0; i < theList.size();i++) {
- currentContent = (EntityContent)theList.elementAt(i);
- //fetching/setting the images
- upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
- tinyIcon = null;
- iconAlt = null;
- mediaHandler = null;
- mediaHandlerName = null;
- for (int n=0; n < upMediaEntityList.size();n++) {
- uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
- mediaType = uploadedMedia.getMediaType();
-
- //must of had a non-existant to_media_type entry..
- //let's save our ass.
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- } catch (Exception e) {
- theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
- }
-
- //the "best" media type to show
- if (mediaHandler.isVideo()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
- iconAlt = "Video";
- break;
- } else if (mediaHandler.isAudio()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
- iconAlt = "Audio";
- } else if (tinyIcon == null && !mediaHandler.isImage()) {
- tinyIcon = mediaHandler.getTinyIconName();
- iconAlt = mediaHandler.getIconAltName();
- }
- }
- }
- //it only has image(s)
- if (tinyIcon == null) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
- iconAlt = "Image";
- }
-
- // uploadedMedia Entity list is empty.
- // we only have text
- } else {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyText");
- iconAlt = "Text";
- }
+ responseData.put("nexturl", null);
+ responseData.put("prevurl", null);
+
+ count=mainModule.getSize(aWhereClause);
- try{
- //mediaList = HTMLTemplateProcessor.makeSimpleList(upMediaEntityList);
- contentHash = (SimpleHash)theList.get(i);
- contentHash.put("tiny_icon", imageRoot+"/"+tinyIcon);
- contentHash.put("icon_alt", iconAlt);
- } catch (Exception e){}
+ if (count>=anOffset+nrArticlesPerPage) {
+ responseData.put("nexturl" ,
+ "module=Content&do=list&where=" + HTMLRoutines.encodeURL(aWhereClause) +
+ "&order=" + HTMLRoutines.encodeURL(anOrderByClause) +
+ "&offset=" + anOffset + nrArticlesPerPage);
+ }
+ if (anOffset>0) {
+ responseData.put("prevurl" ,
+ "module=Content&do=list&where=" + HTMLRoutines.encodeURL(aWhereClause) +
+ "&order=" + HTMLRoutines.encodeURL(anOrderByClause) +
+ "&offset=" + Math.max(anOffset - nrArticlesPerPage, 0));
}
+ responseData.put("articles", contentList);
- deliver(req, res, modelRoot, templateListString);
- } else { // count = 1
- _showObject(theList.elementAt(0).getId(), req, res);
- }
- } catch (StorageObjectException e) {
+ responseData.put("thisurl" ,
+ "module=Content&do=list&where=" + HTMLRoutines.encodeURL(aWhereClause) +
+ "&order=" + HTMLRoutines.encodeURL(anOrderByClause) +
+ "&offset=" + anOffset);
+
+ responseData.put("from" , Integer.toString(anOffset+1));
+ responseData.put("count", Integer.toString(count));
+ responseData.put("to", Integer.toString(Math.min(anOffset+nrArticlesPerPage, count)));
+ responseData.put("offset" , Integer.toString(anOffset));
+ responseData.put("order", anOrderByClause);
+ responseData.put("where" , aWhereClause);
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "contentlist.template");
+ }
+ catch (Throwable e) {
throw new ServletModuleException(e.toString());
}
}
return (EntityUsers)session.getAttribute("login.uid");
}
}
-
import java.io.*;
import java.net.*;
+
import javax.servlet.http.*;
import javax.servlet.*;
+
import freemarker.template.*;
+
import mir.servlet.*;
import mir.misc.*;
import mir.misc.FileExtFilter;
+import mir.log.*;
/*
* ServletModuleFileEdit -
* Allows one to do a basic edit of a file in a directory specified
* in the config file.
*
- * @author $Author: mh $
- * @version $Revision: 1.2 $ $Date: 2002/09/01 22:05:57 $
+ * @author $Author: zapata $
+ * @version $Revision: 1.3 $ $Date: 2002/11/29 13:43:42 $
*
*/
public class ServletModuleFileEdit extends ServletModule
{
- // Singelton / Kontruktor
+// Singelton / Kontruktor
- private static ServletModuleFileEdit instance =
- new ServletModuleFileEdit();
- public static ServletModule getInstance() { return instance; }
+ private static ServletModuleFileEdit instance =
+ new ServletModuleFileEdit();
+ public static ServletModule getInstance() { return instance; }
private String _dirName;
private String _extName;
- private ServletModuleFileEdit() {
-
- theLog = Logfile.getInstance(
- MirConfig.getPropWithHome("ServletModule.FileEdit.Logfile"));
- _dirName = MirConfig.getProp("ServletModule.FileEdit.FileDirectory");
- _extName = MirConfig.getProp("ServletModule.FileEdit.ExtFilter");
-
- templateListString =
- MirConfig.getProp("ServletModule.FileEdit.ListTemplate");
- templateObjektString =
- MirConfig.getProp("ServletModule.FileEdit.ObjektTemplate");
- templateConfirmString =
- MirConfig.getProp("ServletModule.FileEdit.ConfirmTemplate");
- }
-
- public void list(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- // fetch and deliver
- try {
- SimpleHash mergeData = new SimpleHash();
- String offset = req.getParameter("offset");
- if (offset==null || offset.equals("")) offset="0";
- mergeData.put("offset",offset);
+ private ServletModuleFileEdit() {
+
+ logger = new LoggerWrapper("ServletModule.FileEdit");
+
+ _dirName = MirConfig.getProp("ServletModule.FileEdit.FileDirectory");
+ _extName = MirConfig.getProp("ServletModule.FileEdit.ExtFilter");
+
+ templateListString =
+ MirConfig.getProp("ServletModule.FileEdit.ListTemplate");
+ templateObjektString =
+ MirConfig.getProp("ServletModule.FileEdit.ObjektTemplate");
+ templateConfirmString =
+ MirConfig.getProp("ServletModule.FileEdit.ConfirmTemplate");
+ }
+
+ public void list(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+// fetch and deliver
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ String offset = req.getParameter("offset");
+ if (offset==null || offset.equals("")) offset="0";
+ mergeData.put("offset",offset);
File dir = new File(_dirName);
System.out.println("DIRNAME: "+_dirName);
FileExtFilter extFilter = new FileExtFilter(_extName);
}
mergeData.put("filelist",theList);
- // raus damit
- HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
- }
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
+ HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+ }
+ catch (IOException e) {throw new ServletModuleException(e.toString());}
+ catch (Exception e) {throw new ServletModuleException(e.toString());}
+ }
public void edit(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
+ throws ServletModuleException
{
String filename = req.getParameter("filename");
if (filename == null) throw new ServletModuleException("No filename specified");
withValues.put("text", out.toString());
withValues.put("filename", filename);
-
+
deliver(req, res, withValues, null, templateObjektString);
} catch (Exception e) {
throw new ServletModuleException(e.toString());
}
public void update(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
+ throws ServletModuleException
{
String filename = req.getParameter("filename");
if (filename == null) throw new ServletModuleException("No filename specified");
throw new ServletModuleException(e.toString());
}
}
-
-
}
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
-
import mir.entity.*;
+import mir.log.*;
+
import mircoders.storage.*;
import mircoders.module.*;
public class ServletModuleHidden extends ServletModule
{
- // Singelton / Kontruktor
- private static ServletModuleHidden instance = new ServletModuleHidden();
- public static ServletModule getInstance() { return instance; }
-
- private ServletModuleHidden() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Hidden.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Hidden.ListTemplate");
- try {
- mainModule = new ModuleContent(DatabaseContent.getInstance());
- }
- catch (StorageObjectException e) {
- theLog.printError("servletmoduleHidden could not be initialized");
- }
- }
-
-
- public void list(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- // Parameter auswerten
- SimpleHash mergeData = new SimpleHash();
- String query_year = req.getParameter("year");
- String query_month = req.getParameter("month");
- String order = "webdb_create";
-
- // sql basteln
- String whereClause = "is_published=false AND webdb_create LIKE '"+
- query_year+"-"+query_month+"%'";
-
- theLog.printDebugInfo("sql-whereclause: " + whereClause);
-
- // fetch und ausliefern
- try {
-
- if ((query_year!=null && !query_year.equals(""))
- && (query_month!=null && !query_month.equals(""))) {
- EntityList theList = mainModule.getByWhereClause(whereClause, order, -1);
- if (theList!=null && theList.size()>0) {
-
- //make articleHash for comment
- StringBuffer buf= new StringBuffer("id in (");boolean first=true;
- for(int i=0;i<theList.size();i++) {
- if (first==false) buf.append(",");
- first=false;
- buf.append(theList.elementAt(i).getValue("to_media"));
- }
- buf.append(")");
- SimpleHash articleHash =
- HTMLTemplateProcessor.makeSimpleHash(
- mainModule.getByWhereClause(buf.toString(),-1));
- mergeData.put("articleHash", articleHash);
-
- // send the year and month for use in the list template
- mergeData.put("year", query_year);
- mergeData.put("month", query_month);
- // get comment
- mergeData.put("contentlist",theList);
- }
- }
- // raus damit
- HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
- }
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
+// Singelton / Kontruktor
+ private static ServletModuleHidden instance = new ServletModuleHidden();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleHidden() {
+ logger = new LoggerWrapper("ServletModule.Hidden");
+ templateListString = MirConfig.getProp("ServletModule.Hidden.ListTemplate");
+ try {
+ mainModule = new ModuleContent(DatabaseContent.getInstance());
+ }
+ catch (StorageObjectException e) {
+ logger.error("initialization of servletmoduleHidden failed: " + e.getMessage());
+ }
+ }
+
+
+ public void list(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+// determine parameter
+ SimpleHash mergeData = new SimpleHash();
+ String query_year = req.getParameter("year");
+ String query_month = req.getParameter("month");
+ String order = "webdb_create";
+
+// form sql statement
+ String whereClause = "is_published=false AND webdb_create LIKE '"+
+ query_year+"-"+query_month+"%'";
+
+ logger.debug("ServletModuleHidden.list: whereclause: " + whereClause);
+
+// fetch and deliver
+ try {
+
+ if ((query_year!=null && !query_year.equals(""))
+ && (query_month!=null && !query_month.equals(""))) {
+ EntityList theList = mainModule.getByWhereClause(whereClause, order, -1);
+ if (theList!=null && theList.size()>0) {
+
+//make articleHash for comment
+ StringBuffer buf= new StringBuffer("id in (");boolean first=true;
+ for(int i=0;i<theList.size();i++) {
+ if (first==false) buf.append(",");
+ first=false;
+ buf.append(theList.elementAt(i).getValue("to_media"));
+ }
+ buf.append(")");
+ SimpleHash articleHash =
+ HTMLTemplateProcessor.makeSimpleHash(
+ mainModule.getByWhereClause(buf.toString(),-1));
+ mergeData.put("articleHash", articleHash);
+
+// send the year and month for use in the list template
+ mergeData.put("year", query_year);
+ mergeData.put("month", query_month);
+// get comment
+ mergeData.put("contentlist",theList);
+ }
+ }
+// raus damit
+ HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+ }
+ catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+ catch (IOException e) {throw new ServletModuleException(e.toString());}
+ catch (Exception e) {throw new ServletModuleException(e.toString());}
+ }
}
import com.oreilly.servlet.multipart.*;
import com.oreilly.servlet.*;
+import mir.log.*;
import mir.servlet.*;
import mir.module.*;
import mir.misc.*;
/*
* ServletModuleImages -
- * liefert HTML fuer Images
*
- * @version $Id: ServletModuleImages.java,v 1.23 2002/11/27 08:57:32 mh Exp $
+ * @version $Id: ServletModuleImages.java,v 1.24 2002/11/29 13:43:42 zapata Exp $
* @author RK, the mir-coders group
*/
public class ServletModuleImages extends ServletModuleUploadedMedia
{
-
- //private static DatabaseRights dbRights;
-
// Singelton / Kontruktor
private static ServletModuleImages instance = new ServletModuleImages();
public static ServletModule getInstance() { return instance; }
private ServletModuleImages() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Images.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Images");
templateListString = MirConfig.getProp("ServletModule.Images.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Images.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Images.ConfirmTemplate");
+
try {
mainModule = new ModuleImages(DatabaseImages.getInstance());
- //dbRights = DatabaseRights.getInstance();
}
catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodulebilder konnte nicht initialisiert werden");
+ logger.error("Initialization of ServletModuleImages failed!: " + e.getMessage());
}
}
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
public class ServletModuleLanguage extends ServletModule
{
-
- // Singelton / Kontruktor
private static ServletModuleLanguage instance = new ServletModuleLanguage();
public static ServletModule getInstance() { return instance; }
private ServletModuleLanguage() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Language.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Language");
+
templateListString = MirConfig.getProp("ServletModule.Language.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Language.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Language.ConfirmTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Language.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Language.ConfirmTemplate");
try {
mainModule = new ModuleLanguage(DatabaseLanguage.getInstance());
- } catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodulelanguage konnte nicht initialisiert werden");
+ }
+ catch (StorageObjectException e) {
+ logger.error("Initialization of ServletModuleLanguage failed: " + e.getMessage());
}
}
-}
+}
\ No newline at end of file
package mircoders.servlet;
import freemarker.template.SimpleHash;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URLEncoder;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import mir.entity.EntityList;
import mir.misc.HTMLParseException;
import mir.misc.HTMLTemplateProcessor;
import mir.servlet.ServletModule;
import mir.servlet.ServletModuleException;
import mir.storage.StorageObjectException;
+import mir.log.*;
+
import mircoders.module.ModuleLanguage;
import mircoders.module.ModuleLinksImcs;
import mircoders.storage.DatabaseLanguage;
import mircoders.storage.DatabaseLinksImcs;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URLEncoder;
-
/*
* ServletModuleLinksImcs -
* liefert HTML fuer LinksImcs
private ServletModuleLinksImcs() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.LinksImcs.Logfile"));
+ logger = new LoggerWrapper("ServletModule.LinksImcs");
templateListString = MirConfig.getProp("ServletModule.LinksImcs.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.LinksImcs.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.LinksImcs.ConfirmTemplate");
languageModule = new ModuleLanguage(DatabaseLanguage.getInstance());
}
catch (StorageObjectException e) {
- theLog.printDebugInfo("ServletModuleLinksImcs konnte nicht initialisiert werden");
+ logger.error("Initialization of ServletModuleLinksImcs failed!: " + e.getMessage());
}
}
/**
* Title: Mir
- * Description: liefert Webseiten zur Verwaltung von Mediafoldern aus.
+ * Description:
* @author rk
* @version 02
*/
import java.util.*;
+
import javax.servlet.http.*;
+
import freemarker.template.*;
import mir.servlet.*;
import mir.misc.*;
import mir.storage.*;
+import mir.log.*;
+
import mircoders.storage.*;
import mircoders.module.*;
public class ServletModuleMediafolder extends ServletModule
{
+ public static ServletModule getInstance() { return instance; }
+ private static ServletModuleMediafolder instance = new ServletModuleMediafolder();
+
+ private ServletModuleMediafolder() {
+ logger = new LoggerWrapper("ServletModule.Mediafolder");
- // Singelton / Kontruktor
- public static ServletModule getInstance() { return instance; }
- private static ServletModuleMediafolder instance = new ServletModuleMediafolder();
+ templateListString = MirConfig.getProp("ServletModule.Mediafolder.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Mediafolder.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Mediafolder.ConfirmTemplate");
- private ServletModuleMediafolder() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Mediafolder.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Mediafolder.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Mediafolder.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Mediafolder.ConfirmTemplate");
- try {
- mainModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("ServletModuleMediafolder konnte nicht initialisiert werden");
- }
- }
+ try {
+ mainModule = new ModuleMediafolder(DatabaseMediafolder.getInstance());
+ }
+ catch (StorageObjectException e) {
+ logger.error("Failed to initialize ServletModuleMediafolder: " + e.getMessage());
+ }
+ }
- public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
- SimpleHash mergeData = new SimpleHash();
- mergeData.put("new", "1");
- String now = StringUtil.date2webdbDate(new GregorianCalendar());
- // date auf now
- mergeData.put("date", new SimpleScalar(now));
- deliver(req, res, mergeData, templateObjektString);
- }
+ public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+ SimpleHash mergeData = new SimpleHash();
+ mergeData.put("new", "1");
+ String now = StringUtil.date2webdbDate(new GregorianCalendar());
+// date auf now
+ mergeData.put("date", new SimpleScalar(now));
+ deliver(req, res, mergeData, templateObjektString);
+ }
}
\ No newline at end of file
import java.io.*;
import java.net.*;
+
import javax.servlet.http.*;
import javax.servlet.*;
+
import freemarker.template.*;
+
import mir.servlet.*;
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
import mir.module.*;
+import mir.log.*;
+
import mircoders.module.*;
import mircoders.storage.*;
/**
- * Title: ServletModuleMessage
+ * Title: ServletModuleMessage
* Description:
- * Copyright: Copyright (c) 2001
- * Company: Indymedia
+ * Copyright: Copyright (c) 2001-2002
+ * Company: mir-coders
* @author
* @version 1.0
*/
public class ServletModuleMessage extends ServletModule
{
- // Singelton / Kontruktor
-
- private static ServletModuleMessage instance = new ServletModuleMessage();
- public static ServletModule getInstance() { return instance; }
-
- private ServletModuleMessage() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Messages.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Messages.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Messages.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Messages.ConfirmTemplate");
- try {
- mainModule = new ModuleMessage(DatabaseMessages.getInstance());
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("ServletModuleMessage konnte nicht initialisiert werden");
- }
- }
-
- public void list(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- // fetch and deliver
- try {
- SimpleHash mergeData = new SimpleHash();
- String offset = req.getParameter("offset");
- if (offset==null || offset.equals("")) offset="0";
- mergeData.put("offset",offset);
- EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
- 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());
-
- // raus damit
- HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
-
- }
- catch (ModuleException e) {throw new ServletModuleException(e.toString());}
- catch (IOException e) {throw new ServletModuleException(e.toString());}
- catch (Exception e) {throw new ServletModuleException(e.toString());}
- }
+ // Singelton / Kontruktor
+
+ private static ServletModuleMessage instance = new ServletModuleMessage();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleMessage() {
+ logger = new LoggerWrapper("ServletModule.Messages");
+
+ templateListString = MirConfig.getProp("ServletModule.Messages.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Messages.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Messages.ConfirmTemplate");
+
+ try {
+ mainModule = new ModuleMessage(DatabaseMessages.getInstance());
+ }
+ catch (StorageObjectException e) {
+ logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage());
+ }
+ }
+
+ public void list(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+// fetch and deliver
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ String offset = req.getParameter("offset");
+ if (offset==null || offset.equals("")) offset="0";
+ mergeData.put("offset",offset);
+ EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
+ 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());
+
+ HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req));
+
+ }
+ catch (ModuleException e) {throw new ServletModuleException(e.toString());}
+ catch (IOException e) {throw new ServletModuleException(e.toString());}
+ catch (Exception e) {throw new ServletModuleException(e.toString());}
+ }
}
import mir.entity.*;
import mir.storage.*;
import mir.media.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.45 2002/11/27 15:40:25 john Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.46 2002/11/29 13:43:42 zapata Exp $
*
*/
private ServletModuleOpenIndy() {
try {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.OpenIndy.Logfile"));
+ logger = new LoggerWrapper("ServletModule.OpenIndy.Logfile");
commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
commentFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDupeTemplate");
}
catch (StorageObjectException e) {
- theLog.printError("servletmoduleopenindy could not be initialized");
+ logger.error("servletmoduleopenindy could not be initialized");
}
}
if (aid!=null && !aid.equals(""))
{
- SimpleHash mergeData = new SimpleHash();
-
- // onetimepasswd
- if(passwdProtection.equals("yes")){
- String passwd = this.createOneTimePasswd();
- System.out.println(passwd);
- HttpSession session = req.getSession(false);
- session.setAttribute("passwd",passwd);
- mergeData.put("passwd", passwd);
- }
-
- if (language!=null) {
- HttpSession session = req.getSession(false);
- session.setAttribute("Locale", new Locale(language, ""));
- session.setAttribute("passwd",language);
- }
-
- mergeData.put("aid", aid);
- deliver(req, res, mergeData, commentFormTemplate);
+ SimpleHash mergeData = new SimpleHash();
+
+ // onetimepasswd
+ if(passwdProtection.equals("yes")){
+ String passwd = this.createOneTimePasswd();
+ System.out.println(passwd);
+ HttpSession session = req.getSession(false);
+ session.setAttribute("passwd",passwd);
+ mergeData.put("passwd", passwd);
+ }
+
+ if (language!=null) {
+ HttpSession session = req.getSession(false);
+ session.setAttribute("Locale", new Locale(language, ""));
+ session.setAttribute("passwd",language);
+ }
+
+ mergeData.put("aid", aid);
+ deliver(req, res, mergeData, commentFormTemplate);
}
else throw new ServletModuleException("aid not set!");
}
String aid = req.getParameter("to_media"); // the article id the comment will belong to
if (aid!=null && !aid.equals(""))
{
- // ok, collecting data from form
- try {
- HashMap withValues = getIntersectingValues(req, DatabaseComment.getInstance());
+ // ok, collecting data from form
+ try {
+ HashMap withValues = getIntersectingValues(req, DatabaseComment.getInstance());
- //no html in comments(for now)
- for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
+ //no html in comments(for now)
+ for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
String k=(String)i.next();
String v=(String)withValues.get(k);
withValues.put(k,StringUtil.removeHTMLTags(v));
- }
- withValues.put("is_published","1");
-
- //checking the onetimepasswd
- if(passwdProtection.equals("yes")){
- HttpSession session = req.getSession(false);
- String sessionPasswd = (String)session.getAttribute("passwd");
- if ( sessionPasswd == null){
- throw new ServletModuleUserException("Lost password");
- }
- String passwd = req.getParameter("passwd");
- if ( passwd == null || (!sessionPasswd.equals(passwd))) {
- throw new ServletModuleUserException("Missing password");
- }
- session.invalidate();
- }
-
- // inserting into database
- String id = mainModule.add(withValues);
- theLog.printDebugInfo("id: "+id);
- //insert was not successfull
- if(id==null){
- deliver(req, res, new SimpleHash(), commentFormDupeTemplate);
- } else {
- DatabaseContent.getInstance().setUnproduced("id="+aid);
-
- try {
- EntityComment comment = (EntityComment) DatabaseComment.getInstance().selectById(id);
- MirGlobal.localizer().openPostings().afterCommentPosting(comment);
- }
- catch (Throwable t) {
- throw new ServletModuleException(t.getMessage());
- }
-
-
-
- }
-
- // redirecting to url
- // should implement back to article
- SimpleHash mergeData = new SimpleHash();
- deliver(req, res, mergeData, commentFormDoneTemplate);
- }
- catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
- catch (ModuleException e) { throw new ServletModuleException(e.toString());}
+ }
+ withValues.put("is_published","1");
+
+ //checking the onetimepasswd
+ if(passwdProtection.equals("yes")){
+ HttpSession session = req.getSession(false);
+ String sessionPasswd = (String)session.getAttribute("passwd");
+ if ( sessionPasswd == null){
+ throw new ServletModuleUserException("Lost password");
+ }
+ String passwd = req.getParameter("passwd");
+ if ( passwd == null || (!sessionPasswd.equals(passwd))) {
+ throw new ServletModuleUserException("Missing password");
+ }
+ session.invalidate();
+ }
+
+ // inserting into database
+ String id = mainModule.add(withValues);
+ logger.debug("inscomment: id = "+id);
+ //insert was not successfull
+ if(id==null){
+ deliver(req, res, new SimpleHash(), commentFormDupeTemplate);
+ } else {
+ DatabaseContent.getInstance().setUnproduced("id="+aid);
+
+ try {
+ EntityComment comment = (EntityComment) DatabaseComment.getInstance().selectById(id);
+ MirGlobal.localizer().openPostings().afterCommentPosting(comment);
+ }
+ catch (Throwable t) {
+ throw new ServletModuleException(t.getMessage());
+ }
+
+
+
+ }
+
+ // redirecting to url
+ // should implement back to article
+ SimpleHash mergeData = new SimpleHash();
+ deliver(req, res, mergeData, commentFormDoneTemplate);
+ }
+ catch (StorageObjectException e) { throw new ServletModuleException(e.toString());}
+ catch (ModuleException e) { throw new ServletModuleException(e.toString());}
}
else throw new ServletModuleException("aid not set!");
extraInfo.put("topics", themenModule.getTopicsList());
- } catch (Exception e) {
- theLog.printError("languagePopUpData or getTopicslist failed "
- +e.toString());
+ }
+ catch (Exception e) {
+ logger.error("languagePopUpData or getTopicslist failed " + e.toString());
throw new ServletModuleException("OpenIndy -- failed getting language or topics: "+e.toString());
}
} catch (FileHandlerUserException e) {
throw new ServletModuleUserException(e.getMsg());
}
-
+
HashMap withValues = mp.getParameters();
//checking the onetimepasswd
if ((((String)withValues.get("title")).length() == 0) ||
(((String)withValues.get("description")).length() == 0) ||
(((String)withValues.get("content_data")).length() == 0))
- throw new ServletModuleUserException("Missing field");
+ throw new ServletModuleUserException("Missing field");
// call the routines that escape html
// inserting content into database
String cid = contentModule.add(withValues);
- theLog.printDebugInfo("id: "+cid);
+ logger.debug("insposting: id = "+cid);
//insert was not successfull
if(cid==null){
//How do we know that it was not succesful cause of a
try{
DatabaseContentToTopics.getInstance().setTopics(cid,to_topicsArr);
setTopic = true;
- } catch (Exception e) {
- theLog.printError("setting content_x_topic failed");
+ }
+ catch (Exception e) {
+ logger.error("setting content_x_topic failed");
contentModule.deleteById(cid);
throw new ServletModuleException("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString());
} //end try
} //end if
-
+
//if we're here all is ok... associate the media to the article
for(int i=0;i<mediaList.size();i++) {
Entity mediaEnt = (Entity)mediaList.elementAt(i);
try {
MirGlobal.localizer().openPostings().afterContentPosting(
- (EntityContent)contentModule.getById(cid));
+ (EntityContent)contentModule.getById(cid));
}
catch (Throwable t) {
throw new ServletModuleException(t.getMessage());
*/
public void search(HttpServletRequest req, HttpServletResponse res)
throws ServletModuleException, ServletModuleUserException {
-
+
String queryString="";
-
+
SimpleHash mergeData = new SimpleHash();
-
+
//make the query available to subsequent iterations
for (Enumeration theParams = req.getParameterNames(); theParams.hasMoreElements() ;) {
String pName=(String)theParams.nextElement();
if (pName.startsWith("search_")){
- mergeData.put(pName,new SimpleScalar(req.getParameter(pName)));
+ mergeData.put(pName,new SimpleScalar(req.getParameter(pName)));
}
}
-
+
try{
mergeData.put("topics", themenModule.getTopicsAsSimpleList());
}
catch(ModuleException e) {
- theLog.printDebugInfo("Can't get topics: " + e.toString());
+ logger.debug("search: Can't get topics: " + e.toString());
}
String indexPath=MirConfig.getProp("IndexPath");
-
+
KeywordSearchTerm dateTerm = new KeywordSearchTerm("date_formatted","search_date","webdb_create_formatted","webdbcreate_formatted","webdb_create_formatted");
-
+
UnIndexedSearchTerm whereTerm = new UnIndexedSearchTerm("","","","where","where");
-
+
TextSearchTerm creatorTerm = new TextSearchTerm("creator","search_creator","creator","creator","creator");
TextSearchTerm titleTerm = new TextSearchTerm("title","search_content","title","title","title");
TextSearchTerm descriptionTerm = new TextSearchTerm("description","search_content","description","description","description");
ContentSearchTerm contentTerm = new ContentSearchTerm("content_data","search_content","content","","");
TopicSearchTerm topicTerm = new TopicSearchTerm();
-
+
ImagesSearchTerm imagesTerm = new ImagesSearchTerm();
-
+
AudioSearchTerm audioTerm = new AudioSearchTerm();
-
+
VideoSearchTerm videoTerm = new VideoSearchTerm();
String creatorFragment = creatorTerm.makeTerm(req);
if (creatorFragment != null){
queryString = queryString + " +" + creatorFragment;
}
-
+
// search title, description, and content for something
// the contentTerm uses "search_boolean" to combine its terms
String contentFragment = contentTerm.makeTerm(req);
if (contentFragment != null){
- theLog.printDebugInfo("contentFragment: " + contentFragment);
+ logger.debug("search: contentFragment: " + contentFragment);
queryString = queryString + " +" + contentFragment;
}
-
+
String topicFragment = topicTerm.makeTerm(req);
if (topicFragment != null){
queryString = queryString + " +" + topicFragment;
if (imagesFragment != null){
queryString = queryString + " +" + imagesFragment;
}
-
+
String audioFragment = audioTerm.makeTerm(req);
if (audioFragment != null){
queryString = queryString + " +" + audioFragment;
}
-
+
String videoFragment = videoTerm.makeTerm(req);
if (videoFragment != null){
queryString = queryString + " +" + videoFragment;
queryString = "";
}
else{
-
+
try{
- Searcher searcher = null;
- try {
- searcher = new IndexSearcher(indexPath);
- }
- catch(IOException e) {
- theLog.printDebugInfo("Can't open indexPath: " + indexPath);
- throw new ServletModuleUserException("Problem with Search Index!");
- }
-
- // parse the query String.
- Query query = null;
- try {
- query = QueryParser.parse(queryString, "content", new StandardAnalyzer());
- }
- catch(Exception e) {
- searcher.close();
- theLog.printDebugInfo("Query don't parse: " + queryString);
- throw new ServletModuleUserException("Problem with Query String! (was '"+queryString+"')");
- }
-
- Hits hits = null;
- try {
- hits = searcher.search(query);
- } catch(IOException e) {
- searcher.close();
- theLog.printDebugInfo("Can't get hits: " + e.toString());
- throw new ServletModuleUserException("Problem getting hits!");
- }
-
-
- // this is what needs to change in order to get sorting by date
- // iterate over the results
- // the results are an array of document
- // associate this with session so we don't need to reduplicate searches
- // make a map from date to position
- // make an list of dates
- // sort list by date
- // grab low+n entries from the list of dates,
- // iterate over these, using hash to get hit position,
- // and hit position to get hit
- // shove hit into SimpleList of SimpleHashes
-
-
-
- try {
- int start = 0;
- int end = hits.length();
- mergeData.put("numberOfHits", (new Integer(end)).toString());
- SimpleList theHits = new SimpleList();
- for(int i = start; i < end; i++) {
- SimpleHash h = new SimpleHash();
- Document theHit = hits.doc(i);
- whereTerm.returnMeta(h,theHit);
- creatorTerm.returnMeta(h,theHit);
- titleTerm.returnMeta(h,theHit);
- descriptionTerm.returnMeta(h,theHit);
- dateTerm.returnMeta(h,theHit);
- imagesTerm.returnMeta(h,theHit);
- audioTerm.returnMeta(h,theHit);
- videoTerm.returnMeta(h,theHit);
- theHits.add(h);
- }
- mergeData.put("hits",theHits);
- }
- catch (Exception e) {
- searcher.close();
- theLog.printDebugInfo("Can't iterate over hits: " + e.toString());
- throw new ServletModuleUserException("Problem getting hits!");
- }
- searcher.close();
+ Searcher searcher = null;
+ try {
+ searcher = new IndexSearcher(indexPath);
+ }
+ catch(IOException e) {
+ logger.error("search: Can't open indexPath: " + indexPath + ": " + e.getMessage());
+ throw new ServletModuleUserException("Problem with Search Index!");
+ }
+
+ // parse the query String.
+ Query query = null;
+ try {
+ query = QueryParser.parse(queryString, "content", new StandardAnalyzer());
+ }
+ catch(Exception e) {
+ searcher.close();
+ logger.error("search: Query don't parse: " + queryString + ": " + e.getMessage());
+ throw new ServletModuleUserException("Problem with Query String! (was '"+queryString+"')");
+ }
+
+ Hits hits = null;
+ try {
+ hits = searcher.search(query);
+ } catch(IOException e) {
+ searcher.close();
+ logger.error("search: Can't get hits: " + e.getMessage());
+ throw new ServletModuleUserException("Problem getting hits!");
+ }
+
+
+ // this is what needs to change in order to get sorting by date
+ // iterate over the results
+ // the results are an array of document
+ // associate this with session so we don't need to reduplicate searches
+ // make a map from date to position
+ // make an list of dates
+ // sort list by date
+ // grab low+n entries from the list of dates,
+ // iterate over these, using hash to get hit position,
+ // and hit position to get hit
+ // shove hit into SimpleList of SimpleHashes
+
+
+
+ try {
+ int start = 0;
+ int end = hits.length();
+ mergeData.put("numberOfHits", (new Integer(end)).toString());
+ SimpleList theHits = new SimpleList();
+ for(int i = start; i < end; i++) {
+ SimpleHash h = new SimpleHash();
+ Document theHit = hits.doc(i);
+ whereTerm.returnMeta(h,theHit);
+ creatorTerm.returnMeta(h,theHit);
+ titleTerm.returnMeta(h,theHit);
+ descriptionTerm.returnMeta(h,theHit);
+ dateTerm.returnMeta(h,theHit);
+ imagesTerm.returnMeta(h,theHit);
+ audioTerm.returnMeta(h,theHit);
+ videoTerm.returnMeta(h,theHit);
+ theHits.add(h);
+ }
+ mergeData.put("hits",theHits);
+ }
+ catch (Exception e) {
+ searcher.close();
+ logger.error("search: Can't iterate over hits: " + e.getMessage());
+ throw new ServletModuleUserException("Problem getting hits!");
+ }
+ searcher.close();
}
catch (IOException e){
- theLog.printDebugInfo("Can't close searcher: " + e.toString());
- throw new ServletModuleUserException("Problem closing searcher!");
+ logger.error("search: Can't close searcher: " + e.toString());
+ throw new ServletModuleUserException("Problem closing searcher!");
}
}
mergeData.put("queryString",queryString);
deliver(req,res,mergeData,searchResultsTemplate);
}
-
+
/*
* Method for dynamically generating a pdf from a fo file
*/
public void getpdf(HttpServletRequest req, HttpServletResponse res)
throws ServletModuleException, ServletModuleUserException {
String ID_REQUEST_PARAM = "id";
-
+
String generateFO=MirConfig.getProp("GenerateFO");
String generatePDF=MirConfig.getProp("GeneratePDF");
//pregenerating PDF's
if (generateFO.equals("yes") && generatePDF.equals("no")){
//fop complains unless you do the logging this way
- Logger log = null;
+ org.apache.log.Logger log = null;
Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
log = hierarchy.getLoggerFor("fop");
log.setPriority(Priority.WARN);
-
+
String producerStorageRoot=MirConfig.getProp("Producer.StorageRoot");
String producerDocRoot=MirConfig.getProp("Producer.DocRoot");
String templateDir=MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir");
- String xslSheet=templateDir + "/"
+ String xslSheet=templateDir + "/"
+ MirConfig.getProp("Producer.PrintableContent.html2foStyleSheetName");
try {
String idParam = req.getParameter(ID_REQUEST_PARAM);
EntityContent contentEnt =
(EntityContent)contentModule.getById(idParam);
String publishPath = contentEnt.getValue("publish_path");
- String foFile = producerStorageRoot + producerDocRoot + "/"
- + publishPath + "/" + idParam + ".fo";
- XSLTInputHandler input = new XSLTInputHandler(new File(foFile),
- new File(xslSheet));
-
+ String foFile = producerStorageRoot + producerDocRoot + "/"
+ + publishPath + "/" + idParam + ".fo";
+ XSLTInputHandler input = new XSLTInputHandler(new File(foFile),
+ new File(xslSheet));
+
ByteArrayOutputStream out = new ByteArrayOutputStream();
res.setContentType("application/pdf");
throw new ServletModuleUserException("Missing id parameter.");
}
} catch (Exception ex) {
- throw new ServletModuleException(ex.toString());
+ throw new ServletModuleException(ex.toString());
}
} else {
throw new ServletModuleUserException("Can't generate a PDF because the config tells me not to.");
}
}
-
+
private void _throwBadContentType (String fileName, String contentType)
throws ServletModuleUserException {
- theLog.printDebugInfo("Wrong file type uploaded!: " + fileName+" "
- +contentType);
- throw new ServletModuleUserException("The file you uploaded is of the "
- +"following mime-type: "+contentType
- +", we do not support this mime-type. "
- +"Error One or more files of unrecognized type. Sorry");
+ logger.error("Wrong file type uploaded!: " + fileName + " (" + contentType + ")");
+ throw new ServletModuleUserException("A file you uploaded is of the "
+ +"following mime-type: " + contentType + ". Unfortunately we do not support this type. ");
}
protected String createOneTimePasswd(){
/* this is an overwritten method of ServletModule in order
to use different bundles for open and admin */
public void deliver(HttpServletRequest req, HttpServletResponse res,
- TemplateModelRoot rtm, TemplateModelRoot popups,
- String templateFilename)
+ TemplateModelRoot rtm, TemplateModelRoot popups,
+ String templateFilename)
throws ServletModuleException {
if (rtm == null) rtm = new SimpleHash();
try {
PrintWriter out = res.getWriter();
HTMLTemplateProcessor.process(res, templateFilename, rtm, popups, out,
- getLocale(req), "bundles.open");
+ getLocale(req), "bundles.open");
out.close();
} catch (HTMLParseException e) {
throw new ServletModuleException(e.toString());
package mircoders.servlet;
-import mir.misc.Logfile;
import mir.misc.MirConfig;
import mir.servlet.ServletModule;
import mir.storage.StorageObjectException;
+import mir.log.*;
+
import mircoders.module.ModuleUploadedMedia;
import mircoders.storage.DatabaseOther;
*/
public class ServletModuleOtherMedia extends ServletModuleUploadedMedia {
-
- //private static DatabaseRights dbRights;
-
// Singelton / Contructor
private static ServletModuleOtherMedia instance = new ServletModuleOtherMedia();
return instance;
}
-
private ServletModuleOtherMedia() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.OtherMedia.Logfile"));
+ logger = new LoggerWrapper("ServletModule.OtherMedia");
+
templateListString = MirConfig.getProp("ServletModule.OtherMedia.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.OtherMedia.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.OtherMedia.ConfirmTemplate");
//dbRights = DatabaseRights.getInstance();
}
catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodule otherMedia could not be initialized");
+ logger.error("servletmodule otherMedia could not be initialized: " + e.getMessage());
}
}
}
import mir.producer.*;
import mir.entity.adapter.*;
import mir.util.*;
+import mir.log.*;
import mircoders.global.*;
-/* Verteilerservlet, dass je nach Parameter task die Klasse Producer"TASK"
- * ueber die Methode handle(); aufruft
- *
- * @author RK
- */
-
public class ServletModuleProducer extends ServletModule
{
-
private static ServletModuleProducer instance = new ServletModuleProducer();
public static ServletModule getInstance() { return instance; }
}
private ServletModuleProducer() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Producer.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Producer");
defaultAction="showProducerQueueStatus";
}
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
import mircoders.module.*;
/*
- * ServletModuleSchwerpunkt -
- * liefert HTML fuer Schwerpunkt
+ * ServletModuleSchwerpunkt - code for the handling of "features"
+ *
*
*
* @author RK
public class ServletModuleSchwerpunkt extends ServletModule
{
- // Singelton / Kontruktor
+// Singelton / Kontruktor
private static ServletModuleSchwerpunkt instance = new ServletModuleSchwerpunkt();
public static ServletModule getInstance() { return instance; }
private ServletModuleSchwerpunkt() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Schwerpunkt.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Schwerpunkt.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Schwerpunkt.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Schwerpunkt.ConfirmTemplate");
- try {
- mainModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodulethemen konnte nicht initialisiert werden");
- }
+ logger = new LoggerWrapper("ServletModule.Feature");
+ templateListString = MirConfig.getProp("ServletModule.Schwerpunkt.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Schwerpunkt.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Schwerpunkt.ConfirmTemplate");
+ try {
+ mainModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
+ }
+ catch (StorageObjectException e) {
+ logger.error("Intialization of ServletModuleSchwerpunkt (Features) failed!: " + e.getMessage());
+ }
}
-}
+}
\ No newline at end of file
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
import mircoders.module.*;
/*
- * ServletModuleThemen -
- * liefert HTML fuer Themen
+ * ServletModuleTopics
+ *
*
*
* @author RK
public class ServletModuleTopics extends ServletModule
{
-
- // Singelton / Kontruktor
+// Singelton / Constructor
private static ServletModuleTopics instance = new ServletModuleTopics();
public static ServletModule getInstance() { return instance; }
private ServletModuleTopics() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Themen.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Themen.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Themen.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Themen.ConfirmTemplate");
+ logger = new LoggerWrapper("ServletModule.Topics");
+
+ templateListString = MirConfig.getProp("ServletModule.Themen.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Themen.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Themen.ConfirmTemplate");
+
try {
mainModule = new ModuleTopics(DatabaseTopics.getInstance());
- } catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmoduletopics konnte nicht initialisiert werden");
+ }
+ catch (StorageObjectException e) {
+ logger.error("Initialization of ServletModuleTopics failed!: " + e.getMessage());
}
}
-}
+}
\ No newline at end of file
* ServletModuleBilder -
* liefert HTML fuer Bilder
*
- * @version $Id: ServletModuleUploadedMedia.java,v 1.11 2002/11/27 08:57:32 mh Exp $
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.12 2002/11/29 13:43:42 zapata Exp $
* @author RK, the mir-coders group
*/
parameters.put("is_published", "0");
String id = mainModule.set(parameters);
- theLog.printError("media ID" + id);
+ logger.debug("update: media ID = " + id);
_edit(id, req, res);
}
catch (IOException e) {
}
//theLog.printDebugInfo("sql-whereclause: " + whereClause + " order: " + order + " offset: " + offset);
- // fetch und ausliefern
+ // 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);
mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
}
}
- //fetch the popups
popups.put("mediafolderPopupData", DatabaseMediafolder.getInstance().getPopupData());
- // raus damit
+
deliver(req, res, mergeData, popups, templateListString);
}
catch (ModuleException e) {
} 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++){
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) {
throw new ServletModuleException(e.toString());
}
}
- else theLog.printDebugInfo("id nicht angeben.");
- // darf keine exception werfen
+ else logger.error("id not specified.");
+ // no exception allowed
}
public void getIcon(HttpServletRequest req, HttpServletResponse res)
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();
throw new ServletModuleException(e.toString());
}
}
- else theLog.printDebugInfo("id nicht angeben.");
- // darf keine exception werfen
+ else logger.error("getIcon: id not specified.");
+ // no exception allowed
}
}
import mir.misc.*;
import mir.entity.*;
import mir.storage.*;
+import mir.log.*;
import mircoders.entity.*;
import mircoders.storage.*;
public class ServletModuleUsers extends mir.servlet.ServletModule
{
- // Singelton / Kontruktor
- private static ServletModuleUsers instance = new ServletModuleUsers();
- public static ServletModule getInstance() { return instance; }
+ private static ServletModuleUsers instance = new ServletModuleUsers();
+ public static ServletModule getInstance() { return instance; }
- private ServletModuleUsers() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Users.Logfile"));
- templateListString = MirConfig.getProp("ServletModule.Users.ListTemplate");
- templateObjektString = MirConfig.getProp("ServletModule.Users.ObjektTemplate");
- templateConfirmString = MirConfig.getProp("ServletModule.Users.ConfirmTemplate");
- try {
- mainModule = new ModuleUsers(DatabaseUsers.getInstance());
- }
- catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmoduleusers konnte nicht initialisiert werden");
- }
- }
+ private ServletModuleUsers() {
+ logger = new LoggerWrapper("ServletModule.Users");
- public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
- {
- String idParam = req.getParameter("id");
- if (idParam == null) throw new ServletModuleException("Falscher Aufruf: (id) nicht angegeben");
- try {
- //theLog.printInfo("Showing User with id: " + idParam);
- deliver(req, res, mainModule.getById(idParam), templateObjektString);
- }
- catch (ModuleException e) { throw new ServletModuleException(e.toString());}
- }
+ templateListString = MirConfig.getProp("ServletModule.Users.ListTemplate");
+ templateObjektString = MirConfig.getProp("ServletModule.Users.ObjektTemplate");
+ templateConfirmString = MirConfig.getProp("ServletModule.Users.ConfirmTemplate");
- public void add(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- try {
- SimpleHash mergeData = new SimpleHash();
- mergeData.put("new", "1");
- deliver(req, res, mergeData, templateObjektString);
- }
- catch (Exception e) { throw new ServletModuleException(e.toString());}
- }
+ try {
+ mainModule = new ModuleUsers(DatabaseUsers.getInstance());
+ }
+ catch (StorageObjectException e) {
+ logger.debug("initialization of ServletModuleUsers failed!: " + e.getMessage());
+ }
+ }
- public void insert(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleException
- {
- try {
- HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
- String id = mainModule.add(withValues);
- deliver(req, res, mainModule.getById(id), templateObjektString);
- }
- catch (Exception e) { throw new ServletModuleException(e.toString());}
- }
+ public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
+ {
+ String idParam = req.getParameter("id");
+ if (idParam == null)
+ throw new ServletModuleException("ServletModuleUser.edit: invalid call: (id) not specified");
+
+ try {
+ deliver(req, res, mainModule.getById(idParam), templateObjektString);
+ }
+ catch (ModuleException e) {
+ throw new ServletModuleException(e.toString());
+ }
+ }
+
+ public void add(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ mergeData.put("new", "1");
+ deliver(req, res, mergeData, templateObjektString);
+ }
+ catch (Exception e) { throw new ServletModuleException(e.toString());}
+ }
+
+ public void insert(HttpServletRequest req, HttpServletResponse res)
+ throws ServletModuleException
+ {
+ try {
+ HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
+ String id = mainModule.add(withValues);
+ deliver(req, res, mainModule.getById(id), templateObjektString);
+ }
+ catch (Exception e) { throw new ServletModuleException(e.toString());}
+ }
}
import mir.misc.MirConfig;
import mir.servlet.ServletModule;
import mir.storage.StorageObjectException;
+import mir.log.*;
+
import mircoders.module.ModuleUploadedMedia;
import mircoders.storage.DatabaseVideo;
private ServletModuleVideo() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Video.Logfile"));
+ logger = new LoggerWrapper("ServletModule.Video");
templateListString = MirConfig.getProp("ServletModule.Video.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Video.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Video.ConfirmTemplate");
//dbRights = DatabaseRights.getInstance();
}
catch (StorageObjectException e) {
- theLog.printDebugInfo("servletmodule video could not be initialized");
+ logger.error("servletmodule video could not be initialized: " + e.getMessage());
}
}
}