. Fixed several minor bugs where the various small icons for Space objects were not displayed:

- Clipboard, Recent Spaces, Shortcuts and Space Selector now all show correct Forum or small Space icons as appropriate for the node
 - this is now possible since the forums icons patch standardised the way in which all small icons named
. Externalised actions missing from forums.jsp, forum.jsp and topic.jsp
. Added Create Shortcut action to Forums, Forum and Topic details pages (why not!)
 - The user can now create shortcuts to a Forums space, a Forum or a Topic
. Prototype work for Paste-as-link (not visible yet)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2571 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-03-22 17:41:41 +00:00
parent afbc7754e5
commit cb69c74d73
14 changed files with 392 additions and 236 deletions

View File

@@ -128,9 +128,11 @@ public abstract class AbstractItemSelector extends UIInput
public abstract Collection<NodeRef> getRootChildren(FacesContext context);
/**
* @return The icon image to display next to the item links, or null for no icon
* @param ref NodeRef to the item to get the icon for
*
* @return The icon image to display next to the item links, or null for no icon
*/
public abstract String getItemIcon();
public abstract String getItemIcon(FacesContext context, NodeRef ref);
/**
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
@@ -278,12 +280,6 @@ public abstract class AbstractItemSelector extends UIInput
boolean showValueInHiddenField = false;
NodeRef value = null;
String image = null;
if (getItemIcon() != null)
{
image = "<span style='padding-right:4px'>" + Utils.buildImageTag(context, getItemIcon(), null, "absmiddle") + "</span>";
}
switch (this.mode)
{
case MODE_BEFORE_SELECTION:
@@ -486,7 +482,15 @@ public abstract class AbstractItemSelector extends UIInput
// get the name for the child and output as link
NodeRef childNodeRef = new NodeRef(Repository.getStoreRef(), childId);
String name = Repository.getNameForNode(service, childNodeRef);
renderNodeLink(context, childId, name, image, buf);
String prefixHtml = null;
String icon = getItemIcon(context, childNodeRef);
if (icon != null)
{
prefixHtml = "<span style='padding-right:4px'>" +
Utils.buildImageTag(context, icon, null, "absmiddle") +
"</span>";
}
renderNodeLink(context, childId, name, prefixHtml, buf);
buf.append("</td></tr>");
}

View File

@@ -144,7 +144,7 @@ public class UICategorySelector extends AbstractItemSelector
/**
* @see org.alfresco.web.ui.repo.component.AbstractItemSelector#getItemIcon()
*/
public String getItemIcon()
public String getItemIcon(FacesContext context, NodeRef ref)
{
return WebResources.IMAGE_CATEGORY;
}

View File

@@ -141,8 +141,17 @@ public class UISpaceSelector extends AbstractItemSelector
/**
* @see org.alfresco.web.ui.repo.component.AbstractItemSelector#getItemIcon()
*/
public String getItemIcon()
public String getItemIcon(FacesContext context, NodeRef ref)
{
return WebResources.IMAGE_SPACE;
String icon = (String)getNodeService(context).getProperty(ref, ContentModel.PROP_ICON);
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";
}
else
{
icon = WebResources.IMAGE_SPACE;
}
return icon;
}
}

View File

