SharePointCommunity
Die deutschsprachige Community für SharePoint, Microsoft 365, Teams, Yammer und mit Azure

Sponsored by

Willkommen im Forum Archiv.
Einträge sind hier nicht mehr möglich, aber der Bestand von 12 Jahren SharePoint-Wissen ist hier recherchierbar.




Visio Web-Part öffnet Link nicht im selben Fenster

Unbeantwortet Dieser Beitrag hat 0 Antworten

Ohne Rang
1 Beiträge
Pd000 erstellt 12 Juni 2015 13:15
SchlechtSchlechtIn OrdnungIn OrdnungDurchschnittDurchschnittGutGutSehr gutSehr gut

Hi Folks

Wenn ich in SP2013 im Visio Web-Part auf ein in der vdw-Datei verlinktes Shape klicke, soll es ein anderes vdw öffnen - und das innerhalb des selben Web-Parts. Zur Zeit öffnet es mir eine komplett neue Seite.

Ich habe in Visio den Parameter "neue Webseite öffnen" auf FALSE gestellt, doch ohne jede Wirkung. Ich habe zudem ein JavaScipt ausprobiert (s.u), das ich auf der Visio Web-Part-Website in einen Content Web-Part eingebunden habe und das leider ebenfalls nicht funktioniert hat.

Hat irgendjemand eine Idee?

Danke für Eure Unterstützung!

 

Hier der Code:

<script type="text/javascript"> 
var vwaControl;
var vwaPage;
var vwaPages;
var vwaShapes;
var currentlyAnnotatedShape; 

// Add a handler to the AJAX Sys.Application.load event.
Sys.Application.add_load(onApplicationLoad)

// 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 the SharePoint page to get the WebPartID# for the 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 add handler functions to events.
function onDiagramComplete(){
    try{
        vwaPage = vwaControl.getActivePage();
        vwaShapes = vwaPage.getShapes();
        vwaControl.addHandler("shapeselectionchanged", onShapeSelectionChanged);
    }
    catch(err){
        alert(err);
    }
}

// Open the link in a new window
function onShapeSelectionChanged(source, args){
    try{
        // Ignore the shapeselectionchanged event raised when the selection is cleared.
        if (args != null && args != Sys.EventArgs.Empty){

            var displayMode = vwaControl.getDisplayMode();

            currentlyAnnotatedShape = vwaShapes.getItemById(args);

            var shapeLinks = currentlyAnnotatedShape.getHyperlinks();

            if (shapeLinks.length > 0) {

        link = shapeLinks[0].value;

        // Check if the link is internal
        if(link.indexOf("vdw://") === -1)
        {
            location.href = link;
        }
        else
        {
            var pageLinkName = link.substring(6, link.length -2)

            if(pageLinkName)
            {
                vwaControl.setActivePage(pageLinkName)
            }
        }
            }

        }
    }
    catch(err){
        alert(err);
    }
}
</script>