You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by pr...@apache.org on 2012/08/02 18:34:02 UTC
svn commit: r1368640 - in /incubator/photark/mobile/trunk: ./ assets/www/
assets/www/scripts/
Author: prabhathp
Date: Thu Aug 2 18:34:02 2012
New Revision: 1368640
URL: http://svn.apache.org/viewvc?rev=1368640&view=rev
Log:
mapping and geolocation capabilitis + some bug fixes
Added:
incubator/photark/mobile/trunk/assets/www/scripts/MapView.js
incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.js
incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.services.js
Modified:
incubator/photark/mobile/trunk/AndroidManifest.xml
incubator/photark/mobile/trunk/assets/www/index.html
incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js
incubator/photark/mobile/trunk/assets/www/scripts/search.js
incubator/photark/mobile/trunk/assets/www/scripts/utils.js
Modified: incubator/photark/mobile/trunk/AndroidManifest.xml
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/AndroidManifest.xml?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/AndroidManifest.xml (original)
+++ incubator/photark/mobile/trunk/AndroidManifest.xml Thu Aug 2 18:34:02 2012
@@ -29,7 +29,8 @@
android:label="@string/app_name" >
<activity
android:name=".PhotArkMobileActivity"
- android:label="@string/app_name" >
+ android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -39,4 +40,4 @@
</application>
-</manifest>
\ No newline at end of file
+</manifest>
Modified: incubator/photark/mobile/trunk/assets/www/index.html
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/index.html?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/index.html (original)
+++ incubator/photark/mobile/trunk/assets/www/index.html Thu Aug 2 18:34:02 2012
@@ -20,10 +20,14 @@
<script type="text/javascript" src="scripts/cdv-plugin-fb-connect.js"></script><!--Facebook Connect Plugin-->
<script type="text/javascript" src="scripts/facebook_js_sdk.js"></script><!--Facebook JS SDK-->
<script type="text/javascript" charset="utf-8" src="scripts/contacts.js" ></script>
- <script type="text/javascript" charset="utf-8" src="scripts/geoLocation.js" ></script>
<script type="text/javascript" charset="utf-8" src="scripts/utils.js" ></script>
<script type="text/javascript" charset="utf-8" src="scripts/dataAccess.js"></script>
<script type="text/javascript" charset="utf-8" src="scripts/search.js"></script>
+ <script type="text/javascript" charset="utf-8" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true"></script>
+ <script type="text/javascript" charset="utf-8" src="scripts/geoLocation.js" ></script>
+ <script type="text/javascript" charset="utf-8" src="scripts/jquery.ui.map.js"></script>
+ <script type="text/javascript" charset="utf-8" src="scripts/jquery.ui.map.services.js"></script>
+ <script type="text/javascript" charset="utf-8" src="scripts/MapView.js"></script>
<script type="text/javascript">
var pictureSource;
// picture source
@@ -46,12 +50,30 @@
});
getLocation();
openDB();
- windowWidth=$(window).width();
- windowHeight=$(window).height();
- document.getElementById('largeImage').width=windowWidth;
- //3:4 is the most common aspect ratio
- document.getElementById('largeImage').height=windowWidth*(3/4);
+ //Screen orientation changed
+ $(window).bind( 'orientationchange', function(e){
+ if ($.event.special.orientationchange.orientation() == "portrait") {
+ adjustScreenLayout();
+ } else {
+ adjustScreenLayout();
+ }
+ });
+ adjustScreenLayout();
+
+ //To handle menu button clicks
+ document.addEventListener("menubutton", onMenuClick, false);
+
+ //Auto complete feature of location
+ var options = {
+ types: ['(cities)']
+ };
+
+ var autocomplete = new google.maps.places.Autocomplete($("#editLocation")[0], options);
+ google.maps.event.addListener(autocomplete, 'place_changed', function() {
+ var place = autocomplete.getPlace();
+ console.log(place.address_components);
+ });
}
//Document ready function
@@ -92,7 +114,6 @@
dateOrder : 'yymmdd',
dateFormat : "yy-mm-dd"
});
-
});
@@ -115,12 +136,13 @@
$('#toolbar').listview("create");
uri= imageURI;
window.resolveLocalFileSystemURI(imageURI, onFileEntryComplete, isFail);
- viewData();
+ viewData(imageURI);
$('#largeImage').click(function() { fullScreen(largeImage.src); });
}
function photoCaptureSuccess (uri) {
onPhotoURISuccess(uri);
+ clearMetadata();
$.mobile.changePage("#ConfirmLocation");
}
@@ -180,6 +202,9 @@
loc= $("#editLocation").val();
people=$("#editPeople").val().split(",");
description=$("#editDiscription").val();
+ if(loc!=""){
+ adressToCoordinate(loc);
+ }
updateDB();
}
@@ -197,6 +222,20 @@
};
$("#editPeople").val(s);
});
+
+ function clearMetadata(){
+ $("#nickName").val("Not defined");
+ $("#editDate").val("");
+ $("#editTime").val("");
+ $("#editLocation").val("");
+ $("#editDiscription").val("");
+ $("#editPeople").val("");
+ }
+
+ function onMenuClick(){
+ $.mobile.changePage("#optionMenu");
+ }
+
</script>
</head>
<body>
@@ -225,9 +264,6 @@
<li data-icon="arrow-r" >
<a href="#imageInfo" data-rel="dialog" data-transition="pop">Image Info</a>
</li>
- <li data-icon="arrow-r" >
- <a href="#help" data-rel="dialog" data-transition="pop">Help</a>
- </li>
</ul>
<!-- This is not visible
@@ -280,6 +316,10 @@
id="editTime" value="" onclick='editTimeOnClick($("#editTime"))' />
</div>
<div data-role="fieldcontain">
+ <label for="textarea"> Location </label>
+ <input type="text" name="searchbox" id="editLocation" value="" />
+ </div>
+ <div data-role="fieldcontain">
<label for="textarea"> People: </label>
<textarea cols="40" rows="8" name="textarea" id="editPeople"></textarea>
<a href="#ContactsPage" data-role="button" data-theme="a" data-mini="true">Browse</a>
@@ -289,10 +329,6 @@
<label for="textarea"> Discription </label>
<textarea cols="40" rows="8" name="textarea" id="editDiscription"></textarea>
</div>
- <div data-role="fieldcontain">
- <label for="search"> Location </label>
- <input type="text" name="searchbox" id="editLocation" value="" />
- </div>
</div>
<div data-role="footer" data-position="fixed" style="text-align: center">
<a href="index.html" data-icon="check" onclick="save()">Save</a>
@@ -456,6 +492,10 @@
<div id="metadata">
<p>Capture or open a photo to view data.</p>
</div>
+ <div id="infoControlls">
+ <a href="#mapView"
+ data-role="button" data-mini="true" data-icon="star" onclick=''>Show in Map</a>
+ </div>
</div>
</div>
<!-- Page End -->
@@ -479,6 +519,41 @@
</div>
</div>
<!-- Page End -->
+
+ <!-- Map View-->
+ <div id="mapView" data-role="page">
+ <div data-role="header">
+ <a href="index.html" data-icon="delete">Back</a>
+ <h1>Map View</h1>
+ </div>
+ <div data-role="content">
+ <div class="item rounded dark">
+ <div id="map_canvas" align="center"></div>
+ </div>
+ </div>
+ </div>
+ <!-- Page End -->
+
+ <!-- options menu page-->
+ <div id="optionMenu" data-role="dialog">
+ <div data-role="header">
+ <h1>Menu</h1>
+ </div>
+ <div data-role="content">
+ <div id="options">
+ <a href="#"
+ data-role="button" data-mini="false" data-icon="grid" onclick='viewAllImages()'>View all photos</a>
+ <a href="#mapView"
+ data-role="button" data-mini="false" data-icon="grid" onclick=''>View all in map</a>
+ <a href="#help"
+ data-role="button" data-mini="false" data-icon="info" onclick=''>Help</a>
+ <a href="#"
+ data-role="button" data-mini="false" data-icon="back" onclick='navigator.app.exitApp()'>Exit</a>
+ </div>
+ </div>
+ </div>
+ <!-- Page End -->
+
</body>
</html>
Added: incubator/photark/mobile/trunk/assets/www/scripts/MapView.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/MapView.js?rev=1368640&view=auto
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/MapView.js (added)
+++ incubator/photark/mobile/trunk/assets/www/scripts/MapView.js Thu Aug 2 18:34:02 2012
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+
+$('#mapView').live("pageshow", function() {
+ if (getLocation() != "" && getLocation() != "undefined" && !(typeof(getLocation()) === 'undefined')) {
+ var geocoder2 = new google.maps.Geocoder();
+ geocoder2.geocode({'address': getLocation()}, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK) {
+ $('#map_canvas').gmap({'center': new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()), 'zoom': 10, 'disableDefaultUI':true, 'callback': function() {
+ var self = this;
+ self.addMarker({'position': this.get('map').getCenter() }).click(function() {
+ self.openInfoWindow({ 'content': 'Hello World!' }, this);
+ });
+ }});
+ } else {
+ alert(address + " cannot be found on Google Maps. Map view will be not available for this photo.");
+ }
+ });
+
+ }else {
+ alert('Location not defined!');
+ $.mobile.changePage("#main");
+ }
+
+});
\ No newline at end of file
Modified: incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js Thu Aug 2 18:34:02 2012
@@ -29,7 +29,6 @@ var db;
var clause;
var result=new Array();
-
function getNickname(){
return nickname;
}
@@ -58,6 +57,8 @@ function getURI() {
return uri;
}
+
+
function openDB() {
db = window.openDatabase("photark", "1.0", "DB", 1000000);
db.transaction(populateDB, errorCB, successCB);
@@ -116,7 +117,7 @@ function updateDB(){
db.transaction(insertToDB, errorCB, successCB);
}
-function insertToDB(tx) {
+function insertToDB(tx) {
alert('REPLACE INTO MAIN (uri,nickname, date,time,location,description) VALUES ("'+uri+'","'+nickname+'","'+date+'","'+time+'","'+loc+'","'+description+'")');
tx.executeSql('REPLACE INTO MAIN (uri,nickname, date,time,location,description) VALUES ("'+uri+'","'+nickname+'","'+date+'","'+time+'","'+loc+'","'+description+'")');
for (var i = 0; i < people.length; i++) {
@@ -159,3 +160,7 @@ function searchSuccess(tx, results) {
+
+
+
+
Modified: incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js Thu Aug 2 18:34:02 2012
@@ -22,7 +22,8 @@ var pos;
function onGeoSuccess(position) {
pos=position;
- alert( 'Location success' );
+ alert( 'Location success: '+pos.coords.latitude+","+ pos.coords.longitude);
+ updateLocation();
}
@@ -42,10 +43,42 @@ function getGeoLocation(){
}
function addLocation(){
- $.mobile.showPageLoadingMsg("b", "Location Updating", false);
+ $.mobile.showPageLoadingMsg();
getGeoLocation();
-// updateLocation();
- $.mobile.changePage("#main");
+}
+
+
+function updateLocation(){
+ var latlng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude);
+ //var latlng = new google.maps.LatLng(6.9167,79.8333);
+ var geocoder = new google.maps.Geocoder();
+ geocoder.geocode({'latLng': latlng}, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK) {
+ var address= (results[0].formatted_address);
+ loc = address;
+ updateDB();
+ alert("Location updated:"+address);
+ } else {
+ alert("Geocoder failed due to: " + status);
+ }
+ });
$.mobile.hidePageLoadingMsg();
-
-}
\ No newline at end of file
+ $.mobile.changePage("#main");
+}
+
+function adressToCoordinate(address) {
+ var loc;
+ var geocoder = new google.maps.Geocoder();
+ geocoder.geocode({'address': address}, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK) {
+ lat=results[0].geometry.location.lat();
+ long=results[0].geometry.location.lng();
+
+ alert(lat+","+long);
+ } else {
+ alert(address + " cannot be found on Google Maps. Map view will be not available for this photo.");
+ }
+ });
+}
+
+
Added: incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.js?rev=1368640&view=auto
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.js (added)
+++ incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.js Thu Aug 2 18:34:02 2012
@@ -0,0 +1,373 @@
+ /*!
+ * jQuery FN Google Map 3.0-rc
+ * http://code.google.com/p/jquery-ui-map/
+ * Copyright (c) 2010 - 2012 Johan Säll Larsson
+ * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+ */
+( function($) {
+
+ /**
+ * @param name:string
+ * @param prototype:object
+ */
+ $.a = function(name, prototype) {
+
+ var namespace = name.split('.')[0];
+ name = name.split('.')[1];
+
+ $[namespace] = $[namespace] || {};
+ $[namespace][name] = function(options, element) {
+ if ( arguments.length ) {
+ this._setup(options, element);
+ }
+ };
+
+ $[namespace][name].prototype = $.extend({
+ 'namespace': namespace,
+ 'pluginName': name
+ }, prototype);
+
+ $.fn[name] = function(options) {
+
+ var isMethodCall = typeof options === "string",
+ args = Array.prototype.slice.call(arguments, 1),
+ returnValue = this;
+
+ if ( isMethodCall && options.substring(0, 1) === '_' ) {
+ return returnValue;
+ }
+
+ this.each(function() {
+ var instance = $.data(this, name);
+ if (!instance) {
+ instance = $.data(this, name, new $[namespace][name](options, this));
+ }
+ if (isMethodCall) {
+ returnValue = instance[options].apply(instance, args);
+ }
+ });
+
+ return returnValue;
+
+ };
+
+ };
+
+ $.a('ui.gmap', {
+
+ /**
+ * Map options
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#MapOptions
+ */
+ options: {
+ mapTypeId: 'roadmap',
+ zoom: 5
+ },
+
+ /**
+ * Get or set options
+ * @param key:string
+ * @param options:object
+ * @return object
+ */
+ option: function(key, options) {
+ if (options) {
+ this.options[key] = options;
+ this.get('map').set(key, options);
+ return this;
+ }
+ return this.options[key];
+ },
+
+ /**
+ * Setup plugin basics,
+ * @param options:object
+ * @param element:node
+ */
+ _setup: function(options, element) {
+ this.el = element;
+ options = options || {};
+ jQuery.extend(this.options, options, { 'center': this._latLng(options.center) });
+ this._create();
+ if ( this._init ) { this._init(); }
+ },
+
+ /**
+ * Instanciate the Google Maps object
+ */
+ _create: function() {
+ var self = this;
+ this.instance = { 'map': new google.maps.Map(self.el, self.options), 'markers': [], 'overlays': [], 'services': [] };
+ google.maps.event.addListenerOnce(self.instance.map, 'bounds_changed', function() { $(self.el).trigger('init', self.instance.map); });
+ self._call(self.options.callback, self.instance.map);
+ },
+
+ /**
+ * Adds a latitude longitude pair to the bounds.
+ * @param position:google.maps.LatLng/string
+ */
+ addBounds: function(position) {
+ var bounds = this.get('bounds', new google.maps.LatLngBounds());
+ bounds.extend(this._latLng(position));
+ this.get('map').fitBounds(bounds);
+ return this;
+ },
+
+ /**
+ * Helper function to check if a LatLng is within the viewport
+ * @param marker:google.maps.Marker
+ */
+ inViewport: function(marker) {
+ var bounds = this.get('map').getBounds();
+ return (bounds) ? bounds.contains(marker.getPosition()) : false;
+ },
+
+ /**
+ * Adds a custom control to the map
+ * @param panel:jquery/node/string
+ * @param position:google.maps.ControlPosition
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#ControlPosition
+ */
+ addControl: function(panel, position) {
+ this.get('map').controls[position].push(this._unwrap(panel));
+ return this;
+ },
+
+ /**
+ * Adds a Marker to the map
+ * @param markerOptions:google.maps.MarkerOptions
+ * @param callback:function(map:google.maps.Map, marker:google.maps.Marker) (optional)
+ * @return $(google.maps.Marker)
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#MarkerOptions
+ */
+ addMarker: function(markerOptions, callback) {
+ markerOptions.map = this.get('map');
+ markerOptions.position = this._latLng(markerOptions.position);
+ var marker = new (markerOptions.marker || google.maps.Marker)(markerOptions);
+ var markers = this.get('markers');
+ if ( marker.id ) {
+ markers[marker.id] = marker;
+ } else {
+ markers.push(marker);
+ }
+ if ( marker.bounds ) {
+ this.addBounds(marker.getPosition());
+ }
+ this._call(callback, markerOptions.map, marker);
+ return $(marker);
+ },
+
+ /**
+ * Clears by type
+ * @param ctx:string e.g. 'markers', 'overlays', 'services'
+ */
+ clear: function(ctx) {
+ this._c(this.get(ctx));
+ this.set(ctx, []);
+ return this;
+ },
+
+ _c: function(obj) {
+ for ( var property in obj ) {
+ if ( obj.hasOwnProperty(property) ) {
+ if ( obj[property] instanceof google.maps.MVCObject ) {
+ google.maps.event.clearInstanceListeners(obj[property]);
+ if ( obj[property].setMap ) {
+ obj[property].setMap(null);
+ }
+ } else if ( obj[property] instanceof Array ) {
+ this._c(obj[property]);
+ }
+ obj[property] = null;
+ }
+ }
+ },
+
+ /**
+ * Returns the objects with a specific property and value, e.g. 'category', 'tags'
+ * @param ctx:string in what context, e.g. 'markers'
+ * @param options:object property:string the property to search within, value:string, operator:string (optional) (AND/OR)
+ * @param callback:function(marker:google.maps.Marker, isFound:boolean)
+ */
+ find: function(ctx, options, callback) {
+ var obj = this.get(ctx);
+ options.value = $.isArray(options.value) ? options.value : [options.value];
+ for ( var property in obj ) {
+ if ( obj.hasOwnProperty(property) ) {
+ var isFound = false;
+ for ( var value in options.value ) {
+ if ( $.inArray(options.value[value], obj[property][options.property]) > -1 ) {
+ isFound = true;
+ } else {
+ if ( options.operator && options.operator === 'AND' ) {
+ isFound = false;
+ break;
+ }
+ }
+ }
+ callback(obj[property], isFound);
+ }
+ }
+ return this;
+ },
+
+ /**
+ * Returns an instance property by key. Has the ability to set an object if the property does not exist
+ * @param key:string
+ * @param value:object(optional)
+ */
+ get: function(key, value) {
+ var instance = this.instance;
+ if ( !instance[key] ) {
+ if ( key.indexOf('>') > -1 ) {
+ var e = key.replace(/ /g, '').split('>');
+ for ( var i = 0; i < e.length; i++ ) {
+ if ( !instance[e[i]] ) {
+ if (value) {
+ instance[e[i]] = ( (i + 1) < e.length ) ? [] : value;
+ } else {
+ return null;
+ }
+ }
+ instance = instance[e[i]];
+ }
+ return instance;
+ } else if ( value && !instance[key] ) {
+ this.set(key, value);
+ }
+ }
+ return instance[key];
+ },
+
+ /**
+ * Triggers an InfoWindow to open
+ * @param infoWindowOptions:google.maps.InfoWindowOptions
+ * @param marker:google.maps.Marker (optional)
+ * @param callback:function (optional)
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#InfoWindowOptions
+ */
+ openInfoWindow: function(infoWindowOptions, marker, callback) {
+ var iw = this.get('iw', infoWindowOptions.infoWindow || new google.maps.InfoWindow);
+ iw.setOptions(infoWindowOptions);
+ iw.open(this.get('map'), this._unwrap(marker));
+ this._call(callback, iw);
+ return this;
+ },
+
+ /**
+ * Triggers an InfoWindow to close
+ */
+ closeInfoWindow: function() {
+ if ( this.get('iw') != null ) {
+ this.get('iw').close();
+ }
+ return this;
+ },
+
+ /**
+ * Sets an instance property
+ * @param key:string
+ * @param value:object
+ */
+ set: function(key, value) {
+ this.instance[key] = value;
+ return this;
+ },
+
+ /**
+ * Refreshes the map
+ */
+ refresh: function() {
+ var map = this.get('map');
+ var latLng = map.getCenter();
+ $(map).triggerEvent('resize');
+ map.setCenter(latLng);
+ return this;
+ },
+
+ /**
+ * Destroys the plugin.
+ */
+ destroy: function() {
+ this.clear('markers').clear('services').clear('overlays')._c(this.instance);
+ jQuery.removeData(this.el, this.name);
+ },
+
+ /**
+ * Helper method for calling a function
+ * @param callback
+ */
+ _call: function(callback) {
+ if ( callback && $.isFunction(callback) ) {
+ callback.apply(this, Array.prototype.slice.call(arguments, 1));
+ }
+ },
+
+ /**
+ * Helper method for google.maps.Latlng
+ * @param latLng:string/google.maps.LatLng
+ */
+ _latLng: function(latLng) {
+ if ( !latLng ) {
+ return new google.maps.LatLng(0.0, 0.0);
+ }
+ if ( latLng instanceof google.maps.LatLng ) {
+ return latLng;
+ } else {
+ latLng = latLng.replace(/ /g,'').split(',');
+ return new google.maps.LatLng(latLng[0], latLng[1]);
+ }
+ },
+
+ /**
+ * Helper method for unwrapping jQuery/DOM/string elements
+ * @param obj:string/node/jQuery
+ */
+ _unwrap: function(obj) {
+ return (!obj) ? null : ( (obj instanceof jQuery) ? obj[0] : ((obj instanceof Object) ? obj : $('#'+obj)[0]) )
+ }
+
+ });
+
+ jQuery.fn.extend( {
+
+ triggerEvent: function(eventType) {
+ google.maps.event.trigger(this[0], eventType);
+ return this;
+ },
+
+ addEventListener: function(eventType, eventDataOrCallback, eventCallback) {
+ if ( google.maps && this[0] instanceof google.maps.MVCObject ) {
+ google.maps.event.addListener(this[0], eventType, eventDataOrCallback);
+ } else {
+ if (eventCallback) {
+ this.bind(eventType, eventDataOrCallback, eventCallback);
+ } else {
+ this.bind(eventType, eventDataOrCallback);
+ }
+ }
+ return this;
+ }
+
+ /*removeEventListener: function(eventType) {
+ if ( google.maps && this[0] instanceof google.maps.MVCObject ) {
+ if (eventType) {
+ google.maps.event.clearListeners(this[0], eventType);
+ } else {
+ google.maps.event.clearInstanceListeners(this[0]);
+ }
+ } else {
+ this.unbind(eventType);
+ }
+ return this;
+ }*/
+
+ });
+
+ jQuery.each(('click rightclick dblclick mouseover mouseout drag dragend').split(' '), function(i, name) {
+ jQuery.fn[name] = function(a, b) {
+ return this.addEventListener(name, a, b);
+ }
+ });
+
+} (jQuery) );
\ No newline at end of file
Added: incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.services.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.services.js?rev=1368640&view=auto
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.services.js (added)
+++ incubator/photark/mobile/trunk/assets/www/scripts/jquery.ui.map.services.js Thu Aug 2 18:34:02 2012
@@ -0,0 +1,63 @@
+ /*!
+ * jQuery UI Google Map 3.0-rc
+ * http://code.google.com/p/jquery-ui-map/
+ * Copyright (c) 2010 - 2012 Johan Säll Larsson
+ * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+ *
+ * Depends:
+ * jquery.ui.map.js
+ */
+( function($) {
+
+ $.extend($.ui.gmap.prototype, {
+
+ /**
+ * Computes directions between two or more places.
+ * @param directionsRequest:google.maps.DirectionsRequest
+ * @param directionsRendererOptions:google.maps.DirectionsRendererOptions (optional)
+ * @param callback:function(result:google.maps.DirectionsResult, status:google.maps.DirectionsStatus)
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRequest
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRendererOptions
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsResult
+ */
+ displayDirections: function(directionsRequest, directionsRendererOptions, callback) {
+ var self = this;
+ var directionService = this.get('services > DirectionsService', new google.maps.DirectionsService());
+ var directionRenderer = this.get('services > DirectionsRenderer', new google.maps.DirectionsRenderer());
+ if ( directionsRendererOptions ) {
+ directionRenderer.setOptions(directionsRendererOptions);
+ }
+ directionService.route(directionsRequest, function(results, status) {
+ if ( status === 'OK' ) {
+ directionRenderer.setDirections(results);
+ directionRenderer.setMap(self.get('map'));
+ } else {
+ directionRenderer.setMap(null);
+ }
+ callback(results, status);
+ });
+ },
+
+ /**
+ * Displays the panorama for a given LatLng or panorama ID.
+ * @param panel:jQuery/String/Node
+ * @param streetViewPanoramaOptions:google.maps.StreetViewPanoramaOptions (optional)
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#StreetViewPanoramaOptions
+ */
+ displayStreetView: function(panel, streetViewPanoramaOptions) {
+ this.get('map').setStreetView(this.get('services > StreetViewPanorama', new google.maps.StreetViewPanorama(this._unwrap(panel), streetViewPanoramaOptions)));
+ },
+
+ /**
+ * A service for converting between an address and a LatLng.
+ * @param geocoderRequest:google.maps.GeocoderRequest
+ * @param callback:function(result:google.maps.GeocoderResult, status:google.maps.GeocoderStatus),
+ * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#GeocoderResult
+ */
+ search: function(geocoderRequest, callback) {
+ this.get('services > Geocoder', new google.maps.Geocoder()).geocode(geocoderRequest, callback);
+ }
+
+ });
+
+} (jQuery) );
\ No newline at end of file
Modified: incubator/photark/mobile/trunk/assets/www/scripts/search.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/search.js?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/search.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/search.js Thu Aug 2 18:34:02 2012
@@ -24,6 +24,7 @@ function doSearch(){
var location=$("#searchLocation").val();
var temp=$("#searchPeople").val();
var people=new Array();
+
if(temp!=undefined && temp!=""){
people=temp.split(",");
}
@@ -115,5 +116,9 @@ function selectResult(uri){
}
+function viewAllImages(){
+ searchDB('SELECT * FROM MAIN WHERE nickname LIKE "%";');
+}
+
\ No newline at end of file
Modified: incubator/photark/mobile/trunk/assets/www/scripts/utils.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/utils.js?rev=1368640&r1=1368639&r2=1368640&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/utils.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/utils.js Thu Aug 2 18:34:02 2012
@@ -61,6 +61,19 @@ function scaleImageWidth(maxWidth,width,
}
}
+function adjustScreenLayout() {
+ windowWidth=$(window).width();
+ windowHeight=$(window).height();
+ document.getElementById('largeImage').width=windowWidth;
+ //3:4 is the most common aspect ratio
+ document.getElementById('largeImage').height=windowWidth*(3/4);
+
+ $('#map_canvas').css('width',windowWidth*(7/8));
+ $('#map_canvas').css('height',windowHeight*(5/6));
+ $('#map_canvas').css('margin-left','auto');
+ $('#map_canvas').css('margin-right','auto');
+}
+