You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/01/03 23:03:29 UTC

svn commit: r895490 - in /incubator/wookie/trunk: WebContent/wservices/notsupported/ WebContent/wservices/notsupported/locales/bu/ WebContent/wservices/notsupported/locales/en/ WebContent/wservices/notsupported/locales/fr/ scripts/derby/ scripts/mysql/...

Author: scottbw
Date: Sun Jan  3 22:03:28 2010
New Revision: 895490

URL: http://svn.apache.org/viewvc?rev=895490&view=rev
Log:
Updated the NotSupported widget to use folder-based localization, and added support to the controller to ensure the default widget gets a language tag whenever it is instantiated (only transitively). Also added the startfiles to the DB scripts. See WOOKIE-97 for more details.

Added:
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/index.htm
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/index.htm
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/index.htm
    incubator/wookie/trunk/widgets/notsupported/locales/bu/index.htm
    incubator/wookie/trunk/widgets/notsupported/locales/en/index.htm
    incubator/wookie/trunk/widgets/notsupported/locales/fr/index.htm
Removed:
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/localizedStrings.js
    incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/localizedStrings.js
    incubator/wookie/trunk/widgets/notsupported/locales/bu/localizedStrings.js
    incubator/wookie/trunk/widgets/notsupported/locales/en/localizedStrings.js
    incubator/wookie/trunk/widgets/notsupported/locales/fr/localizedStrings.js
Modified:
    incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm
    incubator/wookie/trunk/scripts/derby/widgetdb.sql
    incubator/wookie/trunk/scripts/mysql/widgetdb.sql
    incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
    incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java
    incubator/wookie/trunk/widgets/notsupported/index.htm

Modified: incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm (original)
+++ incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm Sun Jan  3 22:03:28 2010
@@ -2,38 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>Widget type not supported</title>
-<script type='text/javascript' src='/wookie/dwr/util.js'> </script>  
-<script type='text/javascript' src='/wookie/dwr/engine.js'> </script>
-<script type='text/javascript' src='/wookie/dwr/interface/WidgetImpl.js'> </script>
-<script type='text/javascript' src='/wookie/shared/js/wookie-wrapper.js'> </script>   
-
-<script type='text/javascript' src='locales/en/localizedStrings.js'> </script>
-<script type='text/javascript' src='locales/bu/localizedStrings.js'> </script>
-<script>
-
-
-function init(){
-	document.title = LanguageHelper.getLocalizedString('Widget type not supported');
-	var mainText = "<h3>"+ LanguageHelper.getLocalizedString('Widget Server') +"</div></h3>";
-	mainText += "<p>"+ LanguageHelper.getLocalizedString('Sorry, but the widget server does not support this type of widget') +"</p>";
-	document.getElementById('maindiv').innerHTML = mainText
-
-	var langText = LanguageHelper.getLangOpts(updateLanguage)
-	document.getElementById('langdiv').innerHTML = langText;
-}
-
-function updateLanguage(){
-	init();
-}
-
-  </script>
- </head>
-<body onload="init()">
+<title>Widget type not supported</title> 
+</head>
+<body>
 	<div id="wrapper">
-		<div id="langdiv">		
-		</div>
-		<div id="maindiv"></div>
+		<div id="maindiv"><h3>Widget Server</h3><p>Sorry, but the widget server does not support this type of widget</p></div>
 	</div>
 </body>
 </html>
\ No newline at end of file

Added: incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/index.htm (added)
+++ incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Опцията не се поддържа</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><p><h3>Сървър с допълнителни опции</h3></p>Сървърът не поддържа тази опция</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/index.htm (added)
+++ incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Widget type not supported</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><h3>Widget Server</h3><p>Sorry, but the widget server does not support this type of widget</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/index.htm (added)
+++ incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Widget de type non pris en charge</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><h3>Widget Server</h3><p>Désolé, mais le serveur de widget ne supporte pas ce type de widget</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file

