Merge pull request #99 from Microsoft/alihamud-live-code
enable getting embedUrl, embedId and accessToken from url params.
This commit is contained in:
Коммит
e15763f53d
|
@ -5,7 +5,7 @@
|
|||
<div id="steps-ul-dev">
|
||||
<ul id="steps-ul" class="steps-ul">
|
||||
<li id="steps-auth" class="steps-li-active" onclick="OpenAuthStep();"><a href="#">Authorize</a></li>
|
||||
<li id="steps-embed" onclick="OpenEmbedStepWithSample();"><a href="#">Embed</a></li>
|
||||
<li id="steps-embed" onclick="OpenEmbedStep();"><a href="#">Embed</a></li>
|
||||
<li id="steps-interact" onclick="OpenInteractStep();"><a href="#">Interact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -26,6 +26,15 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
// Open Authorization Step after this page loads.
|
||||
OpenAuthStep();
|
||||
var embedUrl = GetParameterByName("embedUrl");
|
||||
if (!embedUrl)
|
||||
{
|
||||
// Open Authorization Step after this page loads.
|
||||
OpenAuthStep();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenEmbedStep();
|
||||
}
|
||||
|
||||
</script>
|
|
@ -41,10 +41,50 @@ function SetAccessTokenFromSession() {
|
|||
$("#txtAccessToken").val(sessionAccessToken);
|
||||
}
|
||||
|
||||
function SetAccessTokenFromSessionOrUrlParam() {
|
||||
var accessToken = GetParameterByName("accessToken");
|
||||
if (!accessToken)
|
||||
{
|
||||
accessToken = GetSession("accessToken");
|
||||
}
|
||||
|
||||
$("#txtAccessToken").val(accessToken);
|
||||
}
|
||||
|
||||
function GetParameterByName(name, url) {
|
||||
if (!url) {
|
||||
url = window.location.href;
|
||||
}
|
||||
name = name.replace(/[\[\]]/g, "\\$&");
|
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||
results = regex.exec(url);
|
||||
if (!results) return null;
|
||||
if (!results[2]) return '';
|
||||
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function SetEmbedUrlFromSessionOrUrlParam() {
|
||||
var embedUrl = GetParameterByName("embedUrl");
|
||||
if (!embedUrl)
|
||||
{
|
||||
embedUrl = GetSession("embedUrl");
|
||||
}
|
||||
$("#txtReportEmbed").val(embedUrl);
|
||||
|
||||
var embedId = GetParameterByName("embedId");
|
||||
if (!embedId)
|
||||
{
|
||||
embedId = GetSession("embedId");
|
||||
}
|
||||
$("#txtEmbedReportId").val(embedId);
|
||||
}
|
||||
|
||||
function SetEmbedUrlFromSession() {
|
||||
var sessionEmbedUrl = GetSession("embedUrl");
|
||||
$("#txtReportEmbed").val(sessionEmbedUrl);
|
||||
|
||||
var sessionEmbedId = GetSession("embedId");
|
||||
$("#txtEmbedReportId").val(sessionEmbedId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,6 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
SetEmbedUrlFromSession();
|
||||
SetAccessTokenFromSession();
|
||||
SetEmbedUrlFromSessionOrUrlParam();
|
||||
SetAccessTokenFromSessionOrUrlParam();
|
||||
</script>
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
SetEmbedUrlFromSession();
|
||||
SetAccessTokenFromSession();
|
||||
SetEmbedUrlFromSessionOrUrlParam();
|
||||
SetAccessTokenFromSessionOrUrlParam();
|
||||
SetEmbedCode(_Embed_BasicEmbed);
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче