Commit 691328dc authored by Steve Johnson's avatar Steve Johnson

Fixed 2nd video bug; added mobile portal support; added click on Welcome...

Fixed 2nd video bug; added mobile portal support; added click on Welcome screen to logout and go to login screen
parent f6a88245
......@@ -26,6 +26,8 @@ var app = (function () {
app.addPage(K.pageWatchTV);
app.addPage(K.pagePhotoViewer);
var tvFrameUrl;
var accessToken;
// Temp for standalone testing.
accessToken = '2GR-barTxasAAAAAAAAAAfFt18IanLgfFUoOGCZ1amS6w5DiA0tDMIbU8JY18NLz';
......@@ -53,6 +55,9 @@ var app = (function () {
app.applicationBridge = new ApplicationBridge(app);
app.initApp(); // app.js
// Save original watchTV iFrame url for reinsertion later (to fix DropBox issue where you cannot replay videos - cacheing issue I think)
var tvFrameUrl = $('#tvFrame').attr('src');
app.addMessageHandler(K.objRequest, K.requestEndVideo, function(token) {
app.getPage(K.pageWatchTV).endVideo();
console.log("DropBox Videos: endVideo()");
......@@ -62,7 +67,7 @@ var app = (function () {
// Workaround for DropBox video stalls.
setTimeout(function(){
$('#tvFrame').attr('src', '../pages/shared/watchTV/watchtv.html');
$('#tvFrame').attr('src', tvFrameUrl);
}, 1000);
});
};
......
......@@ -102,6 +102,10 @@ var Url = (function() {
return resolveURL("guestPortalURL", "php/auth/guest_portal.php");
};
obj.mobilePortal = function() {
return resolveURL("mobilePortalURL", "php/auth/mobile_portal.php");
};
obj.sessionToken = function() {
return resolveURL("sessionTokenURL", "php/auth/session_token.php");
};
......
......@@ -84,7 +84,7 @@
<center><label id="hostLabel">hostname</label></center>
<br>
<a data-role='button' id='guestButton' style='width: 80%; margin: auto; text-align: center;' onclick='clickGuestButton(); return false;'href='#'>Continue as Guest</a>
<a data-role='button' id='guestButton' style='width: 80%; margin: auto; text-align: center;' onclick='clickGuestButton(); return false;'href='#'>Use Phone</a>
<br>
......
......@@ -446,9 +446,10 @@ var Remote = (function () {
w.performTransition('#deviceList',1,"slide",null);
deviceMenuActive = true;
/*
// App list was created before guest mode enabled, so settings button is missing.
var heading = dijit.byId('appListHeader');
var button = new dojox.mobile.ToolBarButton ({
var button = new ({
moveTo: "appSetup",
icon: "../images/settings.png",
clickable : true,
......@@ -459,6 +460,7 @@ var Remote = (function () {
});
dojo['dom-style'].set(button.domNode, {"float":"right"});
button.placeAt(heading,"last");
*/
var request = new XMLHttpRequest();
request.issue(Url.guestConfig()+"?authorize", function(reply){
......@@ -526,16 +528,17 @@ var Remote = (function () {
deviceListView.startup();
var heading1 = new dojox.mobile.Heading({
id: "deviceListView",
label: "My Stuff Everywhere",
clickable : true,
onClick : function() {
dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
location.replace(resetLocation);
}
clickable : true
//onClick : function() {
// dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
// location.replace(resetLocation);
//}
});
deviceListView.addChild(heading1);
$('#dojox_mobile_Heading_0').click(function(){
$('#deviceListView').click(function(){
dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
location.replace(resetLocation);
});
......@@ -552,8 +555,11 @@ var Remote = (function () {
function refreshSetupApplicationsList() {
console.log("refreshSetupApplicationsList");
var configUrl = guestMode ? Url.guestConfig() : Url.userConfig();
//var configMsg = guestMode ? 'guestConfig:' : 'userConfig:';
var request = new XMLHttpRequest();
request.issue(Url.guestConfig()+"?applist", function(reply){
request.issue(configUrl+"?applist", function(reply){
if (reply.httpStatus == 200) {
var applicationList = JSON.parse(reply.responseText);
clearSetupApplications();
......@@ -580,10 +586,16 @@ var Remote = (function () {
id: "appListHeader",
label: "?", // placeholder, replaced when device is selected.
back: "Devices",
moveTo: "deviceList"
moveTo: "deviceList",
clickable : true,
onClick : function() {
console.log("click: "+this.label);
loadUserConfiguration();
}
});
if (guestMode) {
//if (guestMode) {
var button = new dojox.mobile.ToolBarButton ({
moveTo: "appSetup",
icon: "../images/settings.png",
......@@ -597,7 +609,7 @@ var Remote = (function () {
dojo['dom-style'].set(button.domNode, {"float":"right"});
button.placeAt(heading2,"last");
}
//}
appList.addChild(heading2);
......@@ -628,12 +640,12 @@ var Remote = (function () {
$('#appsInstructionPanel').css('padding-left', '10px');
$('#appsInstructionPanel').css('padding-top', '10px');
if (guestMode) {
//if (guestMode) {
$('#appsInstructionPanel').html('<img src="../images/hint-icon2.png" /> You can add/remove applications by clicking the settings icon. <img src="../images/settings_framed.png" style="margin-bottom: -14px; margin-left: 8px"/><p> </p>');
}
else {
$('#appsInstructionPanel').html('<img src="../images/hint-icon2.png" /> To add or remove applications, log in to your account at the MSE User Portal"/><p> </p>');
}
//}
//else {
// $('#appsInstructionPanel').html('<img src="../images/hint-icon2.png" /> To add or remove applications, log in to your account at the MSE User Portal"/><p> </p>');
//}
$('#appsInstructionPanel').css('opacity', '0');
}
......@@ -703,11 +715,18 @@ var Remote = (function () {
var heading = new dojox.mobile.Heading({
id: "startupHeader",
label: "Welcome" // placeholder, replaced when device is selected.
label: "Welcome", // placeholder, replaced when device is selected.
clickable : true
});
startupView.addChild(heading);
$('#startupView').click(function(){
dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
location.replace(resetLocation);
});
welcomeMessage = new dojox.mobile.RoundRect({
id: 'welcomeMessage',
shadow: true
......@@ -873,14 +892,14 @@ var Remote = (function () {
//var msg = " There are no content sources enabled for this application. You can configure content sources by clicking the settings icon: ";
var msg;
if (guestMode) {
//if (guestMode) {
msg = " No content sources are enabled. Enable content sources by clicking the settings icon: ";
$('#appsInstructionPanel').html('<img src="../images/warning_icon.png" />'+msg+'<img src="../images/settings_framed.png" style="margin-bottom: -14px; margin-left: 8px"/><p> </p>');
}
else {
msg = " No content sources are enabled. Enable content sources by logging in to your account at the MSE User Portal /><p> </p>";
$('#appsInstructionPanel').html(msg);
}
//}
//else {
// msg = " No content sources are enabled. Enable content sources by logging in to your account at the MSE User Portal /><p> </p>";
// $('#appsInstructionPanel').html(msg);
//}
$('#appsInstructionPanel').css('opacity', '1');
}
......@@ -915,8 +934,11 @@ var Remote = (function () {
function setupApplication(appid) {
console.log("setupApplication: "+appid);
var redirectUri = location.href.split("?")[0]+"?restore";
var url = Url.guestPortal()+"?appid="+appid+"&redirectUri="+redirectUri;
remote.guestRedirect(url, "appsetup");
var url = Url.mobilePortal()+"?appid="+appid+"&redirectUri="+redirectUri;
if (guestMode) {
url += "&guest";
}
remote.mobileRedirect(url, "appsetup");
}
function addSetupApplications(applicationList) {
......@@ -978,9 +1000,6 @@ var Remote = (function () {
// First we need a session token.
var request = new XMLHttpRequest();
var url = Url.sessionToken()+"?appid="+appID;
if (guestMode) {
url += "&guestmode";
}
request.issue(url, function(response){
if (response.httpStatus === 200) {
console.log("Received Session Token: - "+ response.responseText);
......@@ -1122,9 +1141,9 @@ var Remote = (function () {
disconnectDevice();
}
// When authorizing an app in guest mode, we cannot redirect to a service provider from within an iframe.
// When authorizing an app in mobile/guest mode, we cannot redirect to a service provider from within an iframe.
// Save the navigation context in a single use cookie so we can restore our state on redirect.
remote.guestRedirect = function(redirectUrl) {
remote.mobileRedirect = function(redirectUrl) {
var context = {};
// Too long for cookie (I think). Load configuration on restore
//context.applicationList = applicationList;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment