Code Cleaning
From MapbenderWiki
Code cleaning is required to make the code more readable and insure that the license is legally correctly contained in the code.
Code transition to SVN
During the transition phase from CVS to SVN code repository the following additional steps have to be taken. Please document all changes in the Mapbender Provenance Review document that needs to be prepared going through the Mapbender Incubation Process.
To switch to SVN header variables first remove the old CVS comments:
#$Id: mod_addWMSfromfilteredList.php,v 1.14 2006/03/10 12:53:25 example Exp $ #$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_addWMSfromfilteredList.php,v 1.14 2006/03/10 12:53:25 example Exp $
Next add the SVN variable, it is just one line of code. This placeholder <$Id$> is automatically exchanged with values from the SVN when committing a new version (see below).
# $Id$
Set the variables (Keywords). If you use the Ecplise development environment this can be done by selecting
- <Team>
- <Add Keywords>
and ticking all fields:
- Last ChangedDate
- Last changedRevision
- Last changedBy
- HeadURL
- Id
Example PHP code module head
- The header has to (must) include a reference to the SVN variables in the first line.
- The second line points to the corresponding Wiki page (see below). Not every code module needs to have a single page, some modules might link to several pages and vice versa.
# $Id: mod_xy.php 73 2006-04-18 10:45:53Z example $ # http://www.mapbender.org/index.php/NameOfModule # Copyright (C) 2002 CCGIS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Example JS code module head
Whether or not a reference to the license has to be added to JS code modules is still being worked out.
Wiki Reference Page
The Wiki reference page for code modules has a more technical view point. See en example at DeleteGUI. The proposed structure looks like this:
Files
SQL
References
Links to related Wiki pages
English
Description of the module
More Details
Even more Details
Notices
Warnings
== [Other languages] == (optional) This is either a list of other pages with the same Wiki Page Name and trailing country code, for German language "_de"
Clean and Format
- Remove, shorten long and needless comments, translate all to English
- Check and clean indentations, one tab per level
- check opening and closing brackets
- check db connections and use constants (DBSERVER,OWNER,PW) instead of variables
- don't use import_request_variables("PG");
- Documentation (whats this?)
http://www.mapbender.org/index.php/javascripts_map.php#mb_registerInitFunctions
