Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a basic index.html starter page with login and logout buttons. …
…Started the system connect service resource javascript.
- Loading branch information
Tyler Frankenstein
committed
Jan 24, 2012
1 parent
9599c09
commit 14923c3
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
var drupalgap_settings = { | |||
"services_endpoint_default":"http://10.0.2.2/drupal-7.10/?q=drupalgap" | |||
} | |||
|
|||
$('#drupalgap_dashboard').live('pageshow',function(){ | |||
drupalgap_services_system_connect(); | |||
}); | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
function drupalgap_services_system_connect () { | |||
var system_connect_url = drupalgap_settings.services_endpoint_default + "/system/connect.json"; | |||
console.log(system_connect_url); | |||
try { | |||
$.ajax({ | |||
url: system_connect_url, | |||
type: 'post', | |||
dataType: 'json', | |||
error: function (XMLHttpRequest, textStatus, errorThrown) { | |||
alert('drupalgap_services_system_connect - failed to connect'); | |||
console.log("drupalgap_services_system_connect"); | |||
console.log(JSON.stringify(XMLHttpRequest)); | |||
console.log(JSON.stringify(textStatus)); | |||
console.log(JSON.stringify(errorThrown)); | |||
}, | |||
success: function (data) { | |||
var drupal_user = data.user; | |||
if (drupal_user.uid == 0) { // user is not logged in, show the login button, hide the logout button | |||
$('#drupalgap_button_user_login').show(); | |||
$('#drupalgap_button_user_logout').hide(); | |||
} | |||
else { // user is logged in, hide the login button, show the logout button | |||
$('#drupalgap_button_user_login').hide(); | |||
$('#drupalgap_button_user_logout').show(); | |||
} | |||
} | |||
}); | |||
} | |||
catch (error) { | |||
alert("drupalgap_services_system_connect - " + error); | |||
consoloe.log("drupalgap_services_system_connect - " + error); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>DrupalGap</title> | |||
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script> | |||
<link rel="stylesheet" href="jquery.mobile-1.0.min.css" /> | |||
<script src="jquery-1.6.4.min.js"></script> | |||
<script src="jquery.mobile-1.0.min.js"></script> | |||
<script src="drupalgap/services/system.js"></script> | |||
<script src="drupalgap/drupalgap.js"></script> | |||
</head> | |||
<body> | |||
<div data-role="page" id="drupalgap_dashboard"> | |||
<div data-role="header"> | |||
<h1>DrupalGap</h1> | |||
</div><!-- /header --> | |||
<div data-role="content"> | |||
<p><a href="#" data-role="button" id="drupalgap_button_user_login">Login</a></p> | |||
<p><a href="#" data-role="button" id="drupalgap_button_user_logout">Logout</a></p> | |||
</div><!-- /content --> | |||
</div><!-- /page --> | |||
</body> | |||
</html> |