Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
pbuyle committed Jan 7, 2011
0 parents commit 63e102b
Show file tree
Hide file tree
Showing 39 changed files with 15,944 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .classpath
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/phonegap-0.9.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
33 changes: 33 additions & 0 deletions .project
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DrupalGeoPicture</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
#Thu Dec 30 10:17:32 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5
36 changes: 36 additions & 0 deletions AndroidManifest.xml
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.buyle.phonegap.drupal.geopicture" android:versionCode="1"
android:versionName="1.0">
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:resizeable="true" android:anyDensity="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".App" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>




</manifest>
110 changes: 110 additions & 0 deletions assets/www/drupal.js
@@ -0,0 +1,110 @@
/*
* Drupal GeoPicture. A simple Drupal picture uploader for Android.
* Copyright (C) 2011 Pierre Buyle
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Drupal = (function($){
var POST = function(path, data, onSuccess, onError) {
$.ajax({
type: "POST",
url: Drupal.base_url + path,
data: JSON.stringify(data),
dataType: 'json',
contentType: 'application/json',
success: onSuccess,
error: onError,
});
};

var chain = function() {
var functions = Array.prototype.slice.call(arguments);
return function(){
for (i=0;(i<functions.length);i++) {
functions[i].apply(this, arguments);
}
}
};

var action = function(path, params, onSuccess, onError) {
return function() {
var data = {};
for (i=0;(i<params.length);i++) {
var p = params[i];
data[p] = arguments[i];
}
if(typeof onSuccess !== 'function') {

}
$.ajax({
type: "POST",
url: Drupal.base_url + path,
data: JSON.stringify(data),
dataType: 'json',
contentType: 'application/json',
success: chain(onSuccess || $.noop, arguments[i] || $.noop),
error: chain(onError || $.noop, arguments[i+1] || $.noop),
});
}
}

return {
base_url: '',
initialize: function(baseUrl, onSuccess, onError) {
Drupal.base_url = baseUrl || Drupal.base_url;
Drupal.system.connect(chain(function(){
if(Drupal.user.is_logged_in()) {
$(document).trigger('DrupalLogin', Drupal.user.current);
}
}, onSuccess || $.noop), onError || $.noop);
},
user: {
current: {uid:0},
is_logged_in: function() {
return parseInt(Drupal.user.current.uid) != 0;
},
login: action('api/user/login', ['name', 'pass'], function(data) {
Drupal.user.current = data.user;
Drupal.session = {id: data.sessid, name: data.session_name};
$(document).trigger('DrupalLogin', Drupal.user.current);
}, function(xhr, textStatus, error) {
alert(textStatus);
}),
logout: action('api/user/logout', [], function(data) {
delete Drupal.user.current;
Drupal.system.connect(function(){
$(document).trigger('DrupalLogout');
}, function(){
$(document).trigger('DrupalLogout');
});
}),
},
system: {
connect: action('api/system/connect', [], function(data){
Drupal.user.current = data.user;
Drupal.session = {id: data.sessid};
}),
},
file: {
create: function(file, callback) {
POST('api/file', {file: file}, callback);
}
},
node: {
create: function(node, callback) {
POST('api/node', {node: node}, callback);
}
}
};
})(jQuery);
Binary file added assets/www/images/ajax-loader.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/entry_no_icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/form-check-off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/form-check-on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/form-radio-off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/form-radio-on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/icon-search-black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/icons-18-black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/icons-18-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/icons-36-black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/www/images/icons-36-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions assets/www/index.css
@@ -0,0 +1,21 @@
/* Drupal GeoPicture. A simple Drupal picture uploader for Android.*/
/* Copyright (C) 2011 Pierre Buyle*/
/**/
/* This program is free software: you can redistribute it and/or modify*/
/* it under the terms of the GNU Affero General Public License as*/
/* published by the Free Software Foundation, either version 3 of the*/
/* License, or (at your option) any later version.*/
/**/
/* This program is distributed in the hope that it will be useful,*/
/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/
/* GNU Affero General Public License for more details.*/
/**/
/* You should have received a copy of the GNU Affero General Public License*/
/* along with this program. If not, see <http://www.gnu.org/licenses/>.*/
#picture {
max-width: 100%;
min-width: 128px;
min-height: 128px;
background-color: transparent;
}
112 changes: 112 additions & 0 deletions assets/www/index.html
@@ -0,0 +1,112 @@
<!DOCTYPE HTML>
<html>
<!--
Drupal GeoPicture. A simple Drupal picture uploader for Android.
Copyright (C) 2011 Pierre Buyle
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<head>
<title>PhoneGap</title>
<link rel="stylesheet" href="jquery.mobile-1.0a2.min.css" />
<link rel="stylesheet" href="index.css" type="text/css">
<script src="jquery-1.4.4.min.js"></script>
<script src="jquery.mobile-1.0a2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-0.9.3.js"></script>
<script type="text/javascript" charset="utf-8" src="drupal.js"></script>
<script type="text/javascript" charset="utf-8" src="index.js"></script>
</head>
<body>

