Skip to content

Commit

Permalink
Updated for Florida DrupalCamp Version
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflinwood committed Feb 11, 2012
1 parent fea7d6e commit ce5951c
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions www/index.html
Expand Up @@ -19,6 +19,8 @@
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
<script type="text/javascript" charset="utf-8" src="drupal-phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.activity-indicator-1.0.0.min.js"></script>

<script type="text/javascript">


Expand Down Expand Up @@ -79,13 +81,15 @@
$('#take-picture-button').live('tap',function(event, ui) {
navigator.camera.getPicture(captureSuccess,
captureError,
{quality:50});
{quality:30,
destinationType:navigator.camera.DestinationType.DATA_URL});

});
$('#upload-photo-button').live('tap',function(event, ui) {
navigator.camera.getPicture(captureSuccess,
captureError,
{quality:50,
destinationType:navigator.camera.DestinationType.DATA_URL,
sourceType:navigator.camera.PictureSourceType.PHOTOLIBRARY});

});
Expand All @@ -108,6 +112,7 @@

var loadFrontPage = function(result) {
$('#frontPageArticles').html("");
$('#home').activity();
window.plugins.drupal.viewGet("frontpage",frontPageSuccess,failureCallback);
}
var loadAllContent = function(result) {
Expand All @@ -116,6 +121,7 @@
}
var articleSaveSuccess = function(result) {
//refresh the list of articles
$('#home').activity(false);
loadFrontPage();
}
var articleDeleteSuccess = function(result) {
Expand All @@ -138,6 +144,8 @@
}

var captureSuccess = function(imageData) {
$('#home').activity();

var file = {
file: imageData,
filename: 'file1.jpg',
Expand All @@ -154,10 +162,9 @@
return false;
}
var savePictureNode = function(result) {
console.log(result);
var node = {
title: "Camera Picture",
type: 'product',
type: 'article',
body: {
und: [{
value: " "
Expand All @@ -175,14 +182,25 @@
return false;
}
var captureError = function(result) {
$('#home').activity(false);

console.log(result);
}

var frontPageSuccess = function(result) {

$('#home').activity(false);

var nodes = result.view;
for (var i = 0; i < nodes.length; i++) {
var html = "<li data-nid='" + nodes[i].nid + "'><a href='#'>" + nodes[i].title + "</a></li>";
var imgHtml = "";
var imageUri = nodes[i].field_image.und[0].uri;
if(imageUri) {
console.log('imageUri:'+imageUri);
var publicImageUri = imageUri.replace("public://","http://YOURDRUPALSITE.com/sites/default/files/styles/large/public/");
console.log('publicImageUri:'+publicImageUri);
imgHtml = "<img src='" + publicImageUri + "'>";
}
var html = "<li data-nid='" + nodes[i].nid + "'><a href='#'>" + imgHtml + "<h3>" + nodes[i].title + "</h3></a></li>";
$(html).appendTo( '#frontPageArticles' );
}
$('#frontPageArticles').listview('refresh');
Expand All @@ -204,31 +222,43 @@
}

var articleSuccess = function(result) {

$("#article").jqmData('nid',result.nid);
$("#articleTitle").html(result.title);
$("#articleContent").html(result.body.und[0].safe_value);
var imageUri = result.field_image.und[0].uri;
if(imageUri) {
console.log('imageUri:'+imageUri);
var publicImageUri = imageUri.replace("public://","http://dev.mobileapp.gotpantheon.com/sites/default/files/styles/large/public/");
console.log('publicImageUri:'+publicImageUri);
var imgHtml = "<img src='" + publicImageUri + "'>";
console.log(imgHtml);
$("#articleContent").html(imgHtml);
}
$.mobile.changePage("#article");
console.log(result.body.und[0]);
}
var failureCallback = function(result) {
$('#home').activity(false);

console.log(result);
}
</script>
</head>
<body onload="onBodyLoad()">
<div data-role="page" id="home">
<div data-role="header">
<a href="#add-article">Add</a>
<a href="#add-article" data-role="button" data-icon="plus">Add</a>
<h1>Home</h1>
<a href="#settings" data-role="button">
Settings
</a>
</div>
<div data-role="content" id="frontPageContent">
<ul data-role="listview" id="frontPageArticles" data-theme="b">
<ul data-role="listview" id="frontPageArticles" data-theme="f">
</ul>
</div>
<div data-role="footer">
<div data-role="footer" data-position="fixed">
<a href="#all-content" data-role="button">All Content</a>
<a id="take-picture-button" href="#" data-role="button">Take Picture</a>
<a id="upload-photo-button" href="#" data-role="button">Upload Photo</a>
Expand Down

0 comments on commit ce5951c

Please sign in to comment.