Skip to content

Commit bd4136e

Browse files
committed
added plugin files
1 parent fbf9101 commit bd4136e

8 files changed

+688
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ sitemap.xml
1111
wp-content/cache/
1212
wp-content/backups/
1313
sitemap.xml
14-
sitemap.xml.gz
14+
sitemap.xml.gz
15+
nbproject

README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
awpp
2-
====
1+
Annuaire Client Wordpress Plugin
2+
================================
3+
Contributors: kwisatz
4+
Tags: api, geocoding
5+
Requires at least: 3.0.1
6+
Tested up to: 3.5.1
7+
Stable tag: 0.1
8+
License: GPLv2 or later
9+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
310

4-
Annuaire Client Wordpress Plugin
11+
Retrieves configurable entries from annuaire.youth.lu and displays them in various formats
12+
13+
Installation
14+
------------
15+
16+
This section describes how to install the plugin and get it working.
17+
18+
1. Upload the awpp directory to the `/wp-content/plugins/` directory
19+
1. Activate the plugin through the 'Plugins' menu in WordPress
20+
1. Set your defaults through the Settings menu
21+
22+
Usage
23+
-----
24+
Currently, two shortcodes are available:
25+
26+
[annuaire-map width=500 height=350 region="North" center="Ettelbruck, Luxembourg"]
27+
28+
and
29+
30+
[annuaire region="north" type="1" map="yes" width="350" height="500"]
31+
32+
Changelog
33+
---------
34+
0.1 - first release

awpp.css

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Document : awpp.css
3+
Created on : 17-Feb-2013, 19:04:36
4+
Author : kwisatz
5+
Description:
6+
Purpose of the stylesheet follows.
7+
*/
8+
9+
.awpp_placemark {
10+
margin: 0 !important;
11+
font-size: medium !important;
12+
line-height: normal !important;
13+
color: black !important;
14+
}
15+
16+
.awpp_placemark h3 {}
17+
margin: 0 !important;
18+
padding: 5px 0;
19+
font-size: medium !important;
20+
line-height: normal !important;
21+
font-weight: normal !important;
22+
}
23+
24+
.awpp_placemark div {
25+
margin: 0 !important;
26+
}
27+
28+
#awpp-map-dom-element img {
29+
width: auto !important;
30+
max-width: none !important;
31+
background: none !important;
32+
border-width: 0;
33+
padding: 0;
34+
margin: 0;
35+
-webkit-box-shadow: none;
36+
-moz-box-shadow: none;
37+
box-shadow: none;
38+
}
39+
40+
#awpp-map-dom-element #content {
41+
width: auto;
42+
height: auto;
43+
overflow: auto;
44+
}
45+
46+
#awpp_addresses {
47+
float:left;
48+
}
49+
50+
51+
.awpp_heading {
52+
font-weight:bold;
53+
padding-top: 10px;
54+
padding-bottom:3px;
55+
}
56+
57+
.awpp_address {
58+
float:left;
59+
padding-left:1em;
60+
}
61+
62+
.awpp_photo_block {
63+
float:left;
64+
padding-left:10px;
65+
}

