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. |