diff --git a/api/soundmap.tags.php b/api/soundmap.tags.php
index fe4decd..0480037 100644
--- a/api/soundmap.tags.php
+++ b/api/soundmap.tags.php
@@ -32,7 +32,7 @@ function the_map($css_id = 'map_canvas', $all_markers = FALSE, $options = array(
?>
-
diff --git a/js/soundmap.front.js b/js/soundmap.front.js
index b1c09b6..e614056 100644
--- a/js/soundmap.front.js
+++ b/js/soundmap.front.js
@@ -14,13 +14,17 @@
},
init: function (selector, query){
- this.map = L.map(selector,{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, scrollWheelZoom: false});
- this.layers.SATELLITE = new L.Google();
+ console.log(selector+'.... '+query);
+ //this.map = L.map(selector,{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, scrollWheelZoom: false});
+ L.mapbox.accessToken = 'pk.eyJ1IjoibHJ1bGxvIiwiYSI6ImNpaDUydjdoNTAwd3BzdGx5bGlhOTh6bXYifQ.tE8QgNbVSgwP8V5LnJWA3w';
+ this.map = L.mapbox.map(selector,'lrullo.cih52v78z00v4krkrzge97rgg',{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, scrollWheelZoom: false});
+ /*this.layers.SATELLITE = new L.Google();
this.layers.TERRAIN = new L.Google('TERRAIN');
this.layers.HYBRID = new L.Google('HYBRID');
- this.layers.ROADMAP = new L.Google('ROADMAP');
- this.map.addLayer(this.layers[this.mapType]);
- this.map.addControl(
+ this.layers.ROADMAP = new L.Google('ROADMAP');*/
+ //this.layers.MAPBOX
+ //this.map.addLayer(this.layers[this.mapType]);
+ /*this.map.addControl(
new L.Control.Layers(
{
'Google':this.layers.SATELLITE,
@@ -29,8 +33,8 @@
'Google Roadmap': this.layers.ROADMAP
}, {}
)
- );
- _.bindAll(this);
+ );*/
+ //_.bindAll(this);
options = {
type: 'POST',
@@ -41,8 +45,11 @@
query: query
}
};
+
+ console.log(options);
// Use with PHP's wp_send_json_success() and wp_send_json_error()
$.ajax( options ).done(this.ajaxDone).fail(this.ajaxFail);
+ console.log(this.infos);
},
addMapCallback: function (event, callback){
@@ -50,26 +57,27 @@
},
onMarkerClick: function(event){
+ self = window.Soundmap;
var id = event.target.feature.properties.id;
- this.ajaxMarker = event.target;
- if(this.infos[id]){
- if (!_.isUndefined(this.callbacks.marker_click)){
- this.callbacks.marker_click.apply(this, [this.infos[id], this.ajaxMarker]);
+ self.ajaxMarker = event.target;
+ if(self.infos[id]){
+ if (!_.isUndefined(self.callbacks.marker_click)){
+ self.callbacks.marker_click.apply(self, [self.infos[id], self.ajaxMarker]);
return;
}
}else{
options = {
type: 'POST',
- url: this.ajaxurl,
- context: this,
+ url: self.ajaxurl,
+ context: self,
data: {
action: 'soundmap-get-content',
id: id
}
};
// Use with PHP's wp_send_json_success() and wp_send_json_error()
- $.ajax( options ).done(this.ajaxMarkerClick).fail(this.ajaxFail);
+ $.ajax( options ).done(self.ajaxMarkerClick).fail(self.ajaxFail);
}
},
@@ -92,6 +100,7 @@
},
ajaxDone: function(response){
+ console.log('done'+response);
var self = this;
this.markers = L.geoJson(response.data,{
onEachFeature: function(feature, layer){
@@ -106,7 +115,10 @@
});
$(document).ready(function(){
- //soundmap.initMap();
+ //soundmap.initMap();
+ soundmap.init('map-content','');
+ console.log('document.ready');
});
-}(jQuery));
\ No newline at end of file
+
+}(jQuery));
diff --git a/soundmap.php b/soundmap.php
index 1481721..c386c80 100644
--- a/soundmap.php
+++ b/soundmap.php
@@ -171,9 +171,11 @@ if (!class_exists('Soundmap')){
- Leaflet Google Plugin
- LeafletCSS
*/
- wp_enqueue_script( 'google-maps', 'http://maps.google.com/maps/api/js?v=3.7&sensor=false' ); // Google Maps
- wp_enqueue_script('leafletjs','http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js',array(),'0.7.2',TRUE); // add Leaflet.js
- wp_enqueue_style('leafletcss','http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css',array(),'0.7.2','all'); // add CSS Leaflet
+ //wp_enqueue_script( 'google-maps', 'http://maps.google.com/maps/api/js?v=3.7&sensor=false' ); // Google Maps
+ wp_enqueue_script('mapboxjs','https://api.mapbox.com/mapbox.js/v2.2.4/mapbox.js',array(),'2.2.4',TRUE); // add Leaflet.js
+ //wp_enqueue_script('leafletjs','http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js',array(),'0.7.2',TRUE); // add Leaflet.js
+ wp_enqueue_style('mapboxcss','https://api.mapbox.com/mapbox.js/v2.2.4/mapbox.css',array(),'2.2.4','all'); // add CSS Leaflet
+ //wp_enqueue_style('leafletcss','http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css',array(),'0.7.2','all'); // add CSS Leaflet
wp_enqueue_script('leaflet-plugin-google', plugins_url('js/leaflet/plugins/Google.js', __FILE__), array('leafletjs', 'google-maps'), '0.7.2', TRUE);
}
@@ -374,6 +376,8 @@ if (!class_exists('Soundmap')){
add_action('wp_ajax_soundmap_load_infowindow', array($this, 'load_infowindow'));
add_action('wp_ajax_soundmap-get-markers',array($this, 'soundmap_get_markers'));
+ add_action('wp_ajax_nopriv_soundmap-get-markers',array($this,'soundmap_get_markers'));
+ //add_action('wp_ajax_nopriv_soundmap-get-markers',array($this, 'soundmap_get_markers'));
add_action('wp_ajax_soundmap-get-content',array($this, 'soundmap_get_content'));
@@ -489,10 +493,11 @@ if (!class_exists('Soundmap')){
}
function soundmap_get_markers(){
- if (!isset($_POST['query']))
- wp_send_json_error();
+ /*if (!isset($_POST['query']))
+ wp_send_json_error();*/
$q = $_POST['query'];
+ if (!is_array($q)) {$q=array($q); }
if (is_array($q)){
$options = array(
@@ -524,9 +529,13 @@ if (!class_exists('Soundmap')){
$feature->properties = new stdclass();
$feature->properties->id = $post_id;
$feature->properties->title = $title;
+ /*$feature->properties = array();
+ $feature->properties['title']=$title;
+ $feature->properties['id']=$id;
+ $feature->properties['marker-color']="#ff00ff";*/
+ //$feature->properties['title']="ssss";
$feature_collection->features[] = $feature;
}
-
wp_send_json_success($feature_collection);
}
}
diff --git a/theme/theme_window.php b/theme/theme_window.php
index dabd3a1..bcb2431 100644
--- a/theme/theme_window.php
+++ b/theme/theme_window.php
@@ -9,7 +9,8 @@
autor) && $mark->autor){ ?>
autor; ?>
-
+
+
'); ?>