diff --git a/js/soundmap.add.js b/js/soundmap.add.js index 34c10f1..9652abd 100755 --- a/js/soundmap.add.js +++ b/js/soundmap.add.js @@ -22,17 +22,11 @@ initMap: function(){ this.map = L.map('map_canvas',{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom}); - this.layers.push(new L.Google()); - this.layers.push(new L.Google('TERRAIN')); - this.map.addLayer(this.layers[0]); - this.map.addControl( - new L.Control.Layers( - { - 'Google':this.layers[0], - 'Google Terrain': this.layers[1] - }, {} - ) - ); + L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { + id: 'mapbox.streets', + maxZoom : 18, + accessToken: 'pk.eyJ1IjoibHJ1bGxvIiwiYSI6ImNpaDUydjdoNTAwd3BzdGx5bGlhOTh6bXYifQ.tE8QgNbVSgwP8V5LnJWA3w' + }).addTo(this.map); this.map.addEventListener('click', this.mapClick, this); @@ -42,7 +36,7 @@ this.map.panTo(_latlng); this.marker.addEventListener('dragend', this.markerDrag, this); } - _.bindAll(this); + //_.bindAll(this); this.initEvents(); ; @@ -50,6 +44,8 @@ initEvents: function(){ + console.log('init events'); + //$('#add_files').bind('click', function() {alert('open media file'); }); $('#add_files').bind('click', this.openMediaManager); this.file_frame.on('select',this.mediaSelected, this); $('.delete-att-item').live('click', this.removeMedia); @@ -63,9 +59,21 @@ if ( this.file_frame ){ this.file_frame.open(); return; - }; + } else { + this.file_frame = wp.media.frames.file_frame = wp.media({ + multiple: false, + library: { + type: 'audio' + } + }); + this.file_frame.on('select',this.mediaSelected, this); + this.file_frame.open(); + return; + //console.log('not init file_frame'); + } }, mediaSelected: function(event){ + console.log('media selected'); var attachment = this.file_frame.state().get('selection').first().toJSON(); var _cT = _.template(this.attachTemplate); var _o = _cT({ @@ -76,7 +84,6 @@ id: attachment.id }); $('#soundmap-attachments-list').append(_o); - }, mapClick: function(event){ @@ -99,11 +106,8 @@ }); - - - $(document).ready(function(){ soundmap.initMap(); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/mapa.php b/mapa.php new file mode 100755 index 0000000..1bfea6f --- /dev/null +++ b/mapa.php @@ -0,0 +1,241 @@ +get_walk($id, true); + $walks[] = $walk; + // En el caso del mapa general + if ($id==26) { + $walks[] = $db_helper->get_walk(27,true); + $walks[] = $db_helper->get_walk(28,true); + $walks[] = $db_helper->get_walk(29,true); + $walks[] = $db_helper->get_walk(30,true); + } +} +// fit to location +$fit = false; +if (isset($_GET['fit'])) { + $fit = true; +} + + +?> + + + + + + + + +Rekording - Audio Map + + + + + + + + + + + + + +
+ + + + diff --git a/soundmap.php b/soundmap.php index 57caf32..67ca5d9 100755 --- a/soundmap.php +++ b/soundmap.php @@ -14,8 +14,10 @@ Author URI: http://www.audio-lab.org License: GPLv2 or later */ -require_once (WP_PLUGIN_DIR . "/soundmap/api/soundmap.tags.php"); -require_once (WP_PLUGIN_DIR . "/soundmap/api/soundmap.api.php"); +require_once (plugin_dir_path( __FILE__ ) . "api/soundmap.tags.php"); +require_once (plugin_dir_path( __FILE__ ) . "api/soundmap.api.php"); +//require_once (WP_PLUGIN_DIR . "/soundmap/api/soundmap.tags.php"); +//require_once (WP_PLUGIN_DIR . "/soundmap/api/soundmap.api.php"); if (!class_exists('Soundmap')){ @@ -81,15 +83,15 @@ if (!class_exists('Soundmap')){ function metaboxes_register_callback(){ add_meta_box('soundmap-map', __("Place the Marker", 'soundmap'), array($this, 'map_meta_box'), 'marker', 'normal', 'high'); add_meta_box('soundmap-media-info', __("Info", 'soundmap'), array($this,'info_meta_box'), 'marker', 'side', 'high'); - add_meta_box('soundmap-media-attachments', __("Media files attached.", 'soundmap'), array($this, 'attachments_meta_box'), 'marker', 'side', 'high'); - add_meta_box('soundmap-email', __("Uploader Mail", 'soundmap'), array($this, 'email_meta_box'), 'marker', 'side', 'low'); + //add_meta_box('soundmap-media-attachments', __("Media files attached.", 'soundmap'), array($this, 'attachments_meta_box'), 'marker', 'side', 'high'); + //add_meta_box('soundmap-email', __("Uploader Mail", 'soundmap'), array($this, 'email_meta_box'), 'marker', 'side', 'low'); } //metaboxes_register_callback function email_meta_box(){ global $post; $mail = get_post_meta($post->ID, 'EMAIL', TRUE); echo "

" . $mail . "

"; - } + } function info_meta_box(){ @@ -107,15 +109,18 @@ if (!class_exists('Soundmap')){ $files = get_post_meta($post->ID, 'soundmap_attachments_id', FALSE); echo '
'; echo '
'; - $out = ''; + $out = ''; + print_r($files); if ($files){ - foreach($files as $file){ - $data = wp_prepare_attachment_for_js( $file ); - $out .= "
-
{$data['title']}
- {$data['fileLength']}
- Borrar
"; - } + foreach($files as $file){ + if ($file!=null) { + $data = wp_prepare_attachment_for_js( $file ); + $out .= "
+
{$data['title']}
+ {$data['fileLength']}
+ Borrar
"; + } + } } echo '
' . $out . '
'; echo '
'; @@ -130,10 +135,8 @@ if (!class_exists('Soundmap')){ echo ''; echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; } function load_options(){ @@ -165,16 +168,8 @@ if (!class_exists('Soundmap')){ }// admin_menu function enqueue_map_scripts(){ - /* Register the basic scripts needed for presenting the maps. - - Google Maps - - LeafletJS - - 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('leaflet-plugin-google', plugins_url('js/leaflet/plugins/Google.js', __FILE__), array('leafletjs', 'google-maps'), '0.7.2', TRUE); + wp_enqueue_script('leafletjs','https://unpkg.com/leaflet@1.2.0/dist/leaflet.js',array(),'1.2.0',TRUE); // add Leaflet.js + wp_enqueue_style('leafletcss','https://unpkg.com/leaflet@1.2.0/dist/leaflet.css',array(),'1.2.0','all'); // add CSS Leaflet } function wp_enqueue_scripts(){