Fixed small icon display issue in details view

Fixed unreported error with topic deletion

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2330 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-02-08 22:21:16 +00:00
parent 63a39037d3
commit 8ae8d98571
3 changed files with 43 additions and 2 deletions

View File

@@ -71,6 +71,7 @@ import org.alfresco.web.ui.repo.component.UINodePath;
import org.alfresco.web.ui.repo.component.UISimpleSearch;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.springframework.util.StringUtils;
/**
* Bean providing properties and behaviour for the main folder/document browse screen and
@@ -531,6 +532,7 @@ public class BrowseBean implements IContextListener
// create our Node representation
MapNode node = new MapNode(nodeRef, this.nodeService, true);
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
node.addPropertyResolver("beingDiscussed", this.resolverBeingDiscussed);
this.containerNodes.add(node);
@@ -648,6 +650,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("path", this.resolverPath);
node.addPropertyResolver("displayPath", this.resolverDisplayPath);
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
node.addPropertyResolver("beingDiscussed", this.resolverBeingDiscussed);
this.containerNodes.add(node);
@@ -814,6 +817,29 @@ public class BrowseBean implements IContextListener
}
};
public NodePropertyResolver resolverSmallIcon = new NodePropertyResolver() {
public Object get(Node node) {
QNameNodeMap props = (QNameNodeMap)node.getProperties();
String icon = "space_small";
// we know we have small versions of the forum space types so use them!
QName nodeType = node.getType();
if (nodeType.equals(ForumModel.TYPE_FORUMS) || nodeType.equals(ForumModel.TYPE_FORUM) ||
nodeType.equals(ForumModel.TYPE_TOPIC))
{
String storedIcon = (String)props.getRaw("app:icon");
if (storedIcon != null)
{
icon = StringUtils.replace(storedIcon, "_large", "");
}
}
return icon;
}
};
public NodePropertyResolver resolverMimetype = new NodePropertyResolver() {
public Object get(Node node) {
ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT);

View File

@@ -800,6 +800,21 @@ public class ForumsBean implements IContextListener
*/
public String deleteTopicOK()
{
String outcomeOverride = "browse";
// find out what the parent type of the node being deleted
Node node = this.browseBean.getActionSpace();
ChildAssociationRef assoc = this.nodeService.getPrimaryParent(node.getNodeRef());
if (assoc != null)
{
NodeRef parent = assoc.getParentRef();
QName parentType = this.nodeService.getType(parent);
if (parentType.equals(ForumModel.TYPE_FORUM))
{
outcomeOverride = "topicDeleted";
}
}
// call the generic handler
String outcome = this.browseBean.deleteSpaceOK();
@@ -807,7 +822,7 @@ public class ForumsBean implements IContextListener
if (outcome != null)
{
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.DIALOG_SEPARATOR + "topicDeleted";
AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcomeOverride;
}
return outcome;

View File

@@ -226,7 +226,7 @@
<a:sortLink label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<f:facet name="small-icon">
<a:actionLink value="#{r.name}" image="/images/icons/space_small.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<a:actionLink value="#{r.name}" image="/images/icons/#{r.smallIcon}.gif" actionListener="#{BrowseBean.clickSpace}" showLink="false">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</f:facet>