Skip to content

Commit

Permalink
Closes #38. Link your cloud doesn't show up unless you aren't logged in.
Browse files Browse the repository at this point in the history
  • Loading branch information
JessieAMorris committed May 17, 2013
1 parent a5d4f8a commit bb9e66e
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 68 deletions.
87 changes: 49 additions & 38 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,48 +98,59 @@ <h3 id="myModalLabel">Link to Your Personal Cloud</h3>
<div class="modal-body"><img src="img/spinner70.gif"></div>
</div>

<!-- View: About
============================================ -->
<div id="view-about" class="view row-fluid" style="display:none;">
<div class="span12" style="margin-bottom:12px;">
<div class="hero-unit">
<h1 style="font-size:38.5px;margin-bottom:20px;">About Forever</h1>

<p>Forever is a demonstration application for personal
clouds. At present, Forever uses <a href="https://squaretag.com">SquareTag</a> as its personal
cloud. We hope to support other personal cloud providers in
the near future.</p>
<!-- View: About
============================================ -->
<div id="view-about" class="view row-fluid" style="display:none;">
<div class="span12" style="margin-bottom:12px;">
<div class="hero-unit">
<h1 style="font-size:38.5px;margin-bottom:20px;">About Forever</h1>

<p>Forever is a demonstration application for personal
clouds. At present, Forever uses <a href="https://squaretag.com">SquareTag</a> as its personal
cloud. We hope to support other personal cloud providers in
the near future.</p>

<p>Forever stores no personal data whatsoever. Forever relies
entirely on the personal cloud for storing data, knowing friend
relationships, and sending notifications. Any data changes made in
Forever are reflected in the linked personal cloud and no where
else. As a result, Forever has no privacy policy of its own. The
privacy policy of the personal cloud provider is what is relevant.</p>

<p>For more information about Forever, see Phil Windley's white paper:</p>

<ul>
<h3 style="font-size:18px;"><a href="http://www.windley.com/archives/2013/05/introducing_forever_and_personal_cloud_application_architectures.shtml">Introducing Forever and Personal Cloud Application Architectures</a></h3>
</ul>

</div>
</div>
</div> <!-- #view-about -->

<p>Forever stores no personal data whatsoever. Forever relies
entirely on the personal cloud for storing data, knowing friend
relationships, and sending notifications. Any data changes made in
Forever are reflected in the linked personal cloud and no where
else. As a result, Forever has no privacy policy of its own. The
privacy policy of the personal cloud provider is what is relevant.</p>

<p>For more information about Forever, see Phil Windley's white paper:</p>

<ul>
<h3style="font-size:18px;"><a href="http://www.windley.com/archives/2013/05/introducing_forever_and_personal_cloud_application_architectures.shtml">Introducing Forever and Personal Cloud Application Architectures</a></h3>
</ul>

</div>
</div>
</div> <!-- #view-about -->
<!-- View: Home
============================================ -->
<div id="view-loading" class="view row-fluid" style="display: block;">
<div class="span12">
<div class="hero-unit">
<h1 style="font-size:38.5px;">Welcome to Forever!</h1>
Loading...
</div>
</div>
</div> <!-- #view-home -->

<!-- View: Home
============================================ -->
<div id="view-home" class="view row-fluid" style="display:block;">
<div class="span12">
<div class="hero-unit">
<h1 style="font-size:38.5px;">Welcome to Forever!</h1>
<h3>Get Started by Linking Forever to your Personal Cloud</h3>
<a href="#" class="btn btn-primary oauth-sqtag-url">Click here to Link Squaretag</a></br>
<a href="#" class="btn disabled" style="margin-top: 12px;">Click here to Link Neustar pCloud</a>
<div style="text-align: right; margin-top: 80px;"><img src="img/forevrLogo128.png"></div>
</div>
</div>
</div> <!-- #view-home -->
<div id="view-home" class="view row-fluid" style="display:none;">
<div class="span12">
<div class="hero-unit">
<h1 style="font-size:38.5px;">Welcome to Forever!</h1>
<h3>Get Started by Linking Forever to your Personal Cloud</h3>
<a href="#" class="btn btn-primary oauth-sqtag-url">Click here to Link Squaretag</a></br>
<a href="#" class="btn disabled" style="margin-top: 12px;">Click here to Link Neustar pCloud</a>
<div style="text-align: right; margin-top: 80px;"><img src="img/forevrLogo128.png"></div>
</div>
</div>
</div> <!-- #view-home -->

<!-- View: Home Authorized
============================================ -->
Expand Down
41 changes: 18 additions & 23 deletions app/js/CloudOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,38 +231,33 @@

// --------------------------------------------
function kookie_create(SkySessionToken) {
if (SkyTokenExpire) {
var date = new Date();
date.setTime(date.getTime()+(SkyTokenExpire*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
var kookie = SkyTokenName+"="+SkySessionToken+expires+"; path=/";
document.cookie = kookie;
// console.debug('(create): ', kookie);
if (SkyTokenExpire) {
var date = new Date();
date.setTime(date.getTime()+(SkyTokenExpire*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
var kookie = SkyTokenName+"="+SkySessionToken+expires+"; path=/";
document.cookie = kookie;
}

// --------------------------------------------
function kookie_delete() {
var kookie = SkyTokenName+"=foo; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/";
document.cookie = kookie;
// console.debug('(destroy): ', kookie);
var kookie = SkyTokenName+"=foo; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/";
document.cookie = kookie;
}

// --------------------------------------------
function kookie_retrieve() {
var TokenValue = 'undefined';
var TokenValue = 'undefined';
var TokenName = '__SkySessionToken';
var allKookies = document.cookie.split('; ');
for (var i=0;i<allKookies.length;i++) {
var kookiePair = allKookies[i].split('=');
// console.debug("Kookie Name: ", kookiePair[0]);
// console.debug("Token Name: ", TokenName);
if (kookiePair[0] == TokenName) {
TokenValue = kookiePair[1];
};
}
// console.debug("(retrieve) TokenValue: ", TokenValue);
var allKookies = document.cookie.split('; ');
for (var i=0;i<allKookies.length;i++) {
var kookiePair = allKookies[i].split('=');
if (kookiePair[0] == TokenName) {
TokenValue = kookiePair[1];
};
}
return TokenValue;
}

Expand Down
28 changes: 21 additions & 7 deletions app/js/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ $(document).ready(function() {
// set type, either numeric or text
type: 'text'
});

// --------------------------------------------
// Check authentication
// Gotta do this before trying to figure out which page we should show (view_loading).
CloudOS.retrieveSession();


page('/', view_home);
page('/', view_loading);
page('/login*', view_login);
page('/signup*', view_signup);
page('/about', view_about);
Expand All @@ -45,12 +51,7 @@ $(document).ready(function() {
page('*', view_notfound);
page();

var currentView = 'home';

// --------------------------------------------
// Check authentication
CloudOS.retrieveSession();

var currentView = 'loading';
if (CloudOS.authenticatedSession()) {
Navbar_Show_Auth();
page('/friends');
Expand Down Expand Up @@ -151,6 +152,19 @@ $(document).ready(function() {
function set_screen_title(screenName) {
$('a.brand').text('Forever ' + screenName);
}

// --------------------------------------------
// View: loading
function view_loading() {
if (CloudOS.authenticatedSession()) {
show_view('loading')
currentView = 'loading';
} else {
show_view('home');
currentView = 'home';
}
};

// --------------------------------------------
// View: home
function view_home() {
Expand Down

0 comments on commit bb9e66e

Please sign in to comment.