Author: chathura
Date: Mon Jan 28 00:02:27 2008
New Revision: 13032
Log:
Formatted the date views in the UI.
Added the backend functionality to get the active (current) version path of a
resource, when browsing its older version.
Modified:
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/utils/CommonUtil.java
branches/registry/1_0/modules/webapps/src/main/webapp/admin/advanced-search.jsp
branches/registry/1_0/modules/webapps/src/main/webapp/admin/search.jsp
Modified:
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
==============================================================================
---
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
(original)
+++
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
Mon Jan 28 00:02:27 2008
@@ -21,6 +21,7 @@
import org.wso2.registry.secure.SecureRegistry;
import org.wso2.registry.web.actions.utils.Permission;
import org.wso2.registry.web.actions.utils.ResourcePath;
+import org.wso2.registry.web.utils.CommonUtil;
import org.wso2.usermanager.Realm;
import org.wso2.usermanager.UserManagerException;
import org.wso2.usermanager.UserManagerConstants;
@@ -31,6 +32,16 @@
public class ResourceDetailsAction extends AbstractRegistryAction {
private String path;
+
+ /**
+ * This class may contain details of the current version of resources or
older versions of
+ * resources. When browsing an older version of a resource, it may be
necessary to get the
+ * path of the current version of that resource. This field contains the
path of the
+ * current (active) version of the resource. If this object contains the
details of the
+ * current version, path feild and the activeResourcePath field will be
identical.
+ */
+ private String activeResourcePath;
+
private String relativePath;
private String contentPath;
private String permalink;
@@ -178,6 +189,19 @@
permalink = path;
}
+ if (versionView) {
+
+ String[] parts = path.split("?v=");
+ if (parts.length == 2) {
+ activeResourcePath = parts[0];
+ } else {
+ activeResourcePath = path;
+ }
+
+ } else {
+ activeResourcePath = path;
+ }
+
if (resource.getAuthorUserName() != null) {
this.author = resource.getAuthorUserName();
}
@@ -540,6 +564,10 @@
return createdOn;
}
+ public String getFormattedCreatedOn() {
+ return CommonUtil.formatDate(createdOn);
+ }
+
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
@@ -548,6 +576,10 @@
return lastModified;
}
+ public String getFormattedLastModified() {
+ return CommonUtil.formatDate(lastModified);
+ }
+
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
Modified:
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
==============================================================================
---
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
(original)
+++
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
Mon Jan 28 00:02:27 2008
@@ -17,6 +17,7 @@
package org.wso2.registry.web.actions.utils;
import org.wso2.registry.RegistryConstants;
+import org.wso2.registry.web.utils.CommonUtil;
import java.util.Date;
import java.util.HashMap;
@@ -132,6 +133,10 @@
return createdOn;
}
+ public String getFormattedCreatedOn() {
+ return CommonUtil.formatDate(createdOn);
+ }
+
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
Modified:
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/utils/CommonUtil.java
==============================================================================
---
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/utils/CommonUtil.java
(original)
+++
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/utils/CommonUtil.java
Mon Jan 28 00:02:27 2008
@@ -26,6 +26,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContext;
+import java.util.Date;
+import java.text.DateFormat;
public class CommonUtil {
@@ -61,7 +63,10 @@
}
public static void invalidateAllSessions(HttpServletRequest request) {
-
request.getSession().invalidate();
}
+
+ public static String formatDate(Date date) {
+ return DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.LONG).format(date);
+ }
}
Modified:
branches/registry/1_0/modules/webapps/src/main/webapp/admin/advanced-search.jsp
==============================================================================
---
branches/registry/1_0/modules/webapps/src/main/webapp/admin/advanced-search.jsp
(original)
+++
branches/registry/1_0/modules/webapps/src/main/webapp/admin/advanced-search.jsp
Mon Jan 28 00:02:27 2008
@@ -298,7 +298,7 @@
%>
<tr id="1">
<td><a href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
class="folder-small"><%=resourceData.getResourcePath()%></a></td>
- <td><%=resourceData.getCreatedOn()%></td>
+ <td><%=resourceData.getFormattedCreatedOn()%></td>
<td><%=resourceData.getAuthorUserName()%></td>
<td>
<img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[0]%>.gif" />
Modified: branches/registry/1_0/modules/webapps/src/main/webapp/admin/search.jsp
==============================================================================
--- branches/registry/1_0/modules/webapps/src/main/webapp/admin/search.jsp
(original)
+++ branches/registry/1_0/modules/webapps/src/main/webapp/admin/search.jsp
Mon Jan 28 00:02:27 2008
@@ -71,7 +71,7 @@
%>
<tr id="1">
<td><a
href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
class="folder-small"><%=resourceData.getResourcePath()%></a></td>
- <td><%=resourceData.getCreatedOn()%></td>
+ <td><%=resourceData.getFormattedCreatedOn()%></td>
<td><%=resourceData.getAuthorUserName()%></td>
<td>
<img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[0]%>.gif" />
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev