Mercurial > pumpbridge
view views/index.jade @ 21:dbe2232af20f
changed syncALONE
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Fri, 13 Jun 2014 21:21:41 +0200 |
parents | c5bf4e02958e |
children | 3e3fa35e3ce2 |
line wrap: on
line source
doctype html html(lang="en") head title= pageTitle link(rel='stylesheet', href='/stylesheets/style.css') link(rel='icon', href='/images/favicon.ico',type='image/x-icon') link(rel='stylesheet', href='/stylesheets/bootstrap.min.css') // load jquery script(src='https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js') // load googleplus api script(type='text/javascript'). (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); // load googleplus api sign in script(type='text/javascript'). (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/client:plusone.js?onload=render'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); /* Executed when the APIs finish loading */ function render() { gapi.signin.render('gp-root', { 'callback': 'signinCallback', 'clientid': 'GOOGLEPLUSID.apps.googleusercontent.com', 'redirecturi': 'postmessage', 'response_type' : 'code', 'accesstype': 'offline', 'approvalprompt': 'force', 'cookiepolicy': "https://server.example", 'requestvisibleactions': 'http://schemas.google.com/AddActivity', 'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email' }); } // handle googleplus callback script(type='text/javascript'). function signinCallback(authResult) { if (authResult['status']['signed_in']) { // Update the app to reflect a signed in user // Hide the sign-in button now that the user is authorized, for example: //document.getElementById('signinButton').setAttribute('style', 'display: none'); //alert('googleplus is ready for bridging'); gapi.client.load('plus', 'v1', function() { var request = gapi.client.plus.people.get({ 'userId': 'me' }); request.execute(function(resp) { //alert(JSON.stringify(resp)); $('#gpstatus').html('<a href=' + resp.url + '> ' + resp.displayName + '</a>'); var token = gapi.auth.getToken(); //alert(JSON.stringify(resp.id)); $('#gpid').val(resp.id+'@google'); $('#gptoken').val(token.access_token + ';' + token.code); }); }); } else { // Update the app to reflect a signed out user // Possible error values: // "user_signed_out" - User is signed-out // "access_denied" - User denied access to your app // "immediate_failed" - Could not automatically log in the user //alert('you cancelled login or did not fully authorize: ' + authResult['error']); } } script. // twitter stuff function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) == 0) return c.substring(name.length,c.length); } return ""; } // load facebook api script. $(document).ready(function () { var usermapfb="#{usermapfb}"; var usermaptw="#{usermaptw}"; var usermapgp="#{usermapgp}"; if(usermapfb == 'true'){ $('#fbloginbutton2').addClass('hide'); $('#fbdeletebutton').removeClass('hide'); }else{ $('#fbloginbutton2').removeClass('hide'); $('#fbdeletebutton').addClass('hide'); } if(usermaptw == 'true'){ $('#twloginbutton2').addClass('hide'); $('#twdeletebutton').removeClass('hide'); }else{ $('#twloginbutton2').removeClass('hide'); $('#twdeletebutton').addClass('hide'); } if(usermapgp == 'true'){ $('#gploginbutton2').addClass('hide'); $('#gpdeletebutton').removeClass('hide'); }else{ $('#gploginbutton2').removeClass('hide'); $('#gpdeletebutton').addClass('hide'); } var twstatus = getCookie('twitterid') if (twstatus != "") $('#twstatus').html('<a href=https://twitter.com/account/redirect_by_id/' + twstatus + '> ' + getCookie('twitteruser') + '</a>'); $.ajaxSetup({ cache: true }); $.getScript('//connect.facebook.net/de_DE/all.js', function () { FB.init({ appId: 'FACEBOOKID', status: true }); FB.getLoginStatus(function(response) { if (response.status === 'connected') { // the user is logged in and has authenticated your // app, and response.authResponse supplies // the user's ID, a valid access token, a signed // request, and the time the access token // and signed request each expire var uid = response.authResponse.userID; var accessToken = response.authResponse.accessToken; $('#fbtoken').val(accessToken); FB.api('/me', function(response) { $('#fbstatus').html('<a href=//facebook.com/' + response.id + '> ' + response.name + '</a>'); $('#fbid').val(response.id+'@facebook'); }); } else if (response.status === 'not_authorized') { // the user is logged in to Facebook, // but has not authenticated your app $('#fbstatus').html('not authorized'); } else { // the user isn't logged in to Facebook. $('#fbstatus').html('not logged in'); } }); }); $('.fbloginbutton').on('click', function(e){ FB.login(function(response) { if (response.authResponse) { FB.api('/me', function(response) { //document.getElementById("logoutbutton").disabled = false; }); } else { //Not logged in //alert('you cancelled login or did not fully authorize.'); } }, {scope: 'publish_actions,publish_stream,read_stream,read_friendlists,user_likes,user_friends,user_activities,user_status'}); }) //$('.logoutbutton').on('click', function(e){ // FB.logout(); // }) $('#pumpobj').val(JSON.stringify(!{JSON.stringify(user)})); }); body block content .main .headlinebox img(class="ribbon", src="/images/ribbonl.png") h1(class='headline') pumpbridge.<br>connecting social networks #pump-root.pump-root h4 | logged in as: a(id='pumpstatus',class='pumpstatus',href=user.homepage)=user.id #fb.fb #fb-root.fb-root input(id='fbloginbutton',type='image',class='fbloginbutton',value='fbLogin',src='images/fb.svg',width='100px',height='100px') #fb-info.fb-info i(id='fbstatus') not logged in br form(class='',action='/bridge',method='post') input(id='fbdeleted',name='fbdelete',hidden='true',value=user.id) button(id='fbdeletebutton',type='submit',class='btn btn-default btn-xs',hidden='true') | delete credentials button(id='fbloginbutton2',name='fbloginbutton2',class='btn btn-default btn-xs',onClick='$("#fbloginbutton").click()') | add credentials #gp.gp #gp-root.gp-root input(id='gploginbutton',type='image',class='gploginbutton',value='gpLogin',src='images/gp.svg',width='100px',height='100px') #gp-info.gp-info i(id='gpstatus') not logged in br form(class='',action='/bridge',method='post') input(id='gpdeleted',name='gpdelete',hidden='true',value=user.id) button(name='gpdeletebutton',id='gpdeletebutton',type='submit',class='btn btn-default btn-xs') | delete credentials button(id='gploginbutton2',name='gploginbutton2',class='btn btn-default btn-xs',onClick='$("#gploginbutton").click()') | add credentials #tw.tw #tw-root.tw-root a(href='/add-account'): input(type='image',value='twitterlogin',src='images/twitter.svg',width='100px',height='100px') #tw-info.tw-info i(id='twstatus') not logged in br form(class='',action='/bridge',method='post') input(id='twdeleted',name='twdelete',hidden='true',value=user.id) button(id='twdeletebutton',type='submit',class='btn btn-default btn-xs') | delete credentials button(id='twloginbutton2',name='twloginbutton2',type='submit',class='btn btn-default btn-xs',onClick='location.href="/add-account"') | add credentials form(class='',action='/bridge',method='post') input(id='pumpid',name='pumpid',hidden='true',value=user.id) input(id='pumptoken',name='pumptoken',hidden='true', value=user.token) input(id='pumpsecret',name='pumpsecret',hidden='true', value=user.secret) input(id='pumpobj',name='pumpobj', hidden='true' value='') input(id='fbid',name='fbid',hidden='true') input(id='fbtoken',name='fbtoken',hidden='true') input(id='gpid',name='gpid',hidden='true') input(id='gptoken',name='gptoken',hidden='true',size=100) br | you need to extra save the credentials br | for facebook and googleplus br input(type='submit',class='btn btn-default',value='save credentials') .footer #logout.logout //input(id='logoutbutton',type='button',class='logoutbutton',value='Logout',disabled) form(class='',action='/logout',method='post') input(type='submit',class='btn btn-default',value='logout') br p. <a href=https://wald.intevation.org/hg/pumpbridge/>pumpbridge</a> is Free Software and available under the Apache License 2.0. <br> visit <a href=https://wald.intevation.org/projects/pumpbridge/>https://wald.intevation.org/projects/pumpbridge</a> for more informations! <br> pumpbridge is hosted and operated by <a href=https://io.intevation.de/mgebbe>Mathias Gebbe</a> <a href=/contact.html>(Contact)</a> <br>