Copyright © 2003, 2004 OMS Project, Northern Governorates Water Authority
Copyright © 2005, 2006 DORSCH Consult
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available from the Free Software Foundation (http://www.gnu.org).
$Date: 2006-09-26 21:04:18 +0300 (Tue, 26 Sep 2006) $
Table of Contents
List of Figures
List of Examples
General information for BMFO developers.
This document describes standards applied in the Bulk Meter Flow and Operations (BMFO) application development.
BMFO is available from http://bmfo.sourceforge.net.
Additional information is available in the BMFO Administration Guide, the BMFO User Guide, the BMFO API Documentation and various UML diagrams that are part of the BMFO distribution.
The document refers to BMFO version 1.2.4 .
This section describes the software tools that are used in the BMFO development.
jEdit - see Section 2.1
poEdit - see Section 4.1
msgmerge - see Section 4.2
TortoiseSVN - see Section 2.2
pageant
WinSCP2
Visio
iReport - see Section 7.1
Install the Java Development Kit as described in the BMFO Administration Guide.
Install jEdit. jEdit is available from http://www.jedit.org
The AntFarm plugin was used extensively during the BMFO development. It can be obtained through the jEdit Plugin Manager
Caution | |
---|---|
Add "-Xmx512m" to your jEdit shortcut in order to increase the available heap memory (in this case 512MB. "C:\j2re\bin\javaw.exe" -Xmx512m -jar "C:\jEdit\jedit.jar" Otherwise you'll run out of memory when compiling the documentation |
TortoiseSVN is available from http://tortoisesvn.tigris.org.
TortoiseSVN adds a context menu to the Windows Explorer.
Select Figure 1.
from the Explorer context menu (As shown in Figure 2, use the URL https://svn.sourceforge.net/svnroot/bmfo/trunk/bmfo to check out the BMFO sources.
See the Sourceforge documentation for detailed instructions how to set up SVN access using TortoiseSVN:
http://sourceforge.net/docman/display_doc.php?docid=31165&group_id=1
Apache Ant is a Java-based build tool. It can be used to automate tasks.
Download the Ant distribution from the internet (http://ant.apache.org).
Unzip the file to c:\software
Add c:\software\jakarta-ant-1.5\bin
to the path.
Add a new enviroment variable, JAVA_HOME
pointing to your
installation of the Java Development Kit, e.g. c:\program files\java\jdk1.5.0_05
.
The BMFO distribution contains 3 ANT build files:
build.xml - used to build the sourcecode
distribution |
doc/build.xml - used to build the
documentation from the DocBook sources |
script/test/build.xml - used to run
the Canoo webtest |
servlet/build.xml - used to build the
bmfo_reports.war web application archive |
The tidy version in the HTML Validator for Firefox is used to validate the generated HTML code.
The HTML Validator for Firefox is available from http://users.skynet.be/mgueury/mozilla/.
Table of Contents
The BMFO documentation is written in XML DocBook. DocBook is a very popular format for technical documentation.
The DocBook XSL stylesheets are used to convert the documentation from the DocBook format to other formats. DocBook XSL is available from http://www.sagehill.net/docbookxsl/index.html.
The actual conversion is done by the XSLT processor saxon, which is available from http://docbook.sourceforge.net.
An ant build file (build.xml
) is available in the
doc
folder to automate building the documentation
in the following formats:
XHTML
CHM
It is possible to create HTML Help files
(*.chm
) from DocBook with the Microsoft HTML Help
Workshop.
The HTML help workshop is available under http://www.microsoft.com/office/ork/xp/appndx/appa06.htm .
PDF Documentation can be generated with fop. The fop is available from http://xml.apache.org.
To build the Arabic documentation, it is currently necessary to
shadow the class
com.icl.saxon.charcode.ASCIICharacterSet with
a new version where the function inCharset()
always returns true
.
The DocBook XSL template
language.attribute in l10.xsl
should be changed to assign the value
"rtl"
to the attribute
dir
if the language
equals "'ar'".
Arabic PDF: Special processing
Doxygen is used to document the BMFO API on the PHP level.
Doxygen is available from http://www.doxygen.org.
The doxygen configuration file can be found under
doc/development/doxygen/doxygen.cfg
.
In order to generate graphical class representations, you should
install Graphviz to c:\program
files\att\graphviz
. Graphviz is available from http://www.graphviz.org.
Please insert the appropriate comments to document the PHP sources.
Debug output to Apache's error.log
can be enabled
by setting $GLOBALS['boolDebug']
to true (e.g.
in dbx_connect.php
).
In the source code, debug output should be implemented like in the following example:
if($GLOBALS['boolDebug']) { error_log($strQuery); }
Manual testing is done using Firefox and Internet Explorer.
The HTML Validator for Firefox is used to check the HTML validity (Section 2.4).
The Canoo Webtest suite is used for testing the application.
Canoo Webtest is freely available from http://webtest.canoo.com.
The file containing the tests is
script/test/build.xml
.
To run the tests, follow the steps below:
Download build.zip
for
Canoo Webtest version 1.7. Extract the
archive to a path without spaces.
Add the bin
folder of the Canoo
distribution to the PATH.
On the command line, change the working directory to
script/test
in the DCMMS sources.
Run the following command:
runWebtest.bat build.xml
The test report will be generated in script/test/webtest-results/results.html
.
Tip | |
---|---|
If you want to generate WebTest.dtd, you can use the "dtd"
target of |
The gettext package is used to internationalize the BMFO application.
Messages that have to be translated but are not included in the PHP
sources should be added to include/i18n.php
. This
is the case e.g. for coded values from the database.
To edit the dcmms.po
files,
poEdit is recommended. It is freely available
from http://poedit.sourceforge.net.
Tip | |
---|---|
Install poEdit version 1.3.4 or higher. |
In order to extract the translation messages from the PHP sources, the following settings should be applied.
Start poEdit.
Select
from the menu.Select the Parser tab and click on the button.
Close the dialogs.
Open a dcmms.po
file.
Choose
from the menu.In the Paths tab, add the path to the BMFO source as shown in Figure 2
Caution | |
---|---|
Make sure that you enter the actual path to the BMFO sources on your system. |
Once the settings above have been applied, it is possible to update the catalog by selecting
from the menu.The PDF reports are internationalized using Java ResourceBundles. These ResourceBundles can be generated from the bmfo.po files using the msgfmt command from the gettext distribution.
Gettext for Windows is available from http://gettext.sourceforge.net.
Create the ResourceBundles for the PDF Reports:
msgfmt --java2 -d ..\..\..\servlet\WEB-INF\classes -l ar_AR -r bmfo bmfo.po
Note that javac must be in your PATH.
Note | |
---|---|
If you are using a gettext version < 0.15.0 on Windows you may encounter an error message like the following: msgfmt: cannot create a temporary directory using template "\/msgK5G9pb": Invalid argument In this case, try to set the environment variable
|
BMFO supports different database backends, currently ORACLE and Postgresql.
All functions that are specific to the different backends have
been isolated in include/dbx_connect.php
. To
To create dbx_connect.php
, the appropriate one of the
two sample files dbx_connect_oracle.php
and
dbx_connect_postgresql.php
needs to be copied
and adjusted. This is done e.g. by the NSIS installer (Section 6.1).
To ease the BMFO deployment under Windows, two NSIS installers have been created.
To compile the installers, you need the Nullsoft Super Installation System, which is available from http://nsis.sourceforge.net.
This section describes how to add new PDF reports to BMFO using iReport.
Use the following font settings for Arabized fields:
Report font: empty
Font name: Arial
PDF Font name: External TTF font...
True Type font: Arial (arial.ttf)
PDF Embedded: true
PDF Encoding: Identity-H (Unicode with horizontal writing)
Caution | |
---|---|
Make sure that |
Standards-compliance is one of the goals of the BMFO development. This will eventually allow e.g. to support different database backends.
SQL
UML
XHTML
CSS
DocBook
UNICODE
The human interface design tries to follow the GNOME Human Interface Guidelines (http://developer.gnome.org/projects/gup/hig/).
Look at the existing codebase and try to code using the same style.
Update the ChangeLog
for every commit.
Example 1. ChangeLog entry
2003-07-29 Steffen Macke <Steffen_Macke@dorsch.com.jo> * doc/development/dcmms_development_guide.xml: more information on coding style
For variable names, use prefixes like flt, str, arr and date to indicate the variable type.
Variable names should be descriptive, with the exception of simple loop variables like i,j,k,l,m
Use a wrap margin of 80 characters. jEdit can provide a guiding line for this purpose: Wrap Margin
Internationalize all messages visible to the end user. See Section 4 for the details.
When echoing texts from PHP, use brackets to indicate that echo() is a function.
Single quotes should be used wherever possible for performance reasons
Important | |
---|---|
Use an indent width of 2 characters and a tab width of 8 characters. Do not use "Soft (emulated with spaces) tabs". |
Indent classes, functions, loops and if statements properly. This allows to use jEdit folding.
Example 5. If indentation
if($strValue == $strValue2) { echo("Values are equal."); } else { echo("Values are not equal."); }
Example 6. Class indentation
class Test { // store the name $strTestName; // constructor function Test($strName) { $strTestName = strName; } }
Example 7. Switch indentation
switch($intValue) { case 1: $intResult = 2; break; default: $intResult = 1; break; }
Separate arguments in function calls by a comma and a space.
Important procedures in the BMFO development.
Update the version number in
include/header.php
,
doc/version.xml
,
doc/administration/bmfo_administration_guide.xml
,
doc/user/en/bmfo_user_guide.xml
,
build.xml
,
bmfo.nsi
,
bmfo-client.nsi
,
servlet/WEB-INF/web.xml
,
etc/index.html
and
doc/development/doxygen/doxygen.cfg
.
Verify that all SQL DDL scripts are running without errors (redirect output to file).
Check that the webtest is passed.
Review Apache's error.log
after
running the web test.
Check that the UML diagrams in
doc/development
are up to date.
Update all translations (See Section 4). Don't forget the Java ResourceBundles.
Add the necessary information to the Updating section of the administration guide.
Check that the documentation build is passed.
Update the NEWS
file and the
"What's New" section in the BMFO user guide.
In the Subversion repository, copy all files to the
appropriate folder under /tags
. Include the
version information, e.g.
/tags/bmfo/BMFO_1_0_8
. This can be done
with the TortoiseSVN repository browser.
Delete temporary files.
Create a zipfile using build.xml
.
Create the installers.
Update the documentation on the CD.
Check the links on the CD.
Update etc/index.html
. Create
a BMFO CD and test.
Release the zipfile and installer on sourceforge.
Upload the updated documentation to Sourceforge.
Create a news item on sourceforge.
Update http://bmfo.sourceforge.net - this is done automatically with RSS for the main page. Update the docs on the website.
Update the freshmeat entry (http://freshmeat.net).
Send a release notice to
<bmfo-info@lists.sourceforge.net>
.
Announce the new release on http://www.omsproject.com.jo
BMFO is currently using the following PEAR classes:
Pager |
DataObject |
DataObject_FormBuilder |
PEAR is the PHP Extensible Application Repository.
It is intended to use more PEAR components in the future.
More information about PEAR can be found under http://pear.php.net.