r57586 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57585‎ | r57586 | r57587 >
Date:19:43, 9 October 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.3.5
Modified paths:
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFunctions.js (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_Mapper.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
@@ -45,7 +45,7 @@
4646
4747 if (empty($smgYahooFormsOnThisPage)) {
4848 $smgYahooFormsOnThisPage = 0;
49 - $this->output .= "<script type='$wgJsMimeType' src='$smgIncludePath/YahooMaps/SM_YahooMapsFunctions.js'></script>";
 49+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/YahooMaps/SM_YahooMapsFunctions.js'></script>";
5050 }
5151 }
5252
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php
@@ -39,13 +39,13 @@
4040 */
4141 protected function addFormDependencies() {
4242 global $wgJsMimeType;
43 - global $smgIncludePath, $smgOLFormsOnThisPage;
 43+ global $smgScriptPath, $smgOLFormsOnThisPage;
4444
4545 MapsOpenLayersUtils::addOLDependencies($this->output);
4646
4747 if (empty($smgOLFormsOnThisPage)) {
4848 $smgOLFormsOnThisPage = 0;
49 - $this->output .= "<script type='$wgJsMimeType' src='$smgIncludePath/OpenLayers/SM_OpenLayersFunctions.js'></script>";
 49+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenLayers/SM_OpenLayersFunctions.js'></script>";
5050 }
5151 }
5252
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -23,21 +23,15 @@
2424 die( 'Not an entry point.' );
2525 }
2626
27 -define('SM_VERSION', '0.3.5');
 27+define('SM_VERSION', '0.3.5 a2');
2828
2929 $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps';
3030 $smgIP = $IP . '/extensions/SemanticMaps';
31 -$smgIncludePath = $wgServer . $smgScriptPath;
3231
3332 // Include the settings file
3433 require_once($smgIP . '/SM_Settings.php');
3534
36 -// Add the extensions initializing function
37 -if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
38 - $wgHooks['ParserFirstCallInit'][] = 'smfSetup';
39 -} else {
40 - $wgExtensionFunctions[] = 'smfSetup'; // Legacy support
41 -}
 35+$wgExtensionFunctions[] = 'smfSetup';
4236
4337 $wgHooks['AdminLinks'][] = 'smfAddToAdminLinks';
4438
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
@@ -1,9 +1,9 @@
22 <?php
33
44 /**
5 - * Initialization file for query printer functionality in the Maps extension
 5+ * Initialization file for query printer functionality in the Semantic Maps extension
66 *
7 - * @file SM_FormInputs.php
 7+ * @file SM_QueryPrinters.php
88 * @ingroup SemanticMaps
99 *
1010 * @author Jeroen De Dauw
@@ -34,15 +34,12 @@
3535 // At least one query printer will be enabled when this point is reached.
3636 $hasQueryPrinters = true;
3737
38 - // Add the result format for the service name.
39 - self::initFormat($serviceName, $serviceData['qp']);
40 -
41 - // Loop through the service alliases, and add them as result formats to the query printer.
42 - foreach ($serviceData['aliases'] as $alias) self::initFormat($alias, $serviceData['qp']);
 38+ // Initiate the format.
 39+ self::initFormat($serviceName, $serviceData['qp'], $serviceData['aliases']);
4340 }
4441
4542 // Add the 'map' result format if there are mapping services that have QP's loaded.
46 - if ($hasQueryPrinters) self::initFormat('map', array('class' => 'SMMapper', 'file' => 'QueryPrinters/SM_Mapper.php', 'local' => true));
 43+ if ($hasQueryPrinters) self::initFormat('map', array('class' => 'SMMapper', 'file' => 'QueryPrinters/SM_Mapper.php', 'local' => true), array());
4744 }
4845
4946 /**
@@ -50,8 +47,9 @@
5148 *
5249 * @param string $format
5350 * @param array $qp
 51+ * @param array $aliases
5452 */
55 - private static function initFormat($format, array $qp) {
 53+ private static function initFormat($format, array $qp, array $aliases) {
5654 global $wgAutoloadClasses, $smwgResultFormats, $smgIP;
5755
5856 if (! array_key_exists($qp['class'], $wgAutoloadClasses)) {
@@ -65,6 +63,10 @@
6664 else {
6765 SMWQueryProcessor::$formats[$format] = $qp['class'];
6866 }
 67+
 68+ // TODO: set aliases
 69+ // PHP 5.3 required
 70+ //call_user_func_array(array($qp['class'], 'setAliases'), array($aliases));
6971 }
7072
7173 }
\ No newline at end of file
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_Mapper.php
@@ -28,6 +28,14 @@
2929 $this->queryPrinter = new $egMapsServices[$service]['qp']['class']($format, $inline);
3030 }
3131
 32+ public static function getAliases() {
 33+ return $this->queryPrinter->getAliases();
 34+ }
 35+
 36+ public static function setAliases() {
 37+ return $this->queryPrinter->setAliases();
 38+ }
 39+
3240 public function getName() {
3341 return $this->queryPrinter->getName();
3442 }
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFunctions.js
@@ -42,7 +42,6 @@
4343
4444 /**
4545 * This function holds spesific functionallity for the Google Maps form input of Semantic Maps
46 - * TODO: Refactor as much code as possible to non specific functions
4746 */
4847 function showGAddress(address, mapName, outputElementName, notFoundFormat) {
4948 var map = GMaps[mapName];
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -41,13 +41,13 @@
4242 */
4343 protected function addFormDependencies() {
4444 global $wgJsMimeType;
45 - global $smgIncludePath, $smgGoogleFormsOnThisPage;
 45+ global $smgScriptPath, $smgGoogleFormsOnThisPage;
4646
4747 MapsGoogleMapsUtils::addGMapDependencies($this->output);
4848
4949 if (empty($smgGoogleFormsOnThisPage)) {
5050 $smgGoogleFormsOnThisPage = 0;
51 - $this->output .= "<script type='$wgJsMimeType' src='$smgIncludePath/GoogleMaps/SM_GoogleMapsFunctions.js'></script>";
 51+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/GoogleMaps/SM_GoogleMapsFunctions.js'></script>";
5252 }
5353 }
5454

Status & tagging log