mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4570 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
56 lines
1.1 KiB
JavaScript
56 lines
1.1 KiB
JavaScript
//
|
|
// Alfresco AJAX support library
|
|
// Gavin Cornwell 14-07-2006
|
|
//
|
|
|
|
var _alfContextPath = null;
|
|
|
|
/**
|
|
* Default handler for errors when using the dojo toolkit
|
|
*/
|
|
function handleErrorDojo(type, errObj)
|
|
{
|
|
// remove the dojo prefix from the message
|
|
var errorStart = "XMLHttpTransport Error: 500 ";
|
|
var msg = errObj.message;
|
|
|
|
if (msg.indexOf(errorStart) != -1)
|
|
{
|
|
msg = msg.substring(errorStart.length);
|
|
}
|
|
|
|
// TODO: Show a nicer error page, an alert will do for now!
|
|
alert(msg);
|
|
}
|
|
|
|
/**
|
|
* Default handler for errors when using the yahoo toolkit
|
|
*/
|
|
function handleErrorYahoo(msg)
|
|
{
|
|
// TODO: Show a nicer error page, an alert will do for now!
|
|
alert(msg);
|
|
}
|
|
|
|
/**
|
|
* Calculates and returns the context path for the current page
|
|
*/
|
|
function getContextPath()
|
|
{
|
|
if (_alfContextPath == null)
|
|
{
|
|
var path = window.location.pathname;
|
|
var idx = path.indexOf("/", 1);
|
|
if (idx != -1)
|
|
{
|
|
_alfContextPath = path.substring(0, idx);
|
|
}
|
|
else
|
|
{
|
|
_alfContextPath = "";
|
|
}
|
|
}
|
|
|
|
return _alfContextPath;
|
|
}
|