<html>
<body>
<div style="width:9%; height:80%;">
<div id="dossierContainer" style ="width:50%; height:50%;"></div>
</div>
</body>
<script <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="https://demo.microstrategy.com/MicroStrategyLibrary/javascript/embeddinglib.js"></script>
<script type="text/javascript">
/* These are the parameters necessary for connecting to the Dossier ----------------------------- */
baseRestURL = "https://demo.microstrategy.com/MicroStrategyLibrary";
projectID = "EC70648611E7A2F962E90080EFD58751";
dossierID = "1730E9598F436BF38B0F4589D5E5484A";
/* since in this case we want dossier to load automatically for everyone we will use a demo user */
username = "";
password = "";
/* End of configuration parameters ------------------------------------------------------------- */
/* Generate the complete URL for the Dossier */
var dossierUrl = baseRestURL + '/app/' + projectID + '/' + dossierID;
/* Populate div with Dossier: */
microstrategy.dossier.create({
/* This is the document's <div> container where the Dossier should be placed. */
placeholder: document.getElementById("dossierContainer"),
url: dossierUrl,
/* The following parameters define the appearance of the Dossier.
E.g. is the navigation or collaboration bar displayed, do right-click actions work, etc. */
disableNotification: true,
enableResponsive: true,
/* And parameters for the user authentication. */
/* In case we didn't want the dossier to load automatically for everyone */
/* and wanted the user to log in we would skip that part. */
enableCustomAuthentication: true,
customAuthenticationType: microstrategy.dossier.CustomAuthenticationType.AUTH_TOKEN,
getLoginToken: login
}).then(function(dossier) {
/* Code to execute after the Dossier has finished loading... */
});
function login() {
/* Prepare some parameters for login request */
var options = {
method: 'POST',
credentials: 'include', /* include cookie */
mode: 'cors', /* set as CORS mode for cross origin resource sharing */
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
/* loginMode: 8 */ /* Login as guest user. */
"loginMode": 1, /* standard login mode */
"username": username,
"password": password
})
};
/* The actual login takes place here */
return fetch(baseRestURL + '/api/auth/login', options).then(function (response) {
if (response.ok) {
return response.headers.get('x-mstr-authToken');
} else {
response.json().then(function(json) {
console.log(json);
});
}
}).catch(function (error) {
console.log(error);
});
};
</html>
</head>
<body onload="load()">
<div id="mydossier"></div>
<script type="text/javascript">
var myDossier;
function load() {
var container = document.getElementById("mydossier"),
url = "https://demo.microstrategy.com/MicroStrategyLibrary/app/EC70648611E7A2F962E90080EFD58751/1730E9598F436BF38B0F4589D5E5484A";
microstrategy.dossier.create({
url: url,
enableResponsive: true,
placeholder: container,
containerHeight: '800px'
});
};
</script>
</body>
</html> |