Merged V2.2 to HEAD

8041: Merged V2.1 to V2.2
      7736: Fix for broken "make versionable" action after webdav fixes
      7755: Fix AR-1962: File is not truncated when opened for overwrite when using the older CIFS open file request
      7971: Fix for AR-1964 (IE7 character encoding)
      7973: Fixes transient submit failures when submitting deleted directories with no ancestors
      7989: ACT-858: AVM Issuer
      7994: WebDav document url now available in Template/Script APIs as per AR-1917
      8002: AR-1978: Added support for SPNEGO to the CIFS passthru authenticator


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8462 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-07 12:40:18 +00:00
parent 5e890e6656
commit c6c115b627
4 changed files with 116 additions and 13 deletions

View File

@@ -24,8 +24,6 @@
*/
package org.alfresco.repo.jscript;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -53,7 +51,6 @@ import org.alfresco.service.cmr.model.FileNotFoundException;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
@@ -81,7 +78,6 @@ import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.UniqueTag;
import org.mozilla.javascript.Wrapper;
import org.springframework.util.FileCopyUtils;
/**
* Node class implementation, specific for use by ScriptService as part of the object model.
@@ -834,6 +830,40 @@ public class ScriptNode implements Serializable, Scopeable
}
}
public String jsGet_downloadUrl()
{
return getDownloadUrl();
}
/**
* @return The WebDav cm:name based path to the content for the default content property
* (@see ContentModel.PROP_CONTENT)
*/
public String getWebdavUrl()
{
try
{
List<FileInfo> paths = this.services.getFileFolderService().getNamePath(null, getNodeRef());
// build up the webdav url
StringBuilder path = new StringBuilder(128);
path.append("/webdav");
// build up the path skipping the first path as it is the root folder
for (int i=1; i<paths.size(); i++)
{
path.append("/")
.append(URLEncoder.encode(paths.get(i).getName()));
}
return path.toString();
}
catch (FileNotFoundException nodeErr)
{
// cannot build path if file no longer exists
return "";
}
}
/**
* @return The mimetype encoding for content attached to the node from the default content property
* (@see ContentModel.PROP_CONTENT)