########## admin ##########
# language: english
-# $Id: admin_en.properties,v 1.37 2003/03/05 04:33:29 zapata Exp $
+# $Id: admin_en.properties,v 1.38 2003/03/09 05:52:12 zapata Exp $
languagename=English
# Comment status values
commentstatus.normal=Normal
+
########## error ##########
error.htmltitle=the system caused an error
error.text=This can happen. Even if the following error message is not be comprehensible for you, it might be helpful to <a href="mailto:{0}">{1}</a>:
error.text2=So please send an e-mail with the <font color="Red">red text</font> and detailed information regarding the events that led to this error to <a href="mailto:{0}">{1}</a>. Thanks!
-usererror.htmltitle=validation error
-usererror.title=Validation error
+usererror.htmltitle=User error
+usererror.title=User error
usererror.text=Your input caused the following error:
usererror.what_to_do=Please press the back button and try it again
+media.error.unsupportedformat=The format of the media you uploaded is not supported\r
+user.error.missingpasswords=The new password must be entered twice\r
+user.error.passwordmismatch=The passwords are not equal
+user.error.missingpassword=A password must be entered\r
+
infomessage.htmltitle = Information
infomessage.produceAllNewAddedToQueue = Your request has been added to the queue.
optional=optional
required=required
-comment.htmltitle=Mir | comment
-comment.header=Adding a coment to an article
-comment.password=Password
-comment.note=
-comment.formtitle=Comment
-comment.title=title of this comment
-comment.name=your name
-comment.email=your eMail
-comment.url=your web site address
-comment.phone=your telephone number.
-comment.address=your address
-comment.language=language of your comment
-comment.text=your comment
-comment.submit=submit comment
-comment.reset=reset form
-
-commentdone.htmltitle=Mir | open posting
-commentdone.thanks=Your comment is on the way!
-commentdone.wait=It will take some minutes until your addition appears under the article.<br>It may take even longer in case of technical problems.<br>
-commentdone.criteria=
-commentdone.stay_calm=Please wait a few minutes
-commentdone.back=Back to the article
-
-commentdupe.htmltitle=Mir | open posting - duplicate entry
-commentdupe.title=Stay calm. Things will happen soon.
-commentdupe.explanation=You probably clicked on the reload button or submitted your comment a second time. The fact that you can read this text means that your comment has been recieved and will soon be included in the article page.
-commentdupe.no_panic=Don't panic
-commentdupe.back=Back to the article
-
posting.htmltitle=Mir | open posting
posting.password=Password
posting.meta.description=Mir CMS system
posting.criteria=
posting.submit=Submit (patience is a virtue!)
posting.reset=Form Reset
+posting.error.missingpassword=The one-time password must be copied into the password field\r
+posting.error.invalidpassword=The one-time password was not copied correctly into the password field\r
+posting.error.missingfield=At least one field was not correctly entered\r
+media.error.unsupportedformat=The format of the media you uploaded is not supported\r
postingdone.htmltitle=open posting
postingdone.title=You have successfully submitted your article
postingdupe.no_panic=Don't panic
postingdupe.back=Back
+comment.htmltitle=Mir | comment
+comment.header=Adding a coment to an article
+comment.password=Password
+comment.note=
+comment.formtitle=Comment
+comment.title=title of this comment
+comment.name=your name
+comment.email=your eMail
+comment.url=your web site address
+comment.phone=your telephone number.
+comment.address=your address
+comment.language=language of your comment
+comment.text=your comment
+comment.submit=submit comment
+comment.reset=reset form
+comment.error.missingpassword=The one-time password must be copied into the password field\r
+comment.error.invalidpassword=The one-time password was not copied correctly into the password field\r
+
+commentdone.htmltitle=Mir | open posting
+commentdone.thanks=Your comment is on the way!
+commentdone.wait=It will take some minutes until your addition appears under the article.<br>It may take even longer in case of technical problems.<br>
+commentdone.criteria=
+commentdone.stay_calm=Please wait a few minutes
+commentdone.back=Back to the article
+
+commentdupe.htmltitle=Mir | open posting - duplicate entry
+commentdupe.title=Stay calm. Things will happen soon.
+commentdupe.explanation=You probably clicked on the reload button or submitted your comment a second time. The fact that you can read this text means that your comment has been recieved and will soon be included in the article page.
+commentdupe.no_panic=Don't panic
+commentdupe.back=Back to the article
+
search.info=Results of your search:
search.title=SEARCH
search.htmltitle=MirSearch (powered by lucene)
email.prepare.send=SEND
email.sent.htmltitle=Email sent successfully
email.sent.title=Your email has been sent
-email.sent.text=The aticle has been forwarded to the specified address.
\ No newline at end of file
+email.sent.text=The article has been forwarded to the specified address.
+email.error.invalidtoaddress=The address to send the article to is not valid\r
+email.error.invalidfromaddress=Your email address is not valid\r
+
+
+
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateModel;
+
import mir.config.MirPropertiesConfiguration;
import mir.generator.FreemarkerGenerator;
import mir.log.LoggerWrapper;
import mircoders.storage.DatabaseMessages;
import mircoders.storage.DatabaseUsers;
-import org.apache.struts.util.MessageResources;
-
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-import freemarker.template.SimpleScalar;
-import freemarker.template.TemplateModel;
* Mir.java - main servlet, that dispatches to servletmodules
*
* @author $Author: zapata $
- * @version $Id: Mir.java,v 1.36 2003/03/09 03:53:10 zapata Exp $
+ * @version $Id: Mir.java,v 1.37 2003/03/09 05:52:12 zapata Exp $
*
*/
public class Mir extends AbstractServlet {
catch (Exception e) {
throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());
}
- } else {
+ }
+ else {
return (ServletModule) servletModuleInstanceHash.get(moduleName);
}
}
private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,
- PrintWriter out, Throwable anException) {
+ PrintWriter out, ServletModuleUserExc anException) {
try {
logger.info("user error: " + anException.getMessage());
SimpleHash modelRoot = new SimpleHash();
- modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));
+ MessageResources messages = MessageResources.getMessageResources("bundles.admin");
+ modelRoot.put("errorstring",
+ new SimpleScalar(
+ messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())
+ ));
modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
- HTMLTemplateProcessor.process(aResponse,MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),
- modelRoot, out, aRequest.getLocale() );
+ HTMLTemplateProcessor.process(
+ aResponse,MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),
+ modelRoot, out, getLocale(aRequest));
out.close();
}
catch (Exception e) {
modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(
new GregorianCalendar())));
HTMLTemplateProcessor.process(aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"),
- modelRoot,out, aRequest.getLocale());
+ modelRoot,out, getLocale(aRequest));
out.close();
}
catch (Exception e) {
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleScalar;
+
import mir.config.MirPropertiesConfiguration;
import mir.misc.HTMLTemplateProcessor;
import mir.misc.StringUtil;
import mir.servlet.ServletModuleUserExc;
import mir.util.ExceptionFunctions;
import mircoders.servlet.ServletModuleOpenIndy;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleScalar;
/**
* OpenMir.java - main servlet for open posting and comment feature to articles
*
* @author RK 1999-2001, the mir-coders group
- * @version $Id: OpenMir.java,v 1.25 2003/03/09 03:53:10 zapata Exp $
+ * @version $Id: OpenMir.java,v 1.26 2003/03/09 05:52:12 zapata Exp $
*
*/
}
private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,
- PrintWriter out, Throwable anException) {
+ PrintWriter out, ServletModuleUserExc anException) {
try {
logger.info("user error: " + anException.getMessage());
SimpleHash modelRoot = new SimpleHash();
- modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));
+ MessageResources messages = MessageResources.getMessageResources("bundles.open");
+ modelRoot.put("errorstring",
+ new SimpleScalar(
+ messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())
+ ));
modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
HTMLTemplateProcessor.process(aResponse,MirPropertiesConfiguration.instance().getString("ServletModule.OpenIndy.UserErrorTemplate"),
- modelRoot, out, aRequest.getLocale() );
+ modelRoot, out, getLocale(aRequest));
out.close();
}
catch (Exception e) {
try {
logger.error("error: " + anException);
SimpleHash modelRoot = new SimpleHash();
+
modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));
modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(
new GregorianCalendar())));
HTMLTemplateProcessor.process(aResponse,MirPropertiesConfiguration.instance().getString("ServletModule.OpenIndy.ErrorTemplate"),
- modelRoot,out, aRequest.getLocale());
+ modelRoot,out, getLocale(aRequest));
out.close();
}
catch (Exception e) {
package mir.servlet;
import multex.Exc;
+/**
+ *
+ * <p>Title: ServletModuleUserExc</p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author Zapata
+ * @version 1.0
+ */
public class ServletModuleUserExc extends Exc {
- public ServletModuleUserExc(String aMessage) {
- super(aMessage);
+ public ServletModuleUserExc(String aMessageName, String[] aParameterArray) {
+ super(aMessageName, aParameterArray);
}
}
import javax.servlet.http.HttpServletRequest;\r
\r
import mir.misc.StringUtil;\r
+import mir.log.LoggerWrapper;\r
\r
public class StoreContainer {\r
private final static int DEFAULT_SIZE = 10;\r
private int hitCount = 0, missCount = 0;\r
private static ObjectStore o_store = ObjectStore.getInstance();\r
\r
+ protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");\r
+\r
// avoid construction without parameters\r
private StoreContainer() {};\r
\r
+\r
public StoreContainer(StoreContainerType stoc_type) {\r
this.uniqueId = ++uniqueCounter;\r
this.stocType = stoc_type;\r
if (sid != null && sid.hasReference()) {\r
if (has(sid)) {\r
moveToHead(sid);\r
- System.err.println("OBJECTStore: tried to add sid " + sid.toString() +\r
- " that was already in store.");\r
+ logger.error("OBJECTStore: tried to add sid " + sid.toString() + " that was already in store.");\r
}\r
else {\r
container.addFirst(sid);\r
import java.util.Set;\r
\r
import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
\r
public class StoreIdentifier {\r
\r
private long timesUsed;\r
private boolean invalidating = false;\r
\r
+ protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");\r
+\r
/** @todo initialize logfile */\r
\r
private StoreIdentifier() {}\r
* @return\r
*/\r
public void invalidate() {\r
- System.out.println("Invalidating: " + toString());\r
+ logger.info("Invalidating: " + toString());\r
// avoid deadlock due to propagation.\r
if (!invalidating) {\r
invalidating = true;\r
if (stocType != null &&\r
stocType.getStocType() == StoreContainerType.STOC_TYPE_ENTITY) {\r
- System.out.println("Propagating invalidation to EntityList for " +\r
- toString());\r
+ logger.info("Propagating invalidation to EntityList for " + toString());\r
// we should invalidate related ENTITY_LIST\r
StoreContainerType entityListStocType =\r
StoreContainerType.valueOf(stocType.getStocClass(),\r
for (Iterator it = set.iterator(); it.hasNext(); ) {\r
Object o = it.next();\r
if (o instanceof StoreIdentifier) {\r
- System.out.println("Propagating invalidation to StoreIdentifier: " +\r
- o.toString());\r
+ logger.info("Propagating invalidation to StoreIdentifier: " + o.toString());\r
// propagate invalidation to a specific StoreIdentifier in cache\r
o_store.invalidate( (StoreIdentifier) o);\r
}\r
else if (o instanceof StoreContainerType) {\r
- System.out.println("Propagating invalidation to StoreContainer: " +\r
- o.toString());\r
+ logger.info("Propagating invalidation to StoreContainer: " + o.toString());\r
// propagate invalidation to a whole StoreContainer\r
o_store.invalidate( (StoreContainerType) o);\r
}\r
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.65 2003/03/09 03:53:12 zapata Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.66 2003/03/09 05:52:13 zapata Exp $
*
*/
HttpSession session = req.getSession(false);
String sessionPasswd = (String)session.getAttribute("passwd");
if ( sessionPasswd == null){
- throw new ServletModuleUserExc("Lost password");
+ throw new ServletModuleExc("Lost password");
}
String passwd = req.getParameter("passwd");
- if ( passwd == null || (!sessionPasswd.equals(passwd))) {
- throw new ServletModuleUserExc("Missing password");
+ if ( passwd == null || passwd.length()==0) {
+ throw new ServletModuleUserExc("comment.error.missingpassword", new String[] {});
+ }
+ if (!sessionPasswd.equals(passwd)) {
+ throw new ServletModuleUserExc("comment.error.invalidpassword", new String[] {});
}
session.invalidate();
}
//insert was not successfull
if(id==null){
deliver(req, res, new SimpleHash(), commentFormDupeTemplate);
- } else {
+ }
+ else {
DatabaseContent.getInstance().setUnproduced("id="+aid);
try {
* the postingDone Page
*/
- public void insposting(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
+ public void insposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
{
SimpleHash mergeData = new SimpleHash();
boolean setMedia=false;
HttpSession session = req.getSession(false);
String sessionPasswd = (String)session.getAttribute("passwd");
if ( sessionPasswd == null){
- throw new ServletModuleUserExc("Lost password");
+ throw new ServletModuleExc("Lost password");
}
String passwd = (String)withValues.get("passwd");
- if ( passwd == null || (!sessionPasswd.equals(passwd))) {
- throw new ServletModuleUserExc("Missing password");
+ if ( passwd == null || passwd.length()==0) {
+ throw new ServletModuleUserExc("posting.error.missingpassword", new String[] {});
+ }
+ if (!sessionPasswd.equals(passwd)) {
+ throw new ServletModuleUserExc("posting.error.invalidpassword", new String[] {});
}
session.invalidate();
}
if ((((String)withValues.get("title")).length() == 0) ||
(((String)withValues.get("description")).length() == 0) ||
(((String)withValues.get("content_data")).length() == 0))
- throw new ServletModuleUserExc("Missing field");
+ throw new ServletModuleUserExc("posting.error.missingfield", new String[] {});
// call the routines that escape html
Throwable cause = ExceptionFunctions.traceCauseException(e);
if (cause instanceof UnsupportedMediaFormatExc) {
- throw new ServletModuleUserExc("Unsupported media format");
+ throw new ServletModuleUserExc("media.unsupportedformat", new String[] {} );
}
throw new ServletModuleFailure(e);
}
{
String aid = req.getParameter("mail_aid");
if (aid == null){
- throw new ServletModuleUserExc("An article id must be specified in requests to email an article. Something therefore went badly wrong....");
+ throw new ServletModuleExc("An article id must be specified in requests to email an article. Something therefore went badly wrong....");
}
String to = req.getParameter("mail_to");
}
else {
//run checks on to and from and mail_language to make sure no monkey business occurring
- if (mail_language.indexOf('.') != -1 || mail_language.indexOf('/') != -1 ){
- throw new ServletModuleUserExc("Sorry, you've entered an illegal character into the language field. Go back and try again, asshole.");
+ if (mail_language.indexOf('.') != -1 || mail_language.indexOf('/') != -1 ) {
+ throw new ServletModuleExc("Invalid language");
}
if (to.indexOf('\n') != -1
|| to.indexOf('\r') != -1
- || to.indexOf(',') != -1
- || from.indexOf('\n') != -1
- || from.indexOf('\r') != -1
- || from.indexOf(',') != -1 ){
- throw new ServletModuleUserExc("Sorry, you've entered an illegal character into the from or to field. Go back and try again.");
+ || to.indexOf(',') != -1) {
+ throw new ServletModuleUserExc("email.error.invalidtoaddress", new String[] {to});
+ }
+ if (from.indexOf('\n') != -1 || from.indexOf('\r') != -1 || from.indexOf(',') != -1 ) {
+ throw new ServletModuleUserExc("email.error.invalidfromaddress", new String[] {from});
}
+
+
EntityContent contentEnt;
try{
contentEnt = (EntityContent)contentModule.getById(aid);
res.getOutputStream().flush();
}
else {
- throw new ServletModuleUserExc("Missing id parameter.");
+ throw new ServletModuleExc("Missing id.");
}
}
catch (Exception ex) {
* ServletModuleBilder -
* liefert HTML fuer Bilder
*
- * @version $Id: ServletModuleUploadedMedia.java,v 1.21 2003/03/09 03:53:12 zapata Exp $
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.22 2003/03/09 05:52:13 zapata Exp $
* @author RK, the mir-coders group
*/
Throwable cause = ExceptionFunctions.traceCauseException(t);
if (cause instanceof UnsupportedMediaFormatExc) {
- throw new ServletModuleUserExc("Unsupported media format");
+ throw new ServletModuleUserExc("media.error.unsupportedformat", new String[] {});
}
throw new ServletModuleFailure("ServletModuleUploadedMedia.insert: " + t.toString(), t);
}
String newPassword2 = aRequestParser.getParameterWithDefault("newpassword2", "");
if (newPassword.length() == 0 || newPassword2.length() == 0) {
- throw new ServletModuleUserExc("The new password must be entered twice!");
+ throw new ServletModuleUserExc("user.error.missingpasswords", new String[] {});
}
if (!newPassword.equals(newPassword2)) {
- throw new ServletModuleUserExc("New password differes from confirmation");
+ throw new ServletModuleUserExc("user.error.passwordmismatch", new String[] {});
}
return newPassword;
if (newPassword!=null)
withValues.put("password", newPassword);
else
- throw new ServletModuleUserExc("Password is empty");
+ throw new ServletModuleUserExc("user.error.missingpassword", new String[] {});
String id = mainModule.add(withValues);
if (requestParser.hasParameter("returnurl"))