Permalink
Browse files

Addresses #2: Adding sample jQuery-mobile and phonegap project from h…

  • Loading branch information...
1 parent 737a8ce commit 2f34520a5e6f77cf920772860d98404d9e99fe83 @evolverine committed May 30, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
View
@@ -0,0 +1,14 @@
+#employeePic {
+ float: left;
+ padding-right: 10px;
+ padding-bottom: 16px;
+}
+
+#employeeDetails p {
+ margin-top: 0px;
+ margin-bottom: 8px;
+}
+
+#actionList {
+ clear: both;
+}
View
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+</head>
+
+<body>
+
+<div id="detailsPage" data-role="page" data-add-back-btn="true">
+
+ <div data-role="header">
+ <h1>Employee Details</h1>
+ </div>
+
+ <div data-role="content">
+
+ <img id="employeePic"/>
+ <div id="employeeDetails">
+ <h3 id="fullName"></h3>
+ <p id="employeeTitle"></p>
+ <p id="city"></p>
+ </div>
+
+ <ul id="actionList" data-role="listview" data-inset="true"></ul>
+
+ </div>
+
+</div>
+
+</body>
+
+</html>
View
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Employee Directory</title>
+<meta name="viewport" content="width=device-width,initial-scale=1"/>
+<link rel="stylesheet" href="css/jquery.mobile-1.0rc1.min.css" />
+<link rel="stylesheet" href="css/styles.css" />
+</head>
+
+<body>
+
+<div id="employeeListPage" data-role="page" >
+
+ <div data-role="header" data-position="fixed">
+ <h1>Employee Directory</h1>
+ </div>
+
+ <div data-role="content">
+ <ul id="employeeList" data-role="listview" data-filter="true"></ul>
+ </div>
+
+</div>
+
+<script src="js/jquery.js"></script>
+<script src="js/jquery.mobile-1.0rc1.min.js"></script>
+<script src="js/employeelist.js"></script>
+<script src="js/employeedetails.js"></script>
+<script src="js/reportlist.js"></script>
+
+</body>
+
+</html>
View
@@ -0,0 +1,50 @@
+$('#detailsPage').live('pageshow', function(event) {
+ var id = getUrlVars()["id"];
+ $.getJSON(serviceURL + 'getemployee.php?id='+id, displayEmployee);
+});
+
+function displayEmployee(data) {
+ var employee = data.item;
+ console.log(employee);
+ $('#employeePic').attr('src', 'pics/' + employee.picture);
+ $('#fullName').text(employee.firstName + ' ' + employee.lastName);
+ $('#employeeTitle').text(employee.title);
+ $('#city').text(employee.city);
+ console.log(employee.officePhone);
+ if (employee.managerId>0) {
+ $('#actionList').append('<li><a href="employeedetails.html?id=' + employee.managerId + '"><h3>View Manager</h3>' +
+ '<p>' + employee.managerFirstName + ' ' + employee.managerLastName + '</p></a></li>');
+ }
+ if (employee.reportCount>0) {
+ $('#actionList').append('<li><a href="reportlist.html?id=' + employee.id + '"><h3>View Direct Reports</h3>' +
+ '<p>' + employee.reportCount + '</p></a></li>');
+ }
+ if (employee.email) {
+ $('#actionList').append('<li><a href="mailto:' + employee.email + '"><h3>Email</h3>' +
+ '<p>' + employee.email + '</p></a></li>');
+ }
+ if (employee.officePhone) {
+ $('#actionList').append('<li><a href="tel:' + employee.officePhone + '"><h3>Call Office</h3>' +
+ '<p>' + employee.officePhone + '</p></a></li>');
+ }
+ if (employee.cellPhone) {
+ $('#actionList').append('<li><a href="tel:' + employee.cellPhone + '"><h3>Call Cell</h3>' +
+ '<p>' + employee.cellPhone + '</p></a></li>');
+ $('#actionList').append('<li><a href="sms:' + employee.cellPhone + '"><h3>SMS</h3>' +
+ '<p>' + employee.cellPhone + '</p></a></li>');
+ }
+ $('#actionList').listview('refresh');
+
+}
+
+function getUrlVars() {
+ var vars = [], hash;
+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+ for(var i = 0; i < hashes.length; i++)
+ {
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+ return vars;
+}
View
@@ -0,0 +1,22 @@
+var serviceURL = "http://localhost/directory/services/";
+
+var employees;
+
+$('#employeeListPage').bind('pageinit', function(event) {
+ getEmployeeList();
+});
+
+function getEmployeeList() {
+ $.getJSON(serviceURL + 'getemployees.php', function(data) {
+ $('#employeeList li').remove();
+ employees = data.items;
+ $.each(employees, function(index, employee) {
+ $('#employeeList').append('<li><a href="employeedetails.html?id=' + employee.id + '">' +
+ '<img src="pics/' + employee.picture + '"/>' +
+ '<h4>' + employee.firstName + ' ' + employee.lastName + '</h4>' +
+ '<p>' + employee.title + '</p>' +
+ '<span class="ui-li-count">' + employee.reportCount + '</span></a></li>');
+ });
+ $('#employeeList').listview('refresh');
+ });
+}
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 2f34520

Please sign in to comment.