mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- More AJAX support (couple of bug fixes, added timing for AJAX calls, added support for adding AJAX scripts to a page once and once only)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3352 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
73
source/web/scripts/ajax/node-info.js
Normal file
73
source/web/scripts/ajax/node-info.js
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Supporting JavaScript for the NodeInfo component
|
||||
// Gavin Cornwell 17-07-2006
|
||||
//
|
||||
|
||||
var _launchElement = null;
|
||||
var _popupElement = null;
|
||||
|
||||
/**
|
||||
* Makes the AJAX request back to the server to get the node info.
|
||||
*
|
||||
* @param nodeRef The node reference to get information for
|
||||
* @param launchElement The element that requested the summary panel
|
||||
*/
|
||||
function showNodeInfo(nodeRef, launchElement)
|
||||
{
|
||||
_launchElement = launchElement;
|
||||
|
||||
dojo.io.bind({
|
||||
method: 'post',
|
||||
url: WEBAPP_CONTEXT + '/ajax/invoke/NodeInfoBean.sendNodeInfo',
|
||||
content: { noderef: nodeRef },
|
||||
load: showNodeInfoHandler,
|
||||
error: handleErrorDojo,
|
||||
mimetype: 'text/html'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fades in the summary panel containing the node information.
|
||||
* This function is called back via the dojo bind call above.
|
||||
*/
|
||||
function showNodeInfoHandler(type, data, evt)
|
||||
{
|
||||
// create a 'div' to hold the summary table
|
||||
var div = document.createElement("div");
|
||||
|
||||
// get the position of the element we are showing info for
|
||||
var pos = dojo.style.getAbsolutePosition(_launchElement, false);
|
||||
|
||||
// setup the div with the correct appearance
|
||||
div.innerHTML = data;
|
||||
div.setAttribute("class", "summaryPopupPanel");
|
||||
// NOTE: use className for IE
|
||||
div.setAttribute("className", "summaryPopupPanel");
|
||||
div.style.position = "absolute";
|
||||
div.style.left = pos[0];
|
||||
div.style.top = pos[1] + 16;
|
||||
div.style.zIndex = 99;
|
||||
|
||||
// is there a better way of doing this, dojo.dom.insertBefore??
|
||||
var body = document.getElementsByTagName("body")[0];
|
||||
dojo.style.setOpacity(div, 0);
|
||||
_popupElement = div;
|
||||
body.appendChild(div);
|
||||
|
||||
dojo.lfx.html.fadeIn(div, 300).play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fades out the summary panel with the node info
|
||||
* and then removes it from the DOM
|
||||
*/
|
||||
function hideNodeInfo()
|
||||
{
|
||||
// remove the node from the DOM and reset variables
|
||||
dojo.lfx.html.fadeOut(_popupElement, 300, dojo.lfx.easeOut, function(nodes)
|
||||
{
|
||||
dojo.lang.forEach(nodes, dojo.dom.removeNode);
|
||||
_popupElement = null;
|
||||
_launchElement = null;
|
||||
}).play();
|
||||
}
|
Reference in New Issue
Block a user