r75358 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75357‎ | r75358 | r75359 >
Date:15:34, 25 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7.2 - layout improvement for layer pages
Modified paths:
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_LayerPage.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Layers.php (modified) (history)
  • /trunk/extensions/Maps/includes/layers/Maps_ImageLayer.php (modified) (history)
  • /trunk/extensions/Maps/includes/layers/Maps_KMLLayer.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.i18n.php
@@ -32,6 +32,8 @@
3333 'maps-error-no-layertype' => 'You need to specify the layer type. {{PLURAL:$2|Only this type is|These types are}} supported: $1',
3434 'validation-error-invalid-layer' => 'Parameter $1 must be a valid layer.',
3535 'validation-error-invalid-layers' => 'Parameter $1 must be one or more valid layers.',
 36+ 'maps-layer-of-type' => 'Layer of type $1',
 37+ 'maps-layer-type-supported-by' => 'This layer type can {{PLURAL:$2|only be used with the $1 mapping service|be used with these mapping services: $1}}.',
3638
3739 // Validation
3840 'validation-error-invalid-location' => 'Parameter $1 must be a valid location.',
Index: trunk/extensions/Maps/includes/layers/Maps_ImageLayer.php
@@ -51,7 +51,7 @@
5252 /**
5353 * @see MapsLayer::getJavaScriptDefinition
5454 *
55 - * @since 0.7.1
 55+ * @since 0.7.2
5656 *
5757 * @return string
5858 */
Index: trunk/extensions/Maps/includes/layers/Maps_KMLLayer.php
@@ -44,7 +44,7 @@
4545 /**
4646 * @see MapsLayer::getJavaScriptDefinition
4747 *
48 - * @since 0.7.1
 48+ * @since 0.7.2
4949 *
5050 * @return string
5151 */
Index: trunk/extensions/Maps/includes/Maps_Layers.php
@@ -22,7 +22,7 @@
2323 protected static $classes = array();
2424
2525 /**
26 - * List that maps layer types (keys) to the services that support them (values).
 26+ * List that maps layer types (keys) to the services that they support (values).
2727 *
2828 * @since 0.7.2
2929 *
@@ -79,6 +79,19 @@
8080 return $layers;
8181 }
8282 }
 83+
 84+ /**
 85+ * Returns the mapping services supported by the provided layer type.
 86+ *
 87+ * @since 0.7.2
 88+ *
 89+ * @param string $type
 90+ *
 91+ * @return array
 92+ */
 93+ public static function getServicesForType( $type ) {
 94+ return array_key_exists( $type, self::$services ) ? self::$services[$type] : array();
 95+ }
8396
8497 /**
8598 * Returns if there is a layer class for the provided layer type.
Index: trunk/extensions/Maps/includes/Maps_LayerPage.php
@@ -49,7 +49,7 @@
5050 * @since 0.7.1
5151 */
5252 public function view() {
53 - global $wgOut;
 53+ global $wgOut, $wgLang;
5454
5555 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
5656
@@ -57,10 +57,23 @@
5858 $layerType = $this->getLayerType();
5959
6060 if ( $layerType !== false && MapsLayers::hasLayer( $layerType ) ) {
 61+ $wgOut->addHTML(
 62+ Html::element(
 63+ 'h3',
 64+ array(),
 65+ wfMsgExt( 'maps-layer-of-type', 'parsemag', $layerType )
 66+ )
 67+ );
 68+
 69+ $supportedServices = MapsLayers::getServicesForType( $layerType );
 70+
 71+ $wgOut->addHTML(
 72+ wfMsgExt( 'maps-layer-type-supported-by', 'parsemag', $wgLang->listToText( $supportedServices ), count( $supportedServices ) )
 73+ );
 74+
6175 $this->displayLayerDefinition();
6276 }
6377 else {
64 - global $wgLang;
6578 $availableLayerTypes = MapsLayers::getAvailableLayers();
6679
6780 if ( $layerType === false ) {
@@ -117,13 +130,11 @@
118131 '</span><br />'
119132 );
120133
121 - if ( count( $layer->getErrorMessages() ) - count( $messages ) > 0 ) {
122 - $errorHeader = Html::element(
123 - 'th',
124 - array( 'width' => '50%' ),
125 - wfMsg( 'maps-layer-errors' )
126 - );
127 - }
 134+ $errorHeader = Html::element(
 135+ 'th',
 136+ array( 'width' => '50%' ),
 137+ wfMsg( 'maps-layer-errors' )
 138+ );
128139 }
129140
130141 $rows = array();
@@ -138,7 +149,7 @@
139150 ) .
140151 Html::element(
141152 'th',
142 - array(),
 153+ array( 'colspan' ),
143154 wfMsg( 'maps-layer-value' )
144155 ) . $errorHeader
145156 );

Status & tagging log