Dialogo Modal di SharePoint 2013 Visio Web Access - Guida
-
29-09-2020 - |
Domanda
Sto cercando di trovare una soluzione o un modo migliore per farlo, fondamentalmente ho Visio Web Access WebPart nella pagina stessa, a causa del layout della pagina, viene visualizzato solo in piccolo modulo, abbiamo deciso di avere un pulsante per fare clic suE espanderlo in modalità completa, ho a conoscenza del fatto che l'utilizzo di VisioWebAccess.aspx basata per chiamare il file Visio ma non vogliamo mostrare il pulsante della barra degli strumenti.
Domande: C'è qualche queryString per VisiowebAccess.aspx che può essere utilizzato?Oppure esiste comunque per la finestra di dialogo SharePoint Modal per iniettare alcuni JavaScript?
Codice come tale:
// Hook into the AJAX Sys.Application.load event.
Sys.Application.add_load(onApplicationLoad)
// Define global variables.
var vwaControl;
var webPartElementID;
var drawingURL ;
var vwaPage;
// Capture a reference to the current session of the Visio Web Access Web Part.
function onApplicationLoad() {
try{
webPartElementID = getVWAWebPartID();
vwaControl= new Vwa.VwaControl(webPartElementID);
drawingURL = vwaControl.getDiagramUrl();
vwaPage = vwaControl.getActivePage();
}
catch(err){
console.log(err);
$("#btn_visioModal").hide();
}
}
// 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;
}
function openInDialog() {
try{
// Get the URL for the drawing currently displayed in the Visio Web Access Web Part.
drawingURL = vwaControl.getDiagramUrl();
// Setup option for the modal dialog
var options = {url: "http://sharepointportal/_layouts/15/VisioWebAccess/VisioWebAccess.aspx?id="
+ drawingURL,
width: 1280,
height: 768,
allowMaximize: false,
showClose: true};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}
catch(err){
console.log(err);
}
.
Grazie.
Soluzione
Sembra che io abbia trovato me stesso una soluzione: Invece di utilizzare la pagina VISIOWEBACCESS, creare una nuova pagina vuota con solo la visualizzazione di Visio Web, utilizzare il contenitore-fluid se il tuo sito di SharePoint ha bootstrap (quale ha), quando si chiama il passaggio modale nell'URL del file tramite querystring e nella pagina ModalIncludi questo CRPT:
function changeUrl(){
// Get the URL of the current file being displayed.
fileURL = GetQueryStringParams('fileURL');
var currDiagram = vwaControl.getDiagramUrl();
currDiagram = currDiagram.replace("%20", " ");
fileURL = decodeURI(fileURL);
console.log(vwaControl.getDiagramUrl());
console.log(fileURL);
// Replace the currently displayed Web Drawing with the other Web Drawing.
vwaControl.openDiagram(fileURL);
}
.