mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Delete space/document action added to MySpaces portlet.
Fixed subtle issue with ajax request being processed before outer txn was completed - caused refresh issues after Create/Upload/Delete actions. More ui improvements to MySpaces portlet. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5799 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
${c?html?replace('$', '<br>', 'rm')}<#if (c?length >= 512)>...</#if>
|
||||
</#if>
|
||||
<#elseif isImage>
|
||||
<center><a href="${url.context}${node.url}" target="new"><img src="${url.context}${node.url}" height=140 border=0></a></center>
|
||||
<center><a href="${url.context}${node.url}" target="new" onclick="event.cancelBubble=true;"><img src="${url.context}${node.url}" height=140 border=0></a></center>
|
||||
<#elseif node.isContainer>
|
||||
<#list node.children?sort_by('name') as c>
|
||||
<#--if (c_index >= 25)><div>...</div><#break></#if>-->
|
||||
@@ -33,13 +33,13 @@
|
||||
<td class="spaceAction docActionViewContent">View Content</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spaceAction docActionDelete">Delete</td>
|
||||
<td class="spaceAction docActionDelete" onclick='event.cancelBubble=true;MySpaces.deleteItem("${node.name}", "${node.nodeRef}");'>Delete</td>
|
||||
<td class="spaceAction docActionMoreActions">More Actions...</td>
|
||||
</tr>
|
||||
<#else>
|
||||
<tr>
|
||||
<td class="spaceAction spaceActionEditDetails">Edit Details</td>
|
||||
<td class="spaceAction spaceActionDelete">Delete</td>
|
||||
<td class="spaceAction spaceActionDelete" onclick='event.cancelBubble=true;MySpaces.deleteItem("${node.name}", "${node.nodeRef}");'>Delete</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spaceAction spaceActionMoreActions">More Actions...</td>
|
||||
|
@@ -12,9 +12,9 @@
|
||||
<div class="spaceRow">
|
||||
<div class="spaceIcon">
|
||||
<#if d.isDocument>
|
||||
<a href="${url.context}${d.url}" target="new"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
|
||||
<a href="${url.context}${d.url}" target="new" onclick="event.cancelBubble=true"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
|
||||
<#else>
|
||||
<a href="${scripturl("${url.context}/service/myspaces?f=${args.f}&p=${args.p}/${d.name}", false)}"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
|
||||
<a href="${scripturl("${url.context}/service/myspaces?f=${args.f}&p=${args.p}/${d.name}", false)}"><img class="spaceIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border="0" onclick="event.cancelBubble=true;"></a>
|
||||
</#if>
|
||||
<div style="display:none"><img class="spaceIconImage64" alt="" width="64" height="64" src="${url.context}${d.icon64}"></div>
|
||||
</div>
|
||||
@@ -46,4 +46,4 @@
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- hidden div with the count value for the page -->
|
||||
<div id="spaceCountValue" style="display:none">${count}</div>
|
||||
<div id="spaceCountValue" style="display:none">${count}</div>
|
@@ -197,7 +197,6 @@ public class FileUploadBean
|
||||
|
||||
ResponseWriter out = fc.getResponseWriter();
|
||||
XMLUtil.print(result, out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
static NodeRef pathToNodeRef(FacesContext fc, String path)
|
||||
|
@@ -105,6 +105,27 @@ public class MySpacesBean
|
||||
{
|
||||
out.write("ERROR: " + err.getMessage());
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||
public void deleteItem() throws Exception
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ResponseWriter out = fc.getResponseWriter();
|
||||
|
||||
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
|
||||
String strNodeRef = (String)requestMap.get("noderef");
|
||||
if (strNodeRef != null && strNodeRef.length() != 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Repository.getServiceRegistry(fc).getFileFolderService().delete(new NodeRef(strNodeRef));
|
||||
out.write("OK: " + strNodeRef);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
out.write("ERROR: " + err.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -180,7 +180,6 @@ public class FilePickerBean
|
||||
|
||||
final ResponseWriter out = facesContext.getResponseWriter();
|
||||
XMLUtil.print(result, out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||
@@ -272,7 +271,6 @@ public class FilePickerBean
|
||||
|
||||
final ResponseWriter out = facesContext.getResponseWriter();
|
||||
XMLUtil.print(result, out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
private String getCurrentAVMPath()
|
||||
|
@@ -227,7 +227,7 @@ var MySpaces = {
|
||||
{
|
||||
if (!resource.isLoaded)
|
||||
{
|
||||
// fire off the ajax request to get the resources for this task
|
||||
// fire off the ajax request to get the preview panel content and actions
|
||||
YAHOO.util.Connect.asyncRequest(
|
||||
"POST",
|
||||
getContextPath() + '/ajax/invoke/NodeInfoBean.sendNodeInfo',
|
||||
@@ -513,18 +513,6 @@ var MySpaces = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancel button click handler for various pop-up panels
|
||||
*/
|
||||
closePopupPanel: function()
|
||||
{
|
||||
if (this.popupPanel != null)
|
||||
{
|
||||
this.popupPanel.setStyle("display", "none");
|
||||
this.popupPanel = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Display the Upload File pop-up panel
|
||||
*/
|
||||
@@ -590,6 +578,51 @@ var MySpaces = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a space/document item
|
||||
*/
|
||||
deleteItem: function(name, noderef)
|
||||
{
|
||||
if (confirm("Are you sure you want to delete: " + name))
|
||||
{
|
||||
// ajax call to create space
|
||||
YAHOO.util.Connect.asyncRequest(
|
||||
"POST",
|
||||
getContextPath() + '/ajax/invoke/MySpacesBean.deleteItem',
|
||||
{
|
||||
success: function(response)
|
||||
{
|
||||
if (response.responseText.indexOf("OK:") == 0)
|
||||
{
|
||||
MySpaces.refreshList();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Error during delete of item: " + response.responseText);
|
||||
}
|
||||
},
|
||||
failure: function(response)
|
||||
{
|
||||
alert("Error during delete of item: " + response.responseText);
|
||||
}
|
||||
},
|
||||
"noderef=" + noderef
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cancel button click handler for various pop-up panels
|
||||
*/
|
||||
closePopupPanel: function()
|
||||
{
|
||||
if (this.popupPanel != null)
|
||||
{
|
||||
this.popupPanel.setStyle("display", "none");
|
||||
this.popupPanel = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh the main data list contents within the spacePanel container
|
||||
*/
|
||||
|
Reference in New Issue
Block a user