<div data-role="page" data-theme="a" id="home">
<div data-role="header"><h1>GeoPicture</h1><a id="options-button" href="#options" data-icon="gear" class="ui-btn-right">Options</a></div>
<div data-role="content">
<div data-role="">
<label for="title">Title</label>
<input type="text" name="title" id="title" value=""/>
</div>
<div>
<label for="picture">Picture</label>
<a href="#" id="get-picture" data-role="button" ><img id="picture" src="images/entry_no_icon.png"/></a>
</div>
<div data-role="">
<label for="body">Description</label>
<textarea cols="40" rows="8" name="body" id="body"></textarea>
</div>
<div data-role="">
<label for="location-summary">Location</label>
<input type="text" name="location-summary" id="location-summary" value="" />
</div>
<a id="post" data-role="button" href="#">Post</a>
</div>
</div>
<div data-role="page" data-theme="a" id="options">
<div data-role="header"><h1>Options</h1></div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="name">Username</label>
<input type="text" name="name" id="name" data-storage-key="username" value="" />
<label for="password">Password</label>
<input type="password" name="password" id="password" data-storage-key="password" value="" />
<a id="login" data-role="button">Login</a>
<a id="logout" data-role="button" style="display: none">Logout</a>
</div>
</div>
</div>
<div data-role="page" data-theme="a" id="location">
<div data-role="header"><h1>Location</h1></div>
<div data-role="content">
<div data-role="">
<a id="location-refresh" data-icon="refresh" data-role="button" class="ui-btn-right">Refresh current location</a>
</div><div data-role="">
<label for="street">Street</label>
<input type="text" name="street" id="street" value="" />
</div><div data-role="">
<label for="city">City</label>
<input type="text" name="city" id="city" value="" />
</div><div data-role="">
<label for="province">Province</label>
<input type="text" name="province" id="province" value="" />
</div><div data-role="">
<label for="postal_code">Postal code</label>
<input type="text" name="postal_code" id="postal_code" value="" />
</div><div data-role="">
<label for="latitude">Latitude</label>
<input type="text" name="latitude" id="latitude" value="" />
</div><div data-role="">
<label for="longitude">Longitude</label>
<input type="text" name="longitude" id="longitude" value="" />
</div>
</div>
</div>
<div data-role="dialog" data-theme="a" id="get-picture-from-device">
<div data-role="header"><h1>Picture</h1></div>
<div data-role="content">
<div data-role="controlgroup">
<a data-picture-source="CAMERA" data-role="button" href="#">Take picture</a>
<a data-picture-source="PHOTOLIBRARY" data-role="button" href="#">Use picture from album</a>
</div>
</div>
</div>
<div data-role="dialog" data-theme="a" id="get-picture-from-file">
<div data-role="header"><h1>Picture</h1></div>
<div data-role="content">
<input type="file" accept="image/gif, image/jpeg, image/png" name="picture-file" id="picture-file"></input>
<a href="#" data-role="button" data-icon="check">Ok</a>
</div>
</div>
<canvas id="picture-canvas"></canvas>
</body>
</html>

0 comments on commit 63e102b

Please sign in to comment.