mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
//
|
|
// Helper functions for launching WebDAV documents for editing
|
|
// Gavin Cornwell 30-11-2005
|
|
//
|
|
|
|
function openDoc(url)
|
|
{
|
|
var showDoc = true;
|
|
var agent = navigator.userAgent.toLowerCase();
|
|
|
|
// work out the context path from the pathname (this means we dont't
|
|
// have to rely on the context path being passed in an anyway)
|
|
var contextPath = window.location.pathname.substring(0, window.location.pathname.indexOf("/", 1));
|
|
var fullUrl = window.location.protocol + "//" + window.location.host + contextPath + url;
|
|
|
|
// if the link represents an Office document and we are in IE try and
|
|
// open the file directly to get WebDAV editing capabilities
|
|
if (agent.indexOf("msie") != -1)
|
|
{
|
|
if (fullUrl.indexOf(".doc") != -1 ||
|
|
fullUrl.indexOf(".dot") != -1 ||
|
|
fullUrl.indexOf(".xls") != -1 ||
|
|
fullUrl.indexOf(".ppt") != -1)
|
|
{
|
|
var wordDoc = new ActiveXObject("SharePoint.OpenDocuments.1");
|
|
if (wordDoc)
|
|
{
|
|
showDoc = false;
|
|
wordDoc.EditDocument(fullUrl);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (showDoc == true)
|
|
{
|
|
window.open(fullUrl, "_blank");
|
|
}
|
|
} |