. Checkpoint of the Clipboard refactoring for AVM nodes:

- Cut and Copy actions now appear for AVM nodes (as appropriate for user permissions)
 - AVM nodes now appear in the clipboard
 - All content nodes in the clipboard are now clickable links which display the content for the item
NOTE: avm nodes cannot be pasted anywhere yet :)
. Fixed 2.0 styles for Simple Search pop-up

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4929 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-25 18:51:10 +00:00
parent 1c966e9a71
commit 1e706a0d36
8 changed files with 80 additions and 5 deletions

View File

@@ -246,6 +246,35 @@
</params> </params>
</action> </action>
<!-- Cut a file or folder to the clipboard -->
<action id="cut_avm_node">
<evaluator>org.alfresco.web.action.evaluator.WCMWorkflowEvaluator</evaluator>
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>cut</label-id>
<image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener>
<params>
<param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params>
</action>
<!-- Copy a file or folder to the clipboard -->
<action id="copy_avm_node">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<label-id>copy</label-id>
<image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener>
<params>
<param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params>
</action>
<!-- Actions for a file in the AVM Browse screen --> <!-- Actions for a file in the AVM Browse screen -->
<action-group id="avm_file_browse"> <action-group id="avm_file_browse">
@@ -253,6 +282,8 @@
<action idref="edit_file" /> <action idref="edit_file" />
<action idref="update_file" /> <action idref="update_file" />
<action idref="preview_file" /> <action idref="preview_file" />
<action idref="cut_avm_node" />
<action idref="copy_avm_node" />
<action idref="file_details" /> <action idref="file_details" />
<action idref="delete_file_browse" /> <action idref="delete_file_browse" />
</action-group> </action-group>
@@ -261,6 +292,8 @@
<action-group id="avm_folder_browse"> <action-group id="avm_folder_browse">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="preview_folder" /> <action idref="preview_folder" />
<action idref="cut_avm_node" />
<action idref="copy_avm_node" />
<action idref="folder_details" /> <action idref="folder_details" />
<action idref="delete_folder_browse" /> <action idref="delete_folder_browse" />
</action-group> </action-group>
@@ -273,6 +306,7 @@
<action idref="submit" /> <action idref="submit" />
<action idref="revert" /> <action idref="revert" />
<action idref="preview_file" /> <action idref="preview_file" />
<action idref="copy_avm_node" />
<action idref="file_details" /> <action idref="file_details" />
<action idref="delete_file" /> <action idref="delete_file" />
</action-group> </action-group>
@@ -283,6 +317,7 @@
<action idref="submit" /> <action idref="submit" />
<action idref="revert" /> <action idref="revert" />
<action idref="preview_folder" /> <action idref="preview_folder" />
<action idref="copy_avm_node" />
<action idref="folder_details" /> <action idref="folder_details" />
<action idref="delete_folder" /> <action idref="delete_folder" />
</action-group> </action-group>
@@ -311,6 +346,8 @@
<!-- Actions for the File Details action menu --> <!-- Actions for the File Details action menu -->
<action-group id="avm_file_details"> <action-group id="avm_file_details">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="cut_avm_node" />
<action idref="copy_avm_node" />
<action idref="edit_file" /> <action idref="edit_file" />
<action idref="update_file" /> <action idref="update_file" />
<action idref="delete_file_browse" /> <action idref="delete_file_browse" />
@@ -319,6 +356,8 @@
<!-- Actions for the Folder Details action menu --> <!-- Actions for the Folder Details action menu -->
<action-group id="avm_folder_details"> <action-group id="avm_folder_details">
<show-link>false</show-link> <show-link>false</show-link>
<action idref="cut_avm_node" />
<action idref="copy_avm_node" />
<action idref="delete_folder_browse" /> <action idref="delete_folder_browse" />
</action-group> </action-group>

View File

@@ -33,4 +33,12 @@ public class AVMClipboardItem extends AbstractClipboardItem
{ {
super(ref, mode); super(ref, mode);
} }
/**
* @see org.alfresco.web.bean.clipboard.ClipboardItem#supportsLink()
*/
public boolean supportsLink()
{
return false;
}
} }

View File

