http://git-wip-us.apache.org/repos/asf/usergrid/blob/fa590f5c/sdks/html5-javascript/examples/facebook/app.js ---------------------------------------------------------------------- diff --git a/sdks/html5-javascript/examples/facebook/app.js b/sdks/html5-javascript/examples/facebook/app.js deleted file mode 100755 index 35b646d..0000000 --- a/sdks/html5-javascript/examples/facebook/app.js +++ /dev/null @@ -1,129 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** -* dogs is a sample app that is powered by Usergrid -* This app shows how to use the Usergrid SDK to connect -* to Usergrid, how to add entities, and how to page through -* a result set of entities -* -* Learn more at http://Usergrid.com/docs -* -* Copyright 2012 Apigee Corporation -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/** -* @file app.js -* @author Rod Simpson (r...@apigee.com) -* -* This file contains the main program logic for Facebook Login Example. -*/ -$(document).ready(function () { - //first set the org / app path (must be orgname / appname or org id / app id - can't mix names and uuids!!) - - var client = new Usergrid.Client({ - orgName:'yourorgname', - appName:'sandbox', - logging: true, //optional - turn on logging, off by default - buildCurl: true //optional - turn on curl commands, off by default - }); - - //bind the login button so we can send the user to facebook - $('#login-button').bind('click', function() { - //get the - var apiKey = $("#api-key").val(); - var location = window.location.protocol + '//' + window.location.host; - var path = window.location.pathname; - - var link = "https://www.facebook.com/dialog/oauth?client_id="; - link += apiKey; - link += "&redirect_uri="; - link += location+path - link += "&scope&COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES&response_type=token"; - - //now forward the user to facebook - window.location = link; - }); - //bind the previous button to the proper method in the collection object - $('#logout-button').bind('click', function() { - logout(); - }); - - //load up the facebook api sdk - window.fbAsyncInit = function() { - FB.init({ - appId : '308790195893570', // App ID - channelUrl : '//usergridsdk.dev//examples/channel.html', // Channel File - status : true, // check login status - cookie : true, // enable cookies to allow the server to access the session - xfbml : true // parse XFBML - }); - }; - - function logout() { - FB.logout(function(response) { - client.logoutAppUser(); - var html = "User logged out. \r\n\r\n // Press 'Log in' to log in with Facebook."; - $('#facebook-status').html(html); - }); - } - - function login(facebookAccessToken) { - client.loginFacebook(facebookAccessToken, function(err, response){ - var output = JSON.stringify(response, null, 2); - if (err) { - var html = '<pre>Oops! There was an error logging you in. \r\n\r\n'; - html += 'Error: \r\n' + output+'</pre>'; - } else { - var html = '<pre>Hurray! You have been logged in. \r\n\r\n'; - html += 'Facebook Token: ' + '\r\n' + facebookAccessToken + '\r\n\r\n'; - html += 'Facebook Profile data stored in Usergrid: \r\n' + output+'</pre>'; - } - $('#facebook-status').html(html); - }) - } - - //pull the access token out of the query string - var ql = []; - if (window.location.hash) { - // split up the query string and store in an associative array - var params = window.location.hash.slice(1).split("#"); - var tmp = params[0].split("&"); - for (var i = 0; i < tmp.length; i++) { - var vals = tmp[i].split("="); - ql[vals[0]] = unescape(vals[1]); - } - } - - if (ql['access_token']) { - var facebookAccessToken = ql['access_token'] - //try to log in with facebook - login(facebookAccessToken); - } -}); \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/usergrid/blob/fa590f5c/sdks/html5-javascript/examples/facebook/facebook.html ---------------------------------------------------------------------- diff --git a/sdks/html5-javascript/examples/facebook/facebook.html b/sdks/html5-javascript/examples/facebook/facebook.html deleted file mode 100755 index 2ea8943..0000000 --- a/sdks/html5-javascript/examples/facebook/facebook.html +++ /dev/null @@ -1,73 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!DOCTYPE html> -<html> - <head> - <title>Facebook Login Example App for Apigee App Services (Usergrid)</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link rel="stylesheet" href="../resources/css/bootstrap-combined.min.css" /> - <link rel="stylesheet" href="../resources/css/styles.css" /> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> - <script src="../../usergrid.js" type="text/javascript"></script> - <script src="app.js" type="text/javascript"></script> - <script src="//connect.facebook.net/en_US/all.js" type="text/javascript"></script> - </head> - <body> - <div class="header"> - <img src="../resources/images/apigee.png"> App Services (Usergrid) Javascript SDK - </div> - <div class="breadcrumb"> - <a href="../../index.html"><< examples</a> - </div> - <div class="info"> - This sample application will show you how to log into App Services (Usergrid) using Facebook and the Usergrid Javascript SDK. - Enter the <a href="https://developers.facebook.com/apps/">API Key that you get from Facebook</a>, then log in. - <br/><br/> - The Log in button sends the user to the facebook login page. Once the user logs in, they are redirected back to - this page and automatically logged into Usergrid. If the user is already logged into facebook, then they don't need to log in again. - <br/><br/> - Clicking the log out button calls the logout method of the Facebook JS SDK, and also logs the user out of Usergrid by calling the Usergrid logoutAppUser method. - <br/><br/> - For a step by step walk-thru on how to get this app running, see this <a href="guide.html">guide</a>. - <br/><br/> - For more information on App Services, see our <a href="http://apigee.com/docs/app_services">docs</a> site, specifically or our <a href="http://apigee.com/docs/usergrid/content/facebook-sign-in">Facebook docs page</a>. - <br/><br/> - For more information on how using the Facebook JS SDK to log users in, see this guide: <a href="http://developers.facebook.com/docs/howtos/login/getting-started/">http://developers.facebook.com/docs/howtos/login/getting-started/</a> - </div> - <div id="main" class="main"> - <div class="section-header">Log in with Facebook</div> - <div class="well"> - <div id="name-control" class="control-group"> - <div class="controls"> - <label class="control-label" for="get-path">Facebook API key (<a href="https://developers.facebook.com" target="_blank">Learn more</a>)</label> - <input type="text" name="api-key" id="api-key" class="span4" style="float: left;" value="308790195893570"/> - <span class="span4 left" style="width: 10px; float: left;"> </span> - <button class="btn btn-primary" id="login-button" style="width: 90px;">Log In</button> - <button class="btn btn-primary" id="logout-button" style="width: 90px;">Log out</button> - <span style="clear: both;"> </span> - </div> - </div> - </div> - <div class="section-header"><b>API Response</b></div> - <div class="well" id="facebook-status"> - // Press 'Log in' to log in with Facebook. - </div> - </div> - <div id="fb-root" class=" fb_reset"> </div> - </body> -</html> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fa590f5c/sdks/html5-javascript/examples/facebook/guide.html ---------------------------------------------------------------------- diff --git a/sdks/html5-javascript/examples/facebook/guide.html b/sdks/html5-javascript/examples/facebook/guide.html deleted file mode 100755 index 725dd9a..0000000 --- a/sdks/html5-javascript/examples/facebook/guide.html +++ /dev/null @@ -1,63 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!DOCTYPE html> -<html> - <head> - <title></title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link rel="stylesheet" href="../resources/css/bootstrap-combined.min.css" /> - <link rel="stylesheet" href="../resources/css/styles.css" /> - </head> - <body> - <div class="header"> - <img src="../resources/images/apigee.png"> App Services (Usergrid) Javascript SDK - </div> - <div class="info"> - To get the Facebook example working on your development machine, follow these steps: - <br/><br/> - <b>1. Sign up</b> - <br/>Sign up for a <a href="http://facebook.com">Facebook</a> account. - <br/><br/> - <b>2. Create a new app</b> - <br/>Go to <a href="https://developers.facebook.com">https://developers.facebook.com</a> and follow - the prompts to authenticate yourself. Then, go to the Facebook App Dashboard, and create a new app. - <br/><br/> - <b>3. Specify your Facebook integration method</b> - <br/>On the app creation page, make sure you specify that you will use "Website with Facebook Login". - You should see something like <a href="http://cl.ly/image/0K2L1z062Q1H">this</a>. You should enter the url where - you will host this sample (e.g. http://mywebsite.com/path-to-my-code). If want just to test with our gh-pages repo, - located here: <a href="http://apigee.github.com/usergrid-javascript-sdk/">http://apigee.github.com/usergrid-javascript-sdk/</a>, - then enter http://apigee.github.com/usergrid-javascript-sdk in the field instead. - <br/><br/> - <b>4. Get your App Id</b> - <br/>Once your app is created, you can get the app id by going here: <a href="https://developers.facebook.com/apps">https://developers.facebook.com/apps</a> - <br/><br/> - <b>5. Download this code</b> (skip this step if you plan to run it on our gh-pages repo) - <br/>If you haven't done so already, download the Usergrid Javascript SDK: <a href="https://github.com/apigee/usergrid-javascript-sdk">https://github.com/apigee/usergrid-javascript-sdk</a> - and save to a local directory on your hard drive. You will then need to deploy the code to your server. - <br/><br/> - <b>6. Run the file</b> - <br/>Navigate your browser to the location where you uploaded your code, or go to our gh-pages repo - ( <a href="http://apigee.github.com/usergrid-javascript-sdk/">http://apigee.github.com/usergrid-javascript-sdk/</a>) and choose "Facebook Login Example". - <br/><br/> - <b>7. Log in!</b> - <br/>Enter your API key, and follow the prompts. - </div> - </body> -</html> - http://git-wip-us.apache.org/repos/asf/usergrid/blob/fa590f5c/sdks/html5-javascript/examples/persistence/test.html ---------------------------------------------------------------------- diff --git a/sdks/html5-javascript/examples/persistence/test.html b/sdks/html5-javascript/examples/persistence/test.html deleted file mode 100644 index 3d7c553..0000000 --- a/sdks/html5-javascript/examples/persistence/test.html +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!DOCTYPE html> -<html> -<head> - <title>Readme File Tests</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <link rel="stylesheet" href="../resources/css/bootstrap-combined.min.css" /> - <link rel="stylesheet" href="../resources/css/styles.css" /> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> - <script src="../../usergrid.js" type="text/javascript"></script> - <script src="test.js" type="text/javascript"></script> - <script type="text/javascript"> - - </script> -</head> -<body> -<div class="header"> - <img src="../resources/images/apigee.png"> App Services (Usergrid) Javascript SDK -</div> -<div class="info"> - This sample application runs tests to demonstrate how to persist collections using the collection.serialize() method. -</div> -<div id="main" class="main"> - <div class="section-header">README sample code tests</div> - <div class="well"> - <div id="name-control" class="control-group"> - <div class="controls"> - <button class="btn btn-primary" id="start-button" style="width: 90px;">Start</button> - <span style="clear: both;"> </span> - </div> - </div> - </div> - <div class="section-header"><b>Test Output</b></div> - <div class="well"> - <pre id="test-output">// Press Start button to begin</pre> - </div> -</body> -</html> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fa590f5c/sdks/html5-javascript/examples/persistence/test.js ---------------------------------------------------------------------- diff --git a/sdks/html5-javascript/examples/persistence/test.js b/sdks/html5-javascript/examples/persistence/test.js deleted file mode 100644 index 352323a..0000000 --- a/sdks/html5-javascript/examples/persistence/test.js +++ /dev/null @@ -1,130 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -$(document).ready(function () { - -//call the runner function to start the process - $('#start-button').bind('click', function() { - $('#start-button').attr("disabled", "disabled"); - $('#test-output').html(''); - runner(0); - }); - - var logSuccess = true; - var successCount = 0; - var logError = true; - var errorCount = 0; - var logNotice = true; - - var client = new Usergrid.Client({ - orgName:'yourorgname', - appName:'sandbox', - logging: true, //optional - turn on logging, off by default - buildCurl: true //optional - turn on curl commands, off by default - }); - - function runner(step, arg, arg2){ - step++; - switch(step) - { - case 1: - notice('-----running step '+step+': create and serialize collection'); - createAndSerialzeCollection(step); - break; - case 2: - notice('-----running step '+step+': de-serialize collection'); - deserializeCollection(step); - break; - default: - notice('-----test complete!-----'); - notice('Success count= ' + successCount); - notice('Error count= ' + errorCount); - notice('-----thank you for playing!-----'); - $('#start-button').removeAttr("disabled"); - } - } - -//logging functions - function success(message){ - successCount++; - if (logSuccess) { - console.log('SUCCESS: ' + message); - var html = $('#test-output').html(); - html += ('SUCCESS: ' + message + '\r\n'); - $('#test-output').html(html); - } - } - - function error(message){ - errorCount++ - if (logError) { - console.log('ERROR: ' + message); - var html = $('#test-output').html(); - html += ('ERROR: ' + message + '\r\n'); - $('#test-output').html(html); - } - } - - function notice(message){ - if (logNotice) { - console.log('NOTICE: ' + message); - var html = $('#test-output').html(); - html += (message + '\r\n'); - $('#test-output').html(html); - } - } - - - function createAndSerialzeCollection(step){ - var options = { - type:'books', - qs:{ql:'order by name'} - } - - client.createCollection(options, function (err, books) { - if (err) { - error('could not make collection'); - } else { - - //collection made, now serialize and store - localStorage.setItem('item', books.serialize()); - - success('new Collection created and data stored'); - - runner(step); - - } - }); - } - - - function deserializeCollection(step){ - var books = client.restoreCollection(localStorage.getItem('item')); - - while(books.hasNextEntity()) { - //get a reference to the book - book = books.getNextEntity(); - var name = book.get('name'); - notice('book is called ' + name); - } - - success('looped through books'); - - runner(step); - } - -}); \ No newline at end of file