mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
15897: Merged V3.1 to V3.2 14485: (RECORD ONLY) ETHREEOH-1937 14915: (RECORD ONLY) Fix for ETHREEOH-2011: chaining-authentication-context.xml.sample 14954: (RECORD ONLY) Fix merge error 14966: (RECORD ONLY) Merged V2.2 to V3.1 14131: *RECORD ONLY* 14605: Merged HEAD to V2.2 (workaround for ETWOTWO-1137) 14368: Fix for ETHREEOH-1936 14607: Fixed NPE in TextMiningContentTransformer: Lead-up to fix for ETWOTWO-1174 14992: (RECORD ONLY) Updated svn:mergeinfo for V2.1-A 15080: Applied suggested fix for ETHREEOH-2252: Emailed content created in wrong space 15131: Merged V2.1-A to V3.1 (ETHREEOH-2270) 13465: Fix for ADB-161 ACT 7870 - added 'xsd' to mimetype map. 15134: Merged V2.2 to V3.1 14332: (RECORD-ONLY) 14717: (RECORD-ONLY) 14745: (RECORD-ONLY) 14746: Fixed error relating to detection and clean-up of duplicate child associations 14759: Missed check-in: Set transactionService for post-transaction duplicate child assoc cleanup 14761: (RECORD-ONLY) 14885: (RECORD-ONLY) 14893: (RECORD-ONLY) 14903: (RECORD-ONLY) 15204: Fixed ETHREEOH-2303: FixNameCrcValuesPatch throws ConstraintViolationException during upgrade ... 15214: Fixed ETHREEOH-1861: Offline synchronization updates file content without any changes 15271: Applied patch fix: Imported users don't conform to case-sensitivity switch 15352: ETHREEOH-2322 15361: ETHREEOH-1112 15369: ETHREEOH-2448 15419: ETHREEOH-2479 15431: ETHREEOH-2520 and ETHREEOH-2521 15587: (RECORD ONLY) Moved Enterprise-only scripts to correct location 15616: Fix ETHREEOH-2581 - WCM layered folder - can't submit deleted file 15675: WCM fixes (ETHREEOH-2110 & ETHREEOH-2645) 15836: Check for null username in ContentUsage service getUserUsage() method 15840: (RECORD ONLY) Merged V3.2 to V3.1 14760: Fix for ALFCOM-586 - trims and ignores leading/trailing whitespace before validation in JSF client forms. 15841: Fixes for ETHREEOH-2702 and ETHREEOH-2687 15860: (RECORD ONLY) Added Oracle and MS SQL Server config 15891: Removed unused compiler directive ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/DEV/BELARUS/ETHREEOH-2221:r14753 Merged /alfresco/BRANCHES/V2.1-A: lots Merged /alfresco/BRANCHES/V2.2:r14131,14332,14605,14607,14717,14745-14746,14759,14761,14885,14893,14903 Merged /alfresco/BRANCHES/V3.1:r14485,14915,14954,14966,14992,15080,15131,15134,15204,15214,15271,15352,15361,15369,15419,15431,15587,15616,15675,15818,15836,15840-15841,15860,15891 Merged /alfresco/BRANCHES/V3.2:r15897 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16886 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
292 lines
8.2 KiB
JavaScript
292 lines
8.2 KiB
JavaScript
/*
|
|
* Prerequisites: mootools.v1.11.js
|
|
*/
|
|
var OfficeAddin =
|
|
{
|
|
ANIM_LENGTH: 500,
|
|
STATUS_FADE: 10000,
|
|
LIST_DEF_HEIGHT: 204,
|
|
|
|
defaultQuery: "",
|
|
|
|
init: function()
|
|
{
|
|
window.queryObject = OfficeAddin.toQueryObject(document.location.search);
|
|
window.contextPath = OfficeAddin.getContextPath();
|
|
window.serviceContextPath = OfficeAddin.getServiceContextPath();
|
|
|
|
/* Update needed after page load? */
|
|
if(this.queryObject.st)
|
|
{
|
|
var objResponse = Json.evaluate(this.queryObject.st),
|
|
imgSuccess = (objResponse.statusCode ? "action_successful.gif" : "action_failed.gif"),
|
|
colBackground = (objResponse.statusCode ? "#50ff50" : "#ff5050");
|
|
OfficeAddin.showStatusText(objResponse.statusString, imgSuccess, true, colBackground);
|
|
}
|
|
|
|
OfficeAddin.makeExternalLinks();
|
|
},
|
|
|
|
makeExternalLinks: function(e)
|
|
{
|
|
$$('a').each(function(anchor, i)
|
|
{
|
|
if (anchor.getProperty('rel') == '_blank')
|
|
{
|
|
anchor.target = "_blank";
|
|
}
|
|
});
|
|
},
|
|
|
|
toQueryObject: function(s)
|
|
{
|
|
var obj = {};
|
|
$A(s.substring(1).split('&')).each(function(param)
|
|
{
|
|
param = decodeURIComponent(param).split("=");
|
|
obj[param[0]] = param[1];
|
|
});
|
|
return obj;
|
|
},
|
|
|
|
showStatusText: function(statusText, statusImage, fadeOut, colBackground)
|
|
{
|
|
var e = $("statusText");
|
|
if (statusImage)
|
|
{
|
|
statusText = "<img src=\"../../images/office/" + statusImage + "\" alt=\"*\" style=\"padding-right: 8px;\" align=\"top\" />" + statusText;
|
|
}
|
|
e.innerHTML = statusText;
|
|
e.setStyle("opacity", "1");
|
|
if (statusText === "")
|
|
{
|
|
e.setStyle("border-top", "");
|
|
}
|
|
else
|
|
{
|
|
e.setStyle("border-top", "1px dashed #808080");
|
|
var fx = new Fx.Style(e, 'background-color',
|
|
{
|
|
duration: OfficeAddin.ANIM_LENGTH,
|
|
transition: Fx.Transitions.linear
|
|
});
|
|
if (fadeOut)
|
|
{
|
|
fx.onComplete = function()
|
|
{
|
|
OfficeAddin.hideStatusText.delay(OfficeAddin.STATUS_FADE);
|
|
};
|
|
}
|
|
var fxBackground = (typeof colBackground == "undefined") ? "#ffffcc" : colBackground;
|
|
fx.start(fxBackground, "#ffffff");
|
|
}
|
|
},
|
|
|
|
hideStatusText: function()
|
|
{
|
|
var e = $("statusText");
|
|
e.setStyle("opacity", "1");
|
|
var fx = new Fx.Style(e, 'opacity',
|
|
{
|
|
duration: OfficeAddin.ANIM_LENGTH
|
|
}).start('1', '0');
|
|
},
|
|
|
|
/* AJAX call to perform server-side actions */
|
|
getAction: function(useTemplate, action, nodeId, confirmMsg, inParams, outParams)
|
|
{
|
|
return OfficeAddin.runAction("get", useTemplate, action, nodeId, confirmMsg, inParams, outParams);
|
|
},
|
|
postAction: function(useTemplate, action, nodeId, confirmMsg, inParams, outParams)
|
|
{
|
|
return OfficeAddin.runAction("post", useTemplate, action, nodeId, confirmMsg, inParams, outParams);
|
|
},
|
|
runAction: function(httpMethod, useTemplate, action, nodeId, confirmMsg, inParams, outParams)
|
|
{
|
|
if ((confirmMsg !== null) && (confirmMsg !== ""))
|
|
{
|
|
if (!window.confirm(confirmMsg))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
OfficeAddin.showStatusText("Running action...", "ajax_anim.gif", false);
|
|
var actionURL = useTemplate + "?a=" + action + "&n=" + nodeId;
|
|
if ((inParams !== null) && (inParams !== ""))
|
|
{
|
|
actionURL += "&" + inParams;
|
|
}
|
|
var myAjax = new Ajax(actionURL,
|
|
{
|
|
method: httpMethod,
|
|
headers: {'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT'},
|
|
onComplete: function(textResponse, xmlResponse)
|
|
{
|
|
// Remove any trailing hash
|
|
var href = window.location.href.replace("#", "");
|
|
// Remove any previous "st" parameters
|
|
href = OfficeAddin.removeParameters(href, "st|version");
|
|
// Optionally add a status string
|
|
if (textResponse !== "")
|
|
{
|
|
href += (href.indexOf("?") == -1) ? "?" : "&";
|
|
href += "st=" + encodeURIComponent(textResponse);
|
|
if ((outParams !== null) && (outParams !== ""))
|
|
{
|
|
href += "&" + outParams;
|
|
}
|
|
}
|
|
window.location.href = href;
|
|
}
|
|
}).request();
|
|
},
|
|
|
|
/* Calculates and returns the context path for the current page */
|
|
getContextPath: function()
|
|
{
|
|
var path = window.location.pathname,
|
|
idx = path.indexOf("/", 1),
|
|
contextPath = "";
|
|
if (idx != -1)
|
|
{
|
|
contextPath = path.substring(0, idx);
|
|
}
|
|
else
|
|
{
|
|
contextPath = "";
|
|
}
|
|
|
|
return contextPath;
|
|
},
|
|
|
|
/* Calculates and returns the service context path for the current page */
|
|
getServiceContextPath: function()
|
|
{
|
|
var path = window.location.pathname,
|
|
idx = path.indexOf("/", 1),
|
|
serviceContextPath = "";
|
|
if (idx != -1)
|
|
{
|
|
serviceContextPath = path.substring(0, idx);
|
|
path = path.substring(idx);
|
|
idx = path.indexOf("/", 1);
|
|
|
|
if (idx != -1)
|
|
{
|
|
serviceContextPath += path.substring(0, idx);
|
|
}
|
|
}
|
|
|
|
return serviceContextPath;
|
|
},
|
|
|
|
/* Removes params "param1|param2...|paramN" from a URL */
|
|
removeParameters: function(theUrl, theParams)
|
|
{
|
|
var regexp = new RegExp("[?&](" + theParams + ")=([^&$]+)", "g"),
|
|
url = theUrl.replace(regexp, "");
|
|
|
|
// Check that an href still contains a "?" after removing parameters
|
|
var pos = url.indexOf("?");
|
|
if (pos == -1)
|
|
{
|
|
// None found - do we have an "&" ?
|
|
pos = url.indexOf("&");
|
|
if (pos != -1)
|
|
{
|
|
// Yes - so replace the first one with a "?"
|
|
url = url.substring(0, pos) + "?" + url.substring(pos+1);
|
|
}
|
|
}
|
|
return url;
|
|
},
|
|
|
|
sortTasks: function(taskContainer)
|
|
{
|
|
var taskArray = [];
|
|
taskContainer.getElementsBySelector('.taskItem').each(function(task, i)
|
|
{
|
|
taskArray[i] = {dueDate: task.getProperty('rel'), theTask: task.clone()};
|
|
});
|
|
|
|
taskArray.sort(OfficeAddin.sortByDueDate);
|
|
taskContainer.empty();
|
|
|
|
for(var i = 0; i < taskArray.length; i++)
|
|
{
|
|
taskArray[i].theTask.addClass((i % 2 === 0) ? "odd" : "even");
|
|
taskArray[i].theTask.injectInside(taskContainer);
|
|
}
|
|
},
|
|
|
|
sortByDueDate: function(a, b)
|
|
{
|
|
var x = a.dueDate,
|
|
y = b.dueDate;
|
|
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
|
},
|
|
|
|
openWindowCallback: function(url, callback)
|
|
{
|
|
// Store the callback function for later
|
|
OfficeAddin.callbackFunction = callback;
|
|
// Register our "well known" callback function
|
|
window.alfrescoCallback = OfficeAddin.openWindowOnCallback;
|
|
// Use a named window so that only one dialog is active at a time
|
|
window.open(url, 'alfrescoDialog', 'width=1024,height=768,scrollbars=yes');
|
|
},
|
|
|
|
openWindowOnCallback: function(fromTimeout)
|
|
{
|
|
if (typeof(fromTimeout)=='undefined')
|
|
{
|
|
window.setTimeout("OfficeAddin.openWindowOnCallback(true)", 10);
|
|
}
|
|
else
|
|
{
|
|
// Clear out the global callback function
|
|
window.alfrescoCallback = null;
|
|
try
|
|
{
|
|
OfficeAddin.callbackFunction();
|
|
}
|
|
catch (e)
|
|
{
|
|
}
|
|
OfficeAddin.callbackFunction = null;
|
|
}
|
|
}
|
|
};
|
|
|
|
function htmlWordWrap(elementId, lineWidth, sentence)
|
|
{
|
|
if(!elementId || (elementId.length < 1) || !sentence || (sentence.length < 1) || (lineWidth <= 0))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var result = "";
|
|
var i = 0;
|
|
|
|
for(; (sentence.length - i) >= lineWidth; i += lineWidth)
|
|
{
|
|
result += sentence.substr(i, lineWidth) + "<br />";
|
|
}
|
|
if((sentence.length - i) > 0)
|
|
{
|
|
result += sentence.substr(i, (sentence.length - i));
|
|
}
|
|
else
|
|
{
|
|
result = result.substr(0, (result.length - 6));
|
|
}
|
|
var nameElement = document.getElementById(elementId);
|
|
if(undefined != nameElement)
|
|
{
|
|
nameElement.innerHTML = result;
|
|
}
|
|
}
|
|
|
|
window.addEvent('domready', OfficeAddin.init);
|