Modified: incubator/wookie/trunk/scripts/derby/widgetdb.sql
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/scripts/derby/widgetdb.sql?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/scripts/derby/widgetdb.sql (original)
+++ incubator/wookie/trunk/scripts/derby/widgetdb.sql Sun Jan  3 22:03:28 2010
@@ -2,6 +2,9 @@
 INSERT INTO Name VALUES(1, 'Unsupported widget widget','Unsupported',NULL,NULL,1);
 INSERT INTO Description VALUES(1, 'This widget is a placeholder for when no corresponding widget is found for a given type',NULL,NULL,1);
 INSERT INTO StartFile VALUES(1,'/wookie/wservices/notsupported/index.htm',NULL,NULL,1);
+INSERT INTO StartFile VALUES(2,'/wookie/wservices/notsupported/locales/bu/index.htm',NULL,'bu',1);
+INSERT INTO StartFile VALUES(3,'/wookie/wservices/notsupported/locales/fr/index.htm',NULL,'fr',1);
+INSERT INTO StartFile VALUES(4,'/wookie/wservices/notsupported/locales/en/index.htm',NULL,'en',1);
 INSERT INTO WidgetDefault VALUES ('unsupported',1);
 INSERT INTO WidgetService VALUES (1,'unsupported'),(2,'chat'),(3,'games'),(4,'voting'),(5,'weather');
 INSERT INTO WidgetType VALUES (1,1,'unsupported');

Modified: incubator/wookie/trunk/scripts/mysql/widgetdb.sql
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/scripts/mysql/widgetdb.sql?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/scripts/mysql/widgetdb.sql (original)
+++ incubator/wookie/trunk/scripts/mysql/widgetdb.sql Sun Jan  3 22:03:28 2010
@@ -228,6 +228,9 @@
 INSERT INTO `Name` VALUES(1, 'Unsupported widget widget','Unsupported',NULL,NULL,1);
 INSERT INTO `Description` VALUES(1, 'This widget is a placeholder for when no corresponding widget is found for a given type',NULL,NULL,1);
 INSERT INTO `StartFile` VALUES(1,'/wookie/wservices/notsupported/index.htm',NULL,NULL,1);
+INSERT INTO `StartFile` VALUES(2,'/wookie/wservices/notsupported/locales/bu/index.htm',NULL,'bu',1);
+INSERT INTO `StartFile` VALUES(3,'/wookie/wservices/notsupported/locales/fr/index.htm',NULL,'fr',1);
+INSERT INTO `StartFile` VALUES(4,'/wookie/wservices/notsupported/locales/en/index.htm',NULL,'en',1);
 INSERT INTO `WidgetDefault` VALUES ('unsupported',1);
 INSERT INTO `WidgetService` VALUES (1,'unsupported'),(2,'chat'),(3,'games'),(4,'voting'),(5,'weather');
 INSERT INTO `WidgetType` VALUES (1,1,'unsupported');

Modified: incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java Sun Jan  3 22:03:28 2010
@@ -196,11 +196,11 @@
 		checkProxy(request);
 		
 		WidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