@@ -438,7 +438,7 @@ public class ClipboardBean
} }
/** /**
* Add a clipboard node for an operation to the clipboard * Add a clipboard node to the clipboard ready for a cut/copy operation
* *
* @param ref NodeRef of the item for the operation * @param ref NodeRef of the item for the operation
* @param mode ClipboardStatus for the operation * @param mode ClipboardStatus for the operation

View File

@@ -44,4 +44,6 @@ public interface ClipboardItem
public String getId(); public String getId();
public NodeRef getNodeRef(); public NodeRef getNodeRef();
public boolean supportsLink();
} }

View File

@@ -33,4 +33,12 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
{ {
super(ref, mode); super(ref, mode);
} }
/**
* @see org.alfresco.web.bean.clipboard.ClipboardItem#supportsLink()
*/
public boolean supportsLink()
{
return true;
}
} }

View File

@@ -194,6 +194,7 @@ public class AVMNode extends Node implements Map<String, Object>
} }
this.properties.put("id", this.id); this.properties.put("id", this.id);
this.properties.put("nodeRef", this.nodeRef);
this.properties.put("size", this.avmRef.getLength()); this.properties.put("size", this.avmRef.getLength());
this.properties.put("name", this.avmRef.getName()); this.properties.put("name", this.avmRef.getName());
this.properties.put("created", this.avmRef.getCreateDate()); this.properties.put("created", this.avmRef.getCreateDate());

View File

@@ -195,7 +195,7 @@ public class UISimpleSearch extends UICommand
// dynamic DIV area containing search options // dynamic DIV area containing search options
out.write("<br><div id='_alfsearch' style='position:absolute;display:none'>"); out.write("<br><div id='_alfsearch' style='position:absolute;display:none'>");
out.write("<table border=0 bgcolor='#eeeeee' style='border-top:thin solid #FFFFFF;border-left:thin solid #FFFFFF;border-right:thin solid #444444;border-bottom:thin solid #444444;' cellspacing=4 cellpadding=0>"); out.write("<table border=0 class='moreActionsMenu' cellspacing=4 cellpadding=0>");
// output each option - setting the current one to CHECKED // output each option - setting the current one to CHECKED
String optionFieldName = getClientId(context) + NamingContainer.SEPARATOR_CHAR + OPTION_PARAM; String optionFieldName = getClientId(context) + NamingContainer.SEPARATOR_CHAR + OPTION_PARAM;

View File

@@ -32,8 +32,10 @@ import javax.faces.event.ActionEvent;
import javax.faces.event.FacesEvent; import javax.faces.event.FacesEvent;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.clipboard.ClipboardItem; import org.alfresco.web.bean.clipboard.ClipboardItem;
import org.alfresco.web.bean.clipboard.ClipboardStatus; import org.alfresco.web.bean.clipboard.ClipboardStatus;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
@@ -170,7 +172,8 @@ public class UIClipboardShelfItem extends UIShelfItem
} }
out.write("</td><td width=16>"); out.write("</td><td width=16>");
if (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER)) boolean isFolder = (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER));
if (isFolder)
{ {
// start row with correct node icon // start row with correct node icon
String icon = (String)item.getIcon(); String icon = (String)item.getIcon();
@@ -193,14 +196,28 @@ public class UIClipboardShelfItem extends UIShelfItem
// output cropped item label - we also output with no breaks, this is ok // output cropped item label - we also output with no breaks, this is ok
// as the copped label will ensure a sensible maximum width // as the copped label will ensure a sensible maximum width
out.write("</td><td width=100%><nobr>&nbsp;"); out.write("</td><td width=100%><nobr>&nbsp;");
if (isFolder)
{
out.write(Utils.cropEncode(item.getName())); out.write(Utils.cropEncode(item.getName()));
}
else
{
// output as a content download link
out.write("<a href='");
out.write(context.getExternalContext().getRequestContextPath());
out.write(DownloadContentServlet.generateBrowserURL(item.getNodeRef(), item.getName()));
out.write("' target='new'>");
out.write(Utils.cropEncode(item.getName()));
out.write("</a>");
}
// output actions // output actions
out.write("</nobr></td><td align=right><nobr>"); out.write("</nobr></td><td align=right><nobr>");
out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE)); out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE));
out.write("&nbsp;"); out.write("&nbsp;");
out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE)); out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE));
if (item.getMode() == ClipboardStatus.COPY && dd.isSubClass(item.getType(), ContentModel.TYPE_LINK) == false) if (item.supportsLink() && item.getMode() == ClipboardStatus.COPY &&
dd.isSubClass(item.getType(), ContentModel.TYPE_LINK) == false)
{ {
out.write("&nbsp;"); out.write("&nbsp;");
out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK)); out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK));