r7852 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7851‎ | r7852 | r7853 >
Date:12:20, 24 March 2005
Author:egilk
Status:old
Tags:
Comment:
Version 0.1: Include support for version diplay, misc minor cleanup
Modified paths:
  • /trunk/extensions/gis/gisversion.php (added) (history)
  • /trunk/extensions/gis/index.php (modified) (history)
  • /trunk/extensions/gis/maparea.php (modified) (history)
  • /trunk/extensions/gis/mapsources.php (modified) (history)

Diff [purge]

Index: trunk/extensions/gis/mapsources.php
@@ -31,10 +31,6 @@
3232
3333 include_once ( "gissettings.php" ) ;
3434
35 -# if ( isset ( $wikibasedir ) )
36 -# {
37 -# require_once( "{$wikibasedir}/extensions/gis/geo.php" );
38 -# }
3935 require_once( 'transversemercator.php' );
4036
4137 /**
@@ -59,10 +55,10 @@
6056 $wgOut->setRobotpolicy( 'noindex,nofollow' );
6157
6258 $wgOut->setPagetitle( $this->mapsources );
63 - $this->showList();
 59+ $wgOut->addWikiText( $this->build_output() );
6460 }
6561
66 - function showList() {
 62+ function build_output() {
6763 global $wgOut, $wgUser, $wgContLang;
6864
6965 if (($e = $this->p->get_error()) != "") {
@@ -70,7 +66,7 @@
7167 "<p>" . htmlspecialchars( $e ) . "</p>");
7268 $wgOut->output();
7369 wfErrorExit();
74 - return;
 70+ return "";
7571 }
7672
7773 $attr = $this->p->get_attr();
@@ -219,17 +215,17 @@
220216 $wgOut->addHTML(
221217 "<p>".
222218 htmlspecialchars( "Please add this page: ".
223 - $bstitle->getText() ));
 219+ $bstitle->getText() )."</p>");
224220 $wgOut->output();
225221 wfErrorExit();
226 - return;
 222+ return "";
227223 }
228224 $bstext = $bsarticle->getContent( false ); # allow redir
229225
230226 /*
231227 * Replace in page
232228 */
233 - $out = str_replace( "{latdegdec}", $lat['deg'],
 229+ return str_replace( "{latdegdec}", $lat['deg'],
234230 str_replace( "{londegdec}", $lon['deg'],
235231 str_replace( "{londegneg}", -$lon['deg'],
236232 str_replace( "{latdegint}", $latdegint,
@@ -265,7 +261,6 @@
266262 str_replace( "{region}", $attr['region'],
267263 str_replace( "{page}", $attr['page'],
268264 $bstext )))))))))))))))))))))))))))))))))));
269 - $wgOut->addWikiText( $out );
270265 }
271266 }
272267
Index: trunk/extensions/gis/maparea.php
@@ -81,9 +81,11 @@
8282 $lat = ($x->gis_latitude_min+$x->gis_latitude_max)/2;
8383 $lon = ($x->gis_longitude_min+$x->gis_longitude_max)/2;
8484 $type = $x->gis_type;
 85+ $name = $g->get_title($id);
8586 if ($type == "") $type = "unknown";
86 - $out .= "==[[" . $g->get_title($id) . "]]==\r\n"
 87+ $out .= "==[[" . $name . "]]==\r\n"
8788 . ";type:" . $type . "\r\n"
 89+ . ";name:" . $name . "\r\n"
8890 . ";data:" . $this->map_pos($lat,$lon) . "\r\n"
8991 . "\r\n";
9092 }
Index: trunk/extensions/gis/index.php
@@ -31,6 +31,8 @@
3232 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3333 */
3434
 35+$wgGisVersion = '0.1alpha';
 36+
3537 include_once ( "gissettings.php" ) ;
3638
3739 if ( isset ( $wikibasedir ) )
@@ -46,29 +48,26 @@
4749 require_once( "mapsources.php");
4850 require_once( "neighbors.php");
4951 require_once( "maparea.php");
 52+require_once( "gisversion.php");
