W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

2006/unicorn/src/org/w3c/unicorn/action IndexAction.java,1.5,1.6

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 01 Sep 2009 13:39:43 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MiTaJ-0004p5-Bd@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv18414/src/org/w3c/unicorn/action

Modified Files:
	IndexAction.java 
Log Message:
added languages merging
+ messages on index

Index: IndexAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/IndexAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- IndexAction.java	31 Aug 2009 15:00:15 -0000	1.5
+++ IndexAction.java	1 Sep 2009 13:39:41 -0000	1.6
@@ -1,6 +1,7 @@
 package org.w3c.unicorn.action;
 
 import java.io.IOException;
+import java.util.ArrayList;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -8,7 +9,7 @@
 
 import org.apache.velocity.VelocityContext;
 import org.w3c.unicorn.Framework;
-import org.w3c.unicorn.language.Language;
+import org.w3c.unicorn.util.Language;
 import org.w3c.unicorn.util.Message;
 import org.w3c.unicorn.util.Property;
 import org.w3c.unicorn.util.Templates;
@@ -41,15 +42,34 @@
 		
 		velocityContext = new VelocityContext(Language.getContext(langParameter));
 		
+		ArrayList<Message> messages = new ArrayList<Message>();
+		
+		/*messages.add(new Message(Message.Level.WARNING, "un warning", null));
+		messages.add(new Message(Message.Level.ERROR, "une error", null));
+		messages.add(new Message(Message.Level.INFO, "une info", null));
+		messages.add(new Message(Message.Level.WARNING, "un warning avec long message", "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\n"));
+		messages.add(new Message(Message.Level.ERROR, "une error avec long message",  "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\n"));
+		messages.add(new Message(Message.Level.INFO, "une info avec long message",  "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\nle long message\n"));*/
+		
+		if (!Language.isComplete(langParameter)) {
+			Message mess = new Message(Message.Level.INFO, "incomplete language", null);
+			messages.add(mess);
+			//velocityContext.put("message", mess);
+		}
+		
+		if (req.getAttribute("unicorn_message") != null)
+			//velocityContext.put("message", req.getAttribute("unicorn_message"));
+			messages.add((Message) req.getAttribute("unicorn_message"));
+		
+		velocityContext.put("messages", messages);
+		
 		String taskParameter = req.getParameter(Property.get("UNICORN_PARAMETER_PREFIX") + "task");
 		if (taskParameter == null || !Framework.mapOfTask.containsKey(taskParameter))
 			taskParameter = Framework.mapOfTask.getDefaultTaskId();
 		
 		velocityContext.put("current_task", Framework.mapOfTask.get(taskParameter));
 		
-		if (req.getAttribute("unicorn_message") != null)
-			//System.out.println("TOM: " + ((Message) req.getAttribute("unicorn_message")).getMessage());
-			velocityContext.put("message", req.getAttribute("unicorn_message"));
+		
 		
 		if (req.getHeader("X-Requested-With") != null && req.getHeader("X-Requested-With").equals("XMLHttpRequest")) {
 			//for JavaScript testing purposes
Received on Tuesday, 1 September 2009 13:39:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:12 GMT