@@ -122,6 +122,7 @@ public class UIClipboardShelfItem extends UIShelfItem
case ACTION_PASTE_ALL:
case ACTION_PASTE_ITEM:
case ACTION_PASTE_LINK:
Utils.processActionMethod(getFacesContext(), getPasteActionListener(), clipEvent);
break;
}
@@ -158,7 +159,7 @@ public class UIClipboardShelfItem extends UIShelfItem
ClipboardItem item = items.get(i);
// start row with cut/copy state icon
out.write("<tr><td>");
out.write("<tr><td width=16>");
if (item.Mode == ClipboardStatus.COPY)
{
out.write(Utils.buildImageTag(context, WebResources.IMAGE_COPY, 14, 16, bundle.getString(MSG_COPY), null, "absmiddle"));
@@ -167,17 +168,26 @@ public class UIClipboardShelfItem extends UIShelfItem
{
out.write(Utils.buildImageTag(context, WebResources.IMAGE_CUT, 13, 16, bundle.getString(MSG_CUT), null, "absmiddle"));
}
out.write("</td><td>");
out.write("</td><td width=16>");
if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER))
{
// start row with Space icon
out.write(Utils.buildImageTag(context, WebResources.IMAGE_SPACE, 16, 16, null, null, "absmiddle"));
// start row with correct node icon
String icon = (String)item.Node.getProperties().get("app:icon");
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";
}
else
{
icon = WebResources.IMAGE_SPACE;
}
out.write(Utils.buildImageTag(context, icon, 16, 16, null, null, "absmiddle"));
}
else if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT))
{
String image = Utils.getFileTypeImage(item.Node.getName(), true);
out.write(Utils.buildImageTag(context, image, 16, 16, null, null, "absmiddle"));
out.write(Utils.buildImageTag(context, image, null, "absmiddle"));
}
// output cropped item label - we also output with no breaks, this is ok
@@ -190,6 +200,11 @@ public class UIClipboardShelfItem extends UIShelfItem
out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE));
out.write("&nbsp;");
out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE));
//if (item.Mode == ClipboardStatus.COPY)
//{
// out.write("&nbsp;");
// out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK));
//}
// end actions cell and end row
out.write("</nobr></td></tr>");
@@ -337,17 +352,19 @@ public class UIClipboardShelfItem extends UIShelfItem
// Private data
/** I18N messages */
private static final String MSG_REMOVE_ALL = "remove_all";
private static final String MSG_PASTE_ALL = "paste_all";
private static final String MSG_PASTE_ITEM = "paste_item";
private static final String MSG_REMOVE_ALL = "remove_all";
private static final String MSG_PASTE_ALL = "paste_all";
private static final String MSG_PASTE_ITEM = "paste_item";
private static final String MSG_PASTE_LINK = "paste_link";
private static final String MSG_REMOVE_ITEM = "remove_item";
private static final String MSG_CUT = "cut";
private static final String MSG_COPY = "copy";
private final static int ACTION_REMOVE_ITEM = 0;
private final static int ACTION_REMOVE_ALL = 1;
private final static int ACTION_PASTE_ITEM = 2;
private final static int ACTION_PASTE_ALL = 3;
public final static int ACTION_REMOVE_ITEM = 0;
public final static int ACTION_REMOVE_ALL = 1;
public final static int ACTION_PASTE_ITEM = 2;
public final static int ACTION_PASTE_ALL = 3;
public final static int ACTION_PASTE_LINK = 4;
/** the current list of clipboard items */
private List<ClipboardItem> collections;

View File

@@ -153,9 +153,18 @@ public class UIRecentSpacesShelfItem extends UIShelfItem
{
Node item = items.get(i);
// start row with Space icon
out.write("<tr><td>");
out.write(Utils.buildImageTag(context, WebResources.IMAGE_SPACE, 16, 16, null, null, "absmiddle"));
// start row with correct node icon
out.write("<tr><td width=16>");
String icon = (String)item.getProperties().get("app:icon");
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";
}
else
{
icon = WebResources.IMAGE_SPACE;
}
out.write(Utils.buildImageTag(context, icon, 16, 16, null, null, "absmiddle"));
// output cropped item label - we also output with no breaks, this is ok
// as the copped label will ensure a sensible maximum width

View File

@@ -179,16 +179,25 @@ public class UIShortcutsShelfItem extends UIShelfItem
{
Node item = items.get(i);
out.write("<tr><td>");
out.write("<tr><td width=16>");
if (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER))
{
// start row with Space icon
out.write(Utils.buildImageTag(context, WebResources.IMAGE_SPACE, 16, 16, null, null, "absmiddle"));
// start row with correct node icon
String icon = (String)item.getProperties().get("app:icon");
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";
}
else
{
icon = WebResources.IMAGE_SPACE;
}
out.write(Utils.buildImageTag(context, icon, 16, 16, null, null, "absmiddle"));
}
else if (dd.isSubClass(item.getType(), ContentModel.TYPE_CONTENT))
{
String image = Utils.getFileTypeImage(item.getName(), true);
out.write(Utils.buildImageTag(context, image, 16, 16, null, null, "absmiddle"));
out.write(Utils.buildImageTag(context, image, null, "absmiddle"));
}
// output cropped item label - we also output with no breaks, this is ok