You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/03/19 06:36:12 UTC
svn commit: r638712 - in /ofbiz/trunk/framework/webtools/webapp/webtools:
WEB-INF/actions/artifactinfo/ArtifactInfo.bsh artifactinfo/ArtifactInfo.ftl
Author: jonesde
Date: Tue Mar 18 22:36:09 2008
New Revision: 638712
URL: http://svn.apache.org/viewvc?rev=638712&view=rev
Log:
Implemented recently viewed list, down at the bottom of the page for now
Modified:
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh
ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh?rev=638712&r1=638711&r2=638712&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh Tue Mar 18 22:36:09 2008
@@ -20,6 +20,7 @@
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.webtools.artifactinfo.*;
import org.ofbiz.base.util.*;
+import javolution.util.FastList;
name = parameters.get("name");
location = parameters.get("location");
@@ -29,17 +30,35 @@
aif = ArtifactInfoFactory.getArtifactInfoFactory(delegator.getDelegatorName());
context.put("aif", aif);
+artifactInfo = null;
if (UtilValidate.isNotEmpty(type)) {
if (UtilValidate.isNotEmpty(name)) {
- context.put("artifactInfo", aif.getArtifactInfoByNameAndType(name, location, type));
+ artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type);
+ context.put("artifactInfo", artifactInfo);
} else if (UtilValidate.isNotEmpty(uniqueId)) {
- context.put("artifactInfo", aif.getArtifactInfoByUniqueIdAndType(uniqueId, type));
+ artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type);
+ context.put("artifactInfo", artifactInfo);
}
} else {
artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name);
if (artifactInfoSet.size() == 1) {
- context.put("artifactInfo", artifactInfoSet.iterator().next());
+ artifactInfo = artifactInfoSet.iterator().next();
+ context.put("artifactInfo", artifactInfo);
} else {
context.put("artifactInfoSet", new TreeSet(artifactInfoSet));
+ }
+}
+
+if (artifactInfo != null) {
+ // add to the recently viewed list
+ recentArtifactInfoList = session.getAttribute("recentArtifactInfoList");
+ if (recentArtifactInfoList == null) {
+ recentArtifactInfoList = FastList.newInstance();
+ session.setAttribute("recentArtifactInfoList", recentArtifactInfoList);
+ }
+ if (recentArtifactInfoList.size() > 0 && recentArtifactInfoList.get(0).equals(artifactInfo)) {
+ // hmmm, I guess do nothing if it's already there
+ } else {
+ recentArtifactInfoList.add(0, artifactInfo);
}
}
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl?rev=638712&r1=638711&r2=638712&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Tue Mar 18 22:36:09 2008
@@ -115,6 +115,15 @@
</#if>
</#if>
+<#if sessionAttributes.recentArtifactInfoList?has_content>
+ <h2>Recently Viewed Artifacts:</h2>
+ <#assign highRef = sessionAttributes.recentArtifactInfoList.size() - 1/>
+ <#if (highRef > 20)><#assign highRef = 20/></#if>
+ <#list sessionAttributes.recentArtifactInfoList[0..highRef] as recentArtifactInfo>
+ <div>${recentArtifactInfo_index + 1} - ${recentArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=recentArtifactInfo/></div>
+ </#list>
+</#if>
+
<#macro displayEntityArtifactInfo entityArtifactInfo>
<div> - <@displayArtifactInfoLink artifactInfo=entityArtifactInfo/></div>
</#macro>