O Sharepoint 2013 do Visio Web Access de diálogo modal - Ajuda
-
29-09-2020 - |
Pergunta
Eu estou tentando encontrar uma solução ou uma melhor forma de o fazer é, basicamente, eu tenho Web part do Visio Web Access na página em si, devido ao layout da página é só apresentar em formato pequeno, decidimos ter um botão para clicar em e expandi-lo em modo de ecrã inteiro, estou ciente de que a utilização da base de VisioWebAccess.aspx, para chamar o arquivo do visio, mas nós não quer que o botão de barra de ferramentas para mostrado.
Perguntas:Existe alguma querystring para o VisioWebAccess.aspx que pode ser o uso?Ou existe uma maneira para sharepoint diálogo modal para injetar um pouco de javascript?
Código assim:
// 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);
}
Obrigado.
Solução
Parece que eu encontrei uma solução:Em vez de usar VisioWebAccess página, crie uma nova página em branco com apenas o Visio Web Part, use recipiente de fluido se o seu site do sharepoint têm bootstrap (que mina), ao chamar o modal passar a url do arquivo via querystring e no modal página incluir este scrpt:
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);
}