Skip to content

Commit

Permalink
Work on mash/hash/cache section.!
Browse files Browse the repository at this point in the history
  • Loading branch information
lsean committed Feb 21, 2012
1 parent 77787c8 commit cd30ab5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
41 changes: 34 additions & 7 deletions client/default/app/controllers/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,39 @@ app.controllers.map = new Ext.Controller({
}
},

getPoints: function(map, callback) {
$fh.act({
act: 'getPoints',
req: {}
}, function(res) {
var mapMarkets = JSON.parse(res);
if (mapMarkets) {
for (var i = 0; i < mapMarkets.points.length; i++) {
var point = mapMarkets.points[i];
var pos = new google.maps.LatLng(point.lat, point.lon);

app.controllers.map.markers.push(new google.maps.Marker({
position: pos,
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000'
}));
}
}

if (typeof callback !== "undefined") {
callback();
}
});
},

getLocation: function(options){
// Instance of the google map
var map = Ext.getCmp("map").map;
var pos = {};

// Show loading spinner
mark.show();

$fh.geo({
interval: 0
}, function(res){
Expand All @@ -24,22 +52,21 @@ app.controllers.map = new Ext.Controller({
// Remove any previously created markers
app.controllers.map.clearMarkers();

// Create a marker
// Create a marker at the current location
app.controllers.map.markers.push(new google.maps.Marker({
position: pos,
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000'
}));

// Get markers from the cloud
app.controllers.map.getPoints(map, function() {
mask.hide()
});
}, function() {
// We failed to get the users geolocation, fallback to geo ip
alert("$fh.geo failed");
alert(JSON.stringify(res.geoip));

/*
$fh.geoip(function(res) {
console.log(JSON.stringify(res.geoip));
});
*/
});
}

Expand Down
18 changes: 15 additions & 3 deletions cloud/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
function getTweets() {
//var url = 'http://api.twitter.com/1/statuses/user_timeline/' + username + '.json?callback=?';
//var url = 'https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=' + username + '&count=' + num_tweets;

var username = 'feedhenry';
var num_tweets = 10;
var url = 'http://search.twitter.com/search.json?q=' + username;
Expand All @@ -11,4 +8,19 @@ function getTweets() {
method: 'GET',
allowSelfSignedCert: true
});
}

function getPoints() {
return {
locations: [
{
lat: '52.245671',
lon: '-7.080002'
},
{
lat: '52.257861',
lon: '-7.136993'
}
]
}
}

0 comments on commit cd30ab5

Please sign in to comment.