|
From: <fg...@us...> - 2009-01-31 20:56:32
|
Revision: 972
http://openutils.svn.sourceforge.net/openutils/?rev=972&view=rev
Author: fgiust
Date: 2009-01-31 20:56:29 +0000 (Sat, 31 Jan 2009)
Log Message:
-----------
updated with latest patches
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_en.properties
trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_it.properties
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/pom.xml 2009-01-31 20:56:29 UTC (rev 972)
@@ -1,5 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+ <parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
<version>10</version>
@@ -73,7 +74,7 @@
<repository>
<id>repository.magnolia.info</id>
<name>magnolia repository</name>
- <url>http://svn.magnolia.info/maven/m2</url>
+ <url>http://repository.magnolia-cms.com/m2</url>
<releases>
<enabled>true</enabled>
</releases>
@@ -82,4 +83,4 @@
</snapshots>
</repository>
</repositories>
-</project>
+</project>
\ No newline at end of file
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -1,6 +1,5 @@
package net.sourceforge.openutils.mgnlmessages.configuration;
-import info.magnolia.api.MgnlException;
import info.magnolia.cms.beans.config.ContentRepository;
import info.magnolia.cms.beans.config.ObservedManager;
import info.magnolia.cms.core.Content;
@@ -77,7 +76,6 @@
/**
* {@inheritDoc}
*/
- @Override
public int compare(Locale o1, Locale o2)
{
if (o1.getLanguage().equals(o2.getLanguage()))
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -1,7 +1,6 @@
package net.sourceforge.openutils.mgnlmessages.i18n;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.ResourceBundle;
@@ -13,7 +12,7 @@
{
/**
- *
+ *
*/
public EmptyResourceBundle()
{
@@ -33,7 +32,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean hasMoreElements()
{
return false;
@@ -42,7 +40,6 @@
/**
* {@inheritDoc}
*/
- @Override
public String nextElement()
{
return null;
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -38,7 +38,6 @@
/**
* {@inheritDoc}
*/
- @Override
public String get(String key)
{
String value;
@@ -61,7 +60,6 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- @Override
public Iterator keys()
{
List<String> keys = new ArrayList<String>();
@@ -79,7 +77,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void reload() throws Exception
{
for (Messages m : messages)
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -86,7 +86,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void reload() throws Exception
{
keys = null;
@@ -96,7 +95,6 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- @Override
public Iterator keys()
{
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -15,7 +15,7 @@
{
/**
- *
+ *
*/
public static final String REPO = "messages";
@@ -24,7 +24,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void start(ModuleLifecycleContext ctx)
{
log.info("Starting module messages");
@@ -34,7 +33,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void stop(ModuleLifecycleContext ctx)
{
log.info("Stopping module messages");
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2009-01-31 20:56:29 UTC (rev 972)
@@ -42,7 +42,7 @@
/**
* @author molaschi
- * @version $Id: MessagesImpExpPage.java 5412 2008-11-10 17:02:20Z manuel $
+ * @version $Id: MessagesImpExpPage.java 5694 2008-12-18 13:49:18Z manuel $
*/
public class MessagesImpExpPage extends TemplatedMVCHandler
{
@@ -147,7 +147,7 @@
throw new RuntimeException(e);
}
- return VIEW_NOTHING;
+ return null;
}
public String importExcel()
Modified: trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_en.properties
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_en.properties 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_en.properties 2009-01-31 20:56:29 UTC (rev 972)
@@ -1 +0,0 @@
-messages.prova.chiave=Key
\ No newline at end of file
Modified: trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_it.properties
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_it.properties 2009-01-31 17:26:20 UTC (rev 971)
+++ trunk/openutils-mgnlmessages/src/main/resources/mgnl-messages/messages/messages_it.properties 2009-01-31 20:56:29 UTC (rev 972)
@@ -1 +0,0 @@
-messages.prova.chiave=Chiave
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mol...@us...> - 2009-02-13 15:57:52
|
Revision: 984
http://openutils.svn.sourceforge.net/openutils/?rev=984&view=rev
Author: molaschi
Date: 2009-02-13 15:57:45 +0000 (Fri, 13 Feb 2009)
Log Message:
-----------
new release to support magnolia 4.0.x
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/resources/META-INF/magnolia/messages.xml
trunk/openutils-mgnlmessages/src/site/apt/index.apt
trunk/openutils-mgnlmessages/src/site/changes/changes.xml
Added Paths:
-----------
trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesProvider.java
trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/OpenutilsMgnlMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/manager/
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/pom.xml 2009-02-13 15:57:45 UTC (rev 984)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
@@ -9,7 +10,7 @@
<packaging>jar</packaging>
<artifactId>openutils-mgnlmessages</artifactId>
<name>openutils-mgnlmessages</name>
- <version>1.2-SNAPSHOT</version>
+ <version>4.0-SNAPSHOT</version>
<licenses>
<license>
<name>GPLv3</name>
@@ -38,12 +39,12 @@
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-core</artifactId>
- <version>3.6.3</version>
+ <version>4.0-rc3</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-admininterface</artifactId>
- <version>3.6.3</version>
+ <version>4.0-rc3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
Modified: trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java 2009-02-13 15:57:45 UTC (rev 984)
@@ -1,6 +1,6 @@
/**
- * This file Copyright (c) 2003-2008 Magnolia International
- * Ltd. (http://www.magnolia.info). All rights reserved.
+ * This file Copyright (c) 2003-2009 Magnolia International
+ * Ltd. (http://www.magnolia-cms.com). All rights reserved.
*
*
* This file is dual-licensed under both the Magnolia
@@ -25,7 +25,7 @@
* 2. For the Magnolia Network Agreement (MNA), this file
* and the accompanying materials are made available under the
* terms of the MNA which accompanies this distribution, and
- * is available at http://www.magnolia.info/mna.html
+ * is available at http://www.magnolia-cms.com/mna.html
*
* Any modifications to this file must keep this entire header
* intact.
@@ -33,16 +33,23 @@
*/
package info.magnolia.cms.i18n;
-import info.magnolia.cms.core.HierarchyManager;
import info.magnolia.cms.beans.config.ContentRepository;
import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.util.FactoryUtil;
import info.magnolia.cms.util.NodeDataUtil;
import info.magnolia.cms.util.ObservationUtil;
import info.magnolia.content2bean.Content2BeanUtil;
-import info.magnolia.context.Context;
import info.magnolia.context.MgnlContext;
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.map.LazyMap;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.jcr.observation.EventIterator;
+import javax.jcr.observation.EventListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -51,52 +58,33 @@
import java.util.Locale;
import java.util.Map;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.servlet.jsp.jstl.core.Config;
-import net.sourceforge.openutils.mgnlmessages.i18n.RepositoryMessagesImpl;
-
-import org.apache.commons.collections.Transformer;
-import org.apache.commons.collections.map.LazyMap;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
/**
* From this class you get the i18n messages. You should pass a a request, but if you can't the getMessages method will
* handle it properly. The get() methods are easy to use.
+ *
* @author philipp
*/
-public final class MessagesManager
-{
+public final class MessagesManager implements MessagesProvider{
+ private final static Logger log = LoggerFactory.getLogger(MessagesManager.class);
/**
- * Use this locale if no other provided
+ * Use this locale if no other provided.
*/
public static final String FALLBACK_LOCALE = "en"; //$NON-NLS-1$
/**
- * Use this basename if no other is provided
+ * Use this basename if no other is provided.
*/
public static final String DEFAULT_BASENAME = "info.magnolia.module.admininterface.messages"; //$NON-NLS-1$
/**
- * Logger.
+ * The node name where the configuration for i18n is stored.
*/
- protected static Logger log = LoggerFactory.getLogger(AbstractMessagesImpl.class);
-
- /**
- * The node name where the configuration for i18n is stored
- */
private static final String I18N_CONFIG_PATH = "/server/i18n/system"; //$NON-NLS-1$
/**
- * The name of the property to store the current system language
+ * The name of the property to store the current system language.
*/
private static final String FALLBACK_NODEDATA = "fallbackLanguage"; //$NON-NLS-1$
@@ -105,107 +93,89 @@
*/
private static final String LANGUAGES_NODE_NAME = "languages"; //$NON-NLS-1$
- /**
- * The current locale of the application
- */
- private static Locale applicationLocale;
- /**
- * List of the available locales
- */
- private static Collection availableLocales = new ArrayList();
+ public static MessagesProvider getInstance() {
+ return (MessagesProvider) FactoryUtil.getSingleton(MessagesManager.class);
+ }
/**
- * The context used for the messages
+ * The current locale of the application.
*/
- private static ServletContext context;
+ private Locale applicationLocale;
/**
- * LRU Map for the messages
+ * List of the available locales.
*/
- private static Map messages;
+ private final Collection availableLocales = new ArrayList();
/**
- * Util has no public constructor
+ * Map for the messages.
*/
- private MessagesManager()
- {
- }
+ private Map messages;
- static
- {
+ private String defaultBasename = DEFAULT_BASENAME;
+
+ public MessagesManager() {
// setting default language (en)
- MessagesManager.setDefaultLocale(FALLBACK_LOCALE);
+ setDefaultLocale(FALLBACK_LOCALE);
- initLRUMap();
+ initMap();
}
+ // for tests
+ void setDefaultBasename(String defaultBasename) {
+ this.defaultBasename = defaultBasename;
+ }
+
/**
- * Called through the initialization process (startup of the container)
- * @param context servlet context
+ * Called through the initialization process. (startup of the container)
*/
- public static void init(ServletContext context)
- {
- MessagesManager.context = context;
-
- // setting fallback
- context.setAttribute(Config.FMT_FALLBACK_LOCALE + ".application", FALLBACK_LOCALE); //$NON-NLS-1$
- // setting basename
- context.setAttribute(Config.FMT_LOCALIZATION_CONTEXT + ".application", MessagesManager.DEFAULT_BASENAME); //$NON-NLS-1$
- // for Resin and other J2EE Containers
- context.setAttribute(Config.FMT_LOCALIZATION_CONTEXT, MessagesManager.DEFAULT_BASENAME);
-
+ public void init() {
load();
registerEventListener();
}
/**
- * The lazzy LRU Map creates messages objects with a faul back to the default locale.
+ * The lazy Map creates messages objects with a fall back to the default locale.
*/
- private static void initLRUMap()
- {
- // FIXME use LRU
- // Map map = new LRUMap(20);
- Map map = new HashMap();
- map = LazyMap.decorate(map, new Transformer()
- {
-
- public Object transform(Object input)
- {
- MessagesID id = (MessagesID) input;
- // check http://jira.magnolia.info/browse/MAGNOLIA-1060
- // We are now chaining current user (LOCALE) messages with system default messages
- // so that it fallsback to default locale if string is not found instead of displaying broken
- // ???LABELS???
- Messages msgs = new MessagesChain(new RepositoryMessagesImpl(id.basename, id.locale))
- .chain(new DefaultMessagesImpl(id.basename, id.locale));
- if (!MessagesManager.getDefaultLocale().equals(id.locale))
- {
- msgs = new MessagesChain(msgs).chain(MessagesManager.getMessages(id.basename, MessagesManager
- .getDefaultLocale()));
- }
- return msgs;
+ protected void initMap() {
+ // FIXME use LRU: new LRUMap(20);
+ // LazyMap will instanciate bundles on demand.
+ final Map map = LazyMap.decorate(new HashMap(), new Transformer() {
+ // this transformer will wrap the Messages in a MessagesChain which will fall back to a Messages instance for the same bundle with default locale.
+ public Object transform(Object input) {
+ final MessagesID id = (MessagesID) input;
+ return newMessages(id);
}
});
messages = Collections.synchronizedMap(map);
}
/**
+ * Initializes a new Messages instances for the given MessagesID.
+ * By default, we chain to the same bundle with the default Locale. (so untranslated messages show up in the default language)
+ */
+ protected Messages newMessages(MessagesID messagesID) {
+ Messages msgs = new DefaultMessagesImpl(messagesID.basename, messagesID.locale);
+ if (!getDefaultLocale().equals(messagesID.locale)) {
+ msgs = new MessagesChain(msgs).chain(getMessages(messagesID.basename, getDefaultLocale()));
+ }
+ return msgs;
+ }
+
+ /**
* Load i18n configuration.
*/
- public static void load()
- {
+ protected void load() {
// reading the configuration from the repository, no need for context
- HierarchyManager hm = ContentRepository.getHierarchyManager(ContentRepository.CONFIG);
+ HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.CONFIG);
- try
- {
- log.info("Config : loading i18n configuration - " + I18N_CONFIG_PATH); //$NON-NLS-1$
+ try {
+ log.info("Loading i18n configuration - " + I18N_CONFIG_PATH); //$NON-NLS-1$
// checks if node exists
- if (!hm.isExist(I18N_CONFIG_PATH))
- {
+ if (!hm.isExist(I18N_CONFIG_PATH)) {
// configNode = ContentUtil.createPath(hm, I18N_CONFIG_PATH, ItemType.CONTENT, true);
log.warn(I18N_CONFIG_PATH + " does not exist yet; skipping.");
return;
@@ -213,51 +183,40 @@
final Content configNode = hm.getContent(I18N_CONFIG_PATH); //$NON-NLS-1$
- MessagesManager.setDefaultLocale(NodeDataUtil.getString(configNode, FALLBACK_NODEDATA, FALLBACK_LOCALE));
+ setDefaultLocale(NodeDataUtil.getString(configNode, FALLBACK_NODEDATA, FALLBACK_LOCALE));
// get the available languages - creates it if it does not exist - necessary to update to 3.5
final Content languagesNode;
- if (configNode.hasContent(LANGUAGES_NODE_NAME))
- {
+ if (configNode.hasContent(LANGUAGES_NODE_NAME)) {
languagesNode = configNode.getContent(LANGUAGES_NODE_NAME);
- }
- else
- {
+ } else {
languagesNode = configNode.createContent(LANGUAGES_NODE_NAME, ItemType.CONTENT);
}
Map languageDefinitions = Content2BeanUtil.toMap(languagesNode, true, LocaleDefinition.class);
// clear collection for reload
- MessagesManager.availableLocales.clear();
+ availableLocales.clear();
- for (Iterator iter = languageDefinitions.values().iterator(); iter.hasNext();)
- {
+ for (Iterator iter = languageDefinitions.values().iterator(); iter.hasNext();) {
LocaleDefinition ld = (LocaleDefinition) iter.next();
- if (ld.isEnabled())
- {
+ if (ld.isEnabled()) {
availableLocales.add(ld.getLocale());
}
}
}
- catch (Exception e)
- {
- log.error("Config : Failed to load i18n configuration - " + I18N_CONFIG_PATH, e); //$NON-NLS-1$
+ catch (Exception e) {
+ log.error("Failed to load i18n configuration - " + I18N_CONFIG_PATH, e); //$NON-NLS-1$
}
}
/**
* Register an event listener: reload configuration when something changes.
*/
- private static void registerEventListener()
- {
-
+ private void registerEventListener() {
log.info("Registering event listener for i18n"); //$NON-NLS-1$
- ObservationUtil.registerChangeListener(ContentRepository.CONFIG, I18N_CONFIG_PATH, new EventListener()
- {
-
- public void onEvent(EventIterator iterator)
- {
+ ObservationUtil.registerChangeListener(ContentRepository.CONFIG, I18N_CONFIG_PATH, new EventListener() {
+ public void onEvent(EventIterator iterator) {
// reload everything
reload();
}
@@ -267,59 +226,56 @@
/**
* Reload i18n configuration.
*/
- public static void reload()
- {
- try
- {
- reloadBundles();
+ public void reload() {
+ try {
+ // reload all present
+ for (Iterator iter = messages.values().iterator(); iter.hasNext();) {
+ Messages msgs = (Messages) iter.next();
+ msgs.reload();
+ }
}
- catch (Exception e)
- {
- log.error("can't reload i18n messages", e);
+ catch (Exception e) {
+ log.error("Can't reload i18n messages", e);
}
- initLRUMap();
+ initMap();
load();
}
- public static Messages getMessages()
- {
- return getMessages(MessagesManager.DEFAULT_BASENAME, MgnlContext.getLocale());
+ public Messages getMessagesInternal(String basename, Locale locale) {
+ if (StringUtils.isEmpty(basename)) {
+ basename = defaultBasename;
+ }
+ return (Messages) messages.get(new MessagesID(basename, locale));
}
- public static Messages getMessages(String basename)
- {
- return getMessages(basename, MgnlContext.getLocale());
+ public static Messages getMessages() {
+ return getMessages(null, getCurrentLocale());
}
- public static Messages getMessages(Locale locale)
- {
- return getMessages(MessagesManager.DEFAULT_BASENAME, locale);
+ public static Messages getMessages(String basename) {
+ return getMessages(basename, getCurrentLocale());
}
- public static Messages getMessages(String basename, Locale locale)
- {
- if (StringUtils.isEmpty(basename))
- {
- basename = MessagesManager.DEFAULT_BASENAME;
- }
- return (Messages) messages.get(new MessagesID(basename, locale));
+ public static Messages getMessages(Locale locale) {
+ return getMessages(null, locale);
}
- public static String get(String key)
- {
- return MgnlContext.getMessages().get(key);
+ public static Messages getMessages(String basename, Locale locale) {
+ return getInstance().getMessagesInternal(basename, locale);
}
+ public static String get(String key) {
+ return getMessages().get(key);
+ }
+
/**
- * Get a message with parameters inside: the value {0} must be a number
+ * Get a message with parameters inside: the value {0} must be a number.
* @param key key to find
* @param args replacement strings
* @return message
*/
-
- public static String get(String key, Object[] args)
- {
- return MgnlContext.getMessages().get(key, args);
+ public static String get(String key, Object[] args) {
+ return getMessages().get(key, args);
}
/**
@@ -328,10 +284,8 @@
* @param defaultMsg default message
* @return message
*/
-
- public static String getWithDefault(String key, String defaultMsg)
- {
- return MgnlContext.getMessages().getWithDefault(key, defaultMsg);
+ public static String getWithDefault(String key, String defaultMsg) {
+ return getMessages().getWithDefault(key, defaultMsg);
}
/**
@@ -341,116 +295,66 @@
* @param defaultMsg default message
* @return message
*/
- public static String getWithDefault(String key, Object[] args, String defaultMsg)
- {
- return MgnlContext.getMessages().getWithDefault(key, args, defaultMsg);
+ public static String getWithDefault(String key, Object[] args, String defaultMsg) {
+ return getMessages().getWithDefault(key, args, defaultMsg);
}
- /**
- * @return Returns the defaultLocale.
- */
- public static Locale getDefaultLocale()
- {
- return applicationLocale;
+ private static Locale getCurrentLocale() {
+ return MgnlContext.getInstance().getLocale();
}
- /**
- * Deprectated! Use MgnlContext
- * @return Returns the current locale for the current user
- * @deprecated
- */
- public static Locale getCurrentLocale(HttpServletRequest request)
- {
- try
- {
- return MgnlContext.getLocale();
- }
- catch (Exception e)
- {
- return getDefaultLocale();
- }
+ public Locale getDefaultLocale() {
+ return applicationLocale;
}
/**
* @param defaultLocale The defaultLocale to set.
+ * @deprecated since 4.0 - not used and should not be. Use setLocale() on the SystemContext instead.
+ * --note: do not remove the method, make it private. applicationLocale field is still needed.
+ * --and/or remove duplication with SystemContext.locale
*/
- public static void setDefaultLocale(String defaultLocale)
- {
- MessagesManager.applicationLocale = new Locale(defaultLocale);
- MgnlContext.getSystemContext().setLocale(applicationLocale);
-
- if (context != null)
- {
- context.setAttribute(Config.FMT_LOCALE + ".application", defaultLocale); //$NON-NLS-1$
- }
+ public void setDefaultLocale(String defaultLocale) {
+ this.applicationLocale = new Locale(defaultLocale);
+ //MgnlContext.getSystemContext().setLocale(applicationLocale);
}
- /**
- * @return Returns the availableLocals.
- */
- public static Collection getAvailableLocales()
- {
+ public Collection getAvailableLocales() {
return availableLocales;
}
/**
- * Set the user language in the session
- * @param language lagnguage to ste
- * @param session current session
- * @deprecated since 3.5, use MgnlContext instead (this is not used - can be safely removed)
- */
- public static void setUserLanguage(String language, HttpSession session)
- {
- MgnlContext.setAttribute(Config.FMT_LOCALE + ".session", language, Context.SESSION_SCOPE); //$NON-NLS-1$
- }
-
- public static void reloadBundles() throws Exception
- {
- // reload all present
- for (Iterator iter = messages.values().iterator(); iter.hasNext();)
- {
- Messages msgs = (Messages) iter.next();
- msgs.reload();
- }
- }
-
- /**
- * Getter for <code>context</code>.
- * @return Returns the context.
- */
- public static ServletContext getContext()
- {
- return context;
- }
-
- /**
- * Used as the key in the LRUMap
+ * Used as the key in the Map.
* @author Philipp Bracher
- * @version $Revision: 878 $ ($Author: manuel $)
+ * @version $Revision: 21431 $ ($Author: gjoseph $)
*/
- static private class MessagesID
- {
+ static private class MessagesID {
+ private final String basename;
+ private final Locale locale;
- String basename;
-
- Locale locale;
-
- public MessagesID(String basename, Locale locale)
- {
+ public MessagesID(String basename, Locale locale) {
this.basename = basename;
this.locale = locale;
}
+ // generated equals and hashcode methods
@Override
- public int hashCode()
- {
- return basename.hashCode();
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ MessagesID that = (MessagesID) o;
+
+ if (basename != null ? !basename.equals(that.basename) : that.basename != null) return false;
+ if (locale != null ? !locale.equals(that.locale) : that.locale != null) return false;
+
+ return true;
}
@Override
- public boolean equals(Object id)
- {
- return ((MessagesID) id).basename.equals(basename) && ((MessagesID) id).locale.equals(locale);
+ public int hashCode() {
+ int result = basename != null ? basename.hashCode() : 0;
+ result = 31 * result + (locale != null ? locale.hashCode() : 0);
+ return result;
}
}
}
Added: trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesProvider.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesProvider.java (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesProvider.java 2009-02-13 15:57:45 UTC (rev 984)
@@ -0,0 +1,16 @@
+package info.magnolia.cms.i18n;
+
+import java.util.Locale;
+
+/**
+ * @author molaschi
+ * @version $Id: $
+ */
+public interface MessagesProvider {
+
+ Locale getDefaultLocale();
+
+ void init();
+
+ Messages getMessagesInternal(String basename, Locale locale);
+}
Added: trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/OpenutilsMgnlMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/OpenutilsMgnlMessagesManager.java (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/OpenutilsMgnlMessagesManager.java 2009-02-13 15:57:45 UTC (rev 984)
@@ -0,0 +1,271 @@
+package info.magnolia.cms.i18n;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
+import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.util.NodeDataUtil;
+import info.magnolia.cms.util.ObservationUtil;
+import info.magnolia.content2bean.Content2BeanUtil;
+import info.magnolia.context.MgnlContext;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.jcr.observation.EventIterator;
+import javax.jcr.observation.EventListener;
+
+import org.apache.commons.collections.Transformer;
+import org.apache.commons.collections.map.LazyMap;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author molaschi
+ * @version $Id: $
+ */
+public class OpenutilsMgnlMessagesManager implements MessagesProvider
+{
+
+ /**
+ * Logger.
+ */
+ private Logger log = LoggerFactory.getLogger(OpenutilsMgnlMessagesManager.class);
+
+ /**
+ * The node name where the configuration for i18n is stored.
+ */
+ private static final String I18N_CONFIG_PATH = "/server/i18n/system"; //$NON-NLS-1$
+
+ /**
+ * The name of the property to store the current system language.
+ */
+ private static final String FALLBACK_NODEDATA = "fallbackLanguage"; //$NON-NLS-1$
+
+ /**
+ * Under this node all the available languages are stored. They are showed in the user dialog.
+ */
+ private static final String LANGUAGES_NODE_NAME = "languages"; //$NON-NLS-1$
+
+ private Locale defaultLocale = new Locale(MessagesManager.FALLBACK_LOCALE);
+
+ Map messages;
+
+ private final Collection availableLocales = new ArrayList();
+
+ /**
+ *
+ */
+ public OpenutilsMgnlMessagesManager()
+ {
+
+ }
+
+ public void init()
+ {
+ load();
+ registerEventListener();
+ }
+
+ /**
+ * The lazy Map creates messages objects with a fall back to the default locale.
+ */
+ protected void initMap()
+ {
+ // FIXME use LRU: new LRUMap(20);
+ // LazyMap will instanciate bundles on demand.
+ final Map map = LazyMap.decorate(new HashMap(), new Transformer()
+ {
+
+ // this transformer will wrap the Messages in a MessagesChain which will fall back to a Messages instance
+ // for the same bundle with default locale.
+ public Object transform(Object input)
+ {
+ final MessagesID id = (MessagesID) input;
+ return newMessages(id);
+ }
+ });
+ messages = Collections.synchronizedMap(map);
+ }
+
+ /**
+ * Initializes a new Messages instances for the given MessagesID. By default, we chain to the same bundle with the
+ * default Locale. (so untranslated messages show up in the default language)
+ */
+ protected Messages newMessages(MessagesID messagesID)
+ {
+ Messages msgs = new DefaultMessagesImpl(messagesID.basename, messagesID.locale);
+ if (!getDefaultLocale().equals(messagesID.locale))
+ {
+ msgs = new MessagesChain(msgs).chain(getMessagesInternal(messagesID.basename, getDefaultLocale()));
+ }
+ return msgs;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Locale getDefaultLocale()
+ {
+ return defaultLocale;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Messages getMessagesInternal(String basename, Locale locale)
+ {
+ if (StringUtils.isEmpty(basename))
+ {
+ basename = MessagesManager.DEFAULT_BASENAME;
+ }
+ return (Messages) messages.get(new MessagesID(basename, locale));
+ }
+
+ /**
+ * Load i18n configuration.
+ */
+ protected void load()
+ {
+
+ // reading the configuration from the repository, no need for context
+ HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.CONFIG);
+
+ try
+ {
+ log.info("Loading i18n configuration - " + I18N_CONFIG_PATH); //$NON-NLS-1$
+
+ // checks if node exists
+ if (!hm.isExist(I18N_CONFIG_PATH))
+ {
+ // configNode = ContentUtil.createPath(hm, I18N_CONFIG_PATH, ItemType.CONTENT, true);
+ log.warn(I18N_CONFIG_PATH + " does not exist yet; skipping.");
+ return;
+ }
+
+ final Content configNode = hm.getContent(I18N_CONFIG_PATH); //$NON-NLS-1$
+
+ defaultLocale = new Locale(NodeDataUtil.getString(
+ configNode,
+ FALLBACK_NODEDATA,
+ MessagesManager.FALLBACK_LOCALE));
+
+ // get the available languages - creates it if it does not exist - necessary to update to 3.5
+ final Content languagesNode;
+ if (configNode.hasContent(LANGUAGES_NODE_NAME))
+ {
+ languagesNode = configNode.getContent(LANGUAGES_NODE_NAME);
+ }
+ else
+ {
+ languagesNode = configNode.createContent(LANGUAGES_NODE_NAME, ItemType.CONTENT);
+ }
+
+ Map languageDefinitions = Content2BeanUtil.toMap(languagesNode, true, LocaleDefinition.class);
+
+ // clear collection for reload
+ availableLocales.clear();
+
+ for (Iterator iter = languageDefinitions.values().iterator(); iter.hasNext();)
+ {
+ LocaleDefinition ld = (LocaleDefinition) iter.next();
+ if (ld.isEnabled())
+ {
+ availableLocales.add(ld.getLocale());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to load i18n configuration - " + I18N_CONFIG_PATH, e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Register an event listener: reload configuration when something changes.
+ */
+ private void registerEventListener()
+ {
+ log.info("Registering event listener for i18n"); //$NON-NLS-1$
+ ObservationUtil.registerChangeListener(ContentRepository.CONFIG, I18N_CONFIG_PATH, new EventListener()
+ {
+
+ public void onEvent(EventIterator iterator)
+ {
+ // reload everything
+ reload();
+ }
+ });
+ }
+
+ /**
+ * Reload i18n configuration.
+ */
+ public void reload()
+ {
+ try
+ {
+ // reload all present
+ for (Iterator iter = messages.values().iterator(); iter.hasNext();)
+ {
+ Messages msgs = (Messages) iter.next();
+ msgs.reload();
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Can't reload i18n messages", e);
+ }
+ initMap();
+ load();
+ }
+
+ static private class MessagesID
+ {
+
+ private final String basename;
+
+ private final Locale locale;
+
+ public MessagesID(String basename, Locale locale)
+ {
+ this.basename = basename;
+ this.locale = locale;
+ }
+
+ // generated equals and hashcode methods
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ MessagesID that = (MessagesID) o;
+
+ if (basename != null ? !basename.equals(that.basename) : that.basename != null)
+ return false;
+ if (locale != null ? !locale.equals(that.locale) : that.locale != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = basename != null ? basename.hashCode() : 0;
+ result = 31 * result + (locale != null ? locale.hashCode() : 0);
+ return result;
+ }
+ }
+
+}
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2009-02-13 15:57:45 UTC (rev 984)
@@ -84,7 +84,7 @@
stream = ClasspathResourcesUtil.getStream("/"
+ StringUtils.replace(basename, ".", "/")
+ "_"
- + MessagesManager.getDefaultLocale().getLanguage()
+ + MessagesManager.getInstance().getDefaultLocale().getLanguage()
+ ".properties", false);
}
if (stream == null)
Modified: trunk/openutils-mgnlmessages/src/main/resources/META-INF/magnolia/messages.xml
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/META-INF/magnolia/messages.xml 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/src/main/resources/META-INF/magnolia/messages.xml 2009-02-13 15:57:45 UTC (rev 984)
@@ -7,10 +7,16 @@
<class>net.sourceforge.openutils.mgnlmessages.lifecycle.MessagesModuleLifecycle</class>
<versionHandler>net.sourceforge.openutils.mgnlmessages.setup.MessagesModuleVersionHandler</versionHandler>
<version>${project.version}</version>
+ <properties>
+ <property>
+ <name>info.magnolia.cms.i18n.MessagesManager</name>
+ <value>info.magnolia.cms.i18n.OpenutilsMgnlMessagesManager</value>
+ </property>
+ </properties>
<dependencies>
<dependency>
<name>adminInterface</name>
- <version>3.1/*</version>
+ <version>4</version>
</dependency>
</dependencies>
<repositories>
Modified: trunk/openutils-mgnlmessages/src/site/apt/index.apt
===================================================================
--- trunk/openutils-mgnlmessages/src/site/apt/index.apt 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/src/site/apt/index.apt 2009-02-13 15:57:45 UTC (rev 984)
@@ -2,6 +2,7 @@
openutils-mgnlmessages
--------------------------
Fabrizio Giustina
+ Manuel Molaschi
--------------------------
About openutils-mgnlmessages
@@ -16,20 +17,13 @@
Installation
- <<This module currently requires magnolia 3.6.x>>
+ <<This module currently requires magnolia 4.0.x>>
The module needs to be installed as usual, by declaring an additional dependency into your pom or by manually dropping the jar
into magnolia.
- Unfortunately, for Magnolia 3.6 this module requires also patching one of the magnolia core classes, info.magnolia.cms.i18n.MessagesManager,
- since there was no way to cleanly extend/replace it.
- You may do that by copying the patched java source (you can find it in the module sources) to your java source folder for
- your webapp (the compiled class file must end up in WEB-INF/classes in order to override the one found in the magnolia jars)
+
- This limitation will be removed after the module will be updated to magnolia 4.0, which allows the configuration of a
- custom message manager.
-
-
Released versions
{{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-mgnlmessages}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-mgnlmessages}}
Modified: trunk/openutils-mgnlmessages/src/site/changes/changes.xml
===================================================================
--- trunk/openutils-mgnlmessages/src/site/changes/changes.xml 2009-02-13 11:59:07 UTC (rev 983)
+++ trunk/openutils-mgnlmessages/src/site/changes/changes.xml 2009-02-13 15:57:45 UTC (rev 984)
@@ -6,8 +6,12 @@
<properties>
<title>Changes</title>
<author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author>
+ <author email="molaschi(at)users.sourceforge.net">Manuel Molaschi</author>
</properties>
<body>
+ <release version="4.0" date="2009-02-13" description="">
+ <action type="update" dev="molaschi">Updated to magnolia 4.0.x.</action>
+ </release>
<release version="1.1" date="2009-01-31" description="">
<action type="fix" dev="fgiust">minor bugfixes and basic documentation added</action>
</release>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2009-05-24 09:36:20
|
Revision: 1199
http://openutils.svn.sourceforge.net/openutils/?rev=1199&view=rev
Author: fgiust
Date: 2009-05-24 09:36:15 +0000 (Sun, 24 May 2009)
Log Message:
-----------
remove magnolia patches
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
Removed Paths:
-------------
trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/DefaultMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2009-05-11 17:51:11 UTC (rev 1198)
+++ trunk/openutils-mgnlmessages/pom.xml 2009-05-24 09:36:15 UTC (rev 1199)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
Deleted: trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/DefaultMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/DefaultMessagesManager.java 2009-05-11 17:51:11 UTC (rev 1198)
+++ trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/DefaultMessagesManager.java 2009-05-24 09:36:15 UTC (rev 1199)
@@ -1,350 +0,0 @@
-/**
- * This file Copyright (c) 2003-2009 Magnolia International
- * Ltd. (http://www.magnolia-cms.com). All rights reserved.
- *
- *
- * This file is dual-licensed under both the Magnolia
- * Network Agreement and the GNU General Public License.
- * You may elect to use one or the other of these licenses.
- *
- * This file is distributed in the hope that it will be
- * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
- * Redistribution, except as permitted by whichever of the GPL
- * or MNA you select, is prohibited.
- *
- * 1. For the GPL license (GPL), you can redistribute and/or
- * modify this file under the terms of the GNU General
- * Public License, Version 3, as published by the Free Software
- * Foundation. You should have received a copy of the GNU
- * General Public License, Version 3 along with this program;
- * if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * 2. For the Magnolia Network Agreement (MNA), this file
- * and the accompanying materials are made available under the
- * terms of the MNA which accompanies this distribution, and
- * is available at http://www.magnolia-cms.com/mna.html
- *
- * Any modifications to this file must keep this entire header
- * intact.
- *
- */
-package info.magnolia.cms.i18n;
-
-import info.magnolia.cms.beans.config.ContentRepository;
-import info.magnolia.cms.core.Content;
-import info.magnolia.cms.core.HierarchyManager;
-import info.magnolia.cms.core.ItemType;
-import info.magnolia.cms.util.FactoryUtil;
-import info.magnolia.cms.util.NodeDataUtil;
-import info.magnolia.cms.util.ObservationUtil;
-import info.magnolia.content2bean.Content2BeanUtil;
-import info.magnolia.context.MgnlContext;
-import org.apache.commons.collections.Transformer;
-import org.apache.commons.collections.map.LazyMap;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- * From this class you get the i18n messages. You should pass a a request, but if you can't the getMessages method will
- * handle it properly. The get() methods are easy to use.
- * @author philipp
- */
-public class DefaultMessagesManager extends MessagesManager
-{
-
- private final static Logger log = LoggerFactory.getLogger(DefaultMessagesManager.class);
-
- /**
- * The current locale of the application.
- */
- private Locale applicationLocale;
-
- /**
- * List of the available locales.
- */
- private final Collection availableLocales = new ArrayList();
-
- /**
- * Map for the messages.
- */
- private Map messages;
-
- private String defaultBasename = DEFAULT_BASENAME;
-
- public DefaultMessagesManager()
- {
- // setting default language (en)
- setDefaultLocale(FALLBACK_LOCALE);
-
- initMap();
- }
-
- // for tests
- @Override
- void setDefaultBasename(String defaultBasename)
- {
- this.defaultBasename = defaultBasename;
- }
-
- /**
- * Called through the initialization process. (startup of the container)
- */
- @Override
- public void init()
- {
- load();
- registerEventListener();
- }
-
- /**
- * The lazy Map creates messages objects with a fall back to the default locale.
- */
- protected void initMap()
- {
- // FIXME use LRU: new LRUMap(20);
- // LazyMap will instanciate bundles on demand.
- final Map map = LazyMap.decorate(new HashMap(), new Transformer()
- {
-
- // this transformer will wrap the Messages in a MessagesChain which
- // will fall back to a Messages instance for the same bundle with
- // default locale.
- public Object transform(Object input)
- {
- final MessagesID id = (MessagesID) input;
- return newMessages(id);
- }
- });
- messages = Collections.synchronizedMap(map);
- }
-
- /**
- * Initializes a new Messages instances for the given MessagesID. By default, we chain to the same bundle with the
- * default Locale. (so untranslated messages show up in the default language)
- */
- protected Messages newMessages(MessagesID messagesID)
- {
- Messages msgs = new DefaultMessagesImpl(messagesID.basename, messagesID.locale);
- if (!getDefaultLocale().equals(messagesID.locale))
- {
- msgs = new MessagesChain(msgs).chain(getMessages(messagesID.basename, getDefaultLocale()));
- }
- return msgs;
- }
-
- /**
- * Load i18n configuration.
- */
- protected void load()
- {
-
- // reading the configuration from the repository, no need for context
- HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.CONFIG);
-
- try
- {
- log.info("Loading i18n configuration - " + I18N_CONFIG_PATH); //$NON-NLS-1$
-
- // checks if node exists
- if (!hm.isExist(I18N_CONFIG_PATH))
- {
- // configNode = ContentUtil.createPath(hm, I18N_CONFIG_PATH,
- // ItemType.CONTENT, true);
- log.warn(I18N_CONFIG_PATH + " does not exist yet; skipping.");
- return;
- }
-
- final Content configNode = hm.getContent(I18N_CONFIG_PATH); //$NON-NLS-1$
-
- setDefaultLocale(NodeDataUtil.getString(configNode, FALLBACK_NODEDATA, FALLBACK_LOCALE));
-
- // get the available languages - creates it if it does not exist -
- // necessary to update to 3.5
- final Content languagesNode;
- if (configNode.hasContent(LANGUAGES_NODE_NAME))
- {
- languagesNode = configNode.getContent(LANGUAGES_NODE_NAME);
- }
- else
- {
- languagesNode = configNode.createContent(LANGUAGES_NODE_NAME, ItemType.CONTENT);
- }
-
- Map languageDefinitions = Content2BeanUtil.toMap(languagesNode, true, LocaleDefinition.class);
-
- // clear collection for reload
- availableLocales.clear();
-
- for (Iterator iter = languageDefinitions.values().iterator(); iter.hasNext();)
- {
- LocaleDefinition ld = (LocaleDefinition) iter.next();
- if (ld.isEnabled())
- {
- availableLocales.add(ld.getLocale());
- }
- }
- }
- catch (Exception e)
- {
- log.error("Failed to load i18n configuration - " + I18N_CONFIG_PATH, e); //$NON-NLS-1$
- }
- }
-
- /**
- * Register an event listener: reload configuration when something changes.
- */
- private void registerEventListener()
- {
- log.info("Registering event listener for i18n"); //$NON-NLS-1$
- ObservationUtil.registerChangeListener(ContentRepository.CONFIG, I18N_CONFIG_PATH, new EventListener()
- {
-
- public void onEvent(EventIterator iterator)
- {
- // reload everything
- reload();
- }
- });
- }
-
- /**
- * Reload i18n configuration.
- */
- public void reload()
- {
- try
- {
- // reload all present
- for (Iterator iter = messages.values().iterator(); iter.hasNext();)
- {
- Messages msgs = (Messages) iter.next();
- msgs.reload();
- }
- }
- catch (Exception e)
- {
- log.error("Can't reload i18n messages", e);
- }
- initMap();
- load();
- }
-
- @Override
- public Messages getMessagesInternal(String basename, Locale locale)
- {
- if (StringUtils.isEmpty(basename))
- {
- basename = defaultBasename;
- }
- return (Messages) messages.get(new MessagesID(basename, locale));
- }
-
- @Override
- public Locale getDefaultLocale()
- {
- return applicationLocale;
- }
-
- /**
- * @param defaultLocale The defaultLocale to set.
- * @deprecated since 4.0 - not used and should not be. Use setLocale() on the SystemContext instead. --note: do not
- * remove the method, make it private. applicationLocale field is still needed. --and/or remove duplication with
- * SystemContext.locale
- */
- public void setDefaultLocale(String defaultLocale)
- {
- this.applicationLocale = new Locale(defaultLocale);
- // MgnlContext.getSystemContext().setLocale(applicationLocale);
- }
-
- @Override
- public Collection getAvailableLocales()
- {
- return availableLocales;
- }
-
- public void setMessages(Map messages)
- {
- this.messages = messages;
- }
-
- /**
- * Used as the key in the Map.
- * @author Philipp Bracher
- * @version $Revision: 21431 $ ($Author: gjoseph $)
- */
- public static class MessagesID
- {
-
- private final String basename;
-
- private final Locale locale;
-
- public MessagesID(String basename, Locale locale)
- {
- this.basename = basename;
- this.locale = locale;
- }
-
- // generated equals and hashcode methods
- @Override
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- MessagesID that = (MessagesID) o;
-
- if (basename != null ? !basename.equals(that.basename) : that.basename != null)
- return false;
- if (locale != null ? !locale.equals(that.locale) : that.locale != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result = basename != null ? basename.hashCode() : 0;
- result = 31 * result + (locale != null ? locale.hashCode() : 0);
- return result;
- }
-
- /**
- * Returns the basename.
- * @return the basename
- */
- public String getBasename()
- {
- return basename;
- }
-
- /**
- * Returns the locale.
- * @return the locale
- */
- public Locale getLocale()
- {
- return locale;
- }
-
- }
-}
Deleted: trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java 2009-05-11 17:51:11 UTC (rev 1198)
+++ trunk/openutils-mgnlmessages/src/main/java/info/magnolia/cms/i18n/MessagesManager.java 2009-05-24 09:36:15 UTC (rev 1199)
@@ -1,123 +0,0 @@
-package info.magnolia.cms.i18n;
-
-import info.magnolia.cms.util.FactoryUtil;
-import info.magnolia.context.MgnlContext;
-
-import java.util.Collection;
-import java.util.Locale;
-
-/**
- *
- * @author molaschi
- *
- */
-public abstract class MessagesManager {
-
- /**
- * Use this locale if no other provided.
- */
- public static final String FALLBACK_LOCALE = "en"; //$NON-NLS-1$
-
- /**
- * Use this basename if no other is provided.
- */
- public static final String DEFAULT_BASENAME = "info.magnolia.module.admininterface.messages"; //$NON-NLS-1$
-
- /**
- * The node name where the configuration for i18n is stored.
- */
- public static final String I18N_CONFIG_PATH = "/server/i18n/system"; //$NON-NLS-1$
-
- /**
- * The name of the property to store the current system language.
- */
- public static final String FALLBACK_NODEDATA = "fallbackLanguage"; //$NON-NLS-1$
-
- /**
- * Under this node all the available languages are stored. They are showed
- * in the user dialog.
- */
- public static final String LANGUAGES_NODE_NAME = "languages"; //$NON-NLS-1$
-
- public static MessagesManager getInstance() {
- return (MessagesManager) FactoryUtil
- .getSingleton(MessagesManager.class);
- }
-
- public static Messages getMessages() {
- return getMessages(null, getCurrentLocale());
- }
-
- public static Messages getMessages(String basename) {
- return getMessages(basename, getCurrentLocale());
- }
-
- public static Messages getMessages(Locale locale) {
- return getMessages(null, locale);
- }
-
- public static Messages getMessages(String basename, Locale locale) {
- return getInstance().getMessagesInternal(basename, locale);
- }
-
- public static String get(String key) {
- return getMessages().get(key);
- }
-
- /**
- * Get a message with parameters inside: the value {0} must be a number.
- *
- * @param key
- * key to find
- * @param args
- * replacement strings
- * @return message
- */
- public static String get(String key, Object[] args) {
- return getMessages().get(key, args);
- }
-
- /**
- * Use a default string.
- *
- * @param key
- * key to find
- * @param defaultMsg
- * default message
- * @return message
- */
- public static String getWithDefault(String key, String defaultMsg) {
- return getMessages().getWithDefault(key, defaultMsg);
- }
-
- /**
- * Get a message with parameters inside: the value {0} must be a number. Use
- * a default message.
- *
- * @param key
- * key to find
- * @param args
- * replacement strings
- * @param defaultMsg
- * default message
- * @return message
- */
- public static String getWithDefault(String key, Object[] args,
- String defaultMsg) {
- return getMessages().getWithDefault(key, args, defaultMsg);
- }
-
- private static Locale getCurrentLocale() {
- return MgnlContext.getInstance().getLocale();
- }
-
- public abstract void init();
-
- public abstract Collection getAvailableLocales();
-
- public abstract Locale getDefaultLocale();
-
- public abstract Messages getMessagesInternal(String basename, Locale locale);
-
- abstract void setDefaultBasename(String basename);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2009-09-05 18:15:51
|
Revision: 1395
http://openutils.svn.sourceforge.net/openutils/?rev=1395&view=rev
Author: fgiust
Date: 2009-09-05 18:15:44 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
ready for a release
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
Added Paths:
-----------
trunk/openutils-mgnlmessages/src/main/assembly/
trunk/openutils-mgnlmessages/src/main/assembly/assembly-bundle.xml
trunk/openutils-mgnlmessages/src/main/bundle/
trunk/openutils-mgnlmessages/src/main/bundle/LICENSE.txt
trunk/openutils-mgnlmessages/src/main/bundle/README.txt
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2009-09-05 18:11:56 UTC (rev 1394)
+++ trunk/openutils-mgnlmessages/pom.xml 2009-09-05 18:15:44 UTC (rev 1395)
@@ -3,12 +3,13 @@
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-parent</artifactId>
- <version>1.0</version>
+ <version>1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>openutils-mgnlmessages</artifactId>
- <name>openutils-mgnlmessages</name>
+ <name>Magnolia Messages Module</name>
+ <description>Manage your translations from the Magnolia admin interface</description>
<version>4.0.3-SNAPSHOT</version>
<licenses>
<license>
@@ -16,6 +17,11 @@
<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
</license>
</licenses>
+ <url>http://lab.openmindonline.it/lab/products/groovy.html</url>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://lab.openmindonline.it/jira/browse/GROOVY</url>
+ </issueManagement>
<build>
<resources>
<resource>
@@ -33,22 +39,41 @@
</includes>
</resource>
</resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
<dependencies>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-core</artifactId>
- <version>4.0.1</version>
+ <version>4.1</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-admininterface</artifactId>
- <version>4.0.1</version>
+ <version>4.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnltasks</artifactId>
- <version>4.0.1</version>
+ <version>4.0.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
Added: trunk/openutils-mgnlmessages/src/main/assembly/assembly-bundle.xml
===================================================================
--- trunk/openutils-mgnlmessages/src/main/assembly/assembly-bundle.xml (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/assembly/assembly-bundle.xml 2009-09-05 18:15:44 UTC (rev 1395)
@@ -0,0 +1,33 @@
+<assembly>
+ <id>bundle</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <filtered>true</filtered>
+ <outputDirectory>/</outputDirectory>
+ <lineEnding>crlf</lineEnding>
+ <directory>${basedir}/src/main/bundle</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/java/</directory>
+ <outputDirectory>/sources/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <includes>
+ <include>net.sourceforge.openutils:*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
Property changes on: trunk/openutils-mgnlmessages/src/main/assembly/assembly-bundle.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlmessages/src/main/bundle/LICENSE.txt
===================================================================
--- trunk/openutils-mgnlmessages/src/main/bundle/LICENSE.txt (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/bundle/LICENSE.txt 2009-09-05 18:15:44 UTC (rev 1395)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/openutils-mgnlmessages/src/main/bundle/LICENSE.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlmessages/src/main/bundle/README.txt
===================================================================
--- trunk/openutils-mgnlmessages/src/main/bundle/README.txt (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/bundle/README.txt 2009-09-05 18:15:44 UTC (rev 1395)
@@ -0,0 +1,76 @@
+===========================================================
+
+${pom.name} ${pom.version}
+by ${pom.organization.name}
+
+===========================================================
+
+${pom.description}
+
+More information about this project can be found at:
+${pom.url}
+
+Change log and known issues can be found at:
+${pom.issueManagement.url}
+
+Source is available from the subversion repository at:
+${pom.scm.url}
+
+
+=========================================
+ INSTALLATION
+=========================================
+
+The bundle is provided as a zip file; the archive contains a number of .jar files
+(the module itself plus the required dependencies not already available in a
+standard Magnolia installation.
+
+Copy to your all the jar files in the bundle into your Magnolia instances'
+WEB-INF/lib folder, just like any other module.
+
+Please check the documentation website for information about required Magnolia
+versions.
+
+
+=========================================
+ USING MAVEN
+=========================================
+
+The preferred way to add ${pom.name} to your project is using maven.
+You can declare the following dependency in your pom.xml:
+
+ <dependency>
+ <groupId>${pom.artifactId}</groupId>
+ <artifactId>${pom.groupId}</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+
+
+=========================================
+ LICENSE
+=========================================
+
+Copyright Openmind http://www.openmindonline.it
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+=========================================
+ GENERAL LEGAL NOTICES
+=========================================
+
+Magnolia is a registered trademark of Magnolia International Ltd.
+
Property changes on: trunk/openutils-mgnlmessages/src/main/bundle/README.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2010-09-11 12:28:51
|
Revision: 3046
http://openutils.svn.sourceforge.net/openutils/?rev=3046&view=rev
Author: fgiust
Date: 2010-09-11 12:28:44 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
MESSAGES-7 Message lookup can be slow with several modules installed
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
Removed Paths:
-------------
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2010-09-11 10:27:12 UTC (rev 3045)
+++ trunk/openutils-mgnlmessages/pom.xml 2010-09-11 12:28:44 UTC (rev 3046)
@@ -69,17 +69,17 @@
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-core</artifactId>
- <version>4.2.3</version>
+ <version>${magnolia.version}</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-admininterface</artifactId>
- <version>4.2.3</version>
+ <version>${magnolia.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnltasks</artifactId>
- <version>4.1.0</version>
+ <version>4.1.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
@@ -124,4 +124,7 @@
</snapshots>
</repository>
</repositories>
+ <properties>
+ <magnolia.version>4.3.6</magnolia.version>
+ </properties>
</project>
\ No newline at end of file
Deleted: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java 2010-09-11 10:27:12 UTC (rev 3045)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/ModulePropertyMessagesImpl.java 2010-09-11 12:28:44 UTC (rev 3046)
@@ -1,107 +0,0 @@
-/**
- *
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.sourceforge.openutils.mgnlmessages.i18n;
-
-import info.magnolia.cms.i18n.AbstractMessagesImpl;
-import info.magnolia.cms.i18n.Messages;
-import info.magnolia.module.ModuleRegistry;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-
-/**
- * @author molaschi
- * @version $Id: $
- */
-public class ModulePropertyMessagesImpl extends AbstractMessagesImpl
-{
-
- List<Messages> messages = new ArrayList<Messages>();
-
- /**
- * @param basename
- * @param locale
- */
- @SuppressWarnings("unchecked")
- public ModulePropertyMessagesImpl(Locale locale)
- {
- super("", locale);
- ModuleRegistry reg = ModuleRegistry.Factory.getInstance();
- for (String name : (Set<String>) reg.getModuleNames())
- {
- messages.add(new SimpleMessagesImpl("mgnl-messages." + name + ".messages", locale));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String get(String key)
- {
- String value;
- for (Messages m : messages)
- {
- value = m.get(key);
- if (value != null)
- {
- return value;
- }
- }
- if (key == null)
- {
- return "??????";
- }
- return "???" + key + "???";
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public Iterator keys()
- {
- List<String> keys = new ArrayList<String>();
- for (Messages m : messages)
- {
- Iterator it = m.keys();
- while (it.hasNext())
- {
- keys.add((String) it.next());
- }
- }
- return keys.iterator();
- }
-
- /**
- * {@inheritDoc}
- */
- public void reload() throws Exception
- {
- for (Messages m : messages)
- {
- m.reload();
- }
- }
-
-}
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-09-11 10:27:12 UTC (rev 3045)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-09-11 12:28:44 UTC (rev 3046)
@@ -22,7 +22,6 @@
import info.magnolia.cms.i18n.DefaultMessagesManager;
import info.magnolia.cms.i18n.Messages;
import info.magnolia.cms.i18n.MessagesChain;
-import info.magnolia.cms.i18n.MessagesManager;
/**
@@ -38,17 +37,11 @@
@Override
protected Messages newMessages(MessagesID messagesID)
{
- Messages msgs = new MessagesChain(new RepositoryMessagesImpl(messagesID.getBasename(), messagesID.getLocale()));
- ((MessagesChain) msgs).chain(new ModulePropertyMessagesImpl(messagesID.getLocale()));
- ((MessagesChain) msgs).chain(new OpenutilsMessagesImpl(messagesID.getBasename(), messagesID.getLocale()));
- if (!getDefaultLocale().equals(messagesID.getLocale()))
- {
- msgs = ((MessagesChain) msgs).chain(MessagesManager.getMessages(
- messagesID.getBasename(),
- getDefaultLocale()));
- }
- return msgs;
+ Messages parentMessages = super.newMessages(messagesID);
+ Messages repositoryMsg = new RepositoryMessagesImpl(messagesID.getBasename(), messagesID.getLocale());
+
+ return new MessagesChain(repositoryMsg).chain(parentMessages);
}
}
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-09-11 10:27:12 UTC (rev 3045)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-09-11 12:28:44 UTC (rev 3046)
@@ -46,7 +46,6 @@
import javax.servlet.http.HttpServletResponse;
import net.sourceforge.openutils.mgnlmessages.configuration.MessagesConfigurationManager;
-import net.sourceforge.openutils.mgnlmessages.i18n.ModulePropertyMessagesImpl;
import net.sourceforge.openutils.mgnlmessages.i18n.RepositoryMessagesImpl;
import org.apache.commons.io.IOUtils;
@@ -111,8 +110,7 @@
cell.setCellValue(localeCode);
index++;
- Messages mc = new MessagesChain(new RepositoryMessagesImpl(MessagesManager.DEFAULT_BASENAME, locale))
- .chain(new ModulePropertyMessagesImpl(locale));
+ Messages mc = new MessagesChain(new RepositoryMessagesImpl(MessagesManager.DEFAULT_BASENAME, locale));
for (String basename : MessagesConfigurationManager.getBaseNames())
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2010-11-17 14:32:48
|
Revision: 3142
http://openutils.svn.sourceforge.net/openutils/?rev=3142&view=rev
Author: fgiust
Date: 2010-11-17 14:32:41 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
license headers
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/pom.xml 2010-11-17 14:32:41 UTC (rev 3142)
@@ -22,6 +22,7 @@
<system>jira</system>
<url>http://jira.openmindlab.com/browse/GROOVY</url>
</issueManagement>
+ <inceptionYear>2008</inceptionYear>
<scm>
<connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</connection>
<developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</developerConnection>
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java 2010-11-17 14:32:10 UTC (rev 3141)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java 2010-11-17 14:32:41 UTC (rev 3142)
@@ -1,7 +1,7 @@
/**
*
* Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
- * Copyright(C) null-2010, Openmind S.r.l. http://www.openmindonline.it
+ * Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2010-12-18 15:12:30
|
Revision: 3185
http://openutils.svn.sourceforge.net/openutils/?rev=3185&view=rev
Author: fgiust
Date: 2010-12-18 15:12:23 +0000 (Sat, 18 Dec 2010)
Log Message:
-----------
license header and cleanup
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMgnlMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/pom.xml 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-parent</artifactId>
@@ -8,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>openutils-mgnlmessages</artifactId>
- <name>Magnolia Messages Module</name>
+ <name>Messages Module for Magnolia CMS</name>
<description>Manage your translations from the Magnolia admin interface</description>
<version>4.1.2-SNAPSHOT</version>
<licenses>
@@ -17,10 +18,10 @@
<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
</license>
</licenses>
- <url>http://www.openmindlab.com/lab/products/groovy.html</url>
+ <url>http://www.openmindlab.com/lab/products/messages.html</url>
<issueManagement>
<system>jira</system>
- <url>http://jira.openmindlab.com/browse/GROOVY</url>
+ <url>http://jira.openmindlab.com/browse/MESSAGES</url>
</issueManagement>
<inceptionYear>2008</inceptionYear>
<scm>
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/configuration/MessagesConfigurationManager.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/EmptyResourceBundle.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMessagesImpl.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMessagesImpl.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMgnlMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMgnlMessagesManager.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/MultiBundleMgnlMessagesManager.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMessagesImpl.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/OpenutilsMgnlMessagesManager.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/SimpleMessagesImpl.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/lifecycle/MessagesModuleLifecycle.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/ExtractMessagesFromDialogsPage.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/IgnoreMissingBundlesMessagesImpl.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
@@ -29,6 +29,8 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
/**
@@ -71,25 +73,18 @@
InputStream stream = null;
try
{
- if (StringUtils.isEmpty(getLocale().getCountry()))
- {
- stream = ClasspathResourcesUtil.getStream("/"
- + StringUtils.replace(basename, ".", "/")
- + "_"
- + getLocale().getLanguage()
- + ".properties", false);
- }
- else
- {
- stream = ClasspathResourcesUtil.getStream("/"
- + StringUtils.replace(basename, ".", "/")
- + "_"
- + getLocale().getLanguage()
- + "_"
- + getLocale().getCountry()
- + ".properties", false);
- }
+ String file = "/"
+ + StringUtils.replace(basename, ".", "/")
+ + "_"
+ + getLocale().getLanguage()
+ + (getLocale().getCountry() != null ? "_" + getLocale().getCountry() : "")
+ + ".properties";
+
+ log.debug("loading bundle {}", file);
+
+ stream = ClasspathResourcesUtil.getStream(file, false);
+
if (stream != null)
{
bundle = new PropertyResourceBundle(stream);
@@ -111,4 +106,25 @@
return bundle;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object object)
+ {
+ if (!(object instanceof IgnoreMissingBundlesMessagesImpl))
+ {
+ return false;
+ }
+ IgnoreMissingBundlesMessagesImpl rhs = (IgnoreMissingBundlesMessagesImpl) object;
+ return new EqualsBuilder().append(this.basename, rhs.basename).append(this.locale, rhs.locale).isEquals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode()
+ {
+ return new HashCodeBuilder(-399088031, -1971683455).append(basename).append(locale).toHashCode();
+ }
+
}
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesEditPage.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/pages/MessagesImpExpPage.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
@@ -34,9 +34,11 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import javax.jcr.RepositoryException;
import javax.servlet.http.HttpServletRequest;
@@ -89,16 +91,17 @@
{
HSSFWorkbook wb = new HSSFWorkbook();
- Map<String, Map<Locale, Messages>> messages = new HashMap<String, Map<Locale, Messages>>();
+ Map<String, Set<Messages>> messages = new HashMap<String, Set<Messages>>();
List<Locale> locales = MessagesConfigurationManager.getAvaiableLocales();
for (String basename : MessagesConfigurationManager.getBaseNames())
{
- Map<Locale, Messages> msgs = new HashMap<Locale, Messages>();
+ Set<Messages> msgs = new LinkedHashSet<Messages>();
for (Locale locale : locales)
{
- msgs.put(locale, new IgnoreMissingBundlesMessagesImpl(basename, locale));
+ log.debug("Adding locale {}", locale);
+ msgs.add(new IgnoreMissingBundlesMessagesImpl(basename, locale));
}
messages.put(basename, msgs);
@@ -134,13 +137,21 @@
// create sheet header (key + locales)
HSSFRow header = sheet.createRow((short) 0);
- HSSFCell headerCell = header.createCell((short) 0);
+ HSSFCell headerCell = header.createCell(0);
headerCell.setCellStyle(style);
headerCell.setCellValue("KEY");
// get the keys for this basename and sort them alphabetically
- Map<Locale, Messages> msgs = messages.get(basename);
- Iterator<String> it = msgs.values().iterator().next().keys();
+ Set<Messages> msgs = messages.get(basename);
+
+ log.debug("Processing {} with {} locales", basename, msgs.size());
+
+ Messages referencelocale = msgs.iterator().next();
+
+ log.debug("Using reference locale {}", referencelocale.getLocale());
+
+ @SuppressWarnings("unchecked")
+ Iterator<String> it = referencelocale.keys();
List<String> keys = new ArrayList<String>();
while (it.hasNext())
{
@@ -148,32 +159,35 @@
}
Collections.sort(keys);
+
+ log.debug("Locale {} has {} keys", referencelocale.getLocale(), keys.size());
+
int r = 1;
// for each key create a row in the sheet
for (String key : keys)
{
- short c = 0;
+ int c = 0;
HSSFRow row = sheet.createRow(r);
HSSFCell cell = row.createCell(c);
cell = row.createCell(c++);
// cell.setEncoding(HSSFWorkbook.ENCODING_UTF_16);
cell.setCellValue(key);
- for (Map.Entry<Locale, Messages> entry : msgs.entrySet())
+ for (Messages entry : msgs)
{
// get back to header row and set the locale for the corresponding value
header = sheet.getRow(0);
headerCell = header.createCell(c);
headerCell.setCellStyle(style);
- Locale locale = entry.getKey();
+ Locale locale = entry.getLocale();
String localeCode = locale.getLanguage();
if (!StringUtils.isEmpty(locale.getCountry()))
{
localeCode += "_" + locale.getCountry();
}
headerCell.setCellValue(localeCode);
- String value = entry.getValue().get(key);
+ String value = entry.get(key);
cell = row.createCell(c);
if (!value.startsWith("???"))
{
@@ -258,7 +272,7 @@
List<String> locales = new ArrayList<String>();
for (short i = 2; i <= row.getLastCellNum(); i++)
{
- HSSFCell cell = row.getCell((short) (i - 1));
+ HSSFCell cell = row.getCell((i - 1));
String locale = cell.getStringCellValue();
if (StringUtils.isEmpty(locale))
{
@@ -270,12 +284,12 @@
for (int r = 1; r < sh.getLastRowNum(); r++)
{
row = sh.getRow(r);
- String key = row.getCell((short) 0).getStringCellValue();
+ String key = row.getCell(0).getStringCellValue();
if (StringUtils.isEmpty(key))
{
break;
}
- for (short c = 1; c < row.getLastCellNum(); c++)
+ for (int c = 1; c < row.getLastCellNum(); c++)
{
if (row.getCell(c) == null)
{
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java 2010-12-14 20:47:38 UTC (rev 3184)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/setup/MessagesModuleVersionHandler.java 2010-12-18 15:12:23 UTC (rev 3185)
@@ -1,6 +1,6 @@
/**
*
- * Magnolia Messages Module (http://www.openmindlab.com/lab/products/groovy.html)
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
* Copyright(C) 2008-2010, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-05-03 12:31:28
|
Revision: 3442
http://openutils.svn.sourceforge.net/openutils/?rev=3442&view=rev
Author: fgiust
Date: 2011-05-03 12:31:22 +0000 (Tue, 03 May 2011)
Log Message:
-----------
MESSAGES-11 Improve speed/memory usage when extracting all the messages
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2011-04-27 13:42:04 UTC (rev 3441)
+++ trunk/openutils-mgnlmessages/pom.xml 2011-05-03 12:31:22 UTC (rev 3442)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-parent</artifactId>
@@ -87,6 +88,11 @@
<version>2.1</version>
</dependency>
<dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnlcriteria</artifactId>
+ <version>3.3.1</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2011-04-27 13:42:04 UTC (rev 3441)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/i18n/RepositoryMessagesImpl.java 2011-05-03 12:31:22 UTC (rev 3442)
@@ -21,10 +21,6 @@
import info.magnolia.cms.core.Content;
import info.magnolia.cms.core.HierarchyManager;
-import info.magnolia.cms.core.ItemType;
-import info.magnolia.cms.core.search.Query;
-import info.magnolia.cms.core.search.QueryManager;
-import info.magnolia.cms.core.search.QueryResult;
import info.magnolia.cms.i18n.AbstractMessagesImpl;
import info.magnolia.cms.util.NodeDataUtil;
import info.magnolia.cms.util.ObservationUtil;
@@ -40,6 +36,11 @@
import javax.jcr.observation.EventIterator;
import javax.jcr.observation.EventListener;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResult;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.Criteria;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Order;
+import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions;
import net.sourceforge.openutils.mgnlmessages.configuration.MessagesConfigurationManager;
import org.apache.commons.lang.StringUtils;
@@ -124,8 +125,7 @@
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public Iterator keys()
+ public Iterator<String> keys()
{
long ms = System.currentTimeMillis();
@@ -135,29 +135,31 @@
keys = new ArrayList<String>();
- try
+ Criteria criteria = JCRCriteriaFactory
+ .createCriteria()
+ .setWorkspace(MessagesConfigurationManager.MESSAGES_REPO)
+ .setBasePath("//*")
+ .add(Restrictions.eq("jcr:primaryType", "mgnl:contentNode"))
+ .addOrder(Order.desc("@jcr:score"));
+
+ AdvancedResult result = criteria.execute();
+
+ log.debug(
+ "Number of messages loaded: {} with query {}",
+ result.getTotalSize(),
+ criteria.toXpathExpression());
+
+ for (Content c : result.getItems())
{
- QueryManager qm = MgnlContext.getSystemContext().getQueryManager(
- MessagesConfigurationManager.MESSAGES_REPO);
- Query q = qm.createQuery("//*", Query.XPATH);
- QueryResult qr = q.execute();
- for (Content c : qr.getContent(ItemType.CONTENTNODE.getSystemName()))
+ if (c.getNodeDataCollection().size() > 0)
{
- if (c.getNodeDataCollection().size() > 0)
- {
- keys.add(StringUtils.replace(c.getHandle(), "/", ".").substring(1));
- }
+ keys.add(StringUtils.replace(c.getHandle(), "/", ".").substring(1));
}
}
- catch (RepositoryException e)
- {
- log.error("Error get keys : " + e.getMessage());
- }
}
log.debug("Messages loaded in {} ms", System.currentTimeMillis() - ms);
return keys.iterator();
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <car...@us...> - 2011-05-16 15:50:10
|
Revision: 3460
http://openutils.svn.sourceforge.net/openutils/?rev=3460&view=rev
Author: carlocolombo
Date: 2011-05-16 15:50:01 +0000 (Mon, 16 May 2011)
Log Message:
-----------
add inline message editing
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
Added Paths:
-----------
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/MessagesServlet.java
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/
trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg/
trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg/msgs-global.tag
trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg.tld
trunk/openutils-mgnlmessages/src/main/resources/mgnl-bootstrap/messages-nooverwrite/config.server.filters.servlets.messages.xml
trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/css/jquery-ui-1.8.5.custom.css
trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/css/messages.css
trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/icons/edit.png
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2011-05-13 09:17:17 UTC (rev 3459)
+++ trunk/openutils-mgnlmessages/pom.xml 2011-05-16 15:50:01 UTC (rev 3460)
@@ -1,135 +1,141 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <parent>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-parent</artifactId>
- <relativePath>../openutils-parent</relativePath>
- <version>1.9</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>openutils-mgnlmessages</artifactId>
- <name>Messages Module for Magnolia CMS</name>
- <description>Manage your translations from the Magnolia admin interface</description>
- <version>4.2.2-SNAPSHOT</version>
- <licenses>
- <license>
- <name>GPLv3</name>
- <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
- </license>
- </licenses>
- <url>http://www.openmindlab.com/lab/products/messages.html</url>
- <issueManagement>
- <system>jira</system>
- <url>http://jira.openmindlab.com/browse/MESSAGES</url>
- </issueManagement>
- <inceptionYear>2008</inceptionYear>
- <scm>
- <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</connection>
- <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</developerConnection>
- <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/trunk/openutils-mgnlmessages</url>
- </scm>
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <filtering>true</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>META-INF/magnolia/*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundle</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptors>
- <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-core</artifactId>
- <version>${magnolia.version}</version>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-module-admininterface</artifactId>
- <version>${magnolia.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>4.1.2</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlext</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlcriteria</artifactId>
- <version>3.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.poi</groupId>
- <artifactId>poi</artifactId>
- <version>3.6</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <classifier>jdk15</classifier>
- <version>5.1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>repository.magnolia.info</id>
- <name>magnolia repository</name>
- <url>http://nexus.magnolia-cms.com/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <properties>
- <magnolia.version>4.4.1</magnolia.version>
- </properties>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+ <parent>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-parent</artifactId>
+ <relativePath>../openutils-parent</relativePath>
+ <version>1.9</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <artifactId>openutils-mgnlmessages</artifactId>
+ <name>Messages Module for Magnolia CMS</name>
+ <description>Manage your translations from the Magnolia admin interface</description>
+ <version>4.2.2-SNAPSHOT</version>
+ <licenses>
+ <license>
+ <name>GPLv3</name>
+ <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
+ </license>
+ </licenses>
+ <url>http://www.openmindlab.com/lab/products/messages.html</url>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.openmindlab.com/browse/MESSAGES</url>
+ </issueManagement>
+ <inceptionYear>2008</inceptionYear>
+ <scm>
+ <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</connection>
+ <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</developerConnection>
+ <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/trunk/openutils-mgnlmessages</url>
+ </scm>
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>META-INF/magnolia/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-core</artifactId>
+ <version>${magnolia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-module-admininterface</artifactId>
+ <version>${magnolia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnltasks</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnlext</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnlcriteria</artifactId>
+ <version>3.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-taglib-cms</artifactId>
+ <version>4.3.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>3.6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <version>5.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>repository.magnolia.info</id>
+ <name>magnolia repository</name>
+ <url>http://nexus.magnolia-cms.com/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <properties>
+ <magnolia.version>4.4.1</magnolia.version>
+ </properties>
</project>
\ No newline at end of file
Added: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/MessagesServlet.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/MessagesServlet.java (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/MessagesServlet.java 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,79 @@
+/**
+ *
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
+ * Copyright(C) 2008-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.sourceforge.openutils.mgnlmessages;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sourceforge.openutils.mgnlmessages.configuration.MessagesConfigurationManager;
+
+
+/**
+ * @author molaschi
+ * @version $Id: $
+ */
+public class MessagesServlet extends HttpServlet
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1763781795315878360L;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ resp.setContentType("text/plain");
+ String key = req.getParameter("key");
+ String locale = req.getParameter("locale");
+ String text = req.getParameter("text");
+
+ // escape single quote due MessageFormat
+ text = text.replaceAll("'", "''");
+
+ try
+ {
+ MessagesConfigurationManager.saveKeyValue(key, text, locale);
+ }
+ catch (RepositoryException ex)
+ {
+ resp.getWriter().println("false");
+ }
+
+ resp.flushBuffer();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ doGet(req, resp);
+ }
+}
Added: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,143 @@
+/**
+ *
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
+ * Copyright(C) 2008-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.sourceforge.openutils.mgnlmessages.el;
+
+import info.magnolia.cms.i18n.I18nContentSupportFactory;
+import info.magnolia.cms.i18n.MessagesManager;
+import info.magnolia.cms.taglibs.CmsFunctions;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.module.templating.MagnoliaTemplatingUtilities;
+
+import java.text.MessageFormat;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
+
+public class MessagesEl {
+ /*
+ * Per rendere editabili i messaggi complessi con argomenti e link è
+ * necessario: - scrivere nel tag il message non formattato in default e
+ * locale corrente - modificare msg-global.tag per recuperare e visualizzare
+ * correttamente i dati passati al tag - per i messaggi con link e
+ * necessario non raddoppiare gli apici o poter discrimininare nel
+ * salvataggio o far inserire i doppi apici a chi modifica le label in
+ * pagina
+ */
+
+ public static String message(String key, boolean fallback,
+ boolean defaultLocale, Object[] arguments) {
+ if (defaultLocale) {
+ return MessagesManager.getMessages(
+ I18nContentSupportFactory.getI18nSupport()
+ .getFallbackLocale()).get(key, arguments);
+ } else {
+ String value = MessagesManager.getMessages(
+ I18nContentSupportFactory.getI18nSupport().getLocale())
+ .get(key, arguments);
+ if (fallback
+ && (StringUtils.isBlank(value) || StringUtils.startsWith(
+ value, "???"))) {
+ return MessagesManager.getMessages(
+ I18nContentSupportFactory.getI18nSupport()
+ .getFallbackLocale()).get(key, arguments);
+ }
+ return value;
+ }
+ }
+
+ private static final String MSGS_TPL = "<span class=\"msgEdit {0}\" data-msgkey=\"{1}\" data-msglocale=\"{2}\" data-msgdefaultlocale=\"{3}\" data-msgdefault=\"{4}\">{5}</span>";
+
+ public static String messageSimple(String key, Object[] arguments) {
+ if (MgnlContext.getAggregationState().getMainContent() != null
+ && MagnoliaTemplatingUtilities.getInstance().isEditMode()
+ && CmsFunctions.canEdit()) {
+ String keyCssClass = StringUtils.replace(key, ".", "_");
+
+ String tag = MessageFormat.format(MSGS_TPL, keyCssClass, key,
+ I18nContentSupportFactory.getI18nSupport().getLocale(),
+ I18nContentSupportFactory.getI18nSupport()
+ .getFallbackLocale(),
+ // evito di sostituire i placeholder quando sono in
+ // edit-mode
+ // StringEscapeUtils.escapeHtml(message(key, false, true,
+ // arguments)),
+ StringEscapeUtils.escapeHtml(message(key, false, true)),
+ // evito di sostituire i placeholder quando sono in
+ // edit-mode
+ // message(key, false, false, arguments));
+ message(key, false, false));
+ return tag;
+ }
+ return message(key, true, false, arguments);
+ }
+
+ public static String messagePlain(String key, Object[] arguments) {
+ return message(key, true, false, arguments);
+ }
+
+ public static String messageSimple(String key) {
+ return messageSimple(key, null);
+ }
+
+ public static String message(String key, boolean fallback,
+ boolean defaultLocale) {
+ return message(key, fallback, defaultLocale, null);
+ }
+
+ public static String messagePlain(String key) {
+ return messagePlain(key, null);
+ }
+
+ public static String messageSimple(String key, Object argument) {
+ return messageSimple(key, new Object[] { argument });
+ }
+
+ public static String message(String key, boolean fallback,
+ boolean defaultLocale, Object argument) {
+ return message(key, fallback, defaultLocale, new Object[] { argument });
+ }
+
+ public static String messagePlain(String key, Object argument) {
+ return messagePlain(key, new Object[] { argument });
+ }
+
+ public static String messageSimple(String key, Object arg1, Object arg2) {
+ return messageSimple(key, new Object[] { arg1, arg2 });
+ }
+
+ public static String message(String key, boolean fallback,
+ boolean defaultLocale, Object arg1, Object arg2) {
+ return message(key, fallback, defaultLocale,
+ new Object[] { arg1, arg2 });
+ }
+
+ public static String messagePlain(String key, Object arg1, Object arg2) {
+ return messagePlain(key, new Object[] { arg1, arg2 });
+ }
+
+ public static String messagePlain(String key, Object arg1, Object arg2,
+ Object arg3) {
+ return messagePlain(key, new Object[] { arg1, arg2, arg3 });
+ }
+
+ public static String escapeJs(String msg) {
+ return StringEscapeUtils.escapeJavaScript(msg);
+ }
+}
Added: trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg/msgs-global.tag
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg/msgs-global.tag (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg/msgs-global.tag 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,139 @@
+<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:cms="urn:jsptld:cms-taglib"
+ xmlns:c="urn:jsptld:http://java.sun.com/jsp/jstl/core" xmlns:fmt="urn:jsptld:http://java.sun.com/jsp/jstl/fmt"
+ xmlns:media="http://net.sourceforge.openutils/mgnlMedia" xmlns:cmsu="urn:jsptld:cms-util-taglib" xmlns:cmsfn="http://www.magnolia.info/tlds/cmsfn-taglib.tld"
+ xmlns:su="http://openutils.sf.net/openutils-stringutils" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:mu="mgnlutils"
+ xmlns:du="dateutils" xmlns:fdt="urn:jsptagdir:/WEB-INF/tags/fieradigitale-tags" xmlns:mgnlt="urn:jsptagdir:/WEB-INF/tags/mgnltags"
+ xmlns:fd="fieradigitale">
+ <jsp:directive.attribute name="jqueryui" required="false" rtexprvalue="true" type="java.lang.Boolean" />
+ <jsp:directive.attribute name="jquery" required="false" rtexprvalue="true" type="java.lang.Boolean" />
+ <c:if test="${mgnl.editMode and cmsfn:canEdit()}">
+ <c:if test="${not empty jquery and jquery}">
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"><!-- -->
+ </script>
+ </c:if>
+ <c:if test="${not empty jqueryui and jqueryui}">
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"><!-- -->
+ </script>
+ </c:if>
+ <script type="text/javascript">
+ <![CDATA[
+ (function($) {
+ var currentMsgEdit = null;
+
+ function init(container, dialog) {
+ container.css({
+ "-webkit-border-radius" : 4,
+ "-moz-border-radius" : 4,
+ "border-radius" : 4
+ });
+ var msgKey = container.attr("data-msgkey");
+ var msgsWithSameKey = $("." + msgKey.replace(/\./g, '_'));
+ var msgLocale = container.attr("data-msglocale");
+ var msgDefaultLocale = container.attr("data-msgdefaultlocale");
+ var defaultMsg = container.attr("data-msgdefault");
+
+ var editLink = $('<a href="#" title="edit" \
+ style="position:absolute;background:#000 url(${appCtx}/.resources/messages/icons/edit.png) center \
+ center no-repeat;border-radius:4px;-moz-border-radius:4px;\
+ -webkit-border-radius:4px;width:24px;height:24px;z-index:1000"></a>');
+ editLink.css({
+ top: container.offset().top + (container.height() - 24) / 2,
+ left: container.offset().left - 24 + parseInt(container.css('margin-left')) + parseInt(container.css('padding-left'))
+ });
+ $("body").append(editLink);
+ editLink.fadeTo('slow',0.3);
+ editLink.mouseenter(function(){
+ editLink.fadeTo('slow',1.0);
+ msgsWithSameKey.animate({
+ "background-color" : 'yellow'});
+ });
+ editLink.mouseleave(function(){
+ editLink.fadeTo('slow',0.3);
+ msgsWithSameKey.css({
+ "background-color" : 'transparent'});
+ });
+ editLink.click(function(evt){
+ evt.preventDefault();
+ currentMsgEdit = container;
+ $("#dialog-msgEdit-default").css({
+ display: (msgDefaultLocale == msgLocale) ? "none" : "block"
+ });
+ if (msgDefaultLocale != msgLocale) {
+ $("#dialog-msgEdit-default-message").text(defaultMsg);
+ }
+ dialog.dialog( "open" );
+ });
+ };
+
+ $.fn.mgnlMessageEdit = function(params) {
+ var dialog = $("#dialog-msgEdit").dialog({
+ autoOpen: false,
+ height: 220,
+ width: 350,
+ modal: true,
+ buttons: {
+ "Save": function() {
+ var valueTxt = $("#dialog-msgEdit-value").val();
+ var msgKey = currentMsgEdit.attr('data-msgkey');
+ if (valueTxt != currentMsgEdit.text().trim())
+ {
+ $("." + msgKey.replace(/\./g, '_')).text(valueTxt);
+ $.ajax({
+ url: '${appCtx}/messages/save',
+ type: 'POST',
+ data: {
+ key: msgKey,
+ locale: currentMsgEdit.attr('data-msglocale'),
+ text: valueTxt
+ },
+ error: function(err) {
+ alert(err);
+ },
+ success: function(msg) {
+ }
+ });
+ $( this ).dialog( "close" );
+ }
+ },
+ "Cancel": function() {
+ $( this ).dialog( "close" );
+ }
+ },
+ open: function() {
+ $("#dialog-msgEdit-value").val(currentMsgEdit.html().trim());
+ },
+ close: function() {
+ }
+
+ });
+ $(this).each(function(i,el){
+ init($(el), dialog);
+ });
+ };
+
+ })($);
+
+ $('head').append('<link type="text/css" rel="stylesheet" href="${appCtx}/.resources/messages/css/messages.css" />');
+ $('head').append('<link type="text/css" rel="stylesheet" href="${appCtx}/.resources/messages/css/jquery-ui-1.8.5.custom.css" />');
+
+ $(document).ready(function(){
+ $(".msgEdit").mgnlMessageEdit();
+ });
+ ]]>
+ </script>
+ <div id="dialog-msgEdit" class="msgEditDialog" title="Edit message">
+ <p id="dialog-msgEdit-default">
+ Message in default locale is:
+ <br />
+ <span id="dialog-msgEdit-default-message" style="font-style:italic"><!-- -->
+ </span>
+ </p>
+ <form id="dialog-msgEdit-form" action="${appCtx}/messages/save">
+ <fieldset>
+ <textarea id="dialog-msgEdit-value"><!-- -->
+ </textarea>
+ </fieldset>
+ </form>
+ </div>
+ </c:if>
+</jsp:root>
\ No newline at end of file
Added: trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg.tld
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg.tld (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/resources/META-INF/tags/msg.tld 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+ <description>Messages tag library</description>
+ <display-name>Messages tags</display-name>
+ <tlib-version>1.1</tlib-version>
+ <short-name>msg</short-name>
+ <uri>http://net.sourceforge.openutils/mgnlMessages</uri>
+ <tag-file>
+ <description>Write global javascript to allow messages editing</description>
+ <display-name>messages Tag</display-name>
+ <name>msgs-global</name>
+ <path>/META-INF/tags/msg/msgs-global.tag</path>
+ <example>
+ <![CDATA[
+ <msg:msgs-global />
+ ]]>
+ </example>
+ </tag-file>
+ <function>
+ <name>msgfortag</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String message(java.lang.String, boolean, boolean)</function-signature>
+ </function>
+ <function>
+ <name>msg</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messageSimple(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>msgplain</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messagePlain(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>msgfortagWith1Arg</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String message(java.lang.String, boolean, boolean,
+ java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgWith1Arg</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messageSimple(java.lang.String,
+ java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgplainWith1Arg</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messagePlain(java.lang.String,
+ java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgfortagWith2Args</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String message(java.lang.String, boolean, boolean,
+ java.lang.Object, java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgWith2Args</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messageSimple(java.lang.String,
+ java.lang.Object, java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgplainWith2Args</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messagePlain(java.lang.String,
+ java.lang.Object, java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgplainWith3Args</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messagePlain(java.lang.String,
+ java.lang.Object, java.lang.Object, java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>msgfortagWithArgs</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String message(java.lang.String, boolean, boolean,
+ java.lang.Object[])</function-signature>
+ </function>
+ <function>
+ <name>msgWithArgs</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messageSimple(java.lang.String,
+ java.lang.Object[])</function-signature>
+ </function>
+ <function>
+ <name>msgplainWithArgs</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String messagePlain(java.lang.String,
+ java.lang.Object[])</function-signature>
+ </function>
+ <function>
+ <name>escapeJs</name>
+ <function-class>net.sourceforge.openutils.mgnlmessages.el.MessagesEl</function-class>
+ <function-signature>String escapeJs(java.lang.String)</function-signature>
+ </function>
+</taglib>
\ No newline at end of file
Added: trunk/openutils-mgnlmessages/src/main/resources/mgnl-bootstrap/messages-nooverwrite/config.server.filters.servlets.messages.xml
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/mgnl-bootstrap/messages-nooverwrite/config.server.filters.servlets.messages.xml (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/resources/mgnl-bootstrap/messages-nooverwrite/config.server.filters.servlets.messages.xml 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="messages" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>0bf4fca2-7820-4496-891e-abbe95d1f204</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>info.magnolia.cms.filters.ServletDispatchingFilter</sv:value>
+ </sv:property>
+ <sv:property sv:name="comment" sv:type="String">
+ <sv:value>a servlet used by the fieradigitale module</sv:value>
+ </sv:property>
+ <sv:property sv:name="enabled" sv:type="Boolean">
+ <sv:value>true</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="servletClass" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlmessages.MessagesServlet</sv:value>
+ </sv:property>
+ <sv:property sv:name="servletName" sv:type="String">
+ <sv:value>messages</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-12-08T22:24:37.047+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2010-12-08T22:24:37.047+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:title" sv:type="String">
+ <sv:value/>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="mappings">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>117eae57-9e9c-457d-b787-e4acccc67986</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-12-08T22:24:37.049+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="-messages-save">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>b53f3aec-1992-4057-bd3f-18f155851357</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="pattern" sv:type="String">
+ <sv:value>/messages/save</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-12-08T22:24:37.049+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+ </sv:node>
+ <sv:node sv:name="parameters">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>9388a84b-c510-49f3-93db-d8a0f6fa5ee4</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:node sv:name="MetaData">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:metaData</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-12-08T22:24:37.049+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+</sv:node>
Added: trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/css/jquery-ui-1.8.5.custom.css
===================================================================
--- trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/css/jquery-ui-1.8.5.custom.css (rev 0)
+++ trunk/openutils-mgnlmessages/src/main/resources/mgnl-resources/messages/css/jquery-ui-1.8.5.custom.css 2011-05-16 15:50:01 UTC (rev 3460)
@@ -0,0 +1,572 @@
+/*
+ * jQuery UI CSS Framework 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/*
+ * jQuery UI Autocomplete 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.6
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/...
[truncated message content] |
|
From: <die...@us...> - 2011-08-26 07:34:37
|
Revision: 3643
http://openutils.svn.sourceforge.net/openutils/?rev=3643&view=rev
Author: diego_schivo
Date: 2011-08-26 07:34:31 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
MESSAGES-14 MessagesElTest
Added Paths:
-----------
trunk/openutils-mgnlmessages/src/test/java/net/
trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/
trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/
trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/
trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/el/
trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/el/MessagesElTest.java
Property Changed:
----------------
trunk/openutils-mgnlmessages/
Property changes on: trunk/openutils-mgnlmessages
___________________________________________________________________
Modified: svn:ignore
- target
.settings
.checkstyle
.classpath
.project
pom.xml.releaseBackup
release.properties
+ target
.settings
.checkstyle
.classpath
.project
pom.xml.releaseBackup
release.properties
test-output
Added: trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/el/MessagesElTest.java
===================================================================
--- trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/el/MessagesElTest.java (rev 0)
+++ trunk/openutils-mgnlmessages/src/test/java/net/sourceforge/openutils/mgnlmessages/el/MessagesElTest.java 2011-08-26 07:34:31 UTC (rev 3643)
@@ -0,0 +1,35 @@
+/**
+ *
+ * Messages Module for Magnolia CMS (http://www.openmindlab.com/lab/products/messages.html)
+ * Copyright(C) 2008-2011, Openmind S.r.l. http://www.openmindonline.it
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.sourceforge.openutils.mgnlmessages.el;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class MessagesElTest
+{
+
+ @Test
+ public void testMessageTextContains()
+ {
+ Assert.assertTrue(MessagesEl.messageTextContains("L'impostazione è stata salvata", "impostazione"));
+ Assert.assertFalse(MessagesEl.messageTextContains("L'impostazione è stata salvata", "impostazioni"));
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-08-26 08:32:56
|
Revision: 3655
http://openutils.svn.sourceforge.net/openutils/?rev=3655&view=rev
Author: fgiust
Date: 2011-08-26 08:32:49 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
update deps and formatting (no tabs!)
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2011-08-26 08:11:17 UTC (rev 3654)
+++ trunk/openutils-mgnlmessages/pom.xml 2011-08-26 08:32:49 UTC (rev 3655)
@@ -1,145 +1,132 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <parent>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-parent</artifactId>
- <relativePath>../openutils-parent</relativePath>
- <version>1.9</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <packaging>jar</packaging>
- <artifactId>openutils-mgnlmessages</artifactId>
- <name>Messages Module for Magnolia CMS</name>
- <description>Manage your translations from the Magnolia admin interface</description>
- <version>4.2.3-SNAPSHOT</version>
- <licenses>
- <license>
- <name>GPLv3</name>
- <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
- </license>
- </licenses>
- <url>http://www.openmindlab.com/lab/products/messages.html</url>
- <issueManagement>
- <system>jira</system>
- <url>http://jira.openmindlab.com/browse/MESSAGES</url>
- </issueManagement>
- <inceptionYear>2008</inceptionYear>
- <scm>
- <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</connection>
- <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</developerConnection>
- <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/trunk/openutils-mgnlmessages</url>
- </scm>
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <filtering>true</filtering>
- <directory>src/main/resources</directory>
- <includes>
- <include>META-INF/magnolia/*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundle</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptors>
- <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-core</artifactId>
- <version>${magnolia.version}</version>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-module-admininterface</artifactId>
- <version>${magnolia.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnltasks</artifactId>
- <version>4.1.2</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlext</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-mgnlcriteria</artifactId>
- <version>3.3.1</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-elfunctions</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-taglib-cms</artifactId>
- <version>4.3.5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.poi</groupId>
- <artifactId>poi</artifactId>
- <version>3.6</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <classifier>jdk15</classifier>
- <version>5.1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>repository.magnolia.info</id>
- <name>magnolia repository</name>
- <url>http://nexus.magnolia-cms.com/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <properties>
- <magnolia.version>4.4.1</magnolia.version>
- </properties>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+ <parent>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-parent</artifactId>
+ <relativePath>../openutils-parent</relativePath>
+ <version>1.9</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <artifactId>openutils-mgnlmessages</artifactId>
+ <name>Messages Module for Magnolia CMS</name>
+ <description>Manage your translations from the Magnolia admin interface</description>
+ <version>4.2.3-SNAPSHOT</version>
+ <licenses>
+ <license>
+ <name>GPLv3</name>
+ <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
+ </license>
+ </licenses>
+ <url>http://www.openmindlab.com/lab/products/messages.html</url>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.openmindlab.com/browse/MESSAGES</url>
+ </issueManagement>
+ <inceptionYear>2008</inceptionYear>
+ <scm>
+ <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</connection>
+ <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/trunk/openutils-mgnlmessages</developerConnection>
+ <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/trunk/openutils-mgnlmessages</url>
+ </scm>
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>META-INF/magnolia/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-core</artifactId>
+ <version>${magnolia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-module-admininterface</artifactId>
+ <version>${magnolia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>info.magnolia</groupId>
+ <artifactId>magnolia-taglib-cms</artifactId>
+ <version>${magnolia.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnltasks</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnlext</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-mgnlcriteria</artifactId>
+ <version>3.3.3</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-elfunctions</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>3.6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.0.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <properties>
+ <magnolia.version>4.4.4</magnolia.version>
+ </properties>
</project>
\ No newline at end of file
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java 2011-08-26 08:11:17 UTC (rev 3654)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java 2011-08-26 08:32:49 UTC (rev 3655)
@@ -32,117 +32,127 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
-public class MessagesEl {
- /*
- * Per rendere editabili i messaggi complessi con argomenti e link è
- * necessario: - scrivere nel tag il message non formattato in default e
- * locale corrente - modificare msg-global.tag per recuperare e visualizzare
- * correttamente i dati passati al tag - per i messaggi con link e
- * necessario non raddoppiare gli apici o poter discrimininare nel
- * salvataggio o far inserire i doppi apici a chi modifica le label in
- * pagina
- */
- public static String message(String key, boolean fallback,
- boolean defaultLocale, Object[] arguments) {
- if (defaultLocale) {
- return MessagesManager.getMessages(
- I18nContentSupportFactory.getI18nSupport()
- .getFallbackLocale()).get(key, arguments);
- } else {
- String value = MessagesManager.getMessages(
- I18nContentSupportFactory.getI18nSupport().getLocale())
- .get(key, arguments);
- if (fallback
- && (StringUtils.isBlank(value) || StringUtils.startsWith(
- value, "???"))) {
- return MessagesManager.getMessages(
- I18nContentSupportFactory.getI18nSupport()
- .getFallbackLocale()).get(key, arguments);
- }
- return value;
- }
- }
+public class MessagesEl
+{
- private static final String MSGS_TPL = "<span class=\"msgEdit {0}\" data-msgkey=\"{1}\" data-msglocale=\"{2}\" data-msgdefaultlocale=\"{3}\" data-msgdefault=\"{4}\">{5}</span>";
+ /*
+ * Per rendere editabili i messaggi complessi con argomenti e link è necessario: - scrivere nel tag il message non
+ * formattato in default e locale corrente - modificare msg-global.tag per recuperare e visualizzare correttamente i
+ * dati passati al tag - per i messaggi con link e necessario non raddoppiare gli apici o poter discrimininare nel
+ * salvataggio o far inserire i doppi apici a chi modifica le label in pagina
+ */
- public static String messageSimple(String key, Object[] arguments) {
- if (MgnlContext.getAggregationState().getMainContent() != null
- && MagnoliaTemplatingUtilities.getInstance().isEditMode()
- && CmsFunctions.canEdit()) {
- String keyCssClass = StringUtils.replace(key, ".", "_");
+ public static String message(String key, boolean fallback, boolean defaultLocale, Object[] arguments)
+ {
+ if (defaultLocale)
+ {
+ return MessagesManager.getMessages(I18nContentSupportFactory.getI18nSupport().getFallbackLocale()).get(
+ key,
+ arguments);
+ }
+ else
+ {
+ String value = MessagesManager.getMessages(I18nContentSupportFactory.getI18nSupport().getLocale()).get(
+ key,
+ arguments);
+ if (fallback && (StringUtils.isBlank(value) || StringUtils.startsWith(value, "???")))
+ {
+ return MessagesManager.getMessages(I18nContentSupportFactory.getI18nSupport().getFallbackLocale()).get(
+ key,
+ arguments);
+ }
+ return value;
+ }
+ }
- String tag = MessageFormat.format(MSGS_TPL, keyCssClass, key,
- I18nContentSupportFactory.getI18nSupport().getLocale(),
- I18nContentSupportFactory.getI18nSupport()
- .getFallbackLocale(),
- // evito di sostituire i placeholder quando sono in
- // edit-mode
- // StringEscapeUtils.escapeHtml(message(key, false, true,
- // arguments)),
- StringEscapeUtils.escapeHtml(message(key, false, true)),
- // evito di sostituire i placeholder quando sono in
- // edit-mode
- // message(key, false, false, arguments));
- message(key, false, false));
- return tag;
- }
- return message(key, true, false, arguments);
- }
+ private static final String MSGS_TPL = "<span class=\"msgEdit {0}\" data-msgkey=\"{1}\" data-msglocale=\"{2}\" data-msgdefaultlocale=\"{3}\" data-msgdefault=\"{4}\">{5}</span>";
- public static String messagePlain(String key, Object[] arguments) {
- return message(key, true, false, arguments);
- }
+ public static String messageSimple(String key, Object[] arguments)
+ {
+ if (MgnlContext.getAggregationState().getMainContent() != null
+ && MagnoliaTemplatingUtilities.getInstance().isEditMode()
+ && CmsFunctions.canEdit())
+ {
+ String keyCssClass = StringUtils.replace(key, ".", "_");
- public static String messageSimple(String key) {
- return messageSimple(key, null);
- }
+ String tag = MessageFormat.format(MSGS_TPL, keyCssClass, key, I18nContentSupportFactory
+ .getI18nSupport()
+ .getLocale(), I18nContentSupportFactory.getI18nSupport().getFallbackLocale(),
+ // evito di sostituire i placeholder quando sono in
+ // edit-mode
+ // StringEscapeUtils.escapeHtml(message(key, false, true,
+ // arguments)),
+ StringEscapeUtils.escapeHtml(message(key, false, true)),
+ // evito di sostituire i placeholder quando sono in
+ // edit-mode
+ // message(key, false, false, arguments));
+ message(key, false, false));
+ return tag;
+ }
+ return message(key, true, false, arguments);
+ }
- public static String message(String key, boolean fallback,
- boolean defaultLocale) {
- return message(key, fallback, defaultLocale, null);
- }
+ public static String messagePlain(String key, Object[] arguments)
+ {
+ return message(key, true, false, arguments);
+ }
- public static String messagePlain(String key) {
- return messagePlain(key, null);
- }
+ public static String messageSimple(String key)
+ {
+ return messageSimple(key, null);
+ }
- public static String messageSimple(String key, Object argument) {
- return messageSimple(key, new Object[] { argument });
- }
+ public static String message(String key, boolean fallback, boolean defaultLocale)
+ {
+ return message(key, fallback, defaultLocale, null);
+ }
- public static String message(String key, boolean fallback,
- boolean defaultLocale, Object argument) {
- return message(key, fallback, defaultLocale, new Object[] { argument });
- }
+ public static String messagePlain(String key)
+ {
+ return messagePlain(key, null);
+ }
- public static String messagePlain(String key, Object argument) {
- return messagePlain(key, new Object[] { argument });
- }
+ public static String messageSimple(String key, Object argument)
+ {
+ return messageSimple(key, new Object[]{argument });
+ }
- public static String messageSimple(String key, Object arg1, Object arg2) {
- return messageSimple(key, new Object[] { arg1, arg2 });
- }
+ public static String message(String key, boolean fallback, boolean defaultLocale, Object argument)
+ {
+ return message(key, fallback, defaultLocale, new Object[]{argument });
+ }
- public static String message(String key, boolean fallback,
- boolean defaultLocale, Object arg1, Object arg2) {
- return message(key, fallback, defaultLocale,
- new Object[] { arg1, arg2 });
- }
+ public static String messagePlain(String key, Object argument)
+ {
+ return messagePlain(key, new Object[]{argument });
+ }
- public static String messagePlain(String key, Object arg1, Object arg2) {
- return messagePlain(key, new Object[] { arg1, arg2 });
- }
+ public static String messageSimple(String key, Object arg1, Object arg2)
+ {
+ return messageSimple(key, new Object[]{arg1, arg2 });
+ }
- public static String messagePlain(String key, Object arg1, Object arg2,
- Object arg3) {
- return messagePlain(key, new Object[] { arg1, arg2, arg3 });
- }
+ public static String message(String key, boolean fallback, boolean defaultLocale, Object arg1, Object arg2)
+ {
+ return message(key, fallback, defaultLocale, new Object[]{arg1, arg2 });
+ }
- public static String escapeJs(String msg) {
- return StringEscapeUtils.escapeJavaScript(msg);
- }
-
+ public static String messagePlain(String key, Object arg1, Object arg2)
+ {
+ return messagePlain(key, new Object[]{arg1, arg2 });
+ }
+
+ public static String messagePlain(String key, Object arg1, Object arg2, Object arg3)
+ {
+ return messagePlain(key, new Object[]{arg1, arg2, arg3 });
+ }
+
+ public static String escapeJs(String msg)
+ {
+ return StringEscapeUtils.escapeJavaScript(msg);
+ }
+
public static boolean messageTextContains(String str, String searchStr)
{
return StringUtils.containsIgnoreCase(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-08-26 08:35:02
|
Revision: 3656
http://openutils.svn.sourceforge.net/openutils/?rev=3656&view=rev
Author: fgiust
Date: 2011-08-26 08:34:56 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
removed dependency from taglib-cms
Modified Paths:
--------------
trunk/openutils-mgnlmessages/pom.xml
trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
Modified: trunk/openutils-mgnlmessages/pom.xml
===================================================================
--- trunk/openutils-mgnlmessages/pom.xml 2011-08-26 08:32:49 UTC (rev 3655)
+++ trunk/openutils-mgnlmessages/pom.xml 2011-08-26 08:34:56 UTC (rev 3656)
@@ -78,11 +78,6 @@
<version>${magnolia.version}</version>
</dependency>
<dependency>
- <groupId>info.magnolia</groupId>
- <artifactId>magnolia-taglib-cms</artifactId>
- <version>${magnolia.version}</version>
- </dependency>
- <dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-mgnltasks</artifactId>
<version>4.1.2</version>
Modified: trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java
===================================================================
--- trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java 2011-08-26 08:32:49 UTC (rev 3655)
+++ trunk/openutils-mgnlmessages/src/main/java/net/sourceforge/openutils/mgnlmessages/el/MessagesEl.java 2011-08-26 08:34:56 UTC (rev 3656)
@@ -21,7 +21,7 @@
import info.magnolia.cms.i18n.I18nContentSupportFactory;
import info.magnolia.cms.i18n.MessagesManager;
-import info.magnolia.cms.taglibs.CmsFunctions;
+import info.magnolia.cms.security.Permission;
import info.magnolia.context.MgnlContext;
import info.magnolia.module.templating.MagnoliaTemplatingUtilities;
@@ -72,7 +72,8 @@
{
if (MgnlContext.getAggregationState().getMainContent() != null
&& MagnoliaTemplatingUtilities.getInstance().isEditMode()
- && CmsFunctions.canEdit())
+ && MgnlContext.getAggregationState().getMainContent().isGranted(Permission.WRITE)) // equivalent of
+ // CmsFunctions.canEdit()
{
String keyCssClass = StringUtils.replace(key, ".", "_");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|