5053
5154 if ( isset ( $_GET['geo'] ) ) {
5255 $geo = urldecode ( $_GET['geo'] );
5356 $title = urldecode ( $_GET['title'] );
 57+ $bsl = new map_sources( $geo, $title );
 58+ $bsl->show();
5459 } else if ( isset ( $_GET['near'] ) ) {
5560 $near = urldecode ( $_GET['near'] ) ;
5661 $dist = urldecode ( $_GET['dist'] ) ;
5762 $title = urldecode ( $_GET['title'] );
 63+ $bsl = new neighbors( $near, $dist, $title );
 64+ $bsl->show();
5865 } else if ( isset ( $_GET['maparea'] ) ) {
5966 $maparea = urldecode ( $_GET['maparea'] ) ;
60 -}
61 -
62 -# FIXME: if no params, then what?
63 -
64 -if ($maparea != "") {
6567 $bsl = new maparea( $maparea );
6668 $bsl->show();
67 -} else if ($near != "") {
68 - $bsl = new neighbors( $near, $dist, $title );
 69+} else if ( isset ( $_GET['version'] ) ) {
 70+ $bsl = new gis_version( );
6971 $bsl->show();
70 -} else {
71 - $bsl = new map_sources( $geo, $title );
72 - $bsl->show();
7372 }
7473
7574 $wgOut->output();
Index: trunk/extensions/gis/gisversion.php
@@ -0,0 +1,68 @@
 2+<?php
 3+/** \file
 4+ *
 5+ * Show version information
 6+ *
 7+ * \todo Make hook for Special:Version instead
 8+ *
 9+ * ----------------------------------------------------------------------
 10+ *
 11+ * Copyright 2005, Egil Kvaleberg <egil@kvaleberg.no>
 12+ *
 13+ * This program is free software; you can redistribute it and/or modify
 14+ * it under the terms of the GNU General Public License as published by
 15+ * the Free Software Foundation; either version 2 of the License, or
 16+ * (at your option) any later version.
 17+ *
 18+ * This program is distributed in the hope that it will be useful,
 19+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 20+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 21+ * GNU General Public License for more details.
 22+ *
 23+ * You should have received a copy of the GNU General Public License
 24+ * along with this program; if not, write to the Free Software
 25+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 26+ */
 27+
 28+include_once ( "gissettings.php" ) ;
 29+
 30+/**
 31+ * Base class
 32+ */
 33+class gis_version {
 34+ function gis_version( ) {
 35+ }
 36+
 37+ function show() {
 38+ global $wgOut, $wgUser, $wgContLang;
 39+ global $wgVersion, $wgGisVersion;
 40+
 41+ $wgOut->setPagetitle( "Version" );
 42+ $wgOut->addHTML( '
 43+ <p><b><a href="http://www.mediawiki.org/">MediaWiki</a></b>
 44+ <a href="http://meta.wikimedia.org/wiki/Gis">GIS extension</a>,
 45+ copyright (C) 2005 by Egil Kvaleberg.</p>
 46+
 47+ <p>The GIS extension is free software; you can redistribute it and/or modify
 48+ it under the terms of the GNU General Public License as published by
 49+ the Free Software Foundation; either version 2 of the License, or
 50+ (at your option) any later version.</p>
 51+
 52+ <p>The GIS extension is distributed in the hope that it will be useful,
 53+ but WITHOUT ANY WARRANTY; without even the implied warranty of
 54+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 55+ GNU General Public License for more details.</p>
 56+
 57+ <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
 58+ along with this program; if not, write to the Free Software
 59+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 60+ or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
 61+');
 62+ $out .= ":GIS extension: $wgGisVersion\n";
 63+ $out .= ":MediaWiki: $wgVersion\n";
 64+
 65+ $wgOut->addWikiText( $out );
 66+ }
 67+}
 68+
 69+?>
Property changes on: trunk/extensions/gis/gisversion.php
___________________________________________________________________
Added: svn:eol-style
170 + native
Added: svn:keywords
271 + Author Date Id Revision

Status & tagging log