From: <fg...@us...> - 2010-01-13 18:49:26
|
Revision: 1634 http://openutils.svn.sourceforge.net/openutils/?rev=1634&view=rev Author: fgiust Date: 2010-01-13 18:49:18 +0000 (Wed, 13 Jan 2010) Log Message: ----------- first shot for new functions libraries, must be complleted, cleaned up and reviewed. Tld definitios are missings. Modified Paths: -------------- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld Added Paths: ----------- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/DateElUtils.java trunk/openutils-elfunctions/src/main/resources/META-INF/dateutils.tld trunk/openutils-mgnlutils/src/main/java/it/ trunk/openutils-mgnlutils/src/main/java/it/openutils/ trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/ trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/ trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java trunk/openutils-mgnlutils/src/main/resources/META-INF/ trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/ trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld Added: trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/DateElUtils.java =================================================================== --- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/DateElUtils.java (rev 0) +++ trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/DateElUtils.java 2010-01-13 18:49:18 UTC (rev 1634) @@ -0,0 +1,299 @@ +package net.sourceforge.openutils.elfunctions; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Locale; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.FastDateFormat; + + +/** + * @author fgiust + * @version $Id$ + */ +public class DateElUtils +{ + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(DateElUtils.class); + + /** + * internal constant value to indicate no builtin format was found for the input pattern + * @see {@link FastDateFormat} + */ + private static final int NO_FORMAT = -1337; + + // constants to support builtin date and time formatting + private static final String FORMAT_SHORT = "short"; + + private static final String FORMAT_MEDIUM = "medium"; + + private static final String FORMAT_LONG = "long"; + + private static final String FORMAT_FULL = "full"; + + /** + * internal utility method to retrieve FastDateFormat format constants from input strings + * @param pattern the pattern string + * @return an integer corresponding to a format in FastDateFormat, or 0 if no match + */ + private static int getFormat(String pattern) + { + int out = NO_FORMAT; + if (StringUtils.isBlank(pattern)) + { + // skip to return + } + else if (FORMAT_SHORT.equalsIgnoreCase(pattern)) + { + out = FastDateFormat.SHORT; + } + else if (FORMAT_MEDIUM.equalsIgnoreCase(pattern)) + { + out = FastDateFormat.MEDIUM; + } + else if (FORMAT_LONG.equalsIgnoreCase(pattern)) + { + out = FastDateFormat.LONG; + } + else if (FORMAT_FULL.equalsIgnoreCase(pattern)) + { + out = FastDateFormat.FULL; + } + return out; + } + + /** + * internal utility method to format dates attempting builtin styles first, and then resorting to + * {@link FastDateFormat#getInstance(String)} + * @param dateTime the date and time to format + * @param pattern the format pattern, or one (or two) of the builtin styles + * @param date true to format the date part with the builtin style + * @param time false to format the time part with the builtin style + * @param locale formatter locale, default locale if null + * @return the formatted date, or the empty string if dateTime was null or pattern was blank + */ + private static String format(Calendar dateTime, String pattern, boolean date, boolean time, Locale locale) + { + if (dateTime == null || StringUtils.isBlank(pattern)) + { + return StringUtils.EMPTY; + } + + FastDateFormat instance; + int dateStyle = NO_FORMAT; + int timeStyle = NO_FORMAT; + if (date || time) + { + dateStyle = timeStyle = getFormat(pattern.trim()); + // if the standard pattern didn't work and we are in the date and time case, try to retrieve two different + // styles with syntax "date_style;time_style" + if (dateStyle == NO_FORMAT && date && time) + { + String[] split = pattern.split(";"); + if (split.length == 2) + { + dateStyle = getFormat(split[0].trim()); + timeStyle = getFormat(split[1].trim()); + } + } + } + if (date && time && dateStyle != NO_FORMAT && timeStyle != NO_FORMAT) + { + instance = FastDateFormat.getDateTimeInstance(dateStyle, timeStyle, locale); + } + else if (date && dateStyle != NO_FORMAT) + { + instance = FastDateFormat.getDateInstance(dateStyle, locale); + } + else if (time && timeStyle != NO_FORMAT) + { + instance = FastDateFormat.getTimeInstance(timeStyle, locale); + } + else + { + instance = FastDateFormat.getInstance(pattern, locale); + } + return instance.format(dateTime); + } + + /** + * formats a date using the given pattern or builtin style + * @param date the date to format + * @param pattern a valid pattern, or one of "short", "medium", "long", "full" (case insensitive) + * @return the formatted date + */ + public static String formatDate(Calendar date, String pattern) + { + return format(date, pattern, true, false, null); + } + + /** + * formats a time using the given pattern or builtin style + * @param time the time to format + * @param pattern a valid pattern, or one of "short", "medium", "long", "full" (case insensitive) + * @return the formatted time + */ + public static String formatTime(Calendar time, String pattern) + { + return format(time, pattern, false, true, null); + } + + /** + * Formats a date and/or time using the given pattern or builtin style - supports composite formats for date and + * time with the syntax "date_format;time_format" (ex: "long;short") + * @param dateTime the date and time + * @param pattern date pattern + * @return formatted string + */ + public static String formatDateTime(Calendar dateTime, String pattern) + { + return format(dateTime, pattern, true, true, null); + } + + /** + * Formats a date and/or time using the given pattern or builtin style - supports composite formats for date and + * time with the syntax "date_format;time_format" (ex: "long;short") with locale + * @param dateTime the date and time + * @param languageId lowercase two-letter ISO-639 code. + * @param pattern date pattern + * @return formatted string + */ + public static String formatDateTimeWithLocale(Calendar dateTime, String languageId, String pattern) + { + return format(dateTime, pattern, true, true, new Locale(languageId)); + } + + /** + * format a milliseconds interval as a string like 1y 2d 23h 22m 18s (year estimation approximates to 365 days) + * @param millisInterval the interval in milliseconds + * @param isDuration isduration + * @return the formatted string + */ + public static String formatInterval(Long millisInterval, Boolean isDuration) + { + if (millisInterval == null) + { + return StringUtils.EMPTY; + } + long secondsInterval = millisInterval / 1000; + long years = secondsInterval / (365 * 24 * 60 * 60); + long days = (secondsInterval % (365 * 24 * 60 * 60)) / (24 * 60 * 60); + long hours = (secondsInterval % (24 * 60 * 60)) / (60 * 60); + long minutes = (secondsInterval % (60 * 60)) / 60; + long seconds = secondsInterval % 60; + StringBuilder out = new StringBuilder(); + if (isDuration) + { + if (years > 0) + { + out.append(years).append("y "); + } + if (days > 0) + { + out.append(days).append("d "); + } + if (hours > 0) + { + out.append(hours).append("h "); + } + if (minutes > 0) + { + out.append(minutes).append("m "); + } + out.append(seconds).append('s'); + } + else + { + if (years > 0) + { + if (years == 1) + { + out.append(years).append(" anno fa"); + } + else + { + out.append(years).append(" anni fa"); + } + } + else if (days > 0) + { + if (days == 1) + { + out.append(days).append(" giorno fa"); + } + else + { + out.append(days).append(" giorni fa"); + } + } + else if (hours > 0) + { + if (hours == 1) + { + out.append(hours).append(" ora fa"); + } + else + { + out.append(hours).append(" ore fa"); + } + } + else if (minutes > 0) + { + if (minutes == 1) + { + out.append(minutes).append(" minuto fa"); + } + else + { + out.append(minutes).append(" minuti fa"); + } + } + + } + return out.toString(); + } + + /** + * retrieve the milliseconds in difference between now and the input date + * @param date the date + * @return positive value for dates older than now + */ + public static Long getMillisFromNow(Calendar date) + { + if (date == null) + { + return 0L; + } + return System.currentTimeMillis() - date.getTimeInMillis(); + } + + /** + * parse a date with a given pattern and return the parsed date as a calendar object (null safe) + * @param date the date string + * @param pattern the pattern + * @return the parsed date as a Calendar, or null + */ + public static Calendar parseDate(String date, String pattern) + { + if (StringUtils.isNotEmpty(date) && StringUtils.isNotEmpty(pattern)) + { + Calendar cal = Calendar.getInstance(); + try + { + cal.setTime(new SimpleDateFormat(pattern).parse(date)); + return cal; + } + catch (ParseException e) + { + log.warn("unable to parse date from string: " + date + " with pattern: " + pattern, e); + } + } + return null; + } + +} Property changes on: trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/DateElUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java =================================================================== --- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java 2010-01-13 15:08:23 UTC (rev 1633) +++ trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java 2010-01-13 18:49:18 UTC (rev 1634) @@ -16,6 +16,9 @@ package net.sourceforge.openutils.elfunctions; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.SystemUtils; +import org.apache.commons.lang.WordUtils; +import org.apache.commons.lang.math.NumberUtils; /** @@ -111,4 +114,102 @@ return string.endsWith(suffix); } + /** + * safely parse a long + * @param value the string to parse + * @return the parsed long, or <code>0L</code> if parse fails + * @see {@link NumberUtils#toLong()} + */ + public static Long toLong(String value) + { + return NumberUtils.toLong(value, 0); + } + + /** + * safely parse a double, and return his closest rounding as a long + * @param value the string to parse + * @return the closest long to the parsed double, or <code>0L</code> if parse fails + * @see {@link Math#round(double)} + */ + public static Long toRoundedLong(String value) + { + double doubleValue = NumberUtils.toDouble(value); + if (doubleValue != 0.0d) + { + return Math.round(doubleValue); + } + return 0L; + } + + /** + * safely parse a double, and return his floor as a long + * @param value the string to parse + * @return the parsed double's floor as a long, or <code>0L</code> if parse fails + * @see {@link Math#floor(double)} + */ + public static Long toFloorLong(String value) + { + double doubleValue = NumberUtils.toDouble(value); + if (doubleValue != 0.0d) + { + return Math.round(Math.floor(doubleValue)); + } + return 0L; + } + + /** + * safely parse a double, and return his ceil as a long + * @param value the string to parse + * @return the parsed double's floor as a long, or <code>0L</code> if parse fails + * @see {@link Math#ceil(double)} + */ + public static Long toCeilLong(String value) + { + double doubleValue = NumberUtils.toDouble(value); + if (doubleValue != 0.0d) + { + return Math.round(Math.ceil(doubleValue)); + } + return 0L; + } + + /** + * Shorten a text + * @param text original text + * @param lines number of lines + * @param numOfCharsPerLine number of chars per line + * @param ellipses ellipses ('...') + * @return cropped string + */ + public static String shorten(String text, int lines, int numOfCharsPerLine, String ellipses) + { + if (text == null) + { + return null; + } + + String wrapped = WordUtils.wrap(text, numOfCharsPerLine, SystemUtils.LINE_SEPARATOR, true); + int j = 0; + int lineCount = 0; + while (lineCount < lines && j != -1) + { + j = StringUtils.indexOf(wrapped, SystemUtils.LINE_SEPARATOR, j + 1); + lineCount++; + } + + return (j != -1) + ? StringUtils.substring(wrapped, 0, j) + (ellipses == null ? StringUtils.EMPTY : ellipses) + : text; + } + + /** + * strip xml and html tags + * @param text the text to strip + * @return the stripped text + */ + public static String stripTags(String text) + { + return text.replaceAll("\\<.*?>", ""); + } + } Added: trunk/openutils-elfunctions/src/main/resources/META-INF/dateutils.tld =================================================================== --- trunk/openutils-elfunctions/src/main/resources/META-INF/dateutils.tld (rev 0) +++ trunk/openutils-elfunctions/src/main/resources/META-INF/dateutils.tld 2010-01-13 18:49:18 UTC (rev 1634) @@ -0,0 +1,11 @@ +<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>Date-related EL functions</description> + <display-name>Date-related EL functions</display-name> + <tlib-version>1.0</tlib-version> + <short-name>du</short-name> + <uri>dateutils</uri> + + +</taglib> \ No newline at end of file Property changes on: trunk/openutils-elfunctions/src/main/resources/META-INF/dateutils.tld ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld =================================================================== --- trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld 2010-01-13 15:08:23 UTC (rev 1633) +++ trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld 2010-01-13 18:49:18 UTC (rev 1634) @@ -114,4 +114,37 @@ <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> <function-signature>boolean endsWith(java.lang.String, java.lang.String)</function-signature> </function> + <function> + <name>shorten</name> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.String shorten(java.lang.String, int, int, java.lang.String)</function-signature> + </function> + <function> + <name>toLong</name> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.Long toLong(java.lang.String)</function-signature> + </function> + <function> + <name>toRoundedLong</name> + <description>safely parse a double, and return his closest rounding as a long (or 0L if parse fails)</description> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.Long toRoundedLong(java.lang.String)</function-signature> + </function> + <function> + <name>toFloorLong</name> + <description>safely parse a double, and return his floor as a long (or 0L if parse fails)</description> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.Long toFloorLong(java.lang.String)</function-signature> + </function> + <function> + <name>toCeilLong</name> + <description>safely parse a double, and return his ceil as a long (or 0L if parse fails)</description> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.Long toCeilLong(java.lang.String)</function-signature> + </function> + <function> + <name>stripTags</name> + <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> + <function-signature>java.lang.String stripTags(java.lang.String)</function-signature> + </function> </taglib> \ No newline at end of file Added: trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java =================================================================== --- trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java (rev 0) +++ trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java 2010-01-13 18:49:18 UTC (rev 1634) @@ -0,0 +1,349 @@ +package it.openutils.mgnlutils.el; + +import info.magnolia.cms.beans.config.ContentRepository; +import info.magnolia.cms.core.Content; +import info.magnolia.cms.core.ItemType; +import info.magnolia.cms.core.Path; +import info.magnolia.cms.core.SystemProperty; +import info.magnolia.context.MgnlContext; +import info.magnolia.link.LinkException; +import info.magnolia.link.LinkUtil; + +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +import javax.jcr.RepositoryException; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Generic utility EL functions. + * @author fgiust + * @version $Id$ + */ +public final class MgnlUtilsElFunctions +{ + + /** + * Logger. + */ + private static Logger log = LoggerFactory.getLogger(MgnlUtilsElFunctions.class); + + private MgnlUtilsElFunctions() + { + // don't instantiate + } + + /** + * return true if exists content + * @param collectionName (column) of magnolia contentNode + * @return boolean value + */ + public static boolean firstPageWithCollection(String collectionName) + { + Content actpage = MgnlContext.getAggregationState().getCurrentContent(); + + try + { + while (actpage.getLevel() > 1) + { + actpage = actpage.getParent(); + + if (actpage.hasContent(collectionName) && actpage.getContent(collectionName).hasChildren()) + { + MgnlContext.getAggregationState().setCurrentContent(actpage); + return true; + } + } + } + catch (RepositoryException e) + { + log.error("Error looking for collection " + collectionName + " in " + actpage.getHandle(), e); + } + + return false; + } + + public static Content contentByPath(String path, String repository) + { + try + { + return MgnlContext.getHierarchyManager(repository).getContent(path); + } + catch (RepositoryException e) + { + return null; + } + } + + @SuppressWarnings("unchecked") + public static Map<String, Object> getRequestAttributeMap() + { + + Map<String, Object> attrs = new HashMap<String, Object>(); + HttpServletRequest request = MgnlContext.getWebContext().getRequest(); + Enumeration<String> attributeNames = request.getAttributeNames(); + + while (attributeNames.hasMoreElements()) + { + String key = attributeNames.nextElement(); + attrs.put(key, request.getAttribute(key)); + attrs.put(key, key); + } + + return attrs; + } + + public static String message(String key) + { + return MgnlContext.getMessages().get(key); + } + + public static boolean develop() + { + return SystemProperty.getBooleanProperty("magnolia.develop"); + } + + public static String link(String uuidOrPath) + { + return uuidLink(uuidOrPath); + } + + public static String uuidLink(String uuid) + { + if (StringUtils.isEmpty(uuid)) + { + return null; + } + + // not an uuid links + if (StringUtils.startsWith(uuid, "/")) + { + String url = MgnlContext.getContextPath() + uuid; + if (!url.endsWith(".html")) + { + return url + ".html"; + } + + return url; + } + if (StringUtils.startsWith(uuid, "http")) + { + return uuid; + } + + String value = null; + try + { + value = MgnlContext.getContextPath() + LinkUtil.convertUUIDtoURI(uuid, ContentRepository.WEBSITE); + } + catch (LinkException e) + { + log.debug("Failed to parse links with from " + + MgnlContext.getAggregationState().getCurrentURI() + + e.getMessage()); + } + return value; + } + + public static String tolink(String url) + { + + String cleanedurl = StringUtils.replace(StringUtils.trim(url), "&", "&"); + if (cleanedurl != null && cleanedurl.startsWith("http")) + { + return cleanedurl; + } + + if (StringUtils.isNotBlank(cleanedurl)) + { + cleanedurl = MgnlContext.getContextPath() + cleanedurl; + } + return cleanedurl; + } + + public static String tolinkOrText(String tabseparatedstring) + { + + if (StringUtils.isBlank(tabseparatedstring)) + { + return StringUtils.EMPTY; + } + + String[] splitted = StringUtils.split(tabseparatedstring, "\t"); + + if (splitted.length > 1) + { + String url = tolink(splitted[1]); + + boolean external = false; + if (splitted.length > 2 && "true".equals(StringUtils.trim(splitted[2]))) + { + external = true; + } + StringBuilder sb = new StringBuilder(); + if (!StringUtils.isBlank(url)) + { + sb.append("<a href=\""); + sb.append(url); + if (external) + { + sb.append("\" class=\"external"); + } + sb.append("\">"); + + sb.append(splitted[0]); + sb.append("</a>"); + } + else + { + sb.append(splitted[0]); + } + + return sb.toString(); + } + // param external + if (splitted[0].equals("false") || splitted[0].equals("true")) + { + return StringUtils.EMPTY; + } + else + { + return splitted[0]; + } + } + + public static int countNodesInCollection(Content content, String subnode) + { + int count = 0; + Content collection = null; + + if (content != null) + { + + try + { + if (content.hasContent(subnode)) + { + collection = content.getContent(subnode); + count = collection.getChildren().size(); + } + } + catch (RepositoryException e) + { + // ignore + } + } + + return count; + } + + public static int countSubpages(Content content) + { + int count = 0; + + if (content != null) + { + count = content.getChildren(ItemType.CONTENT).size(); + } + + return count; + } + + public static Collection<Content> subpages(Content content) + { + + if (content != null) + { + return content.getChildren(ItemType.CONTENT); + } + + return null; + } + + public static boolean userInRole(String role) + { + return MgnlContext.getUser().hasRole(role); + } + + public static boolean isPage(Content content) + { + return content != null && !content.isNodeType(ItemType.CONTENTNODE.getSystemName()); + } + + public static Content getPage(Content content) + { + + Content page = content; + + while (page != null && page.isNodeType(ItemType.CONTENTNODE.getSystemName())) + { + try + { + page = page.getParent(); + } + catch (RepositoryException e) + { + log.debug("Unable to read parent of " + page.getHandle(), e); + } + } + return page; + } + + /** + * retrieve validate label for input string + * @param value the string to validate + * @return the validated label, or null if value was null + * @see {@link Path#getValidatedLabel(String)} + */ + public static String getValidatedLabel(String value) + { + if (value == null) + { + return null; + } + return Path.getValidatedLabel(value); + } + + /** + * splits a list according to a separator and returns true if one of the values equals the input value + * @param list the string to be splitted + * @param value the value to check + * @param separator the separator + * @return true if the value equals one of the values obtained from splitting the string, false otherwise + * @see {@link String#split()} + */ + public static boolean isStringInSeparatedList(String list, String value, String separator) + { + if (StringUtils.isNotEmpty(list) && StringUtils.isNotEmpty(value)) + { + String[] listValues = list.split(separator); + for (String v : listValues) + { + if (v.equals(value)) + { + return true; + } + } + } + return false; + } + + /** + * check if the second argument equals at least one line of the first argument + * @param list the list of lines + * @param value the value to check + * @return true if the value equals one of the lines, false otherwise + */ + public static boolean isLine(String list, String value) + { + return isStringInSeparatedList(list, value, "\r\n") || isStringInSeparatedList(list, value, "\n"); + } + +} Property changes on: trunk/openutils-mgnlutils/src/main/java/it/openutils/mgnlutils/el/MgnlUtilsElFunctions.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld =================================================================== --- trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld (rev 0) +++ trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld 2010-01-13 18:49:18 UTC (rev 1634) @@ -0,0 +1,171 @@ +<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>Magnolia utility Tags and EL functions</description> + <display-name>Magnolia utility Tags and EL functions</display-name> + <tlib-version>1.0</tlib-version> + <short-name>mu</short-name> + <uri>mgnlutils</uri> + <function> + <name>firstPageWithCollection</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean firstPageWithCollection(java.lang.String)</function-signature> + </function> + <function> + <name>isPage</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean isPage(info.magnolia.cms.core.Content)</function-signature> + </function> + <function> + <name>getPage</name> + <function-class>--to be set --</function-class> + <function-signature>info.magnolia.cms.core.Content getPage(info.magnolia.cms.core.Content)</function-signature> + </function> + <function> + <name>requestAttributeMap</name> + <function-class>--to be set --</function-class> + <function-signature>java.util.Map getRequestAttributeMap()</function-signature> + </function> + <function> + <name>countNodesInCollection</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Integer countNodesInCollection(info.magnolia.cms.core.Content, java.lang.String)</function-signature> + </function> + <function> + <name>countSubpages</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Integer countSubpages(info.magnolia.cms.core.Content)</function-signature> + </function> + <function> + <name>subpages</name> + <function-class>--to be set --</function-class> + <function-signature>java.util.Collection subpages(info.magnolia.cms.core.Content)</function-signature> + </function> + <function> + <name>user</name> + <function-class>info.magnolia.context.MgnlContext</function-class> + <function-signature>info.magnolia.cms.security.User getUser()</function-signature> + </function> + <function> + <name>ctx</name> + <function-class>info.magnolia.context.MgnlContext</function-class> + <function-signature>info.magnolia.context.Context getInstance()</function-signature> + </function> + <function> + <name>contentByPath</name> + <function-class>--to be set --</function-class> + <function-signature>info.magnolia.cms.core.Content contentByPath(java.lang.String, java.lang.String)</function-signature> + </function> + <function> + <name>message</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String message(java.lang.String)</function-signature> + </function> + <function> + <name>develop</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean develop()</function-signature> + </function> + <function> + <name>uuidlink</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String uuidLink(java.lang.String)</function-signature> + </function> + <function> + <name>link</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String link(java.lang.String)</function-signature> + </function> + <function> + <name>tolink</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String tolink(java.lang.String)</function-signature> + </function> + <function> + <name>tolinkOrText</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String tolinkOrText(java.lang.String)</function-signature> + </function> + <function> + <name>formatDateTime</name> + <description> + Format a date and time based on a given pattern, or a builtin style (short, medium, long or full). Also supports + different styles for date and time with the syntax "date_style;time_style" (e.g. "short;long") + </description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String formatDateTime(java.util.Calendar, java.lang.String)</function-signature> + </function> + <function> + <name>formatDateTimeWithLocale</name> + <description> + Format a date and time with a specified language (lowercase two-letter ISO-639 code) based on a given pattern, or a builtin style (short, medium, long or full). Also supports + different styles for date and time with the syntax "date_style;time_style" (e.g. "short;long") + </description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String formatDateTimeWithLocale(java.util.Calendar, java.lang.String, + java.lang.String)</function-signature> + </function> + <function> + <name>formatDate</name> + <description>Format a date based on a given pattern, or a builtin style (short, medium, long or full)</description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String formatDate(java.util.Calendar, java.lang.String)</function-signature> + </function> + <function> + <name>formatTime</name> + <description>Format a time based on a given pattern, or a builtin style (short, medium, long or full)</description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String formatTime(java.util.Calendar, java.lang.String)</function-signature> + </function> + <function> + <name>formatInterval</name> + <description>format a milliseconds interval as a string like 523h 22m 18s</description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String formatInterval(java.lang.Long, java.lang.Boolean)</function-signature> + </function> + <function> + <name>getMillisFromNow</name> + <description>retrieve the milliseconds in difference between now and the input date</description> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Long getMillisFromNow(java.util.Calendar)</function-signature> + </function> + <function> + <name>parseDate</name> + <description>parse a date with a given pattern and return the parsed date as a calendar object (null safe)</description> + <function-class>--to be set --</function-class> + <function-signature>java.util.Calendar parseDate(java.lang.String, java.lang.String)</function-signature> + </function> + <function> + <name>userInRole</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean userInRole(java.lang.String)</function-signature> + </function> + <function> + <name>getValidatedLabel</name> + <function-class>--to be set --</function-class> + <function-signature>java.lang.String getValidatedLabel(java.lang.String)</function-signature> + </function> + <function> + <name>isStringInSeparatedList</name> + <description> + splits the first argument based on the third (regex) argument and checks if the second argument is present + in the resulting array + </description> + <example><![CDATA[mu:isStringInSeparatedList('xAxBxC', 'B', 'x') = true]]></example> + <example><![CDATA[mu:isStringInSeparatedList('xAxBxC', 'B', '[A|B]x') = false]]></example> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean isStringInSeparatedList(java.lang.String, java.lang.String, java.lang.String)</function-signature> + </function> + <function> + <name>isLine</name> + <description> + check if the second argument string equals one line of the first argument string, same as isStringInSeparatedList + with third argument "\n" + </description> + <example><![CDATA[mu:isLine('test\r\nprova\r\ntest', 'prova') = true]]></example> + <example><![CDATA[mu:isLine('aaa\nbb\nc', 'c') = true]]></example> + <example><![CDATA[mu:isLine('aaa\nbb\nc', 'b') = false]]></example> + <function-class>--to be set --</function-class> + <function-signature>java.lang.Boolean isLine(java.lang.String, java.lang.String)</function-signature> + </function> +</taglib> \ No newline at end of file Property changes on: trunk/openutils-mgnlutils/src/main/resources/META-INF/tld/mgnlutils.tld ___________________________________________________________________ Added: svn:mime-type + text/xml 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. |