openwebapps-photosite-conne.../index.html

109 строки
3.1 KiB
HTML

{% import config %}
<html>
<head>
<title>SmugMug Connector</title>
<script type="text/javascript" src="/static/js/jquery-1.4.4.min.js"></script>
<link type="text/css" href="/static/css/style.css" rel="stylesheet" />
<link rel="application-manifest" href="/smugmugconnector.webapp"></link>
<script>
{% if user_info %}
window.localStorage.setItem("user_id", "{{ user_info["user_id"] }}");
window.localStorage.setItem("full_name", "{{ user_info["full_name"] }}");
window.localStorage.setItem("credentials", "{{ user_info["credentials"] }}");
{% end %}
function disconnect() {
window.localStorage.setItem("user_id", null);
window.localStorage.setItem("full_name", null);
window.localStorage.setItem("credentials", null);
$("#connected").hide();
$("#notconnected").show();
}
function install() {
navigator.apps.install({
url:"/smugmugconnector.webapp",
success: function() {
$("#notinstalled").fadeOut($("#installed").fadeIn());
},
error: function() {
}
});
}
function init() {
if (window.localStorage.getItem("user_id")) {
$("#notconnected").hide();
} else {
$("#connected").hide();
}
// XX check installed
$("#installed").hide();
$("#notinstalled").hide();
navigator.apps.amInstalled(function(installed) {
if (installed) $("#installed").show();
else $("#notinstalled").show();
});
}
</script>
</head>
<body onLoad="init();">
<div class="container">
<p>This is the {{config.PHOTO_SITE}} Connector application.</p>
<p>It is a product of Mozilla Labs, and is experimental code. It is intended
to show how a {{config.PHOTO_SITE}} integration with an Open Web Apps service framework
would work.</p>
<p>Eventually we would hope that {{config.PHOTO_SITE}} would host this code themselves;
for now, we ask users to authorize us to access their data on their behalf.
</p>
<div id="notinstalled">
<p>The {{config.PHOTO_SITE}} Connector application is <em>not installed.</em> You will
need to install it into your browser before it can do anything interesting for you.</p>
<p style="text-align:center">
<a class="button" href="javascript:install()">Install Application</a>
</p>
</div>
<div id="installed">
<p>The {{config.PHOTO_SITE}} Connector application is installed.</p>
</div>
<div id="notconnected">
<p>By connecting to {{config.PHOTO_SITE}}, you will authorize your browser to connect
to {{config.PHOTO_SITE}} to share your photos with other websites and web applications.
You will still be asked to give your permission before anything is shared.
</p>
<div style="text-align:center">
<a class="button" href="/connect/start">Connect to {{config.PHOTO_SITE}}</a>
</div>
</div>
<div id="connected">
<p>This browser is connected to {{config.PHOTO_SITE}}. It may now share your photos with
other websites and web applications. You will still be asked to give your
permission before anything is shared.
</p>
<div style="text-align:center">
<a class="button" href="javascript:disconnect()">Disconnect</a>
</div>
</div>
</div> <!-- end info -->
<div id="kicker">A <a href="#">Mozilla Labs</a> Project &middot; <a href="http://mozilla.com/privacy">Privacy Policy</a></div>
</body>
</html>