Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/jquery.googlemapsinput.js |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
11 | 11 | */ |
12 | 12 | |
| 13 | + |
13 | 14 | (function( $ ){ $.fn.googlemapsinput = function( mapDivId, options ) { |
14 | 15 | this.attr( { 'class': "ui-widget" } ).css( { 'width': 'auto' } ); |
15 | 16 | |
— | — | @@ -21,43 +22,49 @@ |
22 | 23 | updateInputValue( buildInputValue( options.locations ) ); |
23 | 24 | |
24 | 25 | var table = $( '<table />' ).attr( { 'class' : 'mapinput ui-widget ui-widget-content' } ); |
| 26 | + this.append( table ); |
25 | 27 | |
| 28 | + var mapDiv = $( '<div />' ) |
| 29 | + .attr( { |
| 30 | + 'id': mapDivId, |
| 31 | + 'class': 'ui-widget ui-widget-content' |
| 32 | + } ) |
| 33 | + .css( { |
| 34 | + 'width': options.width, |
| 35 | + 'height': options.height |
| 36 | + } ) |
| 37 | + .googlemaps( options ); |
| 38 | + |
26 | 39 | table.append( |
27 | | - '<thread><tr class="ui-widget-header "><th colspan="2">' + mediaWiki.msg( 'semanticmaps-forminput-locations' ) + '</th></tr></thead><tbody>' |
| 40 | + '<thead><tr class="ui-widget-header "><th colspan="2">' + mediaWiki.msg( 'semanticmaps-forminput-locations' ) + '</th></tr></thead><tbody>' |
28 | 41 | ); |
29 | 42 | |
30 | | - this.append( table ); |
| 43 | + var rowNr = options.locations.length; |
31 | 44 | |
32 | 45 | for ( i in options.locations ) { |
33 | 46 | appendTableRow( i, options.locations[i].lat, options.locations[i].lon ); |
34 | 47 | } |
35 | 48 | |
36 | | - var rowNr = options.locations.length; |
37 | | - |
38 | 49 | table.append( |
39 | 50 | '<tr id="' + mapDivId + '_addrow"><td width="300px">' + |
40 | | - '<input type="text" class="text ui-widget-content ui-corner-all" width="95%" />' + |
| 51 | + '<input type="text" class="text ui-widget-content ui-corner-all" width="95%" id="' + mapDivId + '_addfield" />' + |
41 | 52 | '</td><td>' + |
42 | | - '<button id="' + mapDivId + '_addbutton">' + mediaWiki.msg( 'semanticmaps-forminput-add' ) + '</button>' + |
| 53 | + '<button id="' + mapDivId + '_addbutton" mapid="' + mapDivId + '">' + mediaWiki.msg( 'semanticmaps-forminput-add' ) + '</button>' + |
43 | 54 | '</td></tr></tbody>' |
44 | 55 | ); |
45 | 56 | |
46 | | - this.append( |
47 | | - $( '<div />' ) |
48 | | - .attr( { |
49 | | - 'id': mapDivId, |
50 | | - 'class': 'ui-widget ui-widget-content' |
51 | | - } ) |
52 | | - .css( { |
53 | | - 'width': options.width, |
54 | | - 'height': options.height |
55 | | - } ) |
56 | | - .googlemaps( options ) |
57 | | - ); |
58 | | - |
59 | 57 | $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick ); |
60 | 58 | |
61 | 59 | function onAddButtonClick() { |
| 60 | + var location = $( '#' + $( this ).attr( 'mapid' ) + '_addfield' ).text(); |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + addLocationRow(); |
| 65 | + return false; |
| 66 | + } |
| 67 | + |
| 68 | + function addLocationRow() { |
62 | 69 | var addRow = $( '#' + mapDivId + '_addrow' ); |
63 | 70 | |
64 | 71 | addRow.remove(); |
— | — | @@ -66,8 +73,7 @@ |
67 | 74 | $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick ); |
68 | 75 | rowNr++; |
69 | 76 | |
70 | | - updateInput(); |
71 | | - return false; |
| 77 | + updateInput(); |
72 | 78 | } |
73 | 79 | |
74 | 80 | function onRemoveButtonClick() { |
— | — | @@ -76,8 +82,6 @@ |
77 | 83 | return false; |
78 | 84 | } |
79 | 85 | |
80 | | - //$('#' + mapDivId); |
81 | | - |
82 | 86 | function appendTableRow( i, lat, lon ) { |
83 | 87 | table.append( |
84 | 88 | '<tr id="' + mapDivId + '_row_' + i + '"><td>' + |
Index: branches/SemanticMaps0.8/includes/forminputs/SM_FormInput.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | global $smgFIMulti; |
51 | 51 | |
52 | 52 | $params = MapsMapper::getCommonParameters(); |
53 | | - $this->service->addParameterInfo( $params ); |
| 53 | + $this->service->addParameterInfo( $params ); |
54 | 54 | |
55 | 55 | $params['zoom']->setDefault( false, false ); |
56 | 56 | |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | $params['centre']->addCriteria( new CriterionIsLocation() ); |
64 | 64 | $manipulation = new MapsParamLocation(); |
65 | 65 | $manipulation->toJSONObj = true; |
66 | | - $params['centre']->addManipulations( $manipulation ); |
| 66 | + $params['centre']->addManipulations( $manipulation ); |
67 | 67 | |
68 | 68 | $params['icon'] = new Parameter( 'icon' ); |
69 | 69 | $params['icon']->setDefault( '' ); |