Enable OpenStreetMap support at Setup Wizard
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
//Get variables form input values
|
//Initialize variables
|
||||||
latitude = document.getElementById('sp_latitude').value;
|
latitude = 0;
|
||||||
longitude = document.getElementById('sp_longitude').value;
|
longitude = 0;
|
||||||
|
|
||||||
//Initialize the map and add the Search control box
|
//Initialize the map and add the Search control box
|
||||||
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
|
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ class SP_Admin_Assets {
|
|||||||
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||||
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
|
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
|
||||||
wp_register_script( 'sportspress-admin-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
wp_register_script( 'sportspress-admin-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
||||||
wp_register_script( 'sportspress-admin-setup-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-setup-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
|
||||||
|
|
||||||
wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true );
|
wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true );
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,11 @@ class SP_Admin_Setup_Wizard {
|
|||||||
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
|
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
|
||||||
wp_register_script( 'sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array( 'jquery', 'jquery-locationpicker' ), SP_VERSION, true );
|
wp_register_script( 'sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array( 'jquery', 'jquery-locationpicker' ), SP_VERSION, true );
|
||||||
} else {
|
} else {
|
||||||
|
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||||
|
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
|
||||||
|
wp_register_script( 'sportspress-admin-setup-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-setup-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
||||||
|
wp_enqueue_style( 'control-geocoder', SP()->plugin_url() . '/assets/css/Control.Geocoder.css', array() );
|
||||||
|
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$strings = apply_filters( 'sportspress_localized_strings', array(
|
$strings = apply_filters( 'sportspress_localized_strings', array(
|
||||||
@@ -119,12 +123,6 @@ class SP_Admin_Setup_Wizard {
|
|||||||
// Localize scripts
|
// Localize scripts
|
||||||
wp_localize_script( 'sportspress-setup', 'localized_strings', $strings );
|
wp_localize_script( 'sportspress-setup', 'localized_strings', $strings );
|
||||||
|
|
||||||
if ( class_exists( 'SportsPress_GoogleMaps' ) ) {
|
|
||||||
wp_enqueue_script( 'google-maps' );
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
|
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
|
||||||
call_user_func( $this->steps[ $this->step ]['handler'] );
|
call_user_func( $this->steps[ $this->step ]['handler'] );
|
||||||
}
|
}
|
||||||
@@ -525,6 +523,12 @@ class SP_Admin_Setup_Wizard {
|
|||||||
* Venue Step.
|
* Venue Step.
|
||||||
*/
|
*/
|
||||||
public function sp_setup_venue() {
|
public function sp_setup_venue() {
|
||||||
|
if ( class_exists( 'SportsPress_GoogleMaps' ) ) {
|
||||||
|
wp_print_scripts( 'google-maps' );
|
||||||
|
}else{
|
||||||
|
wp_print_scripts( 'leaflet_js' );
|
||||||
|
wp_print_scripts( 'control-geocoder' );
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<h1><?php _e( 'Venue Setup', 'sportspress' ); ?></h1>
|
<h1><?php _e( 'Venue Setup', 'sportspress' ); ?></h1>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
@@ -539,11 +543,11 @@ class SP_Admin_Setup_Wizard {
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e( 'Address', 'sportspress' ); ?></th>
|
<th scope="row"><?php _e( 'Address', 'sportspress' ); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<input name="address" id="sp-address" class="sp-address" type="text">
|
<input name="address" id="sp_address" class="sp-address" type="text">
|
||||||
<div id="sp-location-picker"></div>
|
<div id="sp-location-picker" style="width: 95%; height: 320px"></div>
|
||||||
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
|
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
|
||||||
<input name="latitude" id="sp-latitude" class="sp-latitude" type="hidden" value="40.7324319">
|
<input name="latitude" id="sp_latitude" class="sp-latitude" type="hidden" value="40.7324319">
|
||||||
<input name="longitude" id="sp-longitude" class="sp-longitude" type="hidden" value="-73.82480799999996">
|
<input name="longitude" id="sp_longitude" class="sp-longitude" type="hidden" value="-73.82480799999996">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user