<script language="javascript">
// Add a button to display or dismiss the custom message.
document.write("<input type='button' value='Show Message' onclick='onDiagramComplete()' />");
// Hook into the AJAX Sys.Application.load event.
Sys.Application.add_load(onApplicationLoad)
// Declare global variables.
var vwaControl;
var vwaPage;
var vwaShapes;
// Capture a reference to the current session of the Visio Web Access Web Part.
function onApplicationLoad() {
try{
vwaControl= new Vwa.VwaControl(getVWAWebPartID());
vwaControl.addHandler("diagramcomplete", onDiagramComplete);
}
catch(err){
alert(err);
}
}
// Search SharePoint page to get WebPartID# for Visio Web Access Web Part.
function getVWAWebPartID() {
// Get a NodesList of all the div tags on the page.
var divArray = document.getElementsByTagName("div");
var webPartElementID;
// Iterate through the NodesList to get the node with the class attribute "VisioWebAccess."
for (var i = 0; i < divArray.length; i++) {
var node = divArray[i];
// Return the first instance of the Visio Web Access Web Part.
if (node.className == "VisioWebAccess") {
webPartElementID = node.parentNode.parentNode.id;
break;
}
}
return webPartElementID;
}
// Capture references to global variables and display message in the Web Part after rendering is complete.
function onDiagramComplete() {
try{
var vwaPage = vwaControl.getActivePage();
var vwaPageName = vwaPage.getId();
alert(vwaPageName);
}
catch(err){
alert(err);
}
}
</script>
No comments:
Post a Comment