Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
82 lines (67 sloc) 2.21 KB
<html>
<head>
<title>Dynamics Image Loader</title>
<style>
body {
height: 100%;
margin: 0;
padding: 0;
}
#over img {
padding: 0;
margin: 0 auto;
max-height: 100%;
max-width: 100%;
display: block;
}
</style>
<script>
document.onreadystatechange = function () {
if (document.readyState == "complete") {
loadImage();
}
}
function loadImage()
{
var imageAttributeName = getDataParameter();
if (imageAttributeName) {
if (!parent || !parent.Xrm || !parent.Xrm.Page)
throw new Error("System form context is not available. Pleas contact your administrator.");
var imageURLAttribute = parent.Xrm.Page.getAttribute(imageAttributeName);
if (imageURLAttribute) {
var imageURL = imageURLAttribute.getValue();
setImageView(imageURL);
}
else
throw new Error("Sorry, the image couldn't be loaded because the data parameter " + imageAttributeName + " doesn't match any attribute. Please contact your administrator.");
}
else
throw new Error("No data parameter was found. Please contact your administrator.");
}
function getDataParameter() {
if (location.search != "") {
var dataParameter;
var vals = location.search.substr(1).split("&");
for (var i in vals) {
dataParameter = vals[i].replace(/\+/g, " ").split("=");
if (dataParameter[0].toLowerCase() == "data") {
return dataParameter[1];
}
}
return null;
}
}
function setImageView(sourceURL)
{
var imageViewer = document.getElementById("imageView");
imageView.src = sourceURL;
}
</script>
<meta>
</head>
<body style="word-wrap: break-word;">
<div id="over" style="position:absolute; width:100%; height:100%">
<img id="imageView" src="" alt="Loading Logo...">
</div>
</body>
</html>