mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Doclist Webscript - main document list now separate ajax panel. New PortletActionsBean to perform server-side actions from portlets. DeleteItem moved out of MySpacesBean into PortletActionsBean. TemplateNode addition of downloadUrl method for non-inline document downloads.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6044 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,16 +17,23 @@
|
|||||||
<td width="300">
|
<td width="300">
|
||||||
<table width="100%" cellpadding="0" cellspacing="0">
|
<table width="100%" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="docAction docActionCheckout">Checkout</td>
|
<#if node.isLocked >
|
||||||
|
<td class="docAction docActionLocked">(Locked)</td>
|
||||||
|
<#elseif hasAspect(node, "cm:workingcopy") == 1>
|
||||||
|
<td class="docAction docActionCheckin" <#if node.hasPermission("CheckIn")>onclick='event.cancelBubble=true;MyDocs.checkinItem("${node.name}", "${node.nodeRef}");'</#if>>Check In</td>
|
||||||
|
<#else>
|
||||||
|
<td class="docAction docActionCheckout" <#if node.hasPermission("CheckOut")>onclick='event.cancelBubble=true;MyDocs.checkoutItem("${node.name}", "${node.nodeRef}");'</#if>>Check Out</td>
|
||||||
|
</#if>
|
||||||
<td class="docAction docActionEditDetails">Edit Details</td>
|
<td class="docAction docActionEditDetails">Edit Details</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="docAction docActionUpdate">Update</td>
|
<td class="docAction docActionUpdate">Update</td>
|
||||||
<td class="docAction docActionViewContent">View Content</td>
|
<td class="docAction docActionViewContent" onclick="window.open('${url.context}${node.downloadUrl}', '_blank');">View Content</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="docAction docActionDelete">Delete</td>
|
<td class="docAction docActionDelete" <#if node.hasPermission("Delete")>onclick='event.cancelBubble=true;MyDocs.deleteItem("${node.name}", "${node.nodeRef}");'</#if>>Delete</td>
|
||||||
<td class="docAction docActionMoreActions">More Actions...</td>
|
<#assign navurl='/navigate/showDocDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id>
|
||||||
|
<td class="docAction docActionMoreActions" onclick="window.open('${url.context}${navurl}', '_blank');">More Actions...</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -45,75 +45,36 @@
|
|||||||
<td height=40>
|
<td height=40>
|
||||||
<table border=0 cellspacing=8 cellpadding=0 width=100%>
|
<table border=0 cellspacing=8 cellpadding=0 width=100%>
|
||||||
<tr>
|
<tr>
|
||||||
<th><a class="docfilterLink <#if filter=0>docfilterLinkSelected</#if>" href="${scripturl("?f=0&p=${path?url}&q=${query?url}")}">All Items</a></th>
|
<th><a id="docFilter0" class="docfilterLink <#if filter=0>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(0); return false;">All Items</a></th>
|
||||||
<th><a class="docfilterLink <#if filter=1>docfilterLinkSelected</#if>" href="${scripturl("?f=1&p=${path?url}&q=${query?url}")}">Word Documents</a></th>
|
<th><a id="docFilter1" class="docfilterLink <#if filter=1>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(1); return false;">Word Documents</a></th>
|
||||||
<th><a class="docfilterLink <#if filter=2>docfilterLinkSelected</#if>" href="${scripturl("?f=2&p=${path?url}&q=${query?url}")}">HTML Documents</a></th>
|
<th><a id="docFilter2" class="docfilterLink <#if filter=2>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(2); return false;">HTML Documents</a></th>
|
||||||
<th><a class="docfilterLink <#if filter=3>docfilterLinkSelected</#if>" href="${scripturl("?f=3&p=${path?url}&q=${query?url}")}">PDF Documents</a></th>
|
<th><a id="docFilter3" class="docfilterLink <#if filter=3>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(3); return false;">PDF Documents</a></th>
|
||||||
<th><a class="docfilterLink <#if filter=4>docfilterLinkSelected</#if>" href="${scripturl("?f=4&p=${path?url}&q=${query?url}")}">Recently Modified</a></th>
|
<th><a id="docFilter4" class="docfilterLink <#if filter=4>docfilterLinkSelected</#if>" href="#" onclick="MyDocs.filter(4); return false;">Recently Modified</a></th>
|
||||||
<td align=right>
|
<td align=right>
|
||||||
<a href="${scripturl("?f=${filter}&p=${path?url}&q=${query?url}")}" class="refreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" style="vertical-align:-25%;padding-right:4px">Refresh</a>
|
<a href="#" onclick="MyDocs.start(); return false;" class="refreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" style="vertical-align:-25%;padding-right:4px">Refresh</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
|
<div id="docPanelOverlay"></div>
|
||||||
<div id="docPanel">
|
<div id="docPanel">
|
||||||
<#assign weekms=1000*60*60*24*7>
|
<#-- populated via an AJAX call to 'doclistpanel' webscript -->
|
||||||
<#assign count=0>
|
<#-- resolved path, filter and home.noderef required as arguments -->
|
||||||
<#if home?exists>
|
<script>
|
||||||
<#assign docs=home.children?sort_by('name')>
|
MyDocs.ServiceContext="${url.serviceContext}";
|
||||||
<#else>
|
MyDocs.Filter="${filter}";
|
||||||
<#assign docs=companyhome.childrenByLuceneSearch[args.q]?sort_by('name')>
|
MyDocs.Home="${home.nodeRef}";
|
||||||
</#if>
|
MyDocs.Query="${query?replace("\"","\\\"")}";
|
||||||
<#list docs as d>
|
</script>
|
||||||
<#if d.isDocument>
|
|
||||||
<#if (filter=0) ||
|
|
||||||
(filter=1 && d.mimetype="application/msword") ||
|
|
||||||
(filter=2 && d.mimetype="text/html") ||
|
|
||||||
(filter=3 && d.mimetype="application/pdf") ||
|
|
||||||
(filter=4 && (dateCompare(d.properties["cm:modified"],date,weekms) == 1 || dateCompare(d.properties["cm:created"], date, weekms) == 1))>
|
|
||||||
<#assign count=count+1>
|
|
||||||
<div class="docRow">
|
|
||||||
<div class="docIcon">
|
|
||||||
<a href="${url.context}${d.url}" target="new"><img class="docIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
|
|
||||||
</div>
|
|
||||||
<div style="display:none"><img class="docIconImage64" alt="" width="64" height="64" src="${url.context}${d.icon64}"></div>
|
|
||||||
<div class="docItem">
|
|
||||||
${d.name?html}
|
|
||||||
<span class="docInfo" onclick="event.cancelBubble=true; AlfNodeInfoMgr.toggle('${d.nodeRef}',this);">
|
|
||||||
<img src="${url.context}/images/icons/popup.gif" class="popupImage" width="16" height="16" />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="docDetail">
|
|
||||||
<table cellpadding="2" cellspacing="0" border="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span class="docMetaprop">Description:</span> <span class="docMetadata"><#if d.properties.description?exists>${d.properties.description?html}<#else> </#if></span><br />
|
|
||||||
<span class="docMetaprop">Modified:</span> <span class="docMetadata">${d.properties.modified?datetime}</span><br />
|
|
||||||
<span class="docMetaprop">Modified By:</span> <span class="docMetadata">${d.properties.modifier}</span>
|
|
||||||
</td>
|
|
||||||
<td width="24"> </td>
|
|
||||||
<td>
|
|
||||||
<span class="docMetaprop">Created:</span> <span class="docMetadata">${d.properties.created?datetime}</span><br />
|
|
||||||
<span class="docMetaprop">Created By:</span> <span class="docMetadata">${d.properties.creator}</span><br />
|
|
||||||
<span class="docMetaprop">Size:</span> <span class="docMetadata">${(d.size/1000)?string("0.##")} KB</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="docResource doclistAjaxWait" id="${d.nodeRef}"></div>
|
|
||||||
</div>
|
|
||||||
</#if>
|
|
||||||
</#if>
|
|
||||||
</#list>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="docFooter">
|
<div class="docFooter">
|
||||||
Showing ${count} items(s)
|
Showing <span id="docCount">0</span> items(s)
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -160,6 +121,18 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited
|
|||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#docPanelOverlay
|
||||||
|
{
|
||||||
|
background-color: #fff;
|
||||||
|
background-image: url(${url.context}/images/icons/ajax_anim.gif);
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
position: absolute;
|
||||||
|
height: 320px;
|
||||||
|
width: 716px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.docRow
|
.docRow
|
||||||
{
|
{
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
@@ -277,6 +250,21 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited
|
|||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.docActionCheckin
|
||||||
|
{
|
||||||
|
background-image: url(${url.context}/images/icons/doclist_action_checkin.png);
|
||||||
|
border-bottom: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docActionLocked
|
||||||
|
{
|
||||||
|
background-image: url(${url.context}/images/icons/doclist_action_locked.png);
|
||||||
|
border-bottom: none;
|
||||||
|
border-right: none;
|
||||||
|
cursor: default !important;
|
||||||
|
}
|
||||||
|
|
||||||
.docActionEditDetails
|
.docActionEditDetails
|
||||||
{
|
{
|
||||||
background-image: url(${url.context}/images/icons/doclist_action_edit.png);
|
background-image: url(${url.context}/images/icons/doclist_action_edit.png);
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
<webscript>
|
||||||
|
<shortname>Document List Panel</shortname>
|
||||||
|
<description>Generate the inner panel for the Document List portlet page</description>
|
||||||
|
<url>/doclistpanel?f={filter}&p={path}&h={home};q={query?}</url>
|
||||||
|
<authentication>user</authentication>
|
||||||
|
<transaction>required</transaction>
|
||||||
|
</webscript>
|
@@ -0,0 +1,53 @@
|
|||||||
|
<#assign weekms=1000*60*60*24*7>
|
||||||
|
<#assign count=0>
|
||||||
|
<#-- get the filter mode from the passed in args -->
|
||||||
|
<#-- filters: 0=all, 1=word, 2=html, 3=pdf, 4=recent -->
|
||||||
|
<#if args.f?exists && args.f?length!=0><#assign filter=args.f?number><#else><#assign filter=0></#if>
|
||||||
|
<#if args.h?exists>
|
||||||
|
<#assign docs=companyhome.nodeByReference[args.h].children?sort_by('name')>
|
||||||
|
<#else>
|
||||||
|
<#assign docs=companyhome.childrenByLuceneSearch[args.q]?sort_by('name')>
|
||||||
|
</#if>
|
||||||
|
<#list docs as d>
|
||||||
|
<#if d.isDocument>
|
||||||
|
<#if (filter=0) ||
|
||||||
|
(filter=1 && d.mimetype="application/msword") ||
|
||||||
|
(filter=2 && d.mimetype="text/html") ||
|
||||||
|
(filter=3 && d.mimetype="application/pdf") ||
|
||||||
|
(filter=4 && (dateCompare(d.properties["cm:modified"],date,weekms) == 1 || dateCompare(d.properties["cm:created"], date, weekms) == 1))>
|
||||||
|
<#assign count=count+1>
|
||||||
|
<div class="docRow">
|
||||||
|
<div class="docIcon">
|
||||||
|
<a href="${url.context}${d.url}" target="new"><img class="docIconImage" alt="" width="16" height="16" src="${url.context}${d.icon16?replace(".gif",".png")}" border=0></a>
|
||||||
|
</div>
|
||||||
|
<div style="display:none"><img class="docIconImage64" alt="" width="64" height="64" src="${url.context}${d.icon64}"></div>
|
||||||
|
<div class="docItem">
|
||||||
|
${d.name?html}
|
||||||
|
<span class="docInfo" onclick="event.cancelBubble=true; AlfNodeInfoMgr.toggle('${d.nodeRef}',this);">
|
||||||
|
<img src="${url.context}/images/icons/popup.gif" class="popupImage" width="16" height="16" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="docDetail">
|
||||||
|
<table cellpadding="2" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span class="docMetaprop">Description:</span> <span class="docMetadata"><#if d.properties.description?exists>${d.properties.description?html}<#else> </#if></span><br />
|
||||||
|
<span class="docMetaprop">Modified:</span> <span class="docMetadata">${d.properties.modified?datetime}</span><br />
|
||||||
|
<span class="docMetaprop">Modified By:</span> <span class="docMetadata">${d.properties.modifier}</span>
|
||||||
|
</td>
|
||||||
|
<td width="24"> </td>
|
||||||
|
<td>
|
||||||
|
<span class="docMetaprop">Created:</span> <span class="docMetadata">${d.properties.created?datetime}</span><br />
|
||||||
|
<span class="docMetaprop">Created By:</span> <span class="docMetadata">${d.properties.creator}</span><br />
|
||||||
|
<span class="docMetaprop">Size:</span> <span class="docMetadata">${(d.size/1000)?string("0.##")} KB</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="docResource doclistAjaxWait" id="${d.nodeRef}"></div>
|
||||||
|
</div>
|
||||||
|
</#if>
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
<#-- hidden div with the count value for the page -->
|
||||||
|
<div id="docCountValue" style="display:none">${count}</div>
|
@@ -81,7 +81,7 @@
|
|||||||
<th><a class="spacefilterLink <#if filter=3>spacefilterLinkSelected</#if>" href="${scripturl("?f=3&p=${path?url}")}">My Items</a></th>
|
<th><a class="spacefilterLink <#if filter=3>spacefilterLinkSelected</#if>" href="${scripturl("?f=3&p=${path?url}")}">My Items</a></th>
|
||||||
<th><a class="spacefilterLink <#if filter=4>spacefilterLinkSelected</#if>" href="${scripturl("?f=4&p=${path?url}")}">Recently Modified</a></th>
|
<th><a class="spacefilterLink <#if filter=4>spacefilterLinkSelected</#if>" href="${scripturl("?f=4&p=${path?url}")}">Recently Modified</a></th>
|
||||||
<td align=right>
|
<td align=right>
|
||||||
<a href="${scripturl("?f=${filter}&p=${path?url}")}" class="refreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" class="spaceImageIcon">Refresh</a>
|
<a href="#" onclick="MySpaces.start(); return false;" class="refreshViewLink"><img src="${url.context}/images/icons/reset.gif" border="0" width="16" height="16" class="spaceImageIcon">Refresh</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -160,6 +160,7 @@ a.spacefilterLinkSelected:link, a.spacefilterLinkSelected:visited
|
|||||||
|
|
||||||
#spacePanelOverlay
|
#spacePanelOverlay
|
||||||
{
|
{
|
||||||
|
background-color: #fff;
|
||||||
background-image: url(${url.context}/images/icons/ajax_anim.gif);
|
background-image: url(${url.context}/images/icons/ajax_anim.gif);
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
@@ -106,26 +106,4 @@ public class MySpacesBean
|
|||||||
out.write("ERROR: " + err.getMessage());
|
out.write("ERROR: " + err.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
131
source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java
Normal file
131
source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.bean.ajax;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.context.ResponseWriter;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.server.filesys.FileExistsException;
|
||||||
|
import org.alfresco.model.ApplicationModel;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
import org.alfresco.repo.version.VersionModel;
|
||||||
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.version.Version;
|
||||||
|
import org.alfresco.service.cmr.version.VersionType;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.web.app.servlet.BaseServlet;
|
||||||
|
import org.alfresco.web.app.servlet.ajax.InvokeCommand;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.bean.spaces.CreateSpaceWizard;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean backing the ajax requests from various Portlet webscripts.
|
||||||
|
*
|
||||||
|
* @author Mike Hatfield
|
||||||
|
*/
|
||||||
|
public class PortletActionsBean
|
||||||
|
{
|
||||||
|
private static Log logger = LogFactory.getLog(PortletActionsBean.class);
|
||||||
|
|
||||||
|
@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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||||
|
public void checkoutItem() 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).getCheckOutCheckInService().checkout(new NodeRef(strNodeRef));
|
||||||
|
out.write("OK: " + strNodeRef);
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
out.write("ERROR: " + err.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||||
|
public void checkinItem() 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
|
||||||
|
{
|
||||||
|
Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f);
|
||||||
|
props.put(Version.PROP_DESCRIPTION, "");
|
||||||
|
props.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
|
||||||
|
Repository.getServiceRegistry(fc).getCheckOutCheckInService().checkin(new NodeRef(strNodeRef), props);
|
||||||
|
out.write("OK: " + strNodeRef);
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
out.write("ERROR: " + err.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3851,6 +3851,15 @@
|
|||||||
<managed-bean-scope>request</managed-bean-scope>
|
<managed-bean-scope>request</managed-bean-scope>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
|
<managed-bean>
|
||||||
|
<description>
|
||||||
|
Bean backing the ajax requests from various Portlet webscripts
|
||||||
|
</description>
|
||||||
|
<managed-bean-name>PortletActionsBean</managed-bean-name>
|
||||||
|
<managed-bean-class>org.alfresco.web.bean.ajax.PortletActionsBean</managed-bean-class>
|
||||||
|
<managed-bean-scope>request</managed-bean-scope>
|
||||||
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>
|
<description>
|
||||||
Bean that returns manages the tree data for the navigator component
|
Bean that returns manages the tree data for the navigator component
|
||||||
|
@@ -104,7 +104,7 @@ input.button {
|
|||||||
clear: both;
|
clear: both;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
float: left;
|
float: left;
|
||||||
padding: 6px 0px 2px 4px;
|
padding: 6px 2px 2px 4px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
width: 282px;
|
width: 282px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
BIN
source/web/images/icons/doclist_action_checkin.png
Normal file
BIN
source/web/images/icons/doclist_action_checkin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
source/web/images/icons/doclist_action_locked.png
Normal file
BIN
source/web/images/icons/doclist_action_locked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@@ -5,15 +5,56 @@ var MyDocs = {
|
|||||||
DETAIL_MARGIN: 56,
|
DETAIL_MARGIN: 56,
|
||||||
TITLE_FONT_SIZE: 18,
|
TITLE_FONT_SIZE: 18,
|
||||||
RESOURCE_PANEL_HEIGHT: 150,
|
RESOURCE_PANEL_HEIGHT: 150,
|
||||||
|
ServiceContext: null,
|
||||||
|
Filter: null,
|
||||||
|
Home: null,
|
||||||
|
Query: null,
|
||||||
|
|
||||||
start: function()
|
start: function()
|
||||||
{
|
{
|
||||||
if ($('docPanel'))
|
if ($('docPanel'))
|
||||||
{
|
{
|
||||||
MyDocs.parseDocPanels();
|
// show AJAX loading overlay
|
||||||
$('docPanel').setStyle('visibility', 'visible');
|
$('docPanelOverlay').setStyle('visibility', 'visible');
|
||||||
|
$('docPanel').setStyle('visibility', 'hidden');
|
||||||
|
// fire off the ajax request to populate the doc list - the 'doclistpanel' webscript
|
||||||
|
// is responsible for rendering just the contents of the main panel div
|
||||||
|
YAHOO.util.Connect.asyncRequest(
|
||||||
|
"GET",
|
||||||
|
MyDocs.ServiceContext + '/doclistpanel?f='+MyDocs.Filter+'&h='+MyDocs.Home+'&q='+MyDocs.Query,
|
||||||
|
{
|
||||||
|
success: function(response)
|
||||||
|
{
|
||||||
|
// push the response into the doc panel div
|
||||||
|
$('docPanel').setHTML(response.responseText);
|
||||||
|
|
||||||
|
// extract the count value from a hidden div and display it
|
||||||
|
$('docCount').setHTML($('docCountValue').innerHTML);
|
||||||
|
|
||||||
|
// wire up all the events and animations
|
||||||
|
MyDocs.init();
|
||||||
|
},
|
||||||
|
failure: function(response)
|
||||||
|
{
|
||||||
|
// display the error
|
||||||
|
$('docPanel').setHTML("Sorry, data currently unavailable.");
|
||||||
|
|
||||||
|
// hide the ajax wait panel and show the main doc panel
|
||||||
|
$('docPanelOverlay').setStyle('visibility', 'hidden');
|
||||||
|
$('docPanel').setStyle('visibility', 'visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
init: function()
|
||||||
|
{
|
||||||
|
MyDocs.parseDocPanels();
|
||||||
|
// hide the ajax wait panel and show the main doc panel
|
||||||
|
$('docPanel').setStyle('visibility', 'visible');
|
||||||
|
$('docPanelOverlay').setStyle('visibility', 'hidden');
|
||||||
|
},
|
||||||
|
|
||||||
parseDocPanels: function()
|
parseDocPanels: function()
|
||||||
{
|
{
|
||||||
@@ -404,6 +445,119 @@ var MyDocs = {
|
|||||||
fxInfo.start(animInfo);
|
fxInfo.start(animInfo);
|
||||||
fxImage.start(animImage);
|
fxImage.start(animImage);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the view filter
|
||||||
|
*/
|
||||||
|
filter: function(filter)
|
||||||
|
{
|
||||||
|
$$('.docfilterLink').each(function(filterLink, i)
|
||||||
|
{
|
||||||
|
if (i == filter)
|
||||||
|
{
|
||||||
|
filterLink.addClass("docfilterLinkSelected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filterLink.removeClass("docfilterLinkSelected");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
MyDocs.Filter = filter;
|
||||||
|
MyDocs.start();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a document item
|
||||||
|
*/
|
||||||
|
deleteItem: function(name, noderef)
|
||||||
|
{
|
||||||
|
if (confirm("Are you sure you want to delete: " + name))
|
||||||
|
{
|
||||||
|
// ajax call to delete item
|
||||||
|
YAHOO.util.Connect.asyncRequest(
|
||||||
|
"POST",
|
||||||
|
getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem',
|
||||||
|
{
|
||||||
|
success: function(response)
|
||||||
|
{
|
||||||
|
if (response.responseText.indexOf("OK:") == 0)
|
||||||
|
{
|
||||||
|
MyDocs.start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("Error during delete of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function(response)
|
||||||
|
{
|
||||||
|
alert("Error during delete of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"noderef=" + noderef
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Out a document item
|
||||||
|
*/
|
||||||
|
checkoutItem: function(name, noderef)
|
||||||
|
{
|
||||||
|
// ajax call to delete item
|
||||||
|
YAHOO.util.Connect.asyncRequest(
|
||||||
|
"POST",
|
||||||
|
getContextPath() + '/ajax/invoke/PortletActionsBean.checkoutItem',
|
||||||
|
{
|
||||||
|
success: function(response)
|
||||||
|
{
|
||||||
|
if (response.responseText.indexOf("OK:") == 0)
|
||||||
|
{
|
||||||
|
MyDocs.start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("Error during check out of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function(response)
|
||||||
|
{
|
||||||
|
alert("Error during check out of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"noderef=" + noderef
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check In a document item
|
||||||
|
*/
|
||||||
|
checkinItem: function(name, noderef)
|
||||||
|
{
|
||||||
|
// ajax call to delete item
|
||||||
|
YAHOO.util.Connect.asyncRequest(
|
||||||
|
"POST",
|
||||||
|
getContextPath() + '/ajax/invoke/PortletActionsBean.checkinItem',
|
||||||
|
{
|
||||||
|
success: function(response)
|
||||||
|
{
|
||||||
|
if (response.responseText.indexOf("OK:") == 0)
|
||||||
|
{
|
||||||
|
MyDocs.start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("Error during check in of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function(response)
|
||||||
|
{
|
||||||
|
alert("Error during check in of item: " + response.responseText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"noderef=" + noderef
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -17,6 +17,9 @@ var MySpaces = {
|
|||||||
{
|
{
|
||||||
if ($('spacePanel'))
|
if ($('spacePanel'))
|
||||||
{
|
{
|
||||||
|
// show AJAX loading overlay
|
||||||
|
$('spacePanelOverlay').setStyle('visibility', 'visible');
|
||||||
|
$('spacePanel').setStyle('visibility', 'hidden');
|
||||||
// fire off the ajax request to populate the spaces list - the 'myspacespanel' webscript
|
// fire off the ajax request to populate the spaces list - the 'myspacespanel' webscript
|
||||||
// is responsible for rendering just the contents of the main panel div
|
// is responsible for rendering just the contents of the main panel div
|
||||||
YAHOO.util.Connect.asyncRequest(
|
YAHOO.util.Connect.asyncRequest(
|
||||||
@@ -613,10 +616,10 @@ var MySpaces = {
|
|||||||
{
|
{
|
||||||
if (confirm("Are you sure you want to delete: " + name))
|
if (confirm("Are you sure you want to delete: " + name))
|
||||||
{
|
{
|
||||||
// ajax call to create space
|
// ajax call to delete item
|
||||||
YAHOO.util.Connect.asyncRequest(
|
YAHOO.util.Connect.asyncRequest(
|
||||||
"POST",
|
"POST",
|
||||||
getContextPath() + '/ajax/invoke/MySpacesBean.deleteItem',
|
getContextPath() + '/ajax/invoke/PortletActionsBean.deleteItem',
|
||||||
{
|
{
|
||||||
success: function(response)
|
success: function(response)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user