r83659 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83658‎ | r83659 | r83660 >
Date:19:21, 10 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some work on the googlemaps3 input
Modified paths:
  • /branches/SemanticMaps0.8/includes/forminputs/SM_FormInput.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/GoogleMaps3/jquery.googlemapsinput.js (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/jquery.googlemapsinput.js
@@ -9,6 +9,7 @@
1010 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
1111 */
1212
 13+
1314 (function( $ ){ $.fn.googlemapsinput = function( mapDivId, options ) {
1415 this.attr( { 'class': "ui-widget" } ).css( { 'width': 'auto' } );
1516
@@ -21,43 +22,49 @@
2223 updateInputValue( buildInputValue( options.locations ) );
2324
2425 var table = $( '<table />' ).attr( { 'class' : 'mapinput ui-widget ui-widget-content' } );
 26+ this.append( table );
2527
 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+
2639 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>'
2841 );
2942
30 - this.append( table );
 43+ var rowNr = options.locations.length;
3144
3245 for ( i in options.locations ) {
3346 appendTableRow( i, options.locations[i].lat, options.locations[i].lon );
3447 }
3548
36 - var rowNr = options.locations.length;
37 -
3849 table.append(
3950 '<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" />' +
4152 '</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>' +
4354 '</td></tr></tbody>'
4455 );
4556
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 -
5957 $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick );
6058
6159 function onAddButtonClick() {
 60+ var location = $( '#' + $( this ).attr( 'mapid' ) + '_addfield' ).text();
 61+
 62+
 63+
 64+ addLocationRow();
 65+ return false;
 66+ }
 67+
 68+ function addLocationRow() {
6269 var addRow = $( '#' + mapDivId + '_addrow' );
6370
6471 addRow.remove();
@@ -66,8 +73,7 @@
6774 $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick );
6875 rowNr++;
6976
70 - updateInput();
71 - return false;
 77+ updateInput();
7278 }
7379
7480 function onRemoveButtonClick() {
@@ -76,8 +82,6 @@
7783 return false;
7884 }
7985
80 - //$('#' + mapDivId);
81 -
8286 function appendTableRow( i, lat, lon ) {
8387 table.append(
8488 '<tr id="' + mapDivId + '_row_' + i + '"><td>' +
Index: branches/SemanticMaps0.8/includes/forminputs/SM_FormInput.php
@@ -49,7 +49,7 @@
5050 global $smgFIMulti;
5151
5252 $params = MapsMapper::getCommonParameters();
53 - $this->service->addParameterInfo( $params );
 53+ $this->service->addParameterInfo( $params );
5454
5555 $params['zoom']->setDefault( false, false );
5656
@@ -62,7 +62,7 @@
6363 $params['centre']->addCriteria( new CriterionIsLocation() );
6464 $manipulation = new MapsParamLocation();
6565 $manipulation->toJSONObj = true;
66 - $params['centre']->addManipulations( $manipulation );
 66+ $params['centre']->addManipulations( $manipulation );
6767
6868 $params['icon'] = new Parameter( 'icon' );
6969 $params['icon']->setDefault( '' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r83661follow up to r83659jeroendedauw19:29, 10 March 2011

Status & tagging log