awpp.js

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
function awpp_wrapper ($) {
3+
var awpp = {
4+
init: function() {
5+
this.name = 'Awpp';
6+
//this.canvas = $('#awpp-map-dom-element');
7+
// see https://groups.google.com/forum/?fromgroups=#!topic/google-maps-api/hf9h71UVBx0
8+
this.canvas = document.getElementById( 'awpp-map-dom-element' );
9+
if( this.canvas )
10+
this.buildMap();
11+
else
12+
$( this.canvas ).html( awpp.name + " error: couldn't retrieve DOM elements." );
13+
},
14+
buildMap : function() {
15+
var mapOptions;
16+
mapOptions = {
17+
'zoom' : parseInt( awppMapData.options.zoom ),
18+
'center' : new google.maps.LatLng(
19+
parseFloat( awppMapData.options.latitude ),
20+
parseFloat( awppMapData.options.longitude ) ),
21+
'mapTypeId' : google.maps.MapTypeId[ awppMapData.options.type ],
22+
'mapTypeControl' : awppMapData.options.typeControl == 'off' ? false : true,
23+
'mapTypeControlOptions' : { style: google.maps.MapTypeControlStyle[ awppMapData.options.typeControl ] },
24+
'navigationControl' : awppMapData.options.navigationControl == 'off' ? false : true,
25+
'navigationControlOptions' : { style: google.maps.NavigationControlStyle[ awppMapData.options.navigationControl ] }
26+
};
27+
// Override default width/heights from settings
28+
$( '#awpp-map-dom-element' ).css( 'width', awppMapData.options.mapWidth );
29+
$( '#awpp-map-dom-element' ).css( 'height', awppMapData.options.mapHeight );
30+
// Create the map
31+
try {
32+
map = new google.maps.Map( this.canvas, mapOptions );
33+
} catch( e ) {
34+
$( this.canvas ).html( awpp.name + " error: couln't build map." );
35+
if( window.console )
36+
console.log( 'awpp_buildMap: '+ e );
37+
return;
38+
}
39+
40+
this.addPlacemarks( map );
41+
},
42+
addPlacemarks : function( map ) {
43+
if( awppMapData.markers.length > 0 )
44+
for( var m in awppMapData.markers ) {
45+
this.createMarker(
46+
map,
47+
awppMapData.markers[m]['title'],
48+
awppMapData.markers[m]['latitude'],
49+
awppMapData.markers[m]['longitude'],
50+
awppMapData.markers[m]['details'],
51+
awppMapData.markers[m]['icon'],
52+
parseInt( awppMapData.markers[m]['zIndex'] )
53+
);
54+
}
55+
},
56+
createMarker : function( map, title, latitude, longitude, details, icon, zIndex ) {
57+
var infowindowcontent, infowindow, marker;
58+
59+
if( isNaN( latitude ) || isNaN( longitude ) ) {
60+
if( window.console )
61+
console.log( "awpp_createMarker(): "+ title +" latitude and longitude weren't valid." );
62+
return false;
63+
}
64+
infowindowcontent = '<div class="awpp_placemark"> <h3>'+ title +'</h3> <div>'+ details +'</div> </div>';
65+
try {
66+
infowindow = new google.maps.InfoWindow( {
67+
content : infowindowcontent,
68+
maxWidth : awppMapData.options.infoWindowMaxWidth
69+
} );
70+
// Replace commas with periods. Some (human) languages use commas to delimit the fraction from the whole number, but Google Maps doesn't accept that.
71+
//latitude = parseFloat( latitude.replace( ',', '.' ) );
72+
//longitude = parseFloat( longitude.replace( ',', '.' ) );
73+
74+
marker = new google.maps.Marker( {
75+
'position' : new google.maps.LatLng( latitude, longitude ),
76+
'map' : map,
77+
'icon' : icon,
78+
'title' : title,
79+
'zIndex' : 0
80+
} );
81+
82+
google.maps.event.addListener( marker, 'click', function() {
83+
if( this.previousInfoWindow != undefined )
84+
this.previousInfoWindow.close();
85+
infowindow.open( map, marker );
86+
this.previousInfoWindow = infowindow;
87+
} );
88+
89+
return true;
90+
91+
} catch( e ) {
92+
$( this.canvas ).append( '<p>' + this.name + " error: couldn't add map placemarks.</p>");
93+
if( window.console )
94+
console.log( 'awpp_createMarker: '+ e );
95+
}
96+
}
97+
}
98+
99+
// Kick things off... (wordpress uses jquery in no-conflict mode
100+
// (http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers)
101+
$( document ).ready( function() {
102+
awpp.init();
103+
} );
104+
}
105+
106+
awpp_wrapper( jQuery );

0 commit comments

Comments
 (0)