. First pass of the Saved Searches functionality for the web-client

. Saved Searches bootstrap folder
. Document details and Space details page now show a copy-and-paste NodeRef link 
. Minor bug fixes to Breadcrumb and ActionLink components

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2104 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-01-12 13:40:20 +00:00
parent 5d9576883d
commit 2652d33f08
21 changed files with 1202 additions and 90 deletions

View File

@@ -22,6 +22,7 @@ import java.io.StringReader;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -987,6 +988,79 @@ public final class Utils
throw new AlfrescoRuntimeException("Invalid DateTime pattern", err);
}
}
/**
* Parse XML format date YYYY-MM-DDTHH:MM:SS
* @param isoDate
* @return Date or null if failed to parse
*/
public static Date parseXMLDateFormat(String isoDate)
{
Date parsed = null;
try
{
int offset = 0;
// extract year
int year = Integer.parseInt(isoDate.substring(offset, offset += 4));
if (isoDate.charAt(offset) != '-')
{
throw new IndexOutOfBoundsException("Expected - character but found " + isoDate.charAt(offset));
}
// extract month
int month = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
if (isoDate.charAt(offset) != '-')
{
throw new IndexOutOfBoundsException("Expected - character but found " + isoDate.charAt(offset));
}
// extract day
int day = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
if (isoDate.charAt(offset) != 'T')
{
throw new IndexOutOfBoundsException("Expected T character but found " + isoDate.charAt(offset));
}
// extract hours, minutes, seconds and milliseconds
int hour = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
if (isoDate.charAt(offset) != ':')
{
throw new IndexOutOfBoundsException("Expected : character but found " + isoDate.charAt(offset));
}
int minutes = Integer.parseInt(isoDate.substring(offset += 1, offset += 2));
if (isoDate.charAt(offset) != ':')
{
throw new IndexOutOfBoundsException("Expected : character but found " + isoDate.charAt(offset));
}
int seconds = Integer.parseInt(isoDate.substring(offset += 1 , offset += 2));
// initialize Calendar object
Calendar calendar = Calendar.getInstance();
calendar.setLenient(false);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DAY_OF_MONTH, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.SECOND, seconds);
// extract the date
parsed = calendar.getTime();
}
catch(IndexOutOfBoundsException e)
{
}
catch(NumberFormatException e)
{
}
catch(IllegalArgumentException e)
{
}
return parsed;
}
/**
* Return the image path to the filetype icon for the specified file name string

View File

@@ -303,6 +303,7 @@ public class UIActionLink extends UICommand
this.onclick = onclick;
}
// ------------------------------------------------------------------------------
// Private data

View File

@@ -158,10 +158,10 @@ public class ActionLinkRenderer extends BaseRenderer
linkBuf.append(" class=")
.append(attrs.get("styleClass"));
}
if (attrs.get("tooltip") != null)
if (link.getTooltip() != null)
{
linkBuf.append(" title=\"")
.append(Utils.encode((String)attrs.get("tooltip")))
.append(Utils.encode(link.getTooltip()))
.append('"');
}
linkBuf.append('>');
@@ -266,10 +266,8 @@ public class ActionLinkRenderer extends BaseRenderer
}
buf.append(">");
Map attrs = link.getAttributes();
// render text link cell for the menu
if (attrs.get("href") == null)
if (link.getHref() == null)
{
buf.append("<a href='#' onclick=\"");
buf.append(Utils.generateFormSubmit(context, link, Utils.getActionHiddenFieldName(context, link), link.getClientId(context), getParameterMap(link)));
@@ -277,7 +275,7 @@ public class ActionLinkRenderer extends BaseRenderer
}
else
{
String href = (String)attrs.get("href");
String href = link.getHref();
if (href.startsWith("http") == false)
{
href = context.getExternalContext().getRequestContextPath() + href;
@@ -295,6 +293,7 @@ public class ActionLinkRenderer extends BaseRenderer
}
}
Map attrs = link.getAttributes();
if (attrs.get("style") != null)
{
buf.append(" style=\"")

View File

@@ -108,7 +108,7 @@ public class BreadcrumbRenderer extends BaseRenderer
if (first == false)
{
buf.append(' ')
.append(bc.getSeparator())
.append(Utils.encode(bc.getSeparator()))
.append(' ');
}