-
+		String locale = request.getParameter("locale");//$NON-NLS-1$
+		
 		// Widget exists
 		if(instance==null){
 			String apiKey = request.getParameter("api_key"); //$NON-NLS-1$
-			String locale = request.getParameter("locale");//$NON-NLS-1$
 			instance = WidgetFactory.getWidgetFactory(session, localizedMessages).newInstance(apiKey, userId, sharedDataKey, serviceType, widgetId, locale);
 			response.setStatus(HttpServletResponse.SC_CREATED);
 		} else {
@@ -209,7 +209,7 @@
 		
 		// Return the default widget if not created by now
 		if(instance==null){
-			instance = WidgetFactory.getWidgetFactory(session, localizedMessages).defaultInstance();
+			instance = WidgetFactory.defaultInstance(locale);
 			response.setStatus(HttpServletResponse.SC_NOT_FOUND);	
 		}
 		

Modified: incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/WidgetFactory.java Sun Jan  3 22:03:28 2010
@@ -65,10 +65,11 @@
 	 * Return the "default widget" instance
 	 * @return
 	 */
-	public WidgetInstance defaultInstance(){
+	public static WidgetInstance defaultInstance(String locale){
 		WidgetInstance instance = new WidgetInstance();
 		instance.setWidget(Widget.findDefaultByType("unsupported")); //$NON-NLS-1$
 		instance.setIdKey("0000");
+		instance.setLang(locale);
 		instance.setOpensocialToken("");
 		return instance;
 	}

Modified: incubator/wookie/trunk/widgets/notsupported/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/notsupported/index.htm?rev=895490&r1=895489&r2=895490&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/notsupported/index.htm (original)
+++ incubator/wookie/trunk/widgets/notsupported/index.htm Sun Jan  3 22:03:28 2010
@@ -2,38 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>Widget type not supported</title>
-<script type='text/javascript' src='/wookie/dwr/util.js'> </script>  
-<script type='text/javascript' src='/wookie/dwr/engine.js'> </script>
-<script type='text/javascript' src='/wookie/dwr/interface/WidgetImpl.js'> </script>
-<script type='text/javascript' src='/wookie/shared/js/wookie-wrapper.js'> </script>   
-
-<script type='text/javascript' src='locales/en/localizedStrings.js'> </script>
-<script type='text/javascript' src='locales/bu/localizedStrings.js'> </script>
-<script>
-
-
-function init(){
-	document.title = LanguageHelper.getLocalizedString('Widget type not supported');
-	var mainText = "<h3>"+ LanguageHelper.getLocalizedString('Widget Server') +"</div></h3>";
-	mainText += "<p>"+ LanguageHelper.getLocalizedString('Sorry, but the widget server does not support this type of widget') +"</p>";
-	document.getElementById('maindiv').innerHTML = mainText
-
-	var langText = LanguageHelper.getLangOpts(updateLanguage)
-	document.getElementById('langdiv').innerHTML = langText;
-}
-
-function updateLanguage(){
-	init();
-}
-
-  </script>
- </head>
-<body onload="init()">
+<title>Widget type not supported</title> 
+</head>
+<body>
 	<div id="wrapper">
-		<div id="langdiv">		
-		</div>
-		<div id="maindiv"></div>
+		<div id="maindiv"><h3>Widget Server</h3><p>Sorry, but the widget server does not support this type of widget</p></div>
 	</div>
 </body>
 </html>
\ No newline at end of file

Added: incubator/wookie/trunk/widgets/notsupported/locales/bu/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/notsupported/locales/bu/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/notsupported/locales/bu/index.htm (added)
+++ incubator/wookie/trunk/widgets/notsupported/locales/bu/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Опцията не се поддържа</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><p><h3>Сървър с допълнителни опции</h3></p>Сървърът не поддържа тази опция</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/wookie/trunk/widgets/notsupported/locales/en/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/notsupported/locales/en/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/notsupported/locales/en/index.htm (added)
+++ incubator/wookie/trunk/widgets/notsupported/locales/en/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Widget type not supported</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><h3>Widget Server</h3><p>Sorry, but the widget server does not support this type of widget</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/wookie/trunk/widgets/notsupported/locales/fr/index.htm
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/notsupported/locales/fr/index.htm?rev=895490&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/notsupported/locales/fr/index.htm (added)
+++ incubator/wookie/trunk/widgets/notsupported/locales/fr/index.htm Sun Jan  3 22:03:28 2010
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Widget de type non pris en charge</title> 
+</head>
+<body>
+	<div id="wrapper">
+		<div id="maindiv"><h3>Widget Server</h3><p>Désolé, mais le serveur de widget ne supporte pas ce type de widget</p></div>
+	</div>
+</body>
+</html>
\ No